feat(wxapi): 新增微信小店电子面单子件追加接口

This commit is contained in:
Fu Diwei 2025-04-29 21:08:10 +08:00
parent 3cf32f3680
commit c244e92a16
8 changed files with 188 additions and 3 deletions

View File

@ -2976,6 +2976,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECLogisticsEWaybillOrderCreateResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/logistics/ewaybill/biz/order/addsuborder 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/ewaybill/add_suborder.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECLogisticsEWaybillOrderAddSubOrderResponse> ExecuteChannelsECLogisticsEWaybillOrderAddSubOrderAsync(this WechatApiClient client, Models.ChannelsECLogisticsEWaybillOrderAddSubOrderRequest 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", "logistics", "ewaybill", "biz", "order", "addsuborder")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECLogisticsEWaybillOrderAddSubOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/logistics/ewaybill/biz/order/cancel 接口。</para>
/// <para>

View File

@ -0,0 +1,80 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/order/addsuborder 接口的请求。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillOrderAddSubOrderRequest : WechatApiRequest, IInferable<ChannelsECLogisticsEWaybillOrderAddSubOrderRequest, ChannelsECLogisticsEWaybillOrderAddSubOrderResponse>
{
public static class Types
{
public class SubPackage : ChannelsECLogisticsEWaybillOrderCreateRequest.Types.DeliveryInfo.Types.SubPackage
{
}
}
/// <summary>
/// 获取或设置电子面单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ewaybill_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("ewaybill_order_id")]
public string EWaybillOrderId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置快递单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("waybill_id")]
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
public string WaybillId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置快递公司 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_id")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
public string DeliveryId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置店铺 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_id")]
[System.Text.Json.Serialization.JsonPropertyName("shop_id")]
public string ShopId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置电子面单账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ewaybill_acct_id")]
[System.Text.Json.Serialization.JsonPropertyName("ewaybill_acct_id")]
public string EWaybillAccountId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置追加面单数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("add_package_quantity")]
[System.Text.Json.Serialization.JsonPropertyName("add_package_quantity")]
public int AddPackageQuantity { get; set; }
/// <summary>
/// 获取或设置面单模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id")]
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
public string? TemplateId { get; set; }
/// <summary>
/// 获取或设置子件列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("subpackage_list")]
[System.Text.Json.Serialization.JsonPropertyName("subpackage_list")]
public IList<Types.SubPackage>? SubPackageList { get; set; }
/// <summary>
/// 获取或设置子单额外信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_order_ext_info")]
[System.Text.Json.Serialization.JsonPropertyName("sub_order_ext_info")]
public string? SubOrderExtraInfo { get; set; }
}
}

View File

@ -0,0 +1,50 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/order/addsuborder 接口的响应。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillOrderAddSubOrderResponse : WechatApiResponse
{
public static class Types
{
public class SubWaybill : ChannelsECLogisticsEWaybillOrderCreateResponse.Types.SubWaybill
{
}
}
/// <summary>
/// 获取或设置电子面单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ewaybill_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("ewaybill_order_id")]
public string? EWaybillOrderId { get; set; }
/// <summary>
/// 获取或设置快递单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("waybill_id")]
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
public string? WaybillId { get; set; }
/// <summary>
/// 获取或设置快递公司错误信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_error_msg")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_error_msg")]
public string? DeliveryErrorMessage { get; set; }
/// <summary>
/// 获取或设置打印报文信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("print_info")]
[System.Text.Json.Serialization.JsonPropertyName("print_info")]
public string? PrintInfo { get; set; }
/// <summary>
/// 获取或设置子单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("waybill_id_list")]
[System.Text.Json.Serialization.JsonPropertyName("waybill_id_list")]
public Types.SubWaybill[]? SubWaybillList { get; set; }
}
}

View File

@ -246,7 +246,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("ewaybill_acct_id")]
[System.Text.Json.Serialization.JsonPropertyName("ewaybill_acct_id")]
public string AccountId { get; set; } = string.Empty;
public string EWaybillAccountId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置面单模板 ID。

View File

@ -194,7 +194,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("ewaybill_acct_id")]
[System.Text.Json.Serialization.JsonPropertyName("ewaybill_acct_id")]
public string AccountId { get; set; } = default!;
public string EWaybillAccountId { get; set; } = default!;
/// <summary>
/// 获取或设置寄件人信息。

View File

@ -155,7 +155,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("ewaybill_acct_id")]
[System.Text.Json.Serialization.JsonPropertyName("ewaybill_acct_id")]
public string AccountId { get; set; } = string.Empty;
public string EWaybillAccountId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置寄件人信息。

View File

@ -0,0 +1,8 @@
{
"ewaybill_order_id": "xxxxxxx",
"delivery_id": "JD",
"waybill_id": "xxxxxxx",
"add_package_quantity": 1,
"shop_id": "xxxxxx",
"ewaybill_acct_id": "xxxxx"
}

View File

@ -0,0 +1,24 @@
{
"errcode": 0,
"errmsg": "ok",
"delivery_error_msg": "调用成功",
"waybill_id": "JDAWX0161464774",
"waybill_id_list": [
{
"create_time": 1734508828,
"waybill_id": "JDAWX0161464774-1-3-",
"waybill_type": 2
},
{
"create_time": 1734508828,
"waybill_id": "JDAWX0161464774-2-3-",
"waybill_type": 2
},
{
"create_time": 1734508828,
"waybill_id": "JDAWX0161464774-3-3-",
"waybill_type": 2
}
],
"print_info": "xxxxxxx"
}