diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteProductExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteProductExtensions.cs index 43112247..45d4936d 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteProductExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteProductExtensions.cs @@ -1134,29 +1134,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api #endregion #region Order - /// - /// 异步调用 [POST] /product/order/get 接口。 - /// REF: https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent/API/order/get_order_detail.html - /// - /// - /// - /// - /// - public static async Task ExecuteProductOrderGetAsync(this WechatApiClient client, Models.ProductOrderGetRequest 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, "product", "order", "get") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - /// /// 异步调用 [POST] /product/order/get_list 接口。 /// REF: https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent/API/order/get_order_list.html + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/get_order_list.html /// /// /// @@ -1174,9 +1155,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + /// + /// 异步调用 [POST] /product/order/get 接口。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent/API/order/get_order_detail.html + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/get_order_detail.html + /// + /// + /// + /// + /// + public static async Task ExecuteProductOrderGetAsync(this WechatApiClient client, Models.ProductOrderGetRequest 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, "product", "order", "get") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + /// /// 异步调用 [POST] /product/order/search 接口。 /// REF: https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent/API/order/search_order.html + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/search_order.html /// /// /// @@ -1193,6 +1196,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + + /// + /// 异步调用 [POST] /product/order/change_order_price 接口。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/change_order_price.html + /// + /// + /// + /// + /// + public static async Task ExecuteProductOrderChangeOrderPriceAsync(this WechatApiClient client, Models.ProductOrderChangeOrderPriceRequest 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, "product", "order", "change_order_price") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } #endregion #region Coupon diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Product/Order/ProductOrderChangeOrderPriceRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Product/Order/ProductOrderChangeOrderPriceRequest.cs new file mode 100644 index 00000000..c8506461 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Product/Order/ProductOrderChangeOrderPriceRequest.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /product/order/change_order_price 接口的请求。 + /// + public class ProductOrderChangeOrderPriceRequest : WechatApiRequest + { + public static class Types + { + public class Product + { + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public long ProductId { get; set; } + + /// + /// 获取或设置 SKU ID。 + /// + [Newtonsoft.Json.JsonProperty("sku_id")] + [System.Text.Json.Serialization.JsonPropertyName("sku_id")] + public long SKUId { get; set; } + + /// + /// 获取或设置商品价格(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("change_price")] + [System.Text.Json.Serialization.JsonPropertyName("change_price")] + public int Price { get; set; } + } + } + + /// + /// 获取或设置订单 ID。 + /// + [Newtonsoft.Json.JsonProperty("order_id")] + [System.Text.Json.Serialization.JsonPropertyName("order_id")] + public long OrderId { get; set; } + + /// + /// 获取或设置是否修改运费。 + /// + [Newtonsoft.Json.JsonProperty("change_express")] + [System.Text.Json.Serialization.JsonPropertyName("change_express")] + public bool RequireChangeExpress { get; set; } + + /// + /// 获取或设置运费价格(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("express_fee")] + [System.Text.Json.Serialization.JsonPropertyName("express_fee")] + public int? ExpressFee { get; set; } + + /// + /// 获取或设置修改价格的商品列表。 + /// + [Newtonsoft.Json.JsonProperty("change_order_infos")] + [System.Text.Json.Serialization.JsonPropertyName("change_order_infos")] + public IList ProductList { get; set; } = new List(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Product/Order/ProductOrderChangeOrderPriceResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Product/Order/ProductOrderChangeOrderPriceResponse.cs new file mode 100644 index 00000000..56c673fd --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Product/Order/ProductOrderChangeOrderPriceResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /product/order/change_order_price 接口的响应。 + /// + public class ProductOrderChangeOrderPriceResponse : WechatApiResponse + { + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Product/Order/ProductOrderChangeOrderPriceRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Product/Order/ProductOrderChangeOrderPriceRequest.json new file mode 100644 index 00000000..7ec590ae --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Product/Order/ProductOrderChangeOrderPriceRequest.json @@ -0,0 +1,12 @@ +{ + "order_id": 123456, + "change_express": true, + "express_fee": 0, + "change_order_infos": [ + { + "product_id": 1234, + "sku_id": 5678, + "change_price": 300 + } + ] +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Product/Order/ProductOrderChangeOrderPriceResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Product/Order/ProductOrderChangeOrderPriceResponse.json new file mode 100644 index 00000000..f752befe --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Product/Order/ProductOrderChangeOrderPriceResponse.json @@ -0,0 +1,4 @@ +{ + "errcode": 0, + "errmsg": "ok" +} \ No newline at end of file