From bced0b4998c6773e4932b047e1d3c57d584a7fcd Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Thu, 5 Feb 2026 17:53:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=B0=8F=E5=BA=97=E8=AE=A2=E5=8D=95=E8=A1=A5=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...echatApiClientExecuteChannelsExtensions.cs | 23 ++++++ ...nnelsECOrderDeliveryCompensationRequest.cs | 72 +++++++++++++++++++ ...nelsECOrderDeliveryCompensationResponse.cs | 9 +++ ...elsECOrderDeliveryCompensationRequest.json | 18 +++++ 4 files changed, 122 insertions(+) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.json diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index c9161980..f801acc2 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -4873,6 +4873,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// 异步调用 [POST] /channels/ec/order/delivery/compensation 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECOrderDeliveryCompensationAsync(this WechatApiClient client, Models.ChannelsECOrderDeliveryCompensationRequest 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", "delivery", "compensation") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } #endregion #region ECOrder/Dropship diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.cs new file mode 100644 index 00000000..05908301 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/order/delivery/compensation 接口的请求。 + /// + public class ChannelsECOrderDeliveryCompensationRequest : WechatApiRequest, IInferable + { + public static class Types + { + public class Delivery + { + public static class Types + { + public class Product : ChannelsECOrderDeliverySendRequest.Types.Delivery.Types.Product + { + } + } + + /// + /// 获取或设置快递公司 ID。 + /// + [Newtonsoft.Json.JsonProperty("delivery_id")] + [System.Text.Json.Serialization.JsonPropertyName("delivery_id")] + public string DeliveryId { get; set; } = string.Empty; + + /// + /// 获取或设置快递单号。 + /// + [Newtonsoft.Json.JsonProperty("waybill_id")] + [System.Text.Json.Serialization.JsonPropertyName("waybill_id")] + public string? WaybillId { get; set; } + + /// + /// 获取或设置发货方式。 + /// + [Newtonsoft.Json.JsonProperty("deliver_type")] + [System.Text.Json.Serialization.JsonPropertyName("deliver_type")] + public int DeliverType { get; set; } + + /// + /// 获取或设置商品列表。 + /// + [Newtonsoft.Json.JsonProperty("product_infos")] + [System.Text.Json.Serialization.JsonPropertyName("product_infos")] + public IList ProductList { get; set; } = new List(); + } + } + + /// + /// 获取或设置订单 ID。 + /// + [Newtonsoft.Json.JsonProperty("order_id")] + [System.Text.Json.Serialization.JsonPropertyName("order_id")] + public string OrderId { get; set; } = string.Empty; + + /// + /// 获取或设置快递列表。 + /// + [Newtonsoft.Json.JsonProperty("delivery_list")] + [System.Text.Json.Serialization.JsonPropertyName("delivery_list")] + public IList DeliveryList { get; set; } = new List(); + + /// + /// 获取或设置补发原因类型。 + /// + [Newtonsoft.Json.JsonProperty("reason")] + [System.Text.Json.Serialization.JsonPropertyName("reason")] + public int ReasonType { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationResponse.cs new file mode 100644 index 00000000..b89a1c40 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/order/delivery/compensation 接口的响应。 + /// + public class ChannelsECOrderDeliveryCompensationResponse : WechatApiResponse + { + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.json new file mode 100644 index 00000000..573be443 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECOrder/Delivery/ChannelsECOrderDeliveryCompensationRequest.json @@ -0,0 +1,18 @@ +{ + "order_id": "123456", + "reason": 1, + "delivery_list": [ + { + "delivery_id": "YD", + "waybill_id": "23424324253", + "deliver_type": 1, + "product_infos": [ + { + "product_cnt": 1, + "product_id": "12345", + "sku_id": "678910" + } + ] + } + ] +}