diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/OpenProductReceiveCouponEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/OpenProductReceiveCouponEvent.cs new file mode 100644 index 00000000..03c5e55c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/OpenProductReceiveCouponEvent.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.open_product_receive_coupon 事件的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/callback/receive_coupon.html + /// + public class OpenProductReceiveCouponEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置商家侧优惠券 ID。 + /// + [Newtonsoft.Json.JsonProperty("out_coupon_id")] + [System.Text.Json.Serialization.JsonPropertyName("out_coupon_id")] + [System.Xml.Serialization.XmlElement("out_coupon_id")] + public string OutCouponId { get; set; } = default!; + + /// + /// 获取或设置请求唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("request_id")] + [System.Text.Json.Serialization.JsonPropertyName("request_id")] + [System.Xml.Serialization.XmlElement("request_id")] + public string RequestId { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/OpenProductReceiveCouponReply.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/OpenProductReceiveCouponReply.cs new file mode 100644 index 00000000..16b8334e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/OpenProductReceiveCouponReply.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示被动回复用户领券通知的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/callback/receive_coupon.html + /// + public class OpenProductReceiveCouponReply : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置返回状态码。 + /// + [Newtonsoft.Json.JsonProperty("ret_code")] + [System.Text.Json.Serialization.JsonPropertyName("ret_code")] + [System.Xml.Serialization.XmlElement("ret_code")] + public int ReturnCode { get; set; } + + /// + /// 获取或设置返回描述。 + /// + [Newtonsoft.Json.JsonProperty("ret_msg")] + [System.Text.Json.Serialization.JsonPropertyName("ret_msg")] + [System.Xml.Serialization.XmlElement("ret_msg")] + public string ReturnMessage { get; set; } = string.Empty; + + /// + /// 获取或设置商家侧优惠券 ID。 + /// + [Newtonsoft.Json.JsonProperty("out_coupon_id")] + [System.Text.Json.Serialization.JsonPropertyName("out_coupon_id")] + [System.Xml.Serialization.XmlElement("out_coupon_id", IsNullable = true)] + public string? OutCouponId { get; set; } + + /// + /// 获取或设置商家侧用户优惠券 ID。 + /// + [Newtonsoft.Json.JsonProperty("out_user_coupon_id")] + [System.Text.Json.Serialization.JsonPropertyName("out_user_coupon_id")] + [System.Xml.Serialization.XmlElement("out_user_coupon_id", IsNullable = true)] + public string? OutUserCouponId { get; set; } + + /// + /// 获取或设置请求唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("request_id")] + [System.Text.Json.Serialization.JsonPropertyName("request_id")] + [System.Xml.Serialization.XmlElement("request_id", IsNullable = true)] + public string? RequestId { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/OpenProductReceiveCouponEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/OpenProductReceiveCouponEvent.xml new file mode 100644 index 00000000..8777e669 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/OpenProductReceiveCouponEvent.xml @@ -0,0 +1,9 @@ + + gh_abcdefg + oABCD + 12344555555 + event + open_product_receive_coupon + real_out_coupon_id + real_request_id + \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/OpenProductReceiveCouponReply.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/OpenProductReceiveCouponReply.xml new file mode 100644 index 00000000..39a7a47a --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/OpenProductReceiveCouponReply.xml @@ -0,0 +1,7 @@ + + real_out_user_coupon_id + real_request_id + 0 + ok + real_out_coupon_id + \ No newline at end of file