Skip to content

Commit

Permalink
feat(tenpayv3): 新增服务商平台收付通商家转账相关接口
Browse files Browse the repository at this point in the history
  • Loading branch information
fudiwei committed Jul 2, 2024
1 parent f0ab585 commit 4869479
Show file tree
Hide file tree
Showing 57 changed files with 2,752 additions and 3 deletions.
24 changes: 24 additions & 0 deletions docs/WechatTenpayV3/Basic_ModelDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,30 @@

- 下载账单:`DownloadBillFile`

- 平台收付通(商家转账)

- 批量商家转账

- 受理商家转账:`ApplyPlatformSolutionMerchantTransferBatch`

- 微信支付转账批次单号查询批次单:`GetPlatformSolutionMerchantTransferBatchByBatchId`

- 微信支付转账明细单号查询明细单:`GetPlatformSolutionMerchantTransferBatchDetailByDetailId`

- 商户转账批次单号查询批次单:`GetPlatformSolutionMerchantTransferBatchByOutBatchNumber`

- 商户明细单号查询明细单:`GetPlatformSolutionMerchantTransferBatchDetailByOutDetailNumber`

- 预约商家转账

- 受理单次预约商家转账:`ApplyPlatformSolutionMerchantTransferReservation`

- 商户预约单号查询预约商家转账记录:`GetPlatformSolutionMerchantTransferReservationByOutReservationNumber`

- 关闭预约商家转账记录:`ClosePlatformSolutionMerchantTransferReservation`

- 微信支付预约单号查询预约商家转账记录:`GetPlatformSolutionMerchantTransferReservationByReservationId`

- 代金券

- 创建代金券批次:`CreateMarketingFavorStock`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,142 @@ public static async Task<Models.GetEcommerceFundWithdrawByWithdrawIdResponse> Ex
}
#endregion

#region MerchantTransfer
/// <summary>
/// <para>异步调用 [POST] /ecommerce/mch-transfer/authorizations 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/platsolution-mch-transfer/authorization/create-authorization.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateEcommerceMerchantTransferAuthorizationResponse> ExecuteCreateEcommerceMerchantTransferAuthorizationAsync(this WechatTenpayClient client, Models.CreateEcommerceMerchantTransferAuthorizationRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "ecommerce", "mch-transfer", "authorizations");

return await client.SendFlurlRequestAsJsonAsync<Models.CreateEcommerceMerchantTransferAuthorizationResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// <para>异步调用 [GET] /ecommerce/mch-transfer/authorizations/{sub_mchid} 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/platsolution-mch-transfer/authorization/get-authorization.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetEcommerceMerchantTransferAuthorizationBySubMerchantIdResponse> ExecuteGetEcommerceMerchantTransferAuthorizationBySubMerchantIdAsync(this WechatTenpayClient client, Models.GetEcommerceMerchantTransferAuthorizationBySubMerchantIdRequest 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
.CreateFlurlRequest(request, HttpMethod.Get, "ecommerce", "mch-transfer", "authorizations", request.SubMerchantId);

return await client.SendFlurlRequestAsJsonAsync<Models.GetEcommerceMerchantTransferAuthorizationBySubMerchantIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// <para>异步调用 [POST] /ecommerce/mch-transfer/transfer-bills 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/platsolution-mch-transfer/transfer-bill/transfer-to-user.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateEcommerceMerchantTransferBillResponse> ExecuteCreateEcommerceMerchantTransferBillAsync(this WechatTenpayClient client, Models.CreateEcommerceMerchantTransferBillRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "ecommerce", "mch-transfer", "transfer-bills");

return await client.SendFlurlRequestAsJsonAsync<Models.CreateEcommerceMerchantTransferBillResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// <para>异步调用 [GET] /ecommerce/mch-transfer/transfer-bills/out-bill-no/{out_bill_no} 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/platsolution-mch-transfer/transfer-bill/get-transfer-bill-by-out-no.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetEcommerceMerchantTransferBillByOutBillNumberResponse> ExecuteGetEcommerceMerchantTransferBillByOutBillNumberAsync(this WechatTenpayClient client, Models.GetEcommerceMerchantTransferBillByOutBillNumberRequest 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
.CreateFlurlRequest(request, HttpMethod.Get, "ecommerce", "mch-transfer", "transfer-bills", "out-bill-no", request.OutBillNumber)
.SetQueryParam("sub_mchid", request.SubMerchantId);

return await client.SendFlurlRequestAsJsonAsync<Models.GetEcommerceMerchantTransferBillByOutBillNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// <para>异步调用 [GET] /ecommerce/mch-transfer/transfer-bills/transfer-bill-no/{transfer_bill_no} 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/platsolution-mch-transfer/transfer-bill/get-transfer-bill-by-no.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetEcommerceMerchantTransferBillByTransferBillNumberResponse> ExecuteGetEcommerceMerchantTransferBillByTransferBillNumberAsync(this WechatTenpayClient client, Models.GetEcommerceMerchantTransferBillByTransferBillNumberRequest 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
.CreateFlurlRequest(request, HttpMethod.Get, "ecommerce", "mch-transfer", "transfer-bills", "transfer-bill-no", request.TransferBillNumber)
.SetQueryParam("sub_mchid", request.SubMerchantId);

return await client.SendFlurlRequestAsJsonAsync<Models.GetEcommerceMerchantTransferBillByTransferBillNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// <para>异步调用 [POST] /ecommerce/mch-transfer/transfer-bills/out-bill-no/{out_bill_no}/cancel 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/platsolution-mch-transfer/transfer-bill/cancel-transfer.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CancelEcommerceMerchantTransferBillResponse> ExecuteCancelEcommerceMerchantTransferBillAsync(this WechatTenpayClient client, Models.CancelEcommerceMerchantTransferBillRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "ecommerce", "mch-transfer", "transfer-bills", "out-bill-no", request.OutBillNumber, "cancel");

return await client.SendFlurlRequestAsJsonAsync<Models.CancelEcommerceMerchantTransferBillResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion

#region ProfitSharing
/// <summary>
/// <para>异步调用 [POST] /ecommerce/profitsharing/orders 接口。</para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static async Task<Models.GetPartnerTransferBatchByOutBatchNumberResponse>

IFlurlRequest flurlReq = client
.CreateFlurlRequest(request, HttpMethod.Get, "partner-transfer", "batches", "out-batch-no", request.OutBatchNumber)
.SetQueryParam("need_query_detail", request.RequireQueryDetail);
.SetQueryParam("need_query_detail", request.RequireQueryDetail ? "true" : "false");

if (request.DetailStatus is not null)
flurlReq.SetQueryParam("detail_status", request.DetailStatus);
Expand Down
Loading

0 comments on commit 4869479

Please sign in to comment.