mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 10:38:10 +08:00
feat(wxapi): 新增小程序微信物流服务退货组件相关接口
This commit is contained in:
@@ -352,6 +352,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryPathUpdateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
#region Delivery/OpenMessage
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/open_msg/follow_waybill 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html#_4-1%E3%80%81%E4%BC%A0%E8%BF%90%E5%8D%95%E6%8E%A5%E5%8F%A3-follow-waybill </para>
|
||||
@@ -432,6 +433,28 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryOpenMessageOpenOpenMessageResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/open_msg/open_query_plugin 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/logistics-service/applyQueryPlugin.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryOpenMessageOpenQueryPluginResponse> ExecuteCgibinExpressDeliveryOpenMessageOpenQueryPluginAsync(this WechatApiClient client, Models.CgibinExpressDeliveryOpenMessageOpenQueryPluginRequest 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, "cgi-bin", "express", "delivery", "open_msg", "open_query_plugin")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryOpenMessageOpenQueryPluginResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Delivery/Return
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/return/open_return 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/logistics-service/applyReturnPlugin.html </para>
|
||||
@@ -453,25 +476,66 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/open_msg/open_query_plugin 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/logistics-service/applyQueryPlugin.html </para>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/return/add 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_sale_return.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryOpenMessageOpenQueryPluginResponse> ExecuteCgibinExpressDeliveryOpenMessageOpenQueryPluginAsync(this WechatApiClient client, Models.CgibinExpressDeliveryOpenMessageOpenQueryPluginRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.CgibinExpressDeliveryReturnAddResponse> ExecuteCgibinExpressDeliveryReturnAddAsync(this WechatApiClient client, Models.CgibinExpressDeliveryReturnAddRequest 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, "cgi-bin", "express", "delivery", "open_msg", "open_query_plugin")
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "express", "delivery", "return", "add")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryOpenMessageOpenQueryPluginResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryReturnAddResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/return/get 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_sale_return.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryReturnGetResponse> ExecuteCgibinExpressDeliveryReturnGetAsync(this WechatApiClient client, Models.CgibinExpressDeliveryReturnGetRequest 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, "cgi-bin", "express", "delivery", "return", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryReturnGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/return/unbind 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_sale_return.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryReturnUnbindResponse> ExecuteCgibinExpressDeliveryReturnUnbindAsync(this WechatApiClient client, Models.CgibinExpressDeliveryReturnUnbindRequest 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, "cgi-bin", "express", "delivery", "return", "unbind")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryReturnUnbindResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Delivery/SingleWaybill
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/single_waybill/update 接口。</para>
|
||||
|
@@ -0,0 +1,135 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/return/add 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryReturnAddRequest : WechatApiRequest, IInferable<CgibinExpressDeliveryReturnAddRequest, CgibinExpressDeliveryReturnAddResponse>
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class ShopAddress
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置国家。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("country")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("country")]
|
||||
public string Country { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置省份。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("province")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("province")]
|
||||
public string Province { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置城市。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("city")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("city")]
|
||||
public string City { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置区县。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("area")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("area")]
|
||||
public string District { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置详细地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("address")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("address")]
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置联系人。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置联系电话。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mobile")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mobile")]
|
||||
public string MobileNumber { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class UserAddress : ShopAddress
|
||||
{
|
||||
}
|
||||
|
||||
public class Goods
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品图片 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string ImageUrl { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商家退货单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_order_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_order_id")]
|
||||
public string ShopOrderId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商家退货地址信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("biz_addr")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("biz_addr")]
|
||||
public Types.ShopAddress ShopAddress { get; set; } = new Types.ShopAddress();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户收货地址信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("user_addr")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("user_addr")]
|
||||
public Types.UserAddress? UserAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置退货用户的 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string OpenId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单中心页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_path")]
|
||||
public string OrderPagePath { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置退货商品列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_list")]
|
||||
public IList<Types.Goods> GoodsList { get; set; } = new List<Types.Goods>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置退货订单价格(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_price")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_price")]
|
||||
public int OrderPrice { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/return/add 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryReturnAddResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置退货单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("return_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("return_id")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringReadOnlyConverter))]
|
||||
public string ReturnId { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/return/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryReturnGetRequest : WechatApiRequest, IInferable<CgibinExpressDeliveryReturnGetRequest, CgibinExpressDeliveryReturnGetResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置退货单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("return_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("return_id")]
|
||||
public string ReturnId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/return/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryReturnGetResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置退货状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置运单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
|
||||
public string WaybillId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置运单状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_status")]
|
||||
public int OrderStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递公司 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
|
||||
public string DeliveryId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递公司名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_name")]
|
||||
public string DeliveryName { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/return/unbind 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryReturnUnbindRequest : WechatApiRequest, IInferable<CgibinExpressDeliveryReturnUnbindRequest, CgibinExpressDeliveryReturnUnbindResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置退货单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("return_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("return_id")]
|
||||
public string ReturnId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/return/unbind 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryReturnUnbindResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"shop_order_id": "xxx",
|
||||
"biz_addr": {
|
||||
"name": "张三",
|
||||
"mobile": "13600000000",
|
||||
"country": "中国",
|
||||
"province": "广东省",
|
||||
"city": "广州市",
|
||||
"area": "海珠区",
|
||||
"address": "xx路xx号"
|
||||
},
|
||||
"user_addr": {
|
||||
"name": "李四",
|
||||
"mobile": "13600000000",
|
||||
"country": "中国",
|
||||
"province": "广东省",
|
||||
"city": "广州市",
|
||||
"area": "海珠区",
|
||||
"address": "xx路xx号"
|
||||
},
|
||||
"openid": "xxx",
|
||||
"order_path": "xxx",
|
||||
"goods_list": [
|
||||
{
|
||||
"name": "xxx",
|
||||
"url": "xxx"
|
||||
}
|
||||
],
|
||||
"order_price": 1
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "OK",
|
||||
"return_id": "1935761508265738242"
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"return_id": "1935761508265738242"
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "OK",
|
||||
"status": "2",
|
||||
"waybill_id": "JDxxxxxx",
|
||||
"order_status": 0,
|
||||
"delivery_name": "申通快递",
|
||||
"delivery_id": "SF"
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"return_id": "1935761508265738242"
|
||||
}
|
Reference in New Issue
Block a user