feat(wxapi): 新增用户领券相关的回调通知事件模型

This commit is contained in:
Fu Diwei
2021-09-18 14:58:55 +08:00
parent 6eb8de1d8e
commit b808fc63ab
4 changed files with 96 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Events
{
/// <summary>
/// <para>表示 EVENT.open_product_receive_coupon 事件的数据。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/callback/receive_coupon.html </para>
/// </summary>
public class OpenProductReceiveCouponEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable
{
/// <summary>
/// 获取或设置商家侧优惠券 ID。
/// </summary>
[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!;
/// <summary>
/// 获取或设置请求唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("request_id")]
[System.Text.Json.Serialization.JsonPropertyName("request_id")]
[System.Xml.Serialization.XmlElement("request_id")]
public string RequestId { get; set; } = default!;
}
}

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Events
{
/// <summary>
/// <para>表示被动回复用户领券通知的数据。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/callback/receive_coupon.html </para>
/// </summary>
public class OpenProductReceiveCouponReply : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable
{
/// <summary>
/// 获取或设置返回状态码。
/// </summary>
[Newtonsoft.Json.JsonProperty("ret_code")]
[System.Text.Json.Serialization.JsonPropertyName("ret_code")]
[System.Xml.Serialization.XmlElement("ret_code")]
public int ReturnCode { get; set; }
/// <summary>
/// 获取或设置返回描述。
/// </summary>
[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;
/// <summary>
/// 获取或设置商家侧优惠券 ID。
/// </summary>
[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; }
/// <summary>
/// 获取或设置商家侧用户优惠券 ID。
/// </summary>
[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; }
/// <summary>
/// 获取或设置请求唯一标识。
/// </summary>
[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; }
}
}

View File

@@ -0,0 +1,9 @@
<xml>
<ToUserName>gh_abcdefg</ToUserName>
<FromUserName>oABCD</FromUserName>
<CreateTime>12344555555</CreateTime>
<MsgType>event</MsgType>
<Event>open_product_receive_coupon</Event>
<out_coupon_id>real_out_coupon_id</out_coupon_id>
<request_id>real_request_id</request_id>
</xml>

View File

@@ -0,0 +1,7 @@
<xml>
<out_user_coupon_id>real_out_user_coupon_id</out_user_coupon_id>
<request_id>real_request_id</request_id>
<ret_code>0</ret_code>
<ret_msg>ok</ret_msg>
<out_coupon_id>real_out_coupon_id</out_coupon_id>
</xml>