mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 02:29:40 +08:00
feat(work): 新增获取收款项目的商户单号相关接口
This commit is contained in:
@@ -113,5 +113,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExternalPayGetBillListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Payment
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/externalpay/get_payment_info 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95944 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExternalPayGetPaymentInfoResponse> ExecuteCgibinExternalPayGetPaymentInfoAsync(this WechatWorkClient client, Models.CgibinExternalPayGetPaymentInfoRequest 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, "cgi-bin", "externalpay", "get_payment_info")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExternalPayGetPaymentInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/externalpay/get_payment_info 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExternalPayGetPaymentInfoRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置收款项目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("payment_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("payment_id")]
|
||||
public string PaymentId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/externalpay/get_payment_info 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExternalPayGetPaymentInfoResponse : WechatWorkResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Bill
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商户单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置收款单列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("bill_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("bill_list")]
|
||||
public Types.Bill[] BillList { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"payment_id": "xxxx"
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"bill_list": [
|
||||
{
|
||||
"out_trade_no": "xxxx"
|
||||
},
|
||||
{
|
||||
"out_trade_no": "yyyy"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user