diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Events/Withdraw/WithdrawEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Events/Withdraw/WithdrawEvent.cs new file mode 100644 index 00000000..ade5fbe0 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Events/Withdraw/WithdrawEvent.cs @@ -0,0 +1,49 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Events +{ + /// + /// 表示 withdraw.succeeded 通知的数据。 + /// + public class WithdrawEvent : WechatTenpayBusinessEvent + { + public static class Types + { + public class EventContent + { + /// + /// 获取或设置微企付支付单号。 + /// + [Newtonsoft.Json.JsonProperty("payment_id")] + [System.Text.Json.Serialization.JsonPropertyName("payment_id")] + public string PaymentId { get; set; } = default!; + + /// + /// 获取或设置平台提现单号。 + /// + [Newtonsoft.Json.JsonProperty("out_withdraw_id")] + [System.Text.Json.Serialization.JsonPropertyName("out_withdraw_id")] + public string OutWithdrawId { get; set; } = string.Empty; + + /// + /// 获取或设置微企付提现单号。 + /// + [Newtonsoft.Json.JsonProperty("withdraw_id")] + [System.Text.Json.Serialization.JsonPropertyName("withdraw_id")] + public string WithdrawId { get; set; } = string.Empty; + + /// + /// 获取或设置提现金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public int Amount { get; set; } + + /// + /// 获取或设置提现状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + } + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecutePaymentsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecutePaymentsExtensions.cs index 1349bb3b..e64a4ef8 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecutePaymentsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecutePaymentsExtensions.cs @@ -104,28 +104,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } - /// - /// 异步调用 [GET] /mse-pay/payments/out-payment-id/{out_payment_id} 接口。 - /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7 - /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7-2 - /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7-3 - /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7-4 - /// - /// - /// - /// - /// - public static async Task ExecuteGetPaymentByOutPaymentIdAsync(this WechatTenpayBusinessClient client, Models.GetPaymentByOutPaymentIdRequest request, CancellationToken cancellationToken = default) - { - if (client is null) throw new ArgumentNullException(nameof(client)); - if (request is null) throw new ArgumentNullException(nameof(request)); - - IFlurlRequest flurlReq = client - .CreateRequest(request, HttpMethod.Get, "mse-pay", "payments", "out-payment-id", request.OutPaymentId); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - /// /// 异步调用 [GET] /mse-pay/payments/{payment_id} 接口。 /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%86%85%E5%8D%95%E5%8F%B7 @@ -148,6 +126,28 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + /// + /// 异步调用 [GET] /mse-pay/payments/out-payment-id/{out_payment_id} 接口。 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7-2 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7-3 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7-4 + /// + /// + /// + /// + /// + public static async Task ExecuteGetPaymentByOutPaymentIdAsync(this WechatTenpayBusinessClient client, Models.GetPaymentByOutPaymentIdRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "mse-pay", "payments", "out-payment-id", request.OutPaymentId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + /// /// 异步调用 [POST] /mse-pay/payments/{payment_id}/close 接口。 /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%94%AF%E4%BB%98%E5%85%B3%E5%8D%95 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteProductApplicationsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteProductApplicationsExtensions.cs index fc1c99b3..7b896e03 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteProductApplicationsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteProductApplicationsExtensions.cs @@ -27,25 +27,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } - /// - /// 异步调用 [GET] /mse-pay/product-applications/out-request-no/{out_request_no} 接口。 - /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E5%85%A5%E9%A9%BB%E7%BB%93%E6%9E%9C-%E5%A4%96%E5%8D%95%E5%8F%B7 - /// - /// - /// - /// - /// - public static async Task ExecuteGetProductApplicationByOutRequestNumberAsync(this WechatTenpayBusinessClient client, Models.GetProductApplicationByOutRequestNumberRequest request, CancellationToken cancellationToken = default) - { - if (client is null) throw new ArgumentNullException(nameof(client)); - if (request is null) throw new ArgumentNullException(nameof(request)); - - IFlurlRequest flurlReq = client - .CreateRequest(request, HttpMethod.Get, "mse-pay", "product-applications", "out-request-no", request.OutRequestNumber); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - /// /// 异步调用 [GET] /mse-pay/product-applications/{request_no} 接口。 /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E5%85%A5%E9%A9%BB%E7%BB%93%E6%9E%9C-%E5%86%85%E5%8D%95%E5%8F%B7 @@ -65,6 +46,25 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + /// + /// 异步调用 [GET] /mse-pay/product-applications/out-request-no/{out_request_no} 接口。 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E5%85%A5%E9%A9%BB%E7%BB%93%E6%9E%9C-%E5%A4%96%E5%8D%95%E5%8F%B7 + /// + /// + /// + /// + /// + public static async Task ExecuteGetProductApplicationByOutRequestNumberAsync(this WechatTenpayBusinessClient client, Models.GetProductApplicationByOutRequestNumberRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "mse-pay", "product-applications", "out-request-no", request.OutRequestNumber); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + /// /// 异步调用 [POST] /mse-pay/product-applications/{request_no}/links 接口。 /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E5%88%9B%E5%BB%BA%E5%85%A5%E9%A9%BB%E8%B7%B3%E8%BD%AC%E9%93%BE%E6%8E%A5 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteRefundsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteRefundsExtensions.cs index 95a45c26..5a50ed61 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteRefundsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteRefundsExtensions.cs @@ -27,25 +27,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } - /// - /// 异步调用 [GET] /mse-pay/refunds/out-refund-id/{out_refund_id} 接口。 - /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E9%80%80%E6%AC%BE%E6%9F%A5%E8%AF%A2-%E5%A4%96%E5%8D%95%E5%8F%B7 - /// - /// - /// - /// - /// - public static async Task ExecuteGetRefundByOutRefundIdAsync(this WechatTenpayBusinessClient client, Models.GetRefundByOutRefundIdRequest request, CancellationToken cancellationToken = default) - { - if (client is null) throw new ArgumentNullException(nameof(client)); - if (request is null) throw new ArgumentNullException(nameof(request)); - - IFlurlRequest flurlReq = client - .CreateRequest(request, HttpMethod.Get, "mse-pay", "refunds", "out-refund-id", request.OutRefundId); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - /// /// 异步调用 [GET] /mse-pay/refunds/refund-id/{refund_id} 接口。 /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E9%80%80%E6%AC%BE%E6%9F%A5%E8%AF%A2-%E5%86%85%E5%8D%95%E5%8F%B7 @@ -64,5 +45,24 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + + /// + /// 异步调用 [GET] /mse-pay/refunds/out-refund-id/{out_refund_id} 接口。 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E9%80%80%E6%AC%BE%E6%9F%A5%E8%AF%A2-%E5%A4%96%E5%8D%95%E5%8F%B7 + /// + /// + /// + /// + /// + public static async Task ExecuteGetRefundByOutRefundIdAsync(this WechatTenpayBusinessClient client, Models.GetRefundByOutRefundIdRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "mse-pay", "refunds", "out-refund-id", request.OutRefundId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteWithdrawsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteWithdrawsExtensions.cs new file mode 100644 index 00000000..910e7ff4 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Extensions/WechatTenpayBusinessClientExecuteWithdrawsExtensions.cs @@ -0,0 +1,69 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness +{ + public static class WechatTenpayBusinessClientExecuteWithdrawsExtensions + { + /// + /// 异步调用 [POST] /mse-pay/withdraws 接口。 + /// REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E9%80%80%E6%AC%BE%E7%94%B3%E8%AF%B7 + /// + /// + /// + /// + /// + public static async Task ExecuteCreateWithdrawAsync(this WechatTenpayBusinessClient client, Models.CreateWithdrawRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.EnterpriseId == null) + request.EnterpriseId = client.Credentials.EnterpriseId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mse-pay", "withdraws"); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /mse-pay/withdraws/{withdraw_id} 接口。 + /// + /// + /// + /// + /// + public static async Task ExecuteGetWithdrawByWithdrawIdAsync(this WechatTenpayBusinessClient client, Models.GetWithdrawByWithdrawIdRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "mse-pay", "withdraws", request.WithdrawId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /mse-pay/withdraws/out-withdraw-id/{out_withdraw_id} 接口。 + /// + /// + /// + /// + /// + public static async Task ExecuteGetWithdrawByOutWithdrawIdAsync(this WechatTenpayBusinessClient client, Models.GetWithdrawByOutWithdrawIdRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "mse-pay", "withdraws", "out-withdraw-id", request.OutWithdrawId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/CreateProfitAllocationReceiverAccountApplicationResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/CreateProfitAllocationReceiverAccountApplicationResponse.cs index d5fc5847..9aabeb6a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/CreateProfitAllocationReceiverAccountApplicationResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/CreateProfitAllocationReceiverAccountApplicationResponse.cs @@ -3,27 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models /// /// 表示 [POST] /mse-pay/profit-allocations/receiver-accounts-applications 接口的响应。 /// - public class CreateProfitAllocationReceiverAccountApplicationResponse : WechatTenpayBusinessResponse + public class CreateProfitAllocationReceiverAccountApplicationResponse : GetProfitAllocationReceiverAccountApplicationByApplicationIdResponse { - /// - /// 获取或设置平台申请单号。 - /// - [Newtonsoft.Json.JsonProperty("out_application_id")] - [System.Text.Json.Serialization.JsonPropertyName("out_application_id")] - public string OutApplicationId { get; set; } = default!; - - /// - /// 获取或设置微企付申请单号。 - /// - [Newtonsoft.Json.JsonProperty("application_id")] - [System.Text.Json.Serialization.JsonPropertyName("application_id")] - public string ApplicationId { get; set; } = default!; - - /// - /// 获取或设置申请状态。 - /// - [Newtonsoft.Json.JsonProperty("status")] - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } = default!; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/GetProfitAllocationReceiverAccountApplicationByApplicationIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/GetProfitAllocationReceiverAccountApplicationByApplicationIdResponse.cs index bc6f6c0d..8acfdc5a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/GetProfitAllocationReceiverAccountApplicationByApplicationIdResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/ProfitAllocations/ReceiverAccount/GetProfitAllocationReceiverAccountApplicationByApplicationIdResponse.cs @@ -103,7 +103,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models /// [Newtonsoft.Json.JsonProperty("receiver_info")] [System.Text.Json.Serialization.JsonPropertyName("receiver_info")] - public Types.Receiver Receiver { get; set; } = default!; + public Types.Receiver? Receiver { get; set; } /// /// 获取或设置失败信息。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/CreateWithdrawRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/CreateWithdrawRequest.cs new file mode 100644 index 00000000..34e191db --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/CreateWithdrawRequest.cs @@ -0,0 +1,50 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models +{ + /// + /// 表示 [POST] /mse-pay/withdraws 接口的请求。 + /// + public class CreateWithdrawRequest : WechatTenpayBusinessRequest + { + /// + /// 获取或设置企业商户 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("ent_id")] + [System.Text.Json.Serialization.JsonPropertyName("ent_id")] + public string? EnterpriseId { get; set; } + + /// + /// 获取或设置提现账户 ID。 + /// + [Newtonsoft.Json.JsonProperty("receiver_acct_id")] + [System.Text.Json.Serialization.JsonPropertyName("receiver_acct_id")] + public string ReceiverAccountId { get; set; } = string.Empty; + + /// + /// 获取或设置平台提现单号。 + /// + [Newtonsoft.Json.JsonProperty("out_withdraw_id")] + [System.Text.Json.Serialization.JsonPropertyName("out_withdraw_id")] + public string OutWithdrawId { get; set; } = string.Empty; + + /// + /// 获取或设置提现金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public int Amount { get; set; } + + /// + /// 获取或设置提现结果通知 URL。 + /// + [Newtonsoft.Json.JsonProperty("server_notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("server_notify_url")] + public string ServerNotifyUrl { get; set; } = string.Empty; + + /// + /// 获取或设置提现原因描述。 + /// + [Newtonsoft.Json.JsonProperty("desc")] + [System.Text.Json.Serialization.JsonPropertyName("desc")] + public string? Description { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/CreateWithdrawResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/CreateWithdrawResponse.cs new file mode 100644 index 00000000..b894f528 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/CreateWithdrawResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models +{ + /// + /// 表示 [POST] /mse-pay/withdraws 接口的响应。 + /// + public class CreateWithdrawResponse : GetWithdrawByWithdrawIdResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByOutWithdrawIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByOutWithdrawIdRequest.cs new file mode 100644 index 00000000..5d28c1cf --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByOutWithdrawIdRequest.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models +{ + /// + /// 表示 [GET] /mse-pay/withdraws/out-withdraw-id/{out_withdraw_id} 接口的请求。 + /// + public class GetWithdrawByOutWithdrawIdRequest : WechatTenpayBusinessRequest + { + /// + /// 获取或设置平台提现单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string OutWithdrawId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByOutWithdrawIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByOutWithdrawIdResponse.cs new file mode 100644 index 00000000..4da2c6a7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByOutWithdrawIdResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models +{ + /// + /// 表示 [GET] /mse-pay/withdraws/out-withdraw-id/{out_withdraw_id} 接口的响应。 + /// + public class GetWithdrawByOutWithdrawIdResponse : GetWithdrawByWithdrawIdResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByWithdrawIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByWithdrawIdRequest.cs new file mode 100644 index 00000000..a9f2a7eb --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByWithdrawIdRequest.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models +{ + /// + /// 表示 [GET] /mse-pay/withdraws/{withdraw_id} 接口的请求。 + /// + public class GetWithdrawByWithdrawIdRequest : WechatTenpayBusinessRequest + { + /// + /// 获取或设置微企付提现单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string WithdrawId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByWithdrawIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByWithdrawIdResponse.cs new file mode 100644 index 00000000..83a8d986 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayBusiness/Models/Withdraws/GetWithdrawByWithdrawIdResponse.cs @@ -0,0 +1,61 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models +{ + /// + /// 表示 [GET] /mse-pay/withdraws/{withdraw_id} 接口的响应。 + /// + public class GetWithdrawByWithdrawIdResponse : WechatTenpayBusinessResponse + { + public static class Types + { + public class Failure : GetProfitAllocationReceiverAccountApplicationByApplicationIdResponse.Types.Failure + { + } + } + + /// + /// 获取或设置平台提现单号。 + /// + [Newtonsoft.Json.JsonProperty("out_withdraw_id")] + [System.Text.Json.Serialization.JsonPropertyName("out_withdraw_id")] + public string OutWithdrawId { get; set; } = default!; + + /// + /// 获取或设置微企付提现单号。 + /// + [Newtonsoft.Json.JsonProperty("withdraw_id")] + [System.Text.Json.Serialization.JsonPropertyName("withdraw_id")] + public string WithdrawId { get; set; } = default!; + + /// + /// 获取或设置提现金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public int Amount { get; set; } + + /// + /// 获取或设置提现状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置分账成功时间。 + /// + [Newtonsoft.Json.JsonProperty("succeeded_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("succeeded_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + public DateTimeOffset? SucceedTime { get; set; } + + /// + /// 获取或设置失败信息。 + /// + [Newtonsoft.Json.JsonProperty("failed_reason")] + [System.Text.Json.Serialization.JsonPropertyName("failed_reason")] + public Types.Failure? Failure { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/CreateWithdrawRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/CreateWithdrawRequest.json new file mode 100644 index 00000000..9babfe17 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/CreateWithdrawRequest.json @@ -0,0 +1,7 @@ +{ + "ent_id": "string", + "receiver_acct_id": "string", + "out_withdraw_id": "string", + "amount": 0, + "server_notify_url": "string" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/CreateWithdrawResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/CreateWithdrawResponse.json new file mode 100644 index 00000000..8f349725 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/CreateWithdrawResponse.json @@ -0,0 +1,4 @@ +{ + "out_withdraw_id": "string", + "withdraw_id": "string" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/GetWithdrawByOutWithdrawIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/GetWithdrawByOutWithdrawIdResponse.json new file mode 100644 index 00000000..241aaf06 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/GetWithdrawByOutWithdrawIdResponse.json @@ -0,0 +1,7 @@ +{ + "out_withdraw_id": "string", + "withdraw_id": "string", + "amount": 0, + "status": "string", + "succeeded_time": "2021-06-08T10:34:56+08:00" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/GetWithdrawByWithdrawIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/GetWithdrawByWithdrawIdResponse.json new file mode 100644 index 00000000..241aaf06 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayBusiness.UnitTests/ModelSamples/Withdraws/GetWithdrawByWithdrawIdResponse.json @@ -0,0 +1,7 @@ +{ + "out_withdraw_id": "string", + "withdraw_id": "string", + "amount": 0, + "status": "string", + "succeeded_time": "2021-06-08T10:34:56+08:00" +}