diff --git a/docs/WechatTenpayV3/Advanced_ModelDefinition.md b/docs/WechatTenpayV3/Advanced_ModelDefinition.md index 2e501db3..318a965d 100644 --- a/docs/WechatTenpayV3/Advanced_ModelDefinition.md +++ b/docs/WechatTenpayV3/Advanced_ModelDefinition.md @@ -476,7 +476,7 @@ --- -### 【附】服务商模式 API 模型命名速查表: +### 【附】服务商、机构模式 API 模型命名速查表: 注:树形结构与[微信支付开发者文档](https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/index.shtml)目录结构保持一致。 @@ -1068,6 +1068,117 @@ - Sub Merchant Modifying:`ModifySubMerchant` +- Multi-Wallet (For HK) + + - Quick Pay + + - Quick Pay:`CreateHKTransactionMicroPay` / `CreateHKPartnerTransactionMicroPay` + + - Query Order:`GetHKTransactionByOutTradeNumber` / `GetHKTransactionById` / `GetHKPartnerTransactionByOutTradeNumber` / `GetHKPartnerTransactionById` + + - Refund Application:`CreateHKRefund` / `CreateHKPartnerRefund` + + - Query Single Refund:`GetHKRefundByOutRefundNumber` / `GetHKRefundById` / `GetHKPartnerRefundByOutRefundNumber` / `GetHKPartnerRefundById` + + - Downloading Reconciliation:`DownloadHKStatements` + + - Revoke Order:`ReverseHKTransaction` / `ReverseHKPartnerTransaction` + + - Downloading Platform Certificate:`QueryCertificates` + + - Query Fund Settlement Details:`QueryHKSettlements` + + + - QR Code Payment + + - Order Placement:`CreateHKTransactionMicroPay` / `CreateHKPartnerTransactionMicroPay` + + - Query Order:`GetHKTransactionByOutTradeNumber` / `GetHKTransactionById` / `GetHKPartnerTransactionByOutTradeNumber` / `GetHKPartnerTransactionById` + + - Refund Application:`CreateHKRefund` / `CreateHKPartnerRefund` + + - Query Single Refund:`GetHKRefundByOutRefundNumber` / `GetHKRefundById` / `GetHKPartnerRefundByOutRefundNumber` / `GetHKPartnerRefundById` + + - Downloading Reconciliation:`DownloadHKStatements` + + - Close Order:`CloseHKTransaction` / `CloseHKPartnerTransaction` + + - Downloading Platform Certificate:`QueryCertificates` + + - Query Fund Settlement Details:`QueryHKSettlements` + + - Mini-Program Payment + + - Order Placement:`CreateHKTransactionMicroPay` / `CreateHKPartnerTransactionMicroPay` + + - Query Order:`GetHKTransactionByOutTradeNumber` / `GetHKTransactionById` / `GetHKPartnerTransactionByOutTradeNumber` / `GetHKPartnerTransactionById` + + - Refund Application:`CreateHKRefund` / `CreateHKPartnerRefund` + + - Query Single Refund:`GetHKRefundByOutRefundNumber` / `GetHKRefundById` / `GetHKPartnerRefundByOutRefundNumber` / `GetHKPartnerRefundById` + + - Downloading Reconciliation:`DownloadHKStatements` + + - Close Order:`CloseHKTransaction` / `CloseHKPartnerTransaction` + + - Downloading Platform Certificate:`QueryCertificates` + + - Query Fund Settlement Details:`QueryHKSettlements` + + - Official Account Payment + + - Order Placement:`CreateHKTransactionMicroPay` / `CreateHKPartnerTransactionMicroPay` + + - Query Order:`GetHKTransactionByOutTradeNumber` / `GetHKTransactionById` / `GetHKPartnerTransactionByOutTradeNumber` / `GetHKPartnerTransactionById` + + - Refund Application:`CreateHKRefund` / `CreateHKPartnerRefund` + + - Query Single Refund:`GetHKRefundByOutRefundNumber` / `GetHKRefundById` / `GetHKPartnerRefundByOutRefundNumber` / `GetHKPartnerRefundById` + + - Downloading Reconciliation:`DownloadHKStatements` + + - Close Order:`CloseHKTransaction` / `CloseHKPartnerTransaction` + + - Downloading Platform Certificate:`QueryCertificates` + + - Query Fund Settlement Details:`QueryHKSettlements` + + - In-App Payment + + - Order Placement:`CreateHKTransactionMicroPay` / `CreateHKPartnerTransactionMicroPay` + + - Query Order:`GetHKTransactionByOutTradeNumber` / `GetHKTransactionById` / `GetHKPartnerTransactionByOutTradeNumber` / `GetHKPartnerTransactionById` + + - Refund Application:`CreateHKRefund` / `CreateHKPartnerRefund` + + - Query Single Refund:`GetHKRefundByOutRefundNumber` / `GetHKRefundById` / `GetHKPartnerRefundByOutRefundNumber` / `GetHKPartnerRefundById` + + - Downloading Reconciliation:`DownloadHKStatements` + + - Close Order:`CloseHKTransaction` / `CloseHKPartnerTransaction` + + - Downloading Platform Certificate:`QueryCertificates` + + - Query Fund Settlement Details:`QueryHKSettlements` + + - H5 Payment + + - Order Placement:`CreateHKTransactionMicroPay` / `CreateHKPartnerTransactionMicroPay` + + - Query Order:`GetHKTransactionByOutTradeNumber` / `GetHKTransactionById` / `GetHKPartnerTransactionByOutTradeNumber` / `GetHKPartnerTransactionById` + + - Refund Application:`CreateHKRefund` / `CreateHKPartnerRefund` + + - Query Single Refund:`GetHKRefundByOutRefundNumber` / `GetHKRefundById` / `GetHKPartnerRefundByOutRefundNumber` / `GetHKPartnerRefundById` + + - Downloading Reconciliation:`DownloadHKStatements` + + - Close Order:`CloseHKTransaction` / `CloseHKPartnerTransaction` + + - Downloading Platform Certificate:`QueryCertificates` + + - Query Fund Settlement Details:`QueryHKSettlements` + - Customs Declaration - Customs Declaration:`CreateCustomsOrder` diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Settlement/GetPaySettlementResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Settlement/GetPaySettlementResponse.cs index 8aeab705..31091f44 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Settlement/GetPaySettlementResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Settlement/GetPaySettlementResponse.cs @@ -102,7 +102,7 @@ /// [Newtonsoft.Json.JsonProperty("pay_net_fee")] [System.Text.Json.Serialization.JsonPropertyName("pay_net_fee")] - public int PaymentNetFee { get; set; } + public int NetFee { get; set; } /// /// 获取或设置手续费金额(单位:指定货币的最小单位)。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/HKPartnerRefund/HKPartnerRefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/HKPartnerRefund/HKPartnerRefundResource.cs new file mode 100644 index 00000000..fdb7a106 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/HKPartnerRefund/HKPartnerRefundResource.cs @@ -0,0 +1,98 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events +{ + /// + /// 表示 REFUND.SUCCESS (仅限服务商 For HK)通知的数据。 + /// 表示 REFUND.ABNORMAL (仅限服务商 For HK)通知的数据。 + /// 表示 REFUND.CLOSED (仅限服务商 For HK)通知的数据。 + /// + public class HKPartnerRefundResource : WechatTenpayEvent.Types.IDecryptedResource + { + public static class Types + { + public class Amount : Models.GetHKPartnerRefundByOutRefundNumberResponse.Types.Amount + { + } + } + + /// + /// 获取或设置服务商商户号。 + /// + [Newtonsoft.Json.JsonProperty("sp_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("sp_mchid")] + public string MerchantId { get; set; } = default!; + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mchid")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付退款号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("refund_status")] + [System.Text.Json.Serialization.JsonPropertyName("refund_status")] + public string RefundStatus { get; set; } = default!; + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("recv_account")] + [System.Text.Json.Serialization.JsonPropertyName("recv_account")] + public string ReceiveAccount { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("fund_source")] + [System.Text.Json.Serialization.JsonPropertyName("fund_source")] + public string? FundSource { get; set; } + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("success_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("success_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置退款金额信息。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public Types.Amount Amount { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/HKRefund/HKRefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/HKRefund/HKRefundResource.cs new file mode 100644 index 00000000..85a24102 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/HKRefund/HKRefundResource.cs @@ -0,0 +1,91 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events +{ + /// + /// 表示 REFUND.SUCCESS (仅限直连商户 For HK)通知的数据。 + /// 表示 REFUND.ABNORMAL (仅限直连商户 For HK)通知的数据。 + /// 表示 REFUND.CLOSED (仅限直连商户 For HK)通知的数据。 + /// + public class HKRefundResource : WechatTenpayEvent.Types.IDecryptedResource + { + public static class Types + { + public class Amount : Models.GetHKRefundByOutRefundNumberResponse.Types.Amount + { + } + } + + /// + /// 获取或设置微信商户号。 + /// + [Newtonsoft.Json.JsonProperty("mchid")] + [System.Text.Json.Serialization.JsonPropertyName("mchid")] + public string MerchantId { get; set; } = default!; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付退款号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("refund_status")] + [System.Text.Json.Serialization.JsonPropertyName("refund_status")] + public string RefundStatus { get; set; } = default!; + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("recv_account")] + [System.Text.Json.Serialization.JsonPropertyName("recv_account")] + public string ReceiveAccount { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("fund_source")] + [System.Text.Json.Serialization.JsonPropertyName("fund_source")] + public string? FundSource { get; set; } + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("success_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("success_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置退款金额信息。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public Types.Amount Amount { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PartnerRefund/PartnerRefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PartnerRefund/PartnerRefundResource.cs index c52a12be..5ce9100b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PartnerRefund/PartnerRefundResource.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PartnerRefund/PartnerRefundResource.cs @@ -3,9 +3,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events { /// - /// 表示 REFUND.SUCCESS (仅服务商)通知的数据。 - /// 表示 REFUND.ABNORMAL (仅服务商)通知的数据。 - /// 表示 REFUND.CLOSED (仅服务商)通知的数据。 + /// 表示 REFUND.SUCCESS (仅限服务商)通知的数据。 + /// 表示 REFUND.ABNORMAL (仅限服务商)通知的数据。 + /// 表示 REFUND.CLOSED (仅限服务商)通知的数据。 /// public class PartnerRefundResource : WechatTenpayEvent.Types.IDecryptedResource { diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs index cdfeb975..42962241 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs @@ -3,9 +3,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events { /// - /// 表示 REFUND.SUCCESS (仅直连商户)通知的数据。 - /// 表示 REFUND.ABNORMAL (仅直连商户)通知的数据。 - /// 表示 REFUND.CLOSED (仅直连商户)通知的数据。 + /// 表示 REFUND.SUCCESS (仅限直连商户)通知的数据。 + /// 表示 REFUND.ABNORMAL (仅限直连商户)通知的数据。 + /// 表示 REFUND.CLOSED (仅限直连商户)通知的数据。 /// public class RefundResource : WechatTenpayEvent.Types.IDecryptedResource { diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteHKPartnerRefundExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteHKPartnerRefundExtensions.cs new file mode 100644 index 00000000..d353440f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteHKPartnerRefundExtensions.cs @@ -0,0 +1,103 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 +{ + /// + /// 为 提供境外支付退款(For HK)相关的 API 扩展方法。 + /// + public static class WechatTenpayClientExecuteHKPartnerRefundExtensions + { + /// + /// 异步调用 [POST] /refunds 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/In-AppPay/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/H5Payment/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/OfficialPayMent/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/MiniProgramPay/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/NativePay/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/QuickPay/chapter8_2.shtml + /// (请注意调用此接口需在构造 时指定特殊的 。) + /// + /// + /// + /// + /// + public static async Task ExecuteCreateHKPartnerRefundAsync(this WechatTenpayClient client, Models.CreateHKPartnerRefundRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "refunds"); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /refunds/out-refund-no/{out_refund_no} 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/In-AppPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/H5Payment/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/OfficialPayMent/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/MiniProgramPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/NativePay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/QuickPay/chapter8_3.shtml + /// (请注意调用此接口需在构造 时指定特殊的 。) + /// + /// + /// + /// + /// + public static async Task ExecuteGetHKPartnerRefundByOutRefundNumberAsync(this WechatTenpayClient client, Models.GetHKPartnerRefundByOutRefundNumberRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "refunds", "out-refund-no", request.OutRefundNumber) + .SetQueryParam("sp_mchid", request.MerchantId) + .SetQueryParam("sub_mchid", request.SubMerchantId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /refunds/id/{refund_id} 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/In-AppPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/H5Payment/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/OfficialPayMent/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/MiniProgramPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/NativePay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/QuickPay/chapter8_3.shtml + /// (请注意调用此接口需在构造 时指定特殊的 。) + /// + /// + /// + /// + /// + public static async Task ExecuteGetHKPartnerRefundByIdAsync(this WechatTenpayClient client, Models.GetHKPartnerRefundByIdRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "refunds", "id", request.RefundId) + .SetQueryParam("sp_mchid", request.MerchantId) + .SetQueryParam("sub_mchid", request.SubMerchantId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteHKRefundExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteHKRefundExtensions.cs new file mode 100644 index 00000000..f7fc3691 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteHKRefundExtensions.cs @@ -0,0 +1,101 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 +{ + /// + /// 为 提供境外支付退款(For HK)相关的 API 扩展方法。 + /// + public static class WechatTenpayClientExecuteHKRefundExtensions + { + /// + /// 异步调用 [POST] /refunds 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/In-AppPay/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/H5Payment/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/OfficialPayMent/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/MiniProgramPay/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/NativePay/chapter8_2.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/QuickPay/chapter8_2.shtml + /// (请注意调用此接口需在构造 时指定特殊的 。) + /// + /// + /// + /// + /// + public static async Task ExecuteCreateHKRefundAsync(this WechatTenpayClient client, Models.CreateHKRefundRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "refunds"); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /refunds/out-refund-no/{out_refund_no} 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/In-AppPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/H5Payment/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/OfficialPayMent/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/MiniProgramPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/NativePay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/QuickPay/chapter8_3.shtml + /// (请注意调用此接口需在构造 时指定特殊的 。) + /// + /// + /// + /// + /// + public static async Task ExecuteGetHKRefundByOutRefundNumberAsync(this WechatTenpayClient client, Models.GetHKRefundByOutRefundNumberRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "refunds", "out-refund-no", request.OutRefundNumber) + .SetQueryParam("mchid", request.MerchantId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /refunds/id/{refund_id} 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/In-AppPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/H5Payment/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/OfficialPayMent/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/MiniProgramPay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/NativePay/chapter8_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/fusion_wallet/QuickPay/chapter8_3.shtml + /// (请注意调用此接口需在构造 时指定特殊的 。) + /// + /// + /// + /// + /// + public static async Task ExecuteGetHKRefundByIdAsync(this WechatTenpayClient client, Models.GetHKRefundByIdRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "refunds", "id", request.RefundId) + .SetQueryParam("mchid", request.MerchantId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/CreateHKPartnerRefundRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/CreateHKPartnerRefundRequest.cs new file mode 100644 index 00000000..a99d2800 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/CreateHKPartnerRefundRequest.cs @@ -0,0 +1,92 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /refunds 接口的请求。 + /// + public class CreateHKPartnerRefundRequest : WechatTenpayRequest + { + public static class Types + { + public class Amount : CreateHKRefundRequest.Types.Amount + { + } + } + + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("sp_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("sp_mchid")] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sp_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sp_appid")] + public string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mchid")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = string.Empty; + + /// + /// 获取或设置退款原因。 + /// + [Newtonsoft.Json.JsonProperty("reason")] + [System.Text.Json.Serialization.JsonPropertyName("reason")] + public string? Reason { get; set; } + + /// + /// 获取或设置回调通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置退款金额信息。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public Types.Amount Amount { get; set; } = new Types.Amount(); + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("source")] + [System.Text.Json.Serialization.JsonPropertyName("source")] + public string? FundSource { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/CreateHKPartnerRefundResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/CreateHKPartnerRefundResponse.cs new file mode 100644 index 00000000..32bdb543 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/CreateHKPartnerRefundResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /refunds 接口的响应。 + /// + public class CreateHKPartnerRefundResponse : GetHKPartnerRefundByOutRefundNumberResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByIdRequest.cs new file mode 100644 index 00000000..0a97a26e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByIdRequest.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/id/{refund_id} 接口的请求。 + /// + public class GetHKPartnerRefundByIdRequest : WechatTenpayRequest + { + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? MerchantId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置微信支付退款单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string RefundId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByIdResponse.cs new file mode 100644 index 00000000..9a2f1a5d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByIdResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/id/{refund_id} 接口的响应。 + /// + public class GetHKPartnerRefundByIdResponse : GetHKPartnerRefundByOutRefundNumberResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberRequest.cs new file mode 100644 index 00000000..9b8a948b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberRequest.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/out-refund-no/{out_refund_no} 接口的请求。 + /// + public class GetHKPartnerRefundByOutRefundNumberRequest : WechatTenpayRequest + { + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? MerchantId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string OutRefundNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberResponse.cs new file mode 100644 index 00000000..035b43dd --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberResponse.cs @@ -0,0 +1,109 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/out-refund-no/{out_refund_no} 接口的响应。 + /// + public class GetHKPartnerRefundByOutRefundNumberResponse : WechatTenpayResponse + { + public static class Types + { + public class Amount : GetHKRefundByOutRefundNumberResponse.Types.Amount + { + } + + public class Promotion : GetHKRefundByOutRefundNumberResponse.Types.Promotion + { + } + } + + /// + /// 获取或设置微信支付退款单号。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置退款渠道。 + /// + [Newtonsoft.Json.JsonProperty("channel")] + [System.Text.Json.Serialization.JsonPropertyName("channel")] + public string Channel { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("fund_source")] + [System.Text.Json.Serialization.JsonPropertyName("fund_source")] + public string FundSource { get; set; } = default!; + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("recv_account")] + [System.Text.Json.Serialization.JsonPropertyName("recv_account")] + public string ReceiveAccount { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("success_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("success_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置退款创建时间。 + /// + [Newtonsoft.Json.JsonProperty("create_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("create_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))] + public DateTimeOffset CreateTime { get; set; } + + /// + /// 获取或设置退款金额信息。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public Types.Amount Amount { get; set; } = default!; + + /// + /// 获取或设置优惠退款信息。 + /// + [Newtonsoft.Json.JsonProperty("promotion_detail")] + [System.Text.Json.Serialization.JsonPropertyName("promotion_detail")] + public Types.Promotion[]? PromotionList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerTransactions/Settlements/QueryHKSettlementsResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerTransactions/Settlements/QueryHKSettlementsResponse.cs index dfee2ab3..f441653a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerTransactions/Settlements/QueryHKSettlementsResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKPartnerTransactions/Settlements/QueryHKSettlementsResponse.cs @@ -18,14 +18,14 @@ /// [Newtonsoft.Json.JsonProperty("settled")] [System.Text.Json.Serialization.JsonPropertyName("settled")] - public int SettledAmount { get; set; } + public int Settled { get; set; } /// /// 获取或设置未划账金额(单位:指定货币的最小单位)。 /// [Newtonsoft.Json.JsonProperty("unsettle")] [System.Text.Json.Serialization.JsonPropertyName("unsettle")] - public int UnsettledAmount { get; set; } + public int Unsettled { get; set; } /// /// 获取或设置结算币种。 @@ -39,21 +39,21 @@ /// [Newtonsoft.Json.JsonProperty("pay")] [System.Text.Json.Serialization.JsonPropertyName("pay")] - public int PayAmount { get; set; } + public int Payment { get; set; } /// /// 获取或设置该结算周期内退款总金额(单位:指定货币的最小单位)。 /// [Newtonsoft.Json.JsonProperty("refund")] [System.Text.Json.Serialization.JsonPropertyName("refund")] - public int RefundAmount { get; set; } + public int Refund { get; set; } /// /// 获取或设置该结算周期交易与退款总金额之差(单位:指定货币的最小单位)。 /// [Newtonsoft.Json.JsonProperty("net")] [System.Text.Json.Serialization.JsonPropertyName("net")] - public int NetAmount { get; set; } + public int Net { get; set; } /// /// 获取或设置手续费金额(单位:指定货币的最小单位)。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/CreateHKRefundRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/CreateHKRefundRequest.cs new file mode 100644 index 00000000..7f97599f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/CreateHKRefundRequest.cs @@ -0,0 +1,99 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /refunds 接口的请求。 + /// + public class CreateHKRefundRequest : WechatTenpayRequest + { + public static class Types + { + public class Amount + { + /// + /// 获取或设置原订单金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("total")] + [System.Text.Json.Serialization.JsonPropertyName("total")] + public int Total { get; set; } + + /// + /// 获取或设置退款金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("refund")] + [System.Text.Json.Serialization.JsonPropertyName("refund")] + public int Refund { get; set; } + + /// + /// 获取或设置退款币种。 + /// 默认值:HKD + /// + [Newtonsoft.Json.JsonProperty("currency")] + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = "HKD"; + } + } + + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("mchid")] + [System.Text.Json.Serialization.JsonPropertyName("mchid")] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信 AppId。 + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = string.Empty; + + /// + /// 获取或设置退款原因。 + /// + [Newtonsoft.Json.JsonProperty("reason")] + [System.Text.Json.Serialization.JsonPropertyName("reason")] + public string? Reason { get; set; } + + /// + /// 获取或设置回调通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置退款金额信息。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public Types.Amount Amount { get; set; } = new Types.Amount(); + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("source")] + [System.Text.Json.Serialization.JsonPropertyName("source")] + public string? FundSource { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/CreateHKRefundResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/CreateHKRefundResponse.cs new file mode 100644 index 00000000..ad6b9dd4 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/CreateHKRefundResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /refunds 接口的响应。 + /// + public class CreateHKRefundResponse : GetHKRefundByOutRefundNumberResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByIdRequest.cs new file mode 100644 index 00000000..840a4150 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByIdRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/id/{refund_id} 接口的请求。 + /// + public class GetHKRefundByIdRequest : WechatTenpayRequest + { + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信支付退款单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string RefundId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByIdResponse.cs new file mode 100644 index 00000000..b8e139ab --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByIdResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/id/{refund_id} 接口的响应。 + /// + public class GetHKRefundByIdResponse : GetHKRefundByOutRefundNumberResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByOutRefundNumberRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByOutRefundNumberRequest.cs new file mode 100644 index 00000000..360162c7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByOutRefundNumberRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/out-refund-no/{out_refund_no} 接口的请求。 + /// + public class GetHKRefundByOutRefundNumberRequest : WechatTenpayRequest + { + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string OutRefundNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByOutRefundNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByOutRefundNumberResponse.cs new file mode 100644 index 00000000..6b5ddb86 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKRefund/GetHKRefundByOutRefundNumberResponse.cs @@ -0,0 +1,212 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /refunds/out-refund-no/{out_refund_no} 接口的响应。 + /// + public class GetHKRefundByOutRefundNumberResponse : WechatTenpayResponse + { + public static class Types + { + public class Amount + { + public static class Types + { + public class ExchangeRate : GetHKTransactionByOutTradeNumberResponse.Types.Amount.Types.ExchangeRate + { + } + } + + /// + /// 获取或设置原订单金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("total")] + [System.Text.Json.Serialization.JsonPropertyName("total")] + public int? Total { get; set; } + + /// + /// 获取或设置退款金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("refund")] + [System.Text.Json.Serialization.JsonPropertyName("refund")] + public int Refund { get; set; } + + /// + /// 获取或设置退款币种。 + /// + [Newtonsoft.Json.JsonProperty("currency")] + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string? Currency { get; set; } + + /// + /// 获取或设置用户支付金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("payer_total")] + [System.Text.Json.Serialization.JsonPropertyName("payer_total")] + public int PayerTotal { get; set; } + + /// + /// 获取或设置用户退款金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("payer_refund")] + [System.Text.Json.Serialization.JsonPropertyName("payer_refund")] + public int PayerRefund { get; set; } + + /// + /// 获取或设置用户支付币种。 + /// + [Newtonsoft.Json.JsonProperty("payer_currency")] + [System.Text.Json.Serialization.JsonPropertyName("payer_currency")] + public string PayerCurrency { get; set; } = default!; + + /// + /// 获取或设置汇率信息。 + /// + [Newtonsoft.Json.JsonProperty("exchange_rate")] + [System.Text.Json.Serialization.JsonPropertyName("exchange_rate")] + public Types.ExchangeRate? ExchangeRate { get; set; } + } + + public class Promotion + { + /// + /// 获取或设置券 ID。 + /// + [Newtonsoft.Json.JsonProperty("promotion_id")] + [System.Text.Json.Serialization.JsonPropertyName("promotion_id")] + public string PromotionId { get; set; } = default!; + + /// + /// 获取或设置优惠名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置优惠范围。 + /// + [Newtonsoft.Json.JsonProperty("scope")] + [System.Text.Json.Serialization.JsonPropertyName("scope")] + public string? Scope { get; set; } + + /// + /// 获取或设置优惠类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string? Type { get; set; } + + /// + /// 获取或设置优惠券面额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public int Amount { get; set; } + + /// + /// 获取或设置优惠券退款金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("refund_amount")] + [System.Text.Json.Serialization.JsonPropertyName("refund_amount")] + public int? RefundAmount { get; set; } + + /// + /// 获取或设置优惠币种。 + /// + [Newtonsoft.Json.JsonProperty("currency")] + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string? Currency { get; set; } + } + } + + /// + /// 获取或设置微信支付退款单号。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置退款渠道。 + /// + [Newtonsoft.Json.JsonProperty("channel")] + [System.Text.Json.Serialization.JsonPropertyName("channel")] + public string Channel { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("fund_source")] + [System.Text.Json.Serialization.JsonPropertyName("fund_source")] + public string FundSource { get; set; } = default!; + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("recv_account")] + [System.Text.Json.Serialization.JsonPropertyName("recv_account")] + public string ReceiveAccount { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("success_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("success_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置退款创建时间。 + /// + [Newtonsoft.Json.JsonProperty("create_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("create_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))] + public DateTimeOffset CreateTime { get; set; } + + /// + /// 获取或设置退款金额信息。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public Types.Amount Amount { get; set; } = default!; + + /// + /// 获取或设置优惠退款信息。 + /// + [Newtonsoft.Json.JsonProperty("promotion_detail")] + [System.Text.Json.Serialization.JsonPropertyName("promotion_detail")] + public Types.Promotion[]? PromotionList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKTransactions/GetHKTransactionByOutTradeNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKTransactions/GetHKTransactionByOutTradeNumberResponse.cs index 13b75f7a..9d1ba0ab 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKTransactions/GetHKTransactionByOutTradeNumberResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/HKTransactions/GetHKTransactionByOutTradeNumberResponse.cs @@ -122,6 +122,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models [System.Text.Json.Serialization.JsonPropertyName("amount")] public int Amount { get; set; } + /// + /// 获取或设置优惠券退款金额(单位:指定货币的最小单位)。 + /// + [Newtonsoft.Json.JsonProperty("refund_amount")] + [System.Text.Json.Serialization.JsonPropertyName("refund_amount")] + public int? RefundAmount { get; set; } + /// /// 获取或设置活动 ID。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Refund/GetRefundDomesticRefundByOutRefundNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Refund/GetRefundDomesticRefundByOutRefundNumberResponse.cs index 9e6fed68..5ebf78a4 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Refund/GetRefundDomesticRefundByOutRefundNumberResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Refund/GetRefundDomesticRefundByOutRefundNumberResponse.cs @@ -232,6 +232,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models [System.Text.Json.Serialization.JsonPropertyName("user_received_account")] public string UserReceivedAccount { get; set; } = default!; + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("funds_account")] + [System.Text.Json.Serialization.JsonPropertyName("funds_account")] + public string FundsAccount { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + /// /// 获取或设置退款成功时间。 /// @@ -250,20 +264,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))] public DateTimeOffset CreateTime { get; set; } - /// - /// 获取或设置退款状态。 - /// - [Newtonsoft.Json.JsonProperty("status")] - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } = default!; - - /// - /// 获取或设置退款资金来源。 - /// - [Newtonsoft.Json.JsonProperty("funds_account")] - [System.Text.Json.Serialization.JsonPropertyName("funds_account")] - public string FundsAccount { get; set; } = default!; - /// /// 获取或设置退款金额信息。 /// diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/EventSamples/HKPartnerRefund/HKPartnerRefundResource.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/EventSamples/HKPartnerRefund/HKPartnerRefundResource.json new file mode 100644 index 00000000..37845947 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/EventSamples/HKPartnerRefund/HKPartnerRefundResource.json @@ -0,0 +1,24 @@ +{ + "sp_mchid": "1900000100", + "sub_mchid": "1900000109", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "20150806125346", + "refund_id": "50200207182018070300011301001", + "out_refund_no": "7752501201407033233368018", + "refund_status": "SUCCESS", + "success_time": "2018-06-08T10:34:56+08:00", + "recv_account": "招商银行信用卡0403", + "fund_source": "REFUND_SOURCE_UNSETTLED_FUNDS", + "amount": { + "total": 528800, + "currency": "HKD", + "refund": 528800, + "payer_total": 528800, + "payer_refund": 528800, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 100000000 + } + } +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/EventSamples/HKRefund/HKRefundResource.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/EventSamples/HKRefund/HKRefundResource.json new file mode 100644 index 00000000..501a6eef --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/EventSamples/HKRefund/HKRefundResource.json @@ -0,0 +1,23 @@ +{ + "mchid": "1900000100", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "20150806125346", + "refund_id": "50200207182018070300011301001", + "out_refund_no": "7752501201407033233368018", + "refund_status": "SUCCESS", + "success_time": "2018-06-08T10:34:56+08:00", + "recv_account": "招商银行信用卡0403", + "fund_source": "REFUND_SOURCE_UNSETTLED_FUNDS", + "amount": { + "total": 528800, + "currency": "HKD", + "refund": 528800, + "payer_total": 528800, + "payer_refund": 528800, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 100000000 + } + } +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/CreateHKPartnerRefundRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/CreateHKPartnerRefundRequest.json new file mode 100644 index 00000000..e82b0550 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/CreateHKPartnerRefundRequest.json @@ -0,0 +1,15 @@ +{ + "sp_appid": "wx2421b1c4370ec43b", + "sub_appid": "1900000109", + "sp_mchid": "10000100", + "sub_mchid": "20000100", + "transaction_id": "1008450740201411110005820873", + "out_refund_no": "R20150806125346", + "amount": { + "refund": 50, + "total": 100, + "currency": "HKD" + }, + "reason": "商品已售完", + "source": "REFUND_SOURCE_UNSETTLED_FUNDS" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/CreateHKPartnerRefundResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/CreateHKPartnerRefundResponse.json new file mode 100644 index 00000000..62169e49 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/CreateHKPartnerRefundResponse.json @@ -0,0 +1,25 @@ +{ + "id": "2008450740201411110000174436", + "out_refund_no": "R20150806125346", + "create_time": "2018-06-08T10:34:56+08:00", + "amount": { + "refund": 50, + "currency": "CNY", + "payer_refund": 49, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 8000000 + } + }, + "promotion_detail": [ + { + "promotion_id": "109519", + "scope": "GLOBAL", + "type": "COUPON", + "amount": 1, + "refund_amount": 1, + "currency": "HKD" + } + ] +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/GetHKPartnerRefundByIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/GetHKPartnerRefundByIdResponse.json new file mode 100644 index 00000000..e489a4f9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/GetHKPartnerRefundByIdResponse.json @@ -0,0 +1,32 @@ +{ + "id": "2008450740201411110000174436", + "out_refund_no": "R20150806125346", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "20150806125346", + "amount": { + "refund": 50, + "currency": "CNY", + "payer_refund": 49, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 8000000 + } + }, + "promotion_detail": [ + { + "promotion_id": "109519", + "scope": "GLOBAL", + "type": "COUPON", + "amount": 1, + "refund_amount": 1, + "currency": "HKD" + } + ], + "channel": "ORIGINAL", + "status": "SUCCESS", + "recv_account": "招商银行信用卡0403", + "fund_source": "REFUND_SOURCE_REchARGE_FUNDS", + "success_time": "2018-06-08T10:34:56+08:00", + "create_time": "2018-06-08T10:34:56+08:00" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberResponse.json new file mode 100644 index 00000000..e489a4f9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerRefund/GetHKPartnerRefundByOutRefundNumberResponse.json @@ -0,0 +1,32 @@ +{ + "id": "2008450740201411110000174436", + "out_refund_no": "R20150806125346", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "20150806125346", + "amount": { + "refund": 50, + "currency": "CNY", + "payer_refund": 49, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 8000000 + } + }, + "promotion_detail": [ + { + "promotion_id": "109519", + "scope": "GLOBAL", + "type": "COUPON", + "amount": 1, + "refund_amount": 1, + "currency": "HKD" + } + ], + "channel": "ORIGINAL", + "status": "SUCCESS", + "recv_account": "招商银行信用卡0403", + "fund_source": "REFUND_SOURCE_REchARGE_FUNDS", + "success_time": "2018-06-08T10:34:56+08:00", + "create_time": "2018-06-08T10:34:56+08:00" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerTransactions/CreateHKPartnerTransactionMicroPayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerTransactions/CreateHKPartnerTransactionMicroPayResponse.json index 58bc55c4..b8edb573 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerTransactions/CreateHKPartnerTransactionMicroPayResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKPartnerTransactions/CreateHKPartnerTransactionMicroPayResponse.json @@ -25,24 +25,26 @@ "bank_type": "CCB_DEBIT", "attach": "Payment test", "success_time": "2018-06-08T10:34:56+08:00", - "detail": { - "promotion_id": "109519", - "name": "Single-item discount-6", - "scope": "SINGLE", - "type": "DISCOUNT", - "amount": 1, - "currency": "CNY", - "activity_id": "931386", - "wechatpay_contribute_amount": 1, - "merchant_contribute_amount": 0, - "other_contribute_amount": 0, - "goods_detail": [ - { - "goods_id": "iphone6s_16G", - "goods_remark": "Product remarks", - "quantity": 1, - "price": 528800 - } - ] - } + "promotion_detail": [ + { + "promotion_id": "109519", + "name": "Single-item discount-6", + "scope": "SINGLE", + "type": "DISCOUNT", + "amount": 1, + "currency": "CNY", + "activity_id": "931386", + "wechatpay_contribute_amount": 1, + "merchant_contribute_amount": 0, + "other_contribute_amount": 0, + "goods_detail": [ + { + "goods_id": "iphone6s_16G", + "goods_remark": "Product remarks", + "quantity": 1, + "price": 528800 + } + ] + } + ] } diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/CreateHKRefundRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/CreateHKRefundRequest.json new file mode 100644 index 00000000..a01ea4b2 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/CreateHKRefundRequest.json @@ -0,0 +1,12 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mchid": "10000100", + "transaction_id": "1008450740201411110005820873", + "out_refund_no": "R20150806125346", + "amount": { + "refund": 50, + "total": 100, + "currency": "HKD" + }, + "reason": "商品已售完" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/CreateHKRefundResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/CreateHKRefundResponse.json new file mode 100644 index 00000000..62169e49 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/CreateHKRefundResponse.json @@ -0,0 +1,25 @@ +{ + "id": "2008450740201411110000174436", + "out_refund_no": "R20150806125346", + "create_time": "2018-06-08T10:34:56+08:00", + "amount": { + "refund": 50, + "currency": "CNY", + "payer_refund": 49, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 8000000 + } + }, + "promotion_detail": [ + { + "promotion_id": "109519", + "scope": "GLOBAL", + "type": "COUPON", + "amount": 1, + "refund_amount": 1, + "currency": "HKD" + } + ] +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/GetHKRefundByIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/GetHKRefundByIdResponse.json new file mode 100644 index 00000000..e489a4f9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/GetHKRefundByIdResponse.json @@ -0,0 +1,32 @@ +{ + "id": "2008450740201411110000174436", + "out_refund_no": "R20150806125346", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "20150806125346", + "amount": { + "refund": 50, + "currency": "CNY", + "payer_refund": 49, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 8000000 + } + }, + "promotion_detail": [ + { + "promotion_id": "109519", + "scope": "GLOBAL", + "type": "COUPON", + "amount": 1, + "refund_amount": 1, + "currency": "HKD" + } + ], + "channel": "ORIGINAL", + "status": "SUCCESS", + "recv_account": "招商银行信用卡0403", + "fund_source": "REFUND_SOURCE_REchARGE_FUNDS", + "success_time": "2018-06-08T10:34:56+08:00", + "create_time": "2018-06-08T10:34:56+08:00" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/GetHKRefundByOutRefundNumberResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/GetHKRefundByOutRefundNumberResponse.json new file mode 100644 index 00000000..e489a4f9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKRefund/GetHKRefundByOutRefundNumberResponse.json @@ -0,0 +1,32 @@ +{ + "id": "2008450740201411110000174436", + "out_refund_no": "R20150806125346", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "20150806125346", + "amount": { + "refund": 50, + "currency": "CNY", + "payer_refund": 49, + "payer_currency": "HKD", + "exchange_rate": { + "type": "SETTLEMENT_RATE", + "rate": 8000000 + } + }, + "promotion_detail": [ + { + "promotion_id": "109519", + "scope": "GLOBAL", + "type": "COUPON", + "amount": 1, + "refund_amount": 1, + "currency": "HKD" + } + ], + "channel": "ORIGINAL", + "status": "SUCCESS", + "recv_account": "招商银行信用卡0403", + "fund_source": "REFUND_SOURCE_REchARGE_FUNDS", + "success_time": "2018-06-08T10:34:56+08:00", + "create_time": "2018-06-08T10:34:56+08:00" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKTransactions/CreateHKTransactionMicroPayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKTransactions/CreateHKTransactionMicroPayResponse.json index 7b27e87b..e7c208b1 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKTransactions/CreateHKTransactionMicroPayResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/HKTransactions/CreateHKTransactionMicroPayResponse.json @@ -22,24 +22,26 @@ "bank_type": "CCB_DEBIT", "attach": "Payment test", "success_time": "2018-06-08T10:34:56+08:00", - "detail": { - "promotion_id": "109519", - "name": "Single-item discount-6", - "scope": "SINGLE", - "type": "DISCOUNT", - "amount": 1, - "currency": "CNY", - "activity_id": "931386", - "wechatpay_contribute_amount": 1, - "merchant_contribute_amount": 0, - "other_contribute_amount": 0, - "goods_detail": [ - { - "goods_id": "iphone6s_16G", - "goods_remark": "Product remarks", - "quantity": 1, - "price": 528800 - } - ] - } + "promotion_detail": [ + { + "promotion_id": "109519", + "name": "Single-item discount-6", + "scope": "SINGLE", + "type": "DISCOUNT", + "amount": 1, + "currency": "CNY", + "activity_id": "931386", + "wechatpay_contribute_amount": 1, + "merchant_contribute_amount": 0, + "other_contribute_amount": 0, + "goods_detail": [ + { + "goods_id": "iphone6s_16G", + "goods_remark": "Product remarks", + "quantity": 1, + "price": 528800 + } + ] + } + ] }