feat(tenpayv3): 新增从业机构特约商户结算规则 ID 管理相关接口

This commit is contained in:
Fu Diwei 2023-04-03 19:26:42 +08:00
parent 59697b661b
commit 060bf7541d
10 changed files with 212 additions and 6 deletions

View File

@ -0,0 +1,52 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供从业机构特约商户结算规则 ID 管理相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecuteMerchantSettlementExtensions
{
/// <summary>
/// <para>异步调用 [POST] /merchant-settlement/merchant-settle-rule-applications 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter3_1_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateMerchantSettlementSettleRuleApplymentResponse> ExecuteCreateMerchantSettlementSettleRuleApplymentAsync(this WechatTenpayClient client, Models.CreateMerchantSettlementSettleRuleApplymentRequest 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.Post, "merchant-settlement", "merchant-settle-rule-applications");
return await client.SendRequestWithJsonAsync<Models.CreateMerchantSettlementSettleRuleApplymentResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /merchant-settlement/merchant-settle-rule-applications/{application_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter3_1_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetMerchantSettlementSettleRuleApplicationByApplymentIdResponse> ExecuteGetMerchantSettlementSettleRuleApplicationByApplymentIdAsync(this WechatTenpayClient client, Models.GetMerchantSettlementSettleRuleApplicationByApplymentIdRequest 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, "merchant-settlement", "merchant-settle-rule-applications", request.ApplymentId);
return await client.SendRequestWithJsonAsync<Models.GetMerchantSettlementSettleRuleApplicationByApplymentIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
}
}

View File

@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /apply4subject/applyment 接口的响应。</para>
@ -13,11 +13,11 @@
public string ApplymentState { get; set; } = default!;
/// <summary>
/// 获取或设置小程序码图片数据(经 Base64 编码)
/// 获取或设置经 Base64 编码的小程序码图片数据
/// </summary>
[Newtonsoft.Json.JsonProperty("qrcode_data")]
[System.Text.Json.Serialization.JsonPropertyName("qrcode_data")]
public string? QrcodeData { get; set; }
public string? EncodingQrcodeData { get; set; }
/// <summary>
/// 获取或设置驳回参数。

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
@ -64,7 +64,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public int? SuccessUserCount { get; set; }
/// <summary>
/// 获取或设置银行类型。
/// 获取或设置创建类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
@ -73,7 +73,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public DateTimeOffset CreateTime { get; set; }
/// <summary>
/// 获取或设置银行类型。
/// 获取或设置最后更新类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]

View File

@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /merchant-settlement/merchant-settle-rule-applications 接口的请求。</para>
/// </summary>
public class CreateMerchantSettlementSettleRuleApplymentRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置从业机构号。
/// </summary>
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
public string AcquiringBankId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置渠道商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("channel_id")]
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
public string ChannelId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置结算规则 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("settle_rule_id")]
[System.Text.Json.Serialization.JsonPropertyName("settle_rule_id")]
public int SettleRuleId { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /merchant-settlement/merchant-settle-rule-applications 接口的响应。</para>
/// </summary>
public class CreateMerchantSettlementSettleRuleApplymentResponse : GetMerchantSettlementSettleRuleApplicationByApplymentIdResponse
{
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /merchant-settlement/merchant-settle-rule-applications/{application_id} 接口的请求。</para>
/// </summary>
public class GetMerchantSettlementSettleRuleApplicationByApplymentIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置申请单编号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string ApplymentId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,68 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /merchant-settlement/merchant-settle-rule-applications/{application_id} 接口的响应。</para>
/// </summary>
public class GetMerchantSettlementSettleRuleApplicationByApplymentIdResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置申请单编号。
/// </summary>
[Newtonsoft.Json.JsonProperty("application_id")]
[System.Text.Json.Serialization.JsonPropertyName("application_id")]
public string ApplymentId { get; set; } = default!;
/// <summary>
/// 获取或设置申请单处理信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("application_process_info")]
[System.Text.Json.Serialization.JsonPropertyName("application_process_info")]
public string ApplymentProcessInformation { get; set; } = default!;
/// <summary>
/// 获取或设置申请单状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("application_state")]
[System.Text.Json.Serialization.JsonPropertyName("application_state")]
public string? ApplymentState { get; set; }
/// <summary>
/// 获取或设置从业机构号。
/// </summary>
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
public string? AcquiringBankId { get; set; }
/// <summary>
/// 获取或设置渠道商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("channel_id")]
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
public string? ChannelId { get; set; }
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置结算规则 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("settle_rule_id")]
[System.Text.Json.Serialization.JsonPropertyName("settle_rule_id")]
public int? SettleRuleId { get; set; }
/// <summary>
/// 获取或设置最后更新时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? UpdateTime { get; set; }
}
}

View File

@ -0,0 +1,6 @@
{
"acquiring_bank_id": "1356485",
"channel_id": "20001111",
"sub_mchid": "1346578",
"settle_rule_id": 760
}

View File

@ -0,0 +1,10 @@
{
"application_id": "20000011111",
"application_process_info": "正在处理中",
"application_state": "PROCESSING",
"update_time": "2015-05-20T13:29:35+08:00",
"acquiring_bank_id": "1356485",
"channel_id": "20001111",
"sub_mchid": "1346578",
"settle_rule_id": 760
}

View File

@ -0,0 +1,10 @@
{
"application_id": "20000011111",
"application_process_info": "正在处理中",
"application_state": "PASSED",
"update_time": "2015-05-20T13:29:35+08:00",
"acquiring_bank_id": "1356485",
"channel_id": "20001111",
"sub_mchid": "1346578",
"settle_rule_id": 760
}