From 1edafb5305574b435c956b780032716b66acbab0 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 20 Jun 2022 10:59:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=94=AF=E4=BB=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=9C=8D=E5=8A=A1=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/OpenProduct/FundsOrderPayEvent.cs | 47 ++++++++++++++++ .../FundsOrderProfitSharingEvent.cs | 55 +++++++++++++++++++ .../OpenProduct/FundsOrderRefundEvent.cs | 47 ++++++++++++++++ .../Events/OpenProduct/WithdrawNotifyEvent.cs | 39 +++++++++++++ .../Shop/Pay/ShopPayGetOrderResponse.cs | 8 +-- .../OpenProduct/FundsOrderPayEvent.xml | 12 ++++ .../FundsOrderProfitSharingEvent.xml | 13 +++++ .../OpenProduct/FundsOrderRefundEvent.xml | 12 ++++ .../OpenProduct/WithdrawNotifyEvent.xml | 11 ++++ 9 files changed, 240 insertions(+), 4 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderPayEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderProfitSharingEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderRefundEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/WithdrawNotifyEvent.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderPayEvent.xml create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderProfitSharingEvent.xml create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderRefundEvent.xml create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/WithdrawNotifyEvent.xml diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderPayEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderPayEvent.cs new file mode 100644 index 00000000..ed3c850c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderPayEvent.cs @@ -0,0 +1,47 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.funds_order_pay 事件的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/callback/create_order.html + /// + public class FundsOrderPayEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + public static class Types + { + public class Order + { + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("trade_no")] + [System.Xml.Serialization.XmlElement("trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付交易单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + [System.Xml.Serialization.XmlElement("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置支付时间字符串(格式:yyyy-MM-dd HH:mm:ss)。 + /// + [Newtonsoft.Json.JsonProperty("pay_time")] + [System.Text.Json.Serialization.JsonPropertyName("pay_time")] + [System.Xml.Serialization.XmlElement("pay_time")] + public string PayTimeString { get; set; } = default!; + } + } + + /// + /// 获取或设置订单信息。 + /// + [Newtonsoft.Json.JsonProperty("order_info")] + [System.Text.Json.Serialization.JsonPropertyName("order_info")] + [System.Xml.Serialization.XmlElement("order_info")] + public Types.Order Order { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderProfitSharingEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderProfitSharingEvent.cs new file mode 100644 index 00000000..b4da78e0 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderProfitSharingEvent.cs @@ -0,0 +1,55 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.funds_order_profitsharing 事件的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/callback/profitsharing_order.html + /// + public class FundsOrderProfitSharingEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + public static class Types + { + public class Order + { + /// + /// 获取或设置商户分账单号。 + /// + [Newtonsoft.Json.JsonProperty("profit_sharing_no")] + [System.Text.Json.Serialization.JsonPropertyName("profit_sharing_no")] + [System.Xml.Serialization.XmlElement("profit_sharing_no")] + public string OutProfitSharingNumber { get; set; } = default!; + + /// + /// 获取或设置分账金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Xml.Serialization.XmlElement("amount")] + public int Amount { get; set; } + + /// + /// 获取或设置分账状态。 + /// + [Newtonsoft.Json.JsonProperty("result")] + [System.Text.Json.Serialization.JsonPropertyName("result")] + [System.Xml.Serialization.XmlElement("result")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置完成时间字符串(格式:yyyy-MM-dd HH:mm:ss)。 + /// + [Newtonsoft.Json.JsonProperty("finish_time")] + [System.Text.Json.Serialization.JsonPropertyName("finish_time")] + [System.Xml.Serialization.XmlElement("finish_time")] + public string FinishTimeString { get; set; } = default!; + } + } + + /// + /// 获取或设置订单信息。 + /// + [Newtonsoft.Json.JsonProperty("order_info")] + [System.Text.Json.Serialization.JsonPropertyName("order_info")] + [System.Xml.Serialization.XmlElement("order_info")] + public Types.Order Order { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderRefundEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderRefundEvent.cs new file mode 100644 index 00000000..4b57ef8b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/FundsOrderRefundEvent.cs @@ -0,0 +1,47 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.funds_order_refund 事件的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/callback/refunds_order.html + /// + public class FundsOrderRefundEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + public static class Types + { + public class Order + { + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("refund_no")] + [System.Xml.Serialization.XmlElement("refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + [System.Xml.Serialization.XmlElement("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置退款成功时间字符串(格式:yyyy-MM-dd HH:mm:ss)。 + /// + [Newtonsoft.Json.JsonProperty("success_time")] + [System.Text.Json.Serialization.JsonPropertyName("success_time")] + [System.Xml.Serialization.XmlElement("success_time", IsNullable = true)] + public string? SuccessTimeString { get; set; } + } + } + + /// + /// 获取或设置订单信息。 + /// + [Newtonsoft.Json.JsonProperty("order_info")] + [System.Text.Json.Serialization.JsonPropertyName("order_info")] + [System.Xml.Serialization.XmlElement("order_info")] + public Types.Order Order { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/WithdrawNotifyEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/WithdrawNotifyEvent.cs new file mode 100644 index 00000000..3ecd4332 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenProduct/WithdrawNotifyEvent.cs @@ -0,0 +1,39 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.withdraw_notify 事件的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/callback/withdraw_notify.html + /// + public class WithdrawNotifyEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + public static class Types + { + public class Withdraw + { + /// + /// 获取或设置商户提现单号。 + /// + [Newtonsoft.Json.JsonProperty("out_request_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_request_no")] + [System.Xml.Serialization.XmlElement("out_request_no")] + public string OutRequestNumber { get; set; } = default!; + + /// + /// 获取或设置提现结果事件类型。 + /// + [Newtonsoft.Json.JsonProperty("event")] + [System.Text.Json.Serialization.JsonPropertyName("event")] + [System.Xml.Serialization.XmlElement("event")] + public int EventType { get; set; } + } + } + + /// + /// 获取或设置提现信息。 + /// + [Newtonsoft.Json.JsonProperty("withdraw_info")] + [System.Text.Json.Serialization.JsonPropertyName("withdraw_info")] + [System.Xml.Serialization.XmlElement("withdraw_info")] + public Types.Withdraw Withdraw { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Shop/Pay/ShopPayGetOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Shop/Pay/ShopPayGetOrderResponse.cs index c3d19c1e..f5293575 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Shop/Pay/ShopPayGetOrderResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Shop/Pay/ShopPayGetOrderResponse.cs @@ -49,11 +49,11 @@ public long? FinishTimestamp { get; set; } /// - /// 获取或设置退款结果。 + /// 获取或设置退款状态。 /// [Newtonsoft.Json.JsonProperty("result")] [System.Text.Json.Serialization.JsonPropertyName("result")] - public string Result { get; set; } = default!; + public string Status { get; set; } = default!; } public class ProfitSharing @@ -101,11 +101,11 @@ public long? FinishTimestamp { get; set; } /// - /// 获取或设置分账结果。 + /// 获取或设置分账状态。 /// [Newtonsoft.Json.JsonProperty("result")] [System.Text.Json.Serialization.JsonPropertyName("result")] - public string Result { get; set; } = default!; + public string Status { get; set; } = default!; } } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderPayEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderPayEvent.xml new file mode 100644 index 00000000..bf1d232f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderPayEvent.xml @@ -0,0 +1,12 @@ + + gh_abcdefg + oABCD + 12344555555 + event + funds_order_pay + + 1217752501201407033233368018 + 42000000123123 + 2021-12-30 22:31:00 + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderProfitSharingEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderProfitSharingEvent.xml new file mode 100644 index 00000000..c4e0a25f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderProfitSharingEvent.xml @@ -0,0 +1,13 @@ + + gh_abcdefg + oABCD + 12344555555 + event + funds_order_profitsharing + + P2015080612534 + 100 + SUCCESS + 2021-12-30 22:31:00 + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderRefundEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderRefundEvent.xml new file mode 100644 index 00000000..ca26b983 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/FundsOrderRefundEvent.xml @@ -0,0 +1,12 @@ + + gh_abcdefg + oABCD + 12344555555 + event + funds_order_refund + + 1217752501201407033233368018 + SUCCESS + 2021-12-30 22:31:00 + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/WithdrawNotifyEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/WithdrawNotifyEvent.xml new file mode 100644 index 00000000..ec322a41 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenProduct/WithdrawNotifyEvent.xml @@ -0,0 +1,11 @@ + + gh_abcdefg + oABCD + 12344555555 + event + withdraw_notify + + 123456 + 1234567 + +