Browse Source

新增 分账动账通知 Closed #62

Roc 5 years ago
parent
commit
a1915583aa

+ 45 - 0
src/Essensoft.AspNetCore.Payment.WeChatPay/Domain/Receiver.cs

@@ -0,0 +1,45 @@
+using System.Text.Json.Serialization;
+
+namespace Essensoft.AspNetCore.Payment.WeChatPay.Domain
+{
+    /// <summary>
+    /// 分账接收方对象
+    /// </summary>    
+    public class Receiver : WeChatPayObject
+    {
+        /// <summary>
+        /// 分账接收方类型
+        /// MERCHANT_ID:商户ID
+        /// </summary>
+        [JsonPropertyName("type")]
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 分账接收方帐号
+        /// 申请本功能商户号
+        /// </summary>
+        [JsonPropertyName("account")]
+        public string Account { get; set; }
+
+        /// <summary>
+        /// 分账动账金额
+        /// 分账动账金额,单位为分,只能为整数
+        /// </summary>
+        [JsonPropertyName("amount")]
+        public int Amount { get; set; }
+
+        /// <summary>
+        /// 分账/回退描述
+        /// 分账/回退描述
+        /// </summary>
+        [JsonPropertyName("description")]
+        public string Description { get; set; }
+
+        /// <summary>
+        /// 成功时间
+        /// 成功时间,Rfc3339标准
+        /// </summary>
+        [JsonPropertyName("success_time")]
+        public string SuccessTime { get; set; }
+    }
+}

+ 73 - 0
src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayProfitSharingNotify.cs

@@ -0,0 +1,73 @@
+#if NETCOREAPP3_1
+
+using System.Text.Json.Serialization;
+using Essensoft.AspNetCore.Payment.WeChatPay.Domain;
+
+namespace Essensoft.AspNetCore.Payment.WeChatPay.Notify
+{
+    /// <summary>
+    /// 分账动账通知 (普通商户 / 服务商)
+    /// https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_9&index=9
+    /// https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_9&index=9
+    /// </summary>
+    public class WeChatPayProfitSharingNotify : WeChatPayV3Notify
+    {
+        /// <summary>
+        /// 服务商商户号
+        /// 服务商模式分账发起商户
+        /// </summary>
+        [JsonPropertyName("sp_mchid")]
+        public string SpMchId { get; set; }
+
+        /// <summary>
+        /// 子商户号
+        /// 服务商模式分账出资商户
+        /// </summary>
+        [JsonPropertyName("sub_mchid")]
+        public string SubMchid { get; set; }
+
+        /// <summary>
+        /// 直连商户号
+        /// 直连模式分账发起和出资商户
+        /// </summary>
+        [JsonPropertyName("mchid")]
+        public string MchId { get; set; }
+
+        /// <summary>
+        /// 微信订单号
+        /// 微信支付订单号
+        /// </summary>
+        [JsonPropertyName("transaction_id")]
+        public string TransactionId { get; set; }
+
+        /// <summary>
+        /// 微信分账/回退单号
+        /// 微信分账/回退单号
+        /// </summary>
+        [JsonPropertyName("order_id")]
+        public string OrderId { get; set; }
+
+        /// <summary>
+        /// 商户分账/回退单号
+        /// 分账方系统内部的分账/回退单号
+        /// </summary>
+        [JsonPropertyName("out_order_no")]
+        public string OutOrderNo { get; set; }
+
+        /// <summary>
+        /// 分账接收方
+        /// 分账接收方对象
+        /// </summary>
+        [JsonPropertyName("receiver")]
+        public Receiver Receiver { get; set; }
+
+        /// <summary>
+        /// 成功时间
+        /// 成功时间,Rfc3339标准
+        /// </summary>
+        [JsonPropertyName("success_time")]
+        public string SuccessTime { get; set; }
+    }
+}
+
+#endif