mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 14:04:32 +08:00
feat(tenpayv3): 新增商户申请获取微信支付分对账单相关接口
This commit is contained in:
parent
ae6c655b29
commit
fcb1e97315
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
/// <summary>
|
||||
/// 为 <see cref="WechatTenpayClient"/> 提供微信支付分账单相关的 API 扩展方法。
|
||||
/// </summary>
|
||||
public static class WechatTenpayClientExecutePayScoreBillExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /payscore/merchant-bill 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_29.shtml </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.GetPayScoreMerchantBillResponse> ExecuteGetPayScoreMerchantBillAsync(this WechatTenpayClient client, Models.GetPayScoreMerchantBillRequest 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, "payscore", "merchant-bill")
|
||||
.SetQueryParam("bill_date", request.BillDateString)
|
||||
.SetQueryParam("algorithm", request.Algorithm)
|
||||
.SetQueryParam("tar_type", request.TarType)
|
||||
.SetQueryParam("algorithm", request.Algorithm);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.TarType))
|
||||
flurlReq.SetQueryParam("tar_type", request.TarType);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScoreMerchantBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置加密算法。
|
||||
/// <para>默认值:<see cref="Constants.EncryptionAlgorithms.AEAD_AES_256_GCM"/></para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /payscore/merchant-bill 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class GetPayScoreMerchantBillRequest : WechatTenpayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置账单日期(格式:yyyy-MM-dd)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string BillDateString { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置服务 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string ServiceId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置压缩类型。
|
||||
/// <para>默认值:GZIP</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string TarType { get; set; } = "GZIP";
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /payscore/merchant-bill 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class GetPayScoreMerchantBillResponse : 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!;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"download_bill_count": 1,
|
||||
"download_bill_list": [
|
||||
{
|
||||
"bill_sequence": 1,
|
||||
"download_url": "https://api.mch.weixin.qq.com/v3/payscore/bill/downloadurl?token=xxx",
|
||||
"encrypt_key": "a0YK7p+9XaKzE9N4qtFfG/9za1oqKlLXXJWBkH+kX84onAs2Ol/E1fk+6S+FuBXczGDRU8I8D+6PfbwKYBGm0wANUTqHOSezzfbieIo2t51UIId7sP9SoN38W2+IcYDviIsu59KSdyiL3TY2xqZNT8UDcnMWzTNZdSv+CLsSgblB6OKGN9JONTadOFGfv1OKkTp86Li+X7S9bG62wsa572/5Rm4MmDCiKwY4bX2EynWQHBEOExD5URxT6/MX3F1D3BNYrE4fUu1F03k25xVlXnZDjksy6Rf3SCgadR+Cepc6mdfF9b2gTxNsJFMEdYXbqL0W1WQZ3UqSPQCguK6uLA==",
|
||||
"hash_type": "SHA1",
|
||||
"hash_value": "79bb0f45fc4c42234a918000b2668d689e2bde04",
|
||||
"nonce": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user