2021-05-10 15:30:00 +08:00
|
|
|
|
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 WechatTenpayClientExecuteEcommerceFundWithdrawExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <para>异步调用 [POST] /ecommerce/fund/withdraw 接口。</para>
|
|
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_2.shtml </para>
|
2021-07-19 22:05:59 +08:00
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_1.shtml </para>
|
2021-05-10 15:30:00 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static async Task<Models.CreateEcommerceFundWithdrawResponse> ExecuteCreateEcommerceFundWithdrawAsync(this WechatTenpayClient client, Models.CreateEcommerceFundWithdrawRequest 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
|
2021-07-11 00:55:41 +08:00
|
|
|
|
.CreateRequest(request, HttpMethod.Post, "ecommerce", "fund", "withdraw")
|
|
|
|
|
|
;
|
2021-05-10 15:30:00 +08:00
|
|
|
|
|
|
|
|
|
|
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceFundWithdrawResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <para>异步调用 [GET] /ecommerce/fund/withdraw/out-request-no/{out_request_no} 接口。</para>
|
|
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_3.shtml </para>
|
2021-07-19 22:05:59 +08:00
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_2.shtml </para>
|
2021-05-10 15:30:00 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static async Task<Models.GetEcommerceFundWithdrawByOutRequestNumberResponse> ExecuteGetEcommerceFundWithdrawByOutRequestNumberAsync(this WechatTenpayClient client, Models.GetEcommerceFundWithdrawByOutRequestNumberRequest 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
|
2021-07-11 00:55:41 +08:00
|
|
|
|
.CreateRequest(request, HttpMethod.Get, "ecommerce", "fund", "withdraw", "out-request-no", request.OutRequestNumber)
|
2021-05-10 15:30:00 +08:00
|
|
|
|
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
|
|
|
|
|
|
2021-07-11 00:55:41 +08:00
|
|
|
|
return await client.SendRequestWithJsonAsync<Models.GetEcommerceFundWithdrawByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
2021-05-10 15:30:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <para>异步调用 [GET] /ecommerce/fund/withdraw/{withdraw_id} 接口。</para>
|
|
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_3.shtml </para>
|
2021-07-19 22:05:59 +08:00
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_2.shtml </para>
|
2021-05-10 15:30:00 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static async Task<Models.GetEcommerceFundWithdrawByWithdrawIdResponse> ExecuteGetEcommerceFundWithdrawByWithdrawIdAsync(this WechatTenpayClient client, Models.GetEcommerceFundWithdrawByWithdrawIdRequest 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
|
2021-07-11 00:55:41 +08:00
|
|
|
|
.CreateRequest(request, HttpMethod.Get, "ecommerce", "fund", "withdraw", request.WithdrawId)
|
2021-05-10 15:30:00 +08:00
|
|
|
|
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
|
|
|
|
|
|
2021-07-11 00:55:41 +08:00
|
|
|
|
return await client.SendRequestWithJsonAsync<Models.GetEcommerceFundWithdrawByWithdrawIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
2021-05-10 15:30:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|