feat(wxapi): 新增标准版交易组件售后相关接口

This commit is contained in:
Fu Diwei 2021-10-07 16:49:17 +08:00
parent e64973dfe6
commit 9b4e6c12c1
21 changed files with 668 additions and 0 deletions

View File

@ -1236,6 +1236,88 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.ProductOrderChangeMerchantNotesResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#region Aftersale
/// <summary>
/// <para>异步调用 [POST] /product/order/batchgetaftersaleorder 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/batchgetaftersaleorder.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ProductOrderBatchGetAftersaleOrderResponse> ExecuteProductOrderBatchGetAftersaleOrderAsync(this WechatApiClient client, Models.ProductOrderBatchGetAftersaleOrderRequest 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", "batchgetaftersaleorder")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ProductOrderBatchGetAftersaleOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /product/order/getaftersaleorder 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/getaftersaleorder.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ProductOrderGetAftersaleOrderResponse> ExecuteProductOrderGetAftersaleOrderAsync(this WechatApiClient client, Models.ProductOrderGetAftersaleOrderRequest 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", "getaftersaleorder")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ProductOrderGetAftersaleOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /product/order/acceptapply 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/acceptapply.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ProductOrderAcceptApplyResponse> ExecuteProductOrderAcceptApplyAsync(this WechatApiClient client, Models.ProductOrderAcceptApplyRequest 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", "acceptapply")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ProductOrderAcceptApplyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /product/order/rejectrefund 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/rejectrefund.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ProductOrderRejectRefundResponse> ExecuteProductOrderRejectRefundAsync(this WechatApiClient client, Models.ProductOrderRejectRefundRequest 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", "rejectrefund")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ProductOrderRejectRefundResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#endregion
#region Coupon

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/acceptapply 接口的请求。</para>
/// </summary>
public class ProductOrderAcceptApplyRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置售后单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public long AftersaleOrderId { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/acceptapply 接口的响应。</para>
/// </summary>
public class ProductOrderAcceptApplyResponse : WechatApiResponse
{
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/batchgetaftersaleorder 接口的请求。</para>
/// </summary>
public class ProductOrderBatchGetAftersaleOrderRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置售后单号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order_id_list")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order_id_list")]
public IList<long> AftersaleOrderIdList { get; set; } = new List<long>();
}
}

View File

@ -0,0 +1,262 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/batchgetaftersaleorder 接口的响应。</para>
/// </summary>
public class ProductOrderBatchGetAftersaleOrderResponse : WechatApiResponse
{
public static class Types
{
public class Aftersale
{
public static class Types
{
public class Product
{
/// <summary>
/// 获取或设置商品 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置 SKU ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("sku_id")]
[System.Text.Json.Serialization.JsonPropertyName("sku_id")]
public long SKUId { get; set; }
/// <summary>
/// 获取或设置商品数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("count")]
[System.Text.Json.Serialization.JsonPropertyName("count")]
public int Count { get; set; }
}
public class Refund
{
/// <summary>
/// 获取或设置退款金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
}
public class RefundResponse
{
/// <summary>
/// 获取或设置返回码。
/// </summary>
[Newtonsoft.Json.JsonProperty("ret")]
[System.Text.Json.Serialization.JsonPropertyName("ret")]
public int ReturnCode { get; set; }
/// <summary>
/// 获取或设置错误码。
/// </summary>
[Newtonsoft.Json.JsonProperty("code")]
[System.Text.Json.Serialization.JsonPropertyName("code")]
public string? ErrorCode { get; set; }
/// <summary>
/// 获取或设置错误描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("message")]
[System.Text.Json.Serialization.JsonPropertyName("message")]
public string? ErrorMessage { get; set; }
}
public class Return
{
/// <summary>
/// 获取或设置退货快递单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("waybill_id")]
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
public string WaybillId { get; set; } = default!;
/// <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!;
}
public class Detail
{
/// <summary>
/// 获取或设置描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("desc")]
[System.Text.Json.Serialization.JsonPropertyName("desc")]
public string Description { get; set; } = default!;
/// <summary>
/// 获取或设置退款的数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("num")]
[System.Text.Json.Serialization.JsonPropertyName("num")]
public int Count { get; set; }
/// <summary>
/// 获取或设置取消时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("cancel_time")]
[System.Text.Json.Serialization.JsonPropertyName("cancel_time")]
public long? CancelTimestamp { get; set; }
/// <summary>
/// 获取或设置用户电话号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("tel_number")]
[System.Text.Json.Serialization.JsonPropertyName("tel_number")]
public string? PhoneNumber { get; set; }
/// <summary>
/// 获取或设置退款凭证图片 URL 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("prove_imgs")]
[System.Text.Json.Serialization.JsonPropertyName("prove_imgs")]
public string[]? ProofImageUrlList { get; set; }
}
public class MerchantUploadInformation
{
/// <summary>
/// 获取或设置退款凭证图片 URL 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("refund_certificates")]
[System.Text.Json.Serialization.JsonPropertyName("refund_certificates")]
public string[]? RefundCertificateUrlList { get; set; }
/// <summary>
/// 获取或设置拒绝原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("reject_reason")]
[System.Text.Json.Serialization.JsonPropertyName("reject_reason")]
public string? RejectReason { get; set; }
}
}
/// <summary>
/// 获取或设置售后单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public long AftersaleOrderId { get; set; }
/// <summary>
/// 获取或设置售后单对应的订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("original_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("original_order_id")]
public long OriginalOrderId { get; set; }
/// <summary>
/// 获取或设置售后单状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("status")]
[System.Text.Json.Serialization.JsonPropertyName("status")]
public string Status { get; set; } = default!;
/// <summary>
/// 获取或设置用户 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置退款原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("reason")]
[System.Text.Json.Serialization.JsonPropertyName("reason")]
public string Reason { get; set; } = default!;
/// <summary>
/// 获取或设置退款方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = default!;
/// <summary>
/// 获取或设置商品信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_info")]
[System.Text.Json.Serialization.JsonPropertyName("product_info")]
public Types.Product Product { get; set; } = default!;
/// <summary>
/// 获取或设置售后详细信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("details")]
[System.Text.Json.Serialization.JsonPropertyName("details")]
public Types.Detail Detail { get; set; } = default!;
/// <summary>
/// 获取或设置退款信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("refund_info")]
[System.Text.Json.Serialization.JsonPropertyName("refund_info")]
public Types.Refund? Refund { get; set; }
/// <summary>
/// 获取或设置退款响应信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("refund_resp")]
[System.Text.Json.Serialization.JsonPropertyName("refund_resp")]
public Types.RefundResponse? RefundResponse { get; set; }
/// <summary>
/// 获取或设置退货信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("return_info")]
[System.Text.Json.Serialization.JsonPropertyName("return_info")]
public Types.Return? Return { get; set; }
/// <summary>
/// 获取或设置商家上传信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("merchant_upload_info")]
[System.Text.Json.Serialization.JsonPropertyName("merchant_upload_info")]
public Types.MerchantUploadInformation? MerchantUploadInformation { get; set; }
/// <summary>
/// 获取或设置更新时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
public long UpdateTimestamp { get; set; }
/// <summary>
/// 获取或设置创建时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
public long CreateTimestamp { get; set; }
}
}
/// <summary>
/// 获取或设置售后单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order_list")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order_list")]
public Types.Aftersale[] AftersaleOrderList { get; set; } = default!;
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/getaftersaleorder 接口的请求。</para>
/// </summary>
public class ProductOrderGetAftersaleOrderRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置售后单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order_id")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order_id")]
public long AftersaleOrderId { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/getaftersaleorder 接口的响应。</para>
/// </summary>
public class ProductOrderGetAftersaleOrderResponse : WechatApiResponse
{
public static class Types
{
public class Aftersale : ProductOrderBatchGetAftersaleOrderResponse.Types.Aftersale
{
}
}
/// <summary>
/// 获取或设置售后单信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("after_sale_order")]
[System.Text.Json.Serialization.JsonPropertyName("after_sale_order")]
public Types.Aftersale AftersaleOrder { get; set; } = default!;
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/rejectrefund 接口的请求。</para>
/// </summary>
public class ProductOrderRejectRefundRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置售后单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public long AftersaleOrderId { get; set; }
/// <summary>
/// 获取或设置拒绝原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("reject_reason")]
[System.Text.Json.Serialization.JsonPropertyName("reject_reason")]
public string RejectReason { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/rejectrefund 接口的响应。</para>
/// </summary>
public class ProductOrderRejectRefundResponse : WechatApiResponse
{
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/upload_refund_certificate 接口的请求。</para>
/// </summary>
public class ProductOrderUploadRefundCertificateRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置售后单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public long AftersaleOrderId { get; set; }
/// <summary>
/// 获取或设置退款凭证图片 MediaId 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("refund_certificates")]
[System.Text.Json.Serialization.JsonPropertyName("refund_certificates")]
public IList<string>? RefundCertificateMediaIdList { get; set; } = new List<string>();
/// <summary>
/// 获取或设置描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("desc")]
[System.Text.Json.Serialization.JsonPropertyName("desc")]
public string? Description { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/order/upload_refund_certificate 接口的响应。</para>
/// </summary>
public class ProductOrderUploadRefundCertificateResponse : WechatApiResponse
{
}
}

View File

@ -0,0 +1,3 @@
{
"after_sale_order_id_list": [ 7011, 1030 ]
}

View File

@ -0,0 +1,83 @@
{
"errmsg": "",
"after_sale_order_list": [
{
"order_id": 1030,
"status": "MERCHANT_REFUND_SUCCESS",
"openid": "oTVP50Ks6gr9NU2hvc1YF22naK0Y",
"original_order_id": 1342466,
"product_info": {
"product_id": 3286,
"sku_id": 4740,
"count": 1
},
"details": {
"num": 1,
"desc": "",
"cancel_time": 0,
"prove_imgs": [],
"tel_number": ""
},
"refund_info": {
"amount": 11
},
"return_info": {
"waybill_id": "",
"delivery_id": "",
"delivery_name": ""
},
"merchant_upload_info": {
"reject_reason": "",
"refund_certificates": []
},
"create_time": 1591183059,
"update_time": 1612754443,
"reason": "NO_LONGER_WANT",
"refund_resp": {
"code": "",
"ret": 0,
"message": ""
},
"type": "REFUND"
},
{
"order_id": 7011,
"status": "MERCHANT_REFUND_SUCCESS",
"openid": "oTVP50Ks6gr9NU2hvc1YF22naK0Y",
"original_order_id": 1768683047558651,
"product_info": {
"product_id": 3286,
"sku_id": 4740,
"count": 1
},
"details": {
"num": 1,
"desc": "1234",
"cancel_time": 0,
"prove_imgs": [],
"tel_number": ""
},
"refund_info": {
"amount": 11
},
"return_info": {
"waybill_id": "",
"delivery_id": "",
"delivery_name": ""
},
"merchant_upload_info": {
"reject_reason": "",
"refund_certificates": []
},
"create_time": 1591319454,
"update_time": 1612754444,
"reason": "NO_LONGER_WANT",
"refund_resp": {
"code": "",
"ret": 0,
"message": ""
},
"type": "REFUND"
}
]
}

View File

@ -0,0 +1,42 @@
{
"errcode": 0,
"after_sale_order": {
"order_id": 7011,
"status": "MERCHANT_REFUND_SUCCESS",
"openid": "oTVP50Ks6gr9NU2hvc1YF22naK0Y",
"original_order_id": 1768683047558651,
"product_info": {
"product_id": 3286,
"sku_id": 4740,
"count": 1
},
"details": {
"num": 1,
"desc": "1234",
"cancel_time": 0,
"prove_imgs": [],
"tel_number": ""
},
"refund_info": {
"amount": 11
},
"return_info": {
"waybill_id": "",
"delivery_id": "",
"delivery_name": ""
},
"merchant_upload_info": {
"reject_reason": "",
"refund_certificates": []
},
"create_time": 1591319454,
"update_time": 1612754444,
"reason": "NO_LONGER_WANT",
"refund_resp": {
"code": "",
"ret": 0,
"message": ""
},
"type": "REFUND"
}
}

View File

@ -0,0 +1,4 @@
{
"order_id": 1768715750567651,
"reject_reason": "123"
}

View File

@ -0,0 +1,5 @@
{
"order_id": 1768715750567651,
"refund_certificates": [ "media_id1", "media_id2" ],
"desc": ""
}