feat(tenpayv3): 新增获取分账账单相关接口

This commit is contained in:
Fu Diwei 2021-07-26 23:59:14 +08:00
parent a3880f7c4e
commit ab8fe63df9
3 changed files with 93 additions and 0 deletions

View File

@ -199,5 +199,34 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return await client.SendRequestWithJsonAsync<Models.DeleteProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#region Bills
/// <summary>
/// <para>异步调用 [GET] /profitsharing/bills 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_11.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_11.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetProfitSharingBillResponse> ExecuteGetProfitSharingBillAsync(this WechatTenpayClient client, Models.GetProfitSharingBillRequest 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, "profitsharing", "bills")
.SetQueryParam("bill_date", request.BillDateString);
if (!string.IsNullOrEmpty(request.SubMerchantId))
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
if (!string.IsNullOrEmpty(request.TarType))
flurlReq.SetQueryParam("tar_type", request.TarType);
return await client.SendRequestWithJsonAsync<Models.GetProfitSharingBillResponse>(flurlReq, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/bills 接口的请求。</para>
/// </summary>
public class GetProfitSharingBillRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置账单日期格式yyyy-MM-dd
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string BillDateString { get; set; } = string.Empty;
/// <summary>
/// 获取或设置压缩类型。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? TarType { get; set; }
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/bills 接口的响应。</para>
/// </summary>
public class GetProfitSharingBillResponse : WechatTenpayResponse
{
/// <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!;
}
}