feat(wxapi): 新增微信小店待发货前更换 SKU 相关接口

This commit is contained in:
Fu Diwei 2025-04-07 20:10:06 +08:00
parent f5478bb68c
commit 404df5cd77
11 changed files with 173 additions and 0 deletions

View File

@ -3739,6 +3739,77 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECOrderDeliverySendResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECOrder/PreshipmentChangeSKU
/// <summary>
/// <para>异步调用 [POST] /channels/ec/order/preshipmentchangesku/approve 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/order/preshipment_change_sku_approve.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECOrderPreshipmentChangeSKUApproveResponse> ExecuteChannelsECOrderPreshipmentChangeSKUApproveAsync(this WechatApiClient client, Models.ChannelsECOrderPreshipmentChangeSKUApproveRequest 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, "channels", "ec", "order", "preshipmentchangesku", "approve")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECOrderPreshipmentChangeSKUApproveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/order/preshipmentchangesku/reject 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/order/preshipment_change_sku_reject.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECOrderPreshipmentChangeSKURejectResponse> ExecuteChannelsECOrderPreshipmentChangeSKURejectAsync(this WechatApiClient client, Models.ChannelsECOrderPreshipmentChangeSKURejectRequest 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, "channels", "ec", "order", "preshipmentchangesku", "reject")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECOrderPreshipmentChangeSKURejectResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/order/preshipmentchangesku/get 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/order/preshipment_change_sku_reject.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECOrderPreshipmentChangeSKUGetResponse> ExecuteChannelsECOrderPreshipmentChangeSKUGetAsync(this WechatApiClient client, Models.ChannelsECOrderPreshipmentChangeSKUGetRequest 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, "channels", "ec", "order", "preshipmentchangesku", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECOrderPreshipmentChangeSKUGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#endregion
#region ECProduct

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/order/preshipmentchangesku/approve 接口的请求。</para>
/// </summary>
public class ChannelsECOrderPreshipmentChangeSKUApproveRequest : WechatApiRequest, IInferable<ChannelsECOrderPreshipmentChangeSKUApproveRequest, ChannelsECOrderPreshipmentChangeSKUApproveResponse>
{
/// <summary>
/// 获取或设置订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string OrderId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/order/preshipmentchangesku/approve 接口的响应。</para>
/// </summary>
public class ChannelsECOrderPreshipmentChangeSKUApproveResponse : WechatApiResponse
{
}
}

View File

@ -0,0 +1,24 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/order/preshipmentchangesku/get 接口的请求。</para>
/// </summary>
public class ChannelsECOrderPreshipmentChangeSKUGetRequest : WechatApiRequest, IInferable<ChannelsECOrderPreshipmentChangeSKUGetRequest, ChannelsECOrderPreshipmentChangeSKUGetResponse>
{
/// <summary>
/// 获取或设置分页页数。
/// <para>默认值1</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("page")]
[System.Text.Json.Serialization.JsonPropertyName("page")]
public int Page { get; set; } = 1;
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("page_size")]
[System.Text.Json.Serialization.JsonPropertyName("page_size")]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/order/preshipmentchangesku/get 接口的响应。</para>
/// </summary>
public class ChannelsECOrderPreshipmentChangeSKUGetResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置订单 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_ids")]
[System.Text.Json.Serialization.JsonPropertyName("order_ids")]
public string[] OrderIdList { get; set; } = default!;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/order/preshipmentchangesku/reject 接口的请求。</para>
/// </summary>
public class ChannelsECOrderPreshipmentChangeSKURejectRequest : WechatApiRequest, IInferable<ChannelsECOrderPreshipmentChangeSKURejectRequest, ChannelsECOrderPreshipmentChangeSKURejectResponse>
{
/// <summary>
/// 获取或设置订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string OrderId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/order/preshipmentchangesku/reject 接口的响应。</para>
/// </summary>
public class ChannelsECOrderPreshipmentChangeSKURejectResponse : WechatApiResponse
{
}
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"order_ids": [ "123456789" ]
}