feat(wxapi): 新增微信小店换货相关接口

This commit is contained in:
Fu Diwei 2025-04-07 19:28:57 +08:00
parent 1dd9ebccef
commit d2948a7e43
11 changed files with 354 additions and 0 deletions

View File

@ -107,6 +107,75 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECAftersaleRejectApplyResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECAftersaleRejectApplyResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
} }
/// <summary>
/// <para>异步调用 [POST] /channels/ec/aftersale/acceptexchangereship 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/aftersale/acceptexchangereship.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECAftersaleAcceptExchangeReshipResponse> ExecuteChannelsECAftersaleAcceptExchangeReshipAsync(this WechatApiClient client, Models.ChannelsECAftersaleAcceptExchangeReshipRequest 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", "aftersale", "acceptexchangereship")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECAftersaleAcceptExchangeReshipResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/aftersale/rejectexchangereship 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/aftersale/rejectexchangereship.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECAftersaleRejectExchangeReshipResponse> ExecuteChannelsECAftersaleRejectExchangeReshipAsync(this WechatApiClient client, Models.ChannelsECAftersaleRejectExchangeReshipRequest 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", "aftersale", "rejectexchangereship")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECAftersaleRejectExchangeReshipResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/aftersale/merchantupdateaftersale 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/aftersale/merchantupdateaftersale.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECAftersaleMerchantUpdateAftersaleResponse> ExecuteChannelsECAftersaleMerchantUpdateAftersaleAsync(this WechatApiClient client, Models.ChannelsECAftersaleMerchantUpdateAftersaleRequest 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", "aftersale", "merchantupdateaftersale")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECAftersaleMerchantUpdateAftersaleResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary> /// <summary>
/// <para>异步调用 [POST] /channels/ec/aftersale/uploadrefundcertificate 接口。</para> /// <para>异步调用 [POST] /channels/ec/aftersale/uploadrefundcertificate 接口。</para>
/// <para> /// <para>

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/aftersale/acceptexchangereship 接口的请求。</para>
/// </summary>
public class ChannelsECAftersaleAcceptExchangeReshipRequest : WechatApiRequest, IInferable<ChannelsECAftersaleAcceptExchangeReshipRequest, ChannelsECAftersaleAcceptExchangeReshipResponse>
{
/// <summary>
/// 获取或设置售后单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order_id")]
public string AftersaleOrderId { 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>
/// 获取或设置快递单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("waybill_id")]
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
public string WaybillId { get; set; } = string.Empty;
}
}

View File

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

View File

@ -217,6 +217,95 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[System.Text.Json.Serialization.JsonPropertyName("message")] [System.Text.Json.Serialization.JsonPropertyName("message")]
public string? ErrorMessage { get; set; } public string? ErrorMessage { get; set; }
} }
public class ExchangeProductInfo
{
/// <summary>
/// 获取或设置商品 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置旧 SKU ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("old_sku_id")]
[System.Text.Json.Serialization.JsonPropertyName("old_sku_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long OldSKUId { get; set; }
/// <summary>
/// 获取或设置新 SKU ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("new_sku_id")]
[System.Text.Json.Serialization.JsonPropertyName("new_sku_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long NewSKUId { get; set; }
/// <summary>
/// 获取或设置商品数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_count")]
[System.Text.Json.Serialization.JsonPropertyName("product_count")]
public int Count { get; set; }
}
public class ExchangeDeliveryInfo
{
public static class Types
{
public class Address : ChannelsECOrderGetResponse.Types.Order.Types.OrderDetail.Types.Delivery.Types.Address
{
}
}
/// <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!;
/// <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("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public Types.Address? Address { get; set; }
}
public class VirualTeleNumberInfo
{
/// <summary>
/// 获取或设置虚拟号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("virtual_tel_number")]
[System.Text.Json.Serialization.JsonPropertyName("virtual_tel_number")]
public string? VirtualTeleNumber { get; set; }
/// <summary>
/// 获取或设置主动兑换的虚拟号码过期时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("virtual_tel_expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("virtual_tel_expire_time")]
public long? VirtualTeleNumberExpireTimestamp { get; set; }
}
} }
/// <summary> /// <summary>
@ -319,6 +408,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[System.Text.Json.Serialization.JsonPropertyName("deadline")] [System.Text.Json.Serialization.JsonPropertyName("deadline")]
public int Deadline { get; set; } public int Deadline { get; set; }
/// <summary>
/// 获取或设置换货相关商品信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("exchange_product_info")]
[System.Text.Json.Serialization.JsonPropertyName("exchange_product_info")]
public Types.ExchangeProductInfo? ExchangeProductInfo { get; set; }
/// <summary>
/// 获取或设置换货相关物流信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("exchange_delivery_info")]
[System.Text.Json.Serialization.JsonPropertyName("exchange_delivery_info")]
public Types.ExchangeDeliveryInfo? ExchangeDeliveryInfo { get; set; }
/// <summary>
/// 获取或设置虚拟号码信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("virtual_tel_num_info")]
[System.Text.Json.Serialization.JsonPropertyName("virtual_tel_num_info")]
public Types.VirualTeleNumberInfo? VirualTeleNumberInfo { get; set; }
/// <summary> /// <summary>
/// 获取或设置更新时间戳。 /// 获取或设置更新时间戳。
/// </summary> /// </summary>

View File

@ -0,0 +1,59 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/aftersale/merchantupdateaftersale 接口的请求。</para>
/// </summary>
public class ChannelsECAftersaleMerchantUpdateAftersaleRequest : WechatApiRequest, IInferable<ChannelsECAftersaleMerchantUpdateAftersaleRequest, ChannelsECAftersaleMerchantUpdateAftersaleResponse>
{
/// <summary>
/// 获取或设置售后单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order_id")]
public string AftersaleOrderId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置售后类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public int Type { get; set; }
/// <summary>
/// 获取或设置金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置协商原因类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_reason_type")]
[System.Text.Json.Serialization.JsonPropertyName("update_reason_type")]
public int UpdateReasonType { get; set; }
/// <summary>
/// 获取或设置协商类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("merchant_update_type")]
[System.Text.Json.Serialization.JsonPropertyName("merchant_update_type")]
public int MerchantUpdateType { get; set; }
/// <summary>
/// 获取或设置协商描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("merchant_update_desc")]
[System.Text.Json.Serialization.JsonPropertyName("merchant_update_desc")]
public string MerchantUpdateDescription { get; set; } = string.Empty;
/// <summary>
/// 获取或设置协商凭证 MediaId。
/// </summary>
[Newtonsoft.Json.JsonProperty("media_ids")]
[System.Text.Json.Serialization.JsonPropertyName("media_ids")]
public IList<string>? CertificateMediaIdList { get; set; }
}
}

View File

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

View File

@ -0,0 +1,38 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/aftersale/rejectexchangereship 接口的请求。</para>
/// </summary>
public class ChannelsECAftersaleRejectExchangeReshipRequest : WechatApiRequest, IInferable<ChannelsECAftersaleRejectExchangeReshipRequest, ChannelsECAftersaleRejectExchangeReshipResponse>
{
/// <summary>
/// 获取或设置售后单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order_id")]
public string AftersaleOrderId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置拒绝原因类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("reject_reason_type")]
[System.Text.Json.Serialization.JsonPropertyName("reject_reason_type")]
public int RejectReasonType { get; set; }
/// <summary>
/// 获取或设置拒绝原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("reject_reason")]
[System.Text.Json.Serialization.JsonPropertyName("reject_reason")]
public string? RejectReason { get; set; }
/// <summary>
/// 获取或设置退款凭证 MediaId。
/// </summary>
[Newtonsoft.Json.JsonProperty("reject_certificates")]
[System.Text.Json.Serialization.JsonPropertyName("reject_certificates")]
public IList<string>? RejectCertificateMediaIdList { get; set; }
}
}

View File

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

View File

@ -0,0 +1,5 @@
{
"after_sale_order_id": "1768034782998651",
"waybill_id": "123",
"delivery_id": "YD"
}

View File

@ -0,0 +1,12 @@
{
"after_sale_order_id": "1768034782998651",
"type": 1,
"amount": 100,
"merchant_update_desc": "xxx",
"update_reason_type": "123",
"merchant_update_type": 6,
"media_ids": [
"id1",
"id2"
]
}

View File

@ -0,0 +1,5 @@
{
"after_sale_order_id": "1768715750567651",
"reject_reason": "123",
"reject_reason_type": 1
}