feat(tenpayv3): 新增服务商申请单个子商户资金账单相关接口

This commit is contained in:
Fu Diwei
2021-09-06 15:39:08 +08:00
committed by fudiwei
parent 0225f759cb
commit 50573b0f31
3 changed files with 127 additions and 0 deletions

View File

@@ -93,6 +93,34 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return await client.SendRequestWithJsonAsync<Models.GetBillFundflowBillResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /bill/sub-merchant-fundflowbill 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_1_12.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetBillSubMerchantFundflowBillResponse> ExecuteGetBillSubMerchantFundflowBillAsync(this WechatTenpayClient client, Models.GetBillSubMerchantFundflowBillRequest 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, "bill", "sub-merchant-fundflowbill")
.SetQueryParam("sub_mchid", request.SubMerchantId)
.SetQueryParam("bill_date", request.BillDateString)
.SetQueryParam("algorithm", request.Algorithm);
if (!string.IsNullOrEmpty(request.AccountType))
flurlReq.SetQueryParam("account_type", request.AccountType);
if (!string.IsNullOrEmpty(request.TarType))
flurlReq.SetQueryParam("tar_type", request.TarType);
return await client.SendRequestWithJsonAsync<Models.GetBillSubMerchantFundflowBillResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /{download_url} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_8.shtml </para>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /bill/sub-merchant-fundflowbill 接口的请求。</para>
/// </summary>
public class GetBillSubMerchantFundflowBillRequest : GetBillFundflowBillRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string SubMerchantId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置加密算法。
/// <para>默认值:<see cref="Constants.EncryptionAlgorithms.AEAD_AES_256_GCM"/></para>
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string Algorithm { get; set; } = Constants.EncryptionAlgorithms.AEAD_AES_256_GCM;
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /bill/sub-merchant-fundflowbill 接口的响应。</para>
/// </summary>
public class GetBillSubMerchantFundflowBillResponse : WechatTenpayResponse
{
public static class Types
{
public class DownloadBill
{
/// <summary>
/// 获取或设置账单文件序号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bill_sequence")]
[System.Text.Json.Serialization.JsonPropertyName("bill_sequence")]
public int BillSequence { get; set; }
/// <summary>
/// 获取或设置哈希类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("hash_type")]
[System.Text.Json.Serialization.JsonPropertyName("hash_type")]
public string HashType { get; set; } = default!;
/// <summary>
/// 获取或设置哈希值。
/// </summary>
[Newtonsoft.Json.JsonProperty("hash_value")]
[System.Text.Json.Serialization.JsonPropertyName("hash_value")]
public string HashValue { get; set; } = default!;
/// <summary>
/// 获取或设置账单下载地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_url")]
[System.Text.Json.Serialization.JsonPropertyName("download_url")]
public string DownloadUrl { get; set; } = default!;
/// <summary>
/// 获取或设置账单加密密钥(需使用商户私钥解密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("encrypt_key")]
[System.Text.Json.Serialization.JsonPropertyName("encrypt_key")]
public string EncryptKey { get; set; } = default!;
/// <summary>
/// 获取或设置账单加密使用的随机字符串。
/// </summary>
[Newtonsoft.Json.JsonProperty("nonce")]
[System.Text.Json.Serialization.JsonPropertyName("nonce")]
public string Nonce { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置账单文件总数。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_bill_count")]
[System.Text.Json.Serialization.JsonPropertyName("download_bill_count")]
public int DownloadBillCount { get; set; }
/// <summary>
/// 获取或设置账单文件列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_bill_list")]
[System.Text.Json.Serialization.JsonPropertyName("download_bill_list")]
public Types.DownloadBill[] DownloadBillList { get; set; } = default!;
}
}