2023-04-03 16:52:02 +08:00
|
|
|
using System;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Flurl.Http;
|
|
|
|
|
|
|
|
|
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
|
|
|
|
{
|
|
|
|
|
public static class WechatTenpayClientExecuteCateringExtensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>异步调用 [POST] /catering/orders/sync-status 接口。</para>
|
|
|
|
|
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/catering.php?chapter=26_1 </para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static async Task<Models.SyncCateringOrderStatusResponse> ExecuteSyncCateringOrderStatusAsync(this WechatTenpayClient client, Models.SyncCateringOrderStatusRequest request, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
if (client is null) throw new ArgumentNullException(nameof(client));
|
|
|
|
|
if (request is null) throw new ArgumentNullException(nameof(request));
|
|
|
|
|
|
2024-01-29 23:12:37 +08:00
|
|
|
if (request.MerchantId is null)
|
2023-04-03 16:52:02 +08:00
|
|
|
request.MerchantId = client.Credentials.MerchantId;
|
|
|
|
|
|
|
|
|
|
IFlurlRequest flurlReq = client
|
2024-01-29 23:12:37 +08:00
|
|
|
.CreateFlurlRequest(request, HttpMethod.Post, "catering", "orders", "sync-status");
|
2023-04-03 16:52:02 +08:00
|
|
|
|
2024-01-29 23:12:37 +08:00
|
|
|
return await client.SendFlurlRequestAsJsonAsync<Models.SyncCateringOrderStatusResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
2023-04-03 16:52:02 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|