feat(wxapi): 新增视频号小店电子面单打印管理相关接口

This commit is contained in:
Fu Diwei 2024-01-15 12:49:45 +08:00
parent e288b02fb2
commit c59bd6d3de
13 changed files with 255 additions and 3 deletions

View File

@ -1833,6 +1833,68 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsEWaybillOrderGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/logistics/ewaybill/biz/order/print 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/ewaybill/notify_print.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECLogisticsEWaybillOrderPrintResponse> ExecuteChannelsECLogisticsEWaybillOrderPrintAsync(this WechatApiClient client, Models.ChannelsECLogisticsEWaybillOrderPrintRequest 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
.CreateRequest(request, HttpMethod.Post, "channels", "ec", "logistics", "ewaybill", "biz", "order", "print")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsEWaybillOrderPrintResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/logistics/ewaybill/biz/order/batchprint 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/ewaybill/batchnotify_print.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECLogisticsEWaybillOrderBatchPrintResponse> ExecuteChannelsECLogisticsEWaybillOrderBatchPrintAsync(this WechatApiClient client, Models.ChannelsECLogisticsEWaybillOrderBatchPrintRequest 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
.CreateRequest(request, HttpMethod.Post, "channels", "ec", "logistics", "ewaybill", "biz", "order", "batchprint")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsEWaybillOrderBatchPrintResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region ECLogistics/EWaybill/Print
/// <summary>
/// <para>异步调用 [POST] /channels/ec/logistics/ewaybill/biz/print/get 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/ewaybill/get_print_info.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECLogisticsEWaybillPrintGetResponse> ExecuteChannelsECLogisticsEWaybillPrintGetAsync(this WechatApiClient client, Models.ChannelsECLogisticsEWaybillPrintGetRequest 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
.CreateRequest(request, HttpMethod.Post, "channels", "ec", "logistics", "ewaybill", "biz", "print", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECLogisticsEWaybillPrintGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region ECLogistics/EWaybill/Template

View File

@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /card/paygiftcard/add 接口的响应。</para>
@ -58,13 +58,13 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_mchid_list")]
[System.Text.Json.Serialization.JsonPropertyName("fail_mchid_list")]
public Types.Merchant[] FailMerchantList { get; set; } = default!;
public Types.Merchant[] FailedMerchantList { get; set; } = default!;
/// <summary>
/// 获取或设置设置成功的微信商户号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("succ_mchid_list")]
[System.Text.Json.Serialization.JsonPropertyName("succ_mchid_list")]
public string[] SuccessMerchantIdList { get; set; } = default!;
public string[] SuccessfulMerchantIdList { get; set; } = default!;
}
}

View File

@ -0,0 +1,53 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/order/batchprint 接口的请求。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillOrderBatchPrintRequest : WechatApiRequest, IInferable<ChannelsECLogisticsEWaybillOrderBatchPrintRequest, ChannelsECLogisticsEWaybillOrderBatchPrintResponse>
{
public static class Types
{
public class PrintRequest
{
/// <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("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>
/// 获取或设置是否是补打单。
/// </summary>
[Newtonsoft.Json.JsonProperty("re_print")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("re_print")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
public bool IsReprint { get; set; }
}
}
/// <summary>
/// 获取或设置打印请求列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("req_list")]
[System.Text.Json.Serialization.JsonPropertyName("req_list")]
public IList<Types.PrintRequest> PrintRequestList { get; set; } = new List<Types.PrintRequest>();
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/order/batchprint 接口的响应。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillOrderBatchPrintResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置成功的电子面单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("succ_ewaybill_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("succ_ewaybill_order_id")]
public string[]? SuccessfulEWaybillOrderIdList { get; set; }
/// <summary>
/// 获取或设置失败的电子面单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_ewaybill_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("fail_ewaybill_order_id")]
public string[]? FailedEWaybillOrderIdList { get; set; }
}
}

View File

@ -0,0 +1,38 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/order/print 接口的请求。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillOrderPrintRequest : WechatApiRequest, IInferable<ChannelsECLogisticsEWaybillOrderPrintRequest, ChannelsECLogisticsEWaybillOrderPrintResponse>
{
/// <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("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>
/// 获取或设置是否是补打单。
/// </summary>
[Newtonsoft.Json.JsonProperty("re_print")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("re_print")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
public bool IsReprint { get; set; }
}
}

View File

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

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/print/get 接口的请求。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillPrintGetRequest : WechatApiRequest, IInferable<ChannelsECLogisticsEWaybillPrintGetRequest, ChannelsECLogisticsEWaybillPrintGetResponse>
{
/// <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>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id")]
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
public string TemplateId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/logistics/ewaybill/biz/print/get 接口的响应。</para>
/// </summary>
public class ChannelsECLogisticsEWaybillPrintGetResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置打印报文信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("print_info")]
[System.Text.Json.Serialization.JsonPropertyName("print_info")]
public string? PrintInfo { get; set; } = default!;
}
}

View File

@ -0,0 +1,10 @@
{
"req_list": [
{
"ewaybill_order_id": "1212",
"delivery_id": "xxx",
"waybill_id": "xxxx",
"re_print": 0
}
]
}

View File

@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "ok",
"succ_ewaybill_order_id": [ "1111", "222" ],
"fail_ewaybill_order_id": [ "1111", "222" ]
}

View File

@ -0,0 +1,6 @@
{
"ewaybill_order_id": "1212",
"delivery_id": "xxx",
"waybill_id": "xxxx",
"re_print": 0
}

View File

@ -0,0 +1,4 @@
{
"ewaybill_order_id": "xxxx",
"template_id": "xxxx"
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"print_info": "xxxxx"
}