diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/DefaultWeChatPayApiRequester.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/DefaultWeChatPayApiRequester.cs index 7a6d26e..1c41913 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/DefaultWeChatPayApiRequester.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/DefaultWeChatPayApiRequester.cs @@ -1,7 +1,5 @@ -using System.Linq; using System.Net.Http; using System.Net.Http.Headers; -using System.Reflection; using System.Text; using System.Threading.Tasks; using EasyAbp.Abp.WeChat.Common.Extensions; @@ -37,6 +35,22 @@ public DefaultWeChatPayApiRequester(IAbpWeChatPayHttpClientFactory httpClientFac } public async Task RequestAsync(HttpMethod method, string url, string body, string mchId = null) + { + var response = await RequestRawAsync(method, url, body, mchId); + await ValidateResponseAsync(response); + + return await response.Content.ReadAsStringAsync(); + } + + public async Task RequestAsync(HttpMethod method, string url, string body, + string mchId = null) + { + var responseString = await RequestAsync(method, url, body, mchId); + + return JsonConvert.DeserializeObject(responseString); + } + + public async Task RequestRawAsync(HttpMethod method, string url, string body = null, string mchId = null) { var request = CreateRequest(method, url, body); @@ -51,19 +65,7 @@ public async Task RequestAsync(HttpMethod method, string url, string bod // Sending the request. var client = await _httpClientFactory.CreateAsync(mchId); - var response = await client.SendAsync(request); - - await ValidateResponseAsync(response); - - return await response.Content.ReadAsStringAsync(); - } - - public async Task RequestAsync(HttpMethod method, string url, string body, - string mchId = null) - { - var responseString = await RequestAsync(method, url, body, mchId); - - return JsonConvert.DeserializeObject(responseString); + return await client.SendAsync(request); } public Task RequestAsync(HttpMethod method, string url, object body, string mchId = null) diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/IWeChatPayApiRequester.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/IWeChatPayApiRequester.cs index 940aa42..f02755a 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/IWeChatPayApiRequester.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/ApiRequests/IWeChatPayApiRequester.cs @@ -12,6 +12,8 @@ public interface IWeChatPayApiRequester Task RequestAsync(HttpMethod method, string url, [CanBeNull] string body = null, [CanBeNull] string mchId = null); Task RequestAsync(HttpMethod method, string url, [CanBeNull] string body = null, [CanBeNull] string mchId = null); + + Task RequestRawAsync(HttpMethod method, string url, [CanBeNull] string body = null, [CanBeNull] string mchId = null); Task RequestAsync(HttpMethod method, string url, [NotNull] object body, [CanBeNull] string mchId = null); diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/CouponTypeEnum.cs similarity index 65% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/CouponTypeEnum.cs index 0dac064..ce21a8f 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/CouponTypeEnum.cs @@ -1,9 +1,9 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; /// -/// 优惠类型的枚举值定义。 +/// 代金券的枚举值定义。 /// -public static class PromotionTypeEnum +public static class CouponTypeEnum { /// /// 充值型代金券。 diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/FundAccountTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/FundAccountTypeEnum.cs new file mode 100644 index 0000000..c2e27f4 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/FundAccountTypeEnum.cs @@ -0,0 +1,22 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; + +/// +/// 资金账户类型枚举。 +/// +public static class FundAccountTypeEnum +{ + /// + /// 基本账户。 + /// + public const string Basic = "BASIC"; + + /// + /// 运营账户。 + /// + public const string Operation = "OPERATION"; + + /// + /// 手续费账户。 + /// + public const string Fees = "FEES"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionScopeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionScopeEnum.cs similarity index 83% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionScopeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionScopeEnum.cs index b469f9c..df28386 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionScopeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionScopeEnum.cs @@ -1,4 +1,4 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; /// /// 优惠范围的枚举值定义。 diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionTypeEnum.cs new file mode 100644 index 0000000..abead99 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionTypeEnum.cs @@ -0,0 +1,17 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; + +/// +/// 优惠类型的枚举值定义。 +/// +public static class PromotionTypeEnum +{ + /// + /// 代金券,需要走结算资金的充值型代金券。 + /// + public const string Coupon = "COUPON"; + + /// + /// 优惠券,不走结算资金的免充值型优惠券。 + /// + public const string Discount = "DISCOUNT"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundChannelEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundChannelEnum.cs new file mode 100644 index 0000000..a77def2 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundChannelEnum.cs @@ -0,0 +1,27 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; + +/// +/// 退款渠道枚举。 +/// +public static class RefundChannelEnum +{ + /// + /// 原路退款。 + /// + public const string Original = "ORIGINAL"; + + /// + /// 退回到余额。 + /// + public const string Balance = "BALANCE"; + + /// + /// 原账户异常退到其他余额账户。 + /// + public const string OtherBalance = "OTHER_BALANCE"; + + /// + /// 原银行卡异常退到其他银行卡。 + /// + public const string OtherBankCard = "OTHER_BANKCARD"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundFundsAccountEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundFundsAccountEnum.cs new file mode 100644 index 0000000..9034597 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundFundsAccountEnum.cs @@ -0,0 +1,32 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; + +/// +/// 退款资金来源枚举。 +/// +public static class RefundFundsAccountEnum +{ + /// + /// 可用余额账户。 + /// + public const string Available = "AVAILABLE"; + + /// + /// 不可用余额账户。 + /// + public const string Unavailable = "UNAVAILABLE"; + + /// + /// 未结算资金账户。 + /// + public const string Unsettled = "UNSETTLED"; + + /// + /// 运营账户。 + /// + public const string Operation = "OPERATION"; + + /// + /// 基本账户。 + /// + public const string Basic= "BASIC"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundStatusEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundStatusEnum.cs new file mode 100644 index 0000000..e77920e --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundStatusEnum.cs @@ -0,0 +1,27 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; + +/// +/// 退款状态枚举。 +/// +public static class RefundStatusEnum +{ + /// + /// 退款成功。 + /// + public const string Success = "SUCCESS"; + + /// + /// 退款关闭。 + /// + public const string Closed = "CLOSED"; + + /// + /// 退款处理中。 + /// + public const string Processing = "PROCESSING"; + + /// + /// 退款异常。 + /// + public const string Abnormal = "ABNORMAL"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TradeStateEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TradeStateEnum.cs similarity index 93% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TradeStateEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TradeStateEnum.cs index e7a1d51..e226dfb 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TradeStateEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TradeStateEnum.cs @@ -1,4 +1,4 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; /// /// 交易状态的枚举值定义。 diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TradeTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TradeTypeEnum.cs similarity index 92% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TradeTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TradeTypeEnum.cs index 353246c..6550c35 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TradeTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TradeTypeEnum.cs @@ -1,4 +1,4 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; /// /// 交易类型的枚举值定义。 diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TransactionBillTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TransactionBillTypeEnum.cs new file mode 100644 index 0000000..844353e --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TransactionBillTypeEnum.cs @@ -0,0 +1,22 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; + +/// +/// 账单类型枚举。 +/// +public static class TransactionBillTypeEnum +{ + /// + /// 回当日所有订单信息 (不含充值退款订单)。 + /// + public const string All = "ALL"; + + /// + /// 返回当日成功支付的订单 (不含充值退款订单)。 + /// + public const string Success = "SUCCESS"; + + /// + /// 返回当日退款订单 (不含充值退款订单)。 + /// + public const string Refund = "REFUND"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs index c37b334..0e5cba5 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs @@ -1,8 +1,10 @@ -using System.Net.Http; +using System.IO; +using System.Net.Http; using System.Threading.Tasks; using EasyAbp.Abp.WeChat.Pay.Options; using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models; using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; +using EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; using Volo.Abp.DependencyInjection; using CreateOrderRequest = EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models.CreateOrderRequest; @@ -11,12 +13,13 @@ namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment; public class JsPaymentService : WeChatPayServiceBase { public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi"; - - public const string QueryOrderByWechatNumberUrl = - "https://api.mch.weixin.qq.com/v3/pay/transactions/{transaction_id}"; - - public const string QueryOrderByOutTradeNumberUrl = - "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}"; + public const string QueryOrderByWechatNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/{transaction_id}"; + public const string QueryOrderByOutTradeNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}"; + public const string CloseOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}/close"; + public const string RefundUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds"; + public const string QueryRefundOrderUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds/{out_refund_no}"; + public const string GetTransactionBillUrl = "https://api.mch.weixin.qq.com/v3/bill/tradebill"; + public const string GetFundFlowBillUrl = "https://api.mch.weixin.qq.com/v3/bill/fundflowbill"; public JsPaymentService(AbpWeChatPayOptions options, IAbpLazyServiceProvider lazyServiceProvider) : base(options, @@ -40,4 +43,36 @@ public Task QueryOrderByOutTradeNumberAsync(QueryOrderByOutT var requestUrl = QueryOrderByOutTradeNumberUrl.Replace("{out_trade_no}", request.OutTradeNo); return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl, request); } + + public Task CloseOrderAsync(CloseOrderRequest request) + { + var requestUrl = CloseOrderUrl.Replace("{out_trade_no}", request.OutTradeNo); + return ApiRequester.RequestAsync(HttpMethod.Post, requestUrl, request); + } + + public Task RefundAsync(RefundOrderRequest orderRequest) + { + return ApiRequester.RequestAsync(HttpMethod.Post, RefundUrl, orderRequest); + } + + public Task QueryRefundOrderAsync(QueryRefundOrderRequest request) + { + var requestUrl = QueryRefundOrderUrl.Replace("{out_refund_no}", request.OutRefundNo); + return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl); + } + + public Task GetTransactionBillAsync(GetTransactionBillRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Get, GetTransactionBillUrl, request); + } + + public Task GetFundFlowBillAsync(GetFundFlowBillRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Get, GetFundFlowBillUrl, request); + } + + public async Task DownloadBillFileAsync(string billDownloadUrl) + { + return await (await ApiRequester.RequestRawAsync(HttpMethod.Get, billDownloadUrl)).Content.ReadAsStreamAsync(); + } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/CloseOrderRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/CloseOrderRequest.cs new file mode 100644 index 0000000..b3fc7bd --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/CloseOrderRequest.cs @@ -0,0 +1,35 @@ +using System.ComponentModel.DataAnnotations; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class CloseOrderRequest +{ + /// + /// 直连商户号。 + /// + /// + /// 直连商户的商户号,由微信支付生成并下发。 + /// + /// + /// 示例值: 1230000109 + /// + [Required] + [StringLength(32, MinimumLength = 1)] + [JsonProperty("mchid")] + public string MchId { get; set; } + + /// + /// 商户订单号。 + /// + /// + /// 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [Required] + [StringLength(32,MinimumLength = 6)] + [JsonProperty("out_trade_no")] + public string OutTradeNo { get; set; } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetBillResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetBillResponse.cs new file mode 100644 index 0000000..d4d6ab1 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetBillResponse.cs @@ -0,0 +1,51 @@ +using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class GetBillResponse : WeChatPayCommonErrorResponse +{ + /// + /// 哈希类型。 + /// + /// + /// 枚举值:
+ /// SHA1: SHA1 值 + ///
+ /// + /// 示例值: SHA1 + /// + [Required] + [StringLength(32, MinimumLength = 1)] + [JsonProperty("hash_type")] + public string HashType { get; set; } + + /// + /// 哈希值。 + /// + /// + /// 原始账单 (gzip 需要解压缩) 的摘要值,用于校验文件的完整性。 + /// + /// + /// 示例值: 79bb0f45fc4c42234a918000b2668d689e2bde04 + /// + [Required] + [StringLength(1024, MinimumLength = 1)] + [JsonProperty("hash_value")] + public string HashValue { get; set; } + + /// + /// 账单下载地址。 + /// + /// + /// 供下一步请求账单文件的下载地址,该地址 30s 内有效。 + /// + /// + /// 示例值: https://api.mch.weixin.qq.com/v3/billdownload/file?token=xxx + /// + [Required] + [StringLength(2048, MinimumLength = 1)] + [JsonProperty("download_url")] + public string DownloadUrl { get; set; } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs new file mode 100644 index 0000000..aa5cc0e --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs @@ -0,0 +1,50 @@ +using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class GetFundFlowBillRequest +{ + /// + /// 账单日期。 + /// + /// + /// 格式 yyyy-MM-dd。
+ /// 仅支持三个月内的账单下载申请。 + ///
+ /// + /// 示例值: 2019-06-11 + /// + [Required] + [StringLength(10, MinimumLength = 1)] + [JsonProperty("bill_date")] + public string BillDate { get; set; } + + /// + /// 资金账户类型。 + /// + /// + /// 枚举值,具体定义参考类型 ,不填则默认是 BASIC。 + /// + /// + /// 示例值: Basic () + /// + [StringLength(32, MinimumLength = 1)] + [JsonProperty("account_type")] + public string AccountType { get; set; } + + /// + /// 压缩类型。 + /// + /// + /// 不填则默认是数据流。
+ /// GZIP: 返回格式为.gzip的压缩包账单。 + ///
+ /// + /// 示例值: GZIP + /// + [StringLength(32, MinimumLength = 1)] + [JsonProperty("tar_type")] + public string TarType { get; set; } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs new file mode 100644 index 0000000..06cab99 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs @@ -0,0 +1,50 @@ +using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class GetTransactionBillRequest +{ + /// + /// 账单日期。 + /// + /// + /// 格式 yyyy-MM-dd。
+ /// 仅支持三个月内的账单下载申请。 + ///
+ /// + /// 示例值: 2019-06-11 + /// + [Required] + [StringLength(10, MinimumLength = 1)] + [JsonProperty("bill_date")] + public string BillDate { get; set; } + + /// + /// 账单类型。 + /// + /// + /// 枚举值,具体定义参考类型 ,不填则默认是 ALL。 + /// + /// + /// 示例值: ALL () + /// + [StringLength(32, MinimumLength = 1)] + [JsonProperty("bill_type")] + public string BillType { get; set; } + + /// + /// 压缩类型。 + /// + /// + /// 不填则默认是数据流。
+ /// GZIP: 返回格式为.gzip的压缩包账单。 + ///
+ /// + /// 示例值: GZIP + /// + [StringLength(32, MinimumLength = 1)] + [JsonProperty("tar_type")] + public string TarType { get; set; } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryOrderResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryOrderResponse.cs index ef64071..12e8388 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryOrderResponse.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryOrderResponse.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; using EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; using Newtonsoft.Json; @@ -308,10 +309,10 @@ public class QueryOrderPromotionDetailModel /// 优惠类型。 ///
/// - /// 枚举值,取值范围请参考 。 + /// 枚举值,取值范围请参考 。 /// /// - /// 示例值: CASH。() + /// 示例值: CASH。() /// [StringLength(32)] [JsonProperty("type")] diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryRefundOrderRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryRefundOrderRequest.cs new file mode 100644 index 0000000..f762290 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryRefundOrderRequest.cs @@ -0,0 +1,21 @@ +using System.ComponentModel.DataAnnotations; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class QueryRefundOrderRequest +{ + /// + /// 商户退款单号。 + /// + /// + /// 商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [Required] + [StringLength(64, MinimumLength = 1)] + [JsonProperty("out_refund_no")] + public string OutRefundNo { get; set; } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs new file mode 100644 index 0000000..bae4652 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs @@ -0,0 +1,280 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class RefundOrderRequest +{ + /// + /// 微信支付订单号。 + /// + /// + /// 原支付交易对应的微信订单号。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("transaction_id")] + [StringLength(32, MinimumLength = 1)] + public string TransactionId { get; set; } + + /// + /// 商户订单号。 + /// + /// + /// 原支付交易对应的商户订单号。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("out_trade_no")] + [StringLength(32, MinimumLength = 6)] + public string OutTradeNo { get; set; } + + /// + /// 商户退款单号。 + /// + /// + /// 商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("out_refund_no")] + [Required] + [StringLength(64, MinimumLength = 1)] + public string OutRefundNo { get; set; } + + /// + /// 退款原因。 + /// + /// + /// 若商户传入,会在下发给用户的退款消息中体现退款原因。 + /// + /// + /// 示例值: 商品已售完 + /// + [JsonProperty("reason")] + [StringLength(80)] + public string Reason { get; set; } + + /// + /// 退款结果回调 URL。 + /// + /// + /// 异步接收微信支付退款结果通知的回调地址,通知url必须为外网可访问的url,不能携带参数。
+ /// 如果参数中传了 notify_url,则商户平台上配置的回调地址将不会生效,优先回调当前传的这个地址。 + ///
+ /// + /// 示例值: https://weixin.qq.com + /// + [JsonProperty("notify_url")] + [StringLength(256, MinimumLength = 8)] + public string NotifyUrl { get; set; } + + /// + /// 退款资金来源。 + /// + /// + /// 若传递此参数则使用对应的资金账户退款,否则默认使用未结算资金退款 (仅对老资金流商户适用)。 + /// 仅支持取值为 。 + /// + /// + /// 示例值: AVAILABLE () + /// + [JsonProperty("funds_account")] + [StringLength(32)] + public string FundsAccount { get; set; } + + /// + /// 金额信息。 + /// + /// + /// 订单金额信息。 + /// + [JsonProperty("amount")] + [Required] + public AmountInfo Amount { get; set; } + + /// + /// 退款商品。 + /// + /// + /// 指定商品退款需要传此参数,其他场景无需传递。 + /// + [JsonProperty("goods_detail")] + public List GoodsDetails { get; set; } + + public class AmountInfo + { + /// + /// 退款金额。 + /// + /// + /// 退款金额,单位为分,只能为整数,不能超过原订单支付金额。 + /// + /// + /// 示例值: 888 + /// + [JsonProperty("refund")] + [Required] + public int Refund { get; set; } + + /// + /// 退款出资账户及金额。 + /// + /// + /// 退款需要从指定账户出资时,传递此参数指定出资金额(币种的最小单位,只能为整数)。
+ /// 同时指定多个账户出资退款的使用场景需要满足以下条件:
+ /// 1. 未开通退款支出分离产品功能;
+ /// 2. 订单属于分账订单,且分账处于待分账或分账中状态。
+ /// 参数传递需要满足条件:
+ /// 1. 基本账户可用余额出资金额与基本账户不可用余额出资金额之和等于退款金额;
+ /// 2. 账户类型不能重复。
+ /// 上述任一条件不满足将返回错误。 + ///
+ [JsonProperty("from")] + public List RefundSources { get; set; } + + /// + /// 原始订单金额。 + /// + /// + /// 原支付交易的订单总金额,单位为分,只能为整数。 + /// + /// + /// 示例值: 888 + /// + [JsonProperty("total")] + [Required] + public int Total { get; set; } + + /// + /// 退款币种。 + /// + /// + /// 符合ISO 4217标准的三位字母代码,目前只支持人民币: CNY。 + /// + /// + /// 示例值: CNY + /// + [JsonProperty("currency")] + [Required] + [StringLength(16, MinimumLength = 1)] + public string Currency { get; set; } + + public class RefundSource + { + /// + /// 出资账户类型。 + /// + /// + /// 参考类型 的定义。 + /// + /// + /// 示例值: AVAILABLE () + /// + [JsonProperty("account")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string Account { get; set; } + + /// + /// 出资金额。 + /// + /// + /// 对应账户出资金额。 + /// + /// + /// 示例值: 444 + /// + [JsonProperty("amount")] + [Required] + public int Amount { get; set; } + } + } + + public class GoodsDetail + { + /// + /// 商户侧商品编码。 + /// + /// + /// 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("merchant_goods_id")] + [Required] + [StringLength(32)] + public string MerchantGoodsId { get; set; } + + /// + /// 微信支付商品编码。 + /// + /// + /// 微信支付定义的统一商品编号(没有可不传)。 + /// + /// + /// 示例值: 1001 + /// + [JsonProperty("wechatpay_goods_id")] + [StringLength(32)] + public string WechatPayGoodsId { get; set; } + + /// + /// 商品名称。 + /// + /// + /// 商品的实际名称。 + /// + /// + /// 示例值: iPhone6s 16G + /// + [JsonProperty("goods_name")] + [StringLength(256)] + public string GoodsName { get; set; } + + /// + /// 商品单价。 + /// + /// + /// 商品单价金额,单位为分。 + /// + /// + /// 示例值: 528800 + /// + [JsonProperty("unit_price")] + [Required] + public int UnitPrice { get; set; } + + /// + /// 商品退款金额。 + /// + /// + /// 商品退款金额,单位为分。 + /// + /// + /// 示例值: 528800 + /// + [JsonProperty("refund_amount")] + [Required] + public int RefundAmount { get; set; } + + /// + /// 商品退货数量。 + /// + /// + /// 单品的退款数量。 + /// + /// + /// 示例值: 1 + /// + [JsonProperty("refund_quantity")] + [Required] + public int RefundQuantity { get; set; } + } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs new file mode 100644 index 0000000..c552c73 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs @@ -0,0 +1,457 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; +using EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; +using Newtonsoft.Json; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; + +public class RefundOrderResponse : WeChatPayCommonErrorResponse +{ + /// + /// 微信支付退款单号。 + /// + /// + /// 微信支付退款单号。 + /// + /// + /// 示例值: 50000000382019052709732678859 + /// + [JsonProperty("refund_id")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string RefundId { get; set; } + + /// + /// 商户退款单号。 + /// + /// + /// 商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("out_refund_no")] + [Required] + [StringLength(64, MinimumLength = 1)] + public string OutRefundNo { get; set; } + + /// + /// 微信支付订单号。 + /// + /// + /// 微信支付交易订单号。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("transaction_id")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string TransactionId { get; set; } + + /// + /// 商户订单号。 + /// + /// + /// 原支付交易对应的商户订单号。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("out_trade_no")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string OutTradeNo { get; set; } + + /// + /// 退款渠道。 + /// + /// + /// 具体渠道请参考类型 的定义。 + /// + /// + /// 示例值: ORIGINAL () + /// + [JsonProperty("channel")] + [Required] + [StringLength(16, MinimumLength = 1)] + public string Channel { get; set; } + + /// + /// 退款入账账户。 + /// + /// + /// 取当前退款单的退款入账方,有以下几种情况:
+ /// 1. 退回银行卡: {银行名称}{卡类型}{卡尾号}
+ /// 2. 退回支付用户零钱: 支付用户零钱
+ /// 3. 退还商户: 商户基本账户商户结算银行账户
+ /// 4. 退回支付用户零钱通:支付用户零钱通 + ///
+ /// + /// 示例值: 招商银行信用卡0403 + /// + [JsonProperty("user_received_account")] + [Required] + [StringLength(64, MinimumLength = 1)] + public string UserReceivedAccount { get; set; } + + /// + /// 退款成功时间。 + /// + /// + /// 退款成功时间,当退款状态为退款成功时有返回。 + /// + /// + /// 示例值: 2020-12-01T16:18:12+08:00 + /// + [JsonProperty("success_time")] + [StringLength(64, MinimumLength = 1)] + public DateTime? SuccessTime { get; set; } + + /// + /// 退款创建时间。 + /// + /// + /// 退款受理时间。 + /// + /// 示例值: 2020-12-01T16:18:12+08:00 + [JsonProperty("create_time")] + [Required] + [StringLength(64, MinimumLength = 1)] + public DateTime? CreateTime { get; set; } + + /// + /// 退款状态。 + /// + /// + /// 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台-交易中心,手动处理此笔退款。
+ /// 具体状态值可以参考类型 的定义。 + ///
+ /// + /// 示例值: SUCCESS + /// + [JsonProperty("status")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string Status { get; set; } + + /// + /// 资金账户。 + /// + /// + /// 退款所使用资金对应的资金账户类型,请参考类型 的定义。 + /// + /// + /// 示例值: UNSETTLED () + /// + [JsonProperty("funds_account")] + [StringLength(32, MinimumLength = 1)] + public string FundsAccount { get; set; } + + /// + /// 金额信息。 + /// + /// + /// 金额详细信息。 + /// + [JsonProperty("amount")] + [Required] + public AmountInfo Amount { get; set; } + + /// + /// 优惠退款信息。 + /// + [JsonProperty("promotion_detail")] + public List PromotionDetail { get; set; } + + public class AmountInfo + { + /// + /// 订单金额。 + /// + /// + /// 订单总金额,单位为分。 + /// + /// + /// 示例值: 100 + /// + [JsonProperty("total")] + [Required] + public int Total { get; set; } + + /// + /// 退款金额。 + /// + /// + /// 退款标价金额,单位为分,可以做部分退款。 + /// + /// + /// 示例值: 100 + /// + [JsonProperty("refund")] + [Required] + public int Refund { get; set; } + + /// + /// 退款出资账户及金额。 + /// + /// + /// 退款出资的账户类型及金额信息。 + /// + [JsonProperty("from")] + public List From { get; set; } + + /// + /// 用户支付金额。 + /// + /// + /// 现金支付金额,单位为分,只能为整数。 + /// + /// + /// 示例值: 90 + /// + [JsonProperty("payer_total")] + [Required] + public int PayerTotal { get; set; } + + /// + /// 用户退款金额。 + /// + /// + /// 退款给用户的金额,不包含所有优惠券金额。 + /// + /// + /// 示例值: 90 + /// + [JsonProperty("payer_refund")] + [Required] + public int PayerRefund { get; set; } + + /// + /// 应结退款金额。 + /// + /// + /// 去掉非充值代金券退款金额后的退款金额,单位为分,退款金额=申请退款金额-非充值代金券退款金额,退款金额小于等于申请退款金额。 + /// + /// 示例值: 100 + [JsonProperty("settlement_refund")] + [Required] + public int SettlementRefund { get; set; } + + /// + /// 应结订单金额。 + /// + /// + /// 应结订单金额=订单金额-免充值代金券金额,应结订单金额小于等于订单金额,单位为分。 + /// + /// + /// 示例值: 100 + /// + [JsonProperty("settlement_total")] + [Required] + public int SettlementTotal { get; set; } + + /// + /// 优惠退款金额。 + /// + /// + /// 优惠退款金额小于等于退款金额,退款金额-代金券或立减优惠退款金额为现金,说明详见代金券或立减优惠,单位为分。 + /// + /// + /// 示例值: 10 + /// + [JsonProperty("discount_refund")] + [Required] + public int DiscountRefund { get; set; } + + /// + /// 退款币种。 + /// + /// + /// 符合ISO 4217标准的三位字母代码,目前只支持人民币: CNY。 + /// + /// + /// 示例值: CNY + /// + [JsonProperty("currency")] + [Required] + [StringLength(16)] + public string Currency { get; set; } + + /// + /// 手续费退款金额。 + /// + /// + /// 手续费退款金额,单位为分。 + /// + /// + /// 示例值: 10 + /// + [JsonProperty("refund_fee")] + public int? RefundFee { get; set; } + } + + public class PromotionDetailModel + { + /// + /// 券 ID。 + /// + /// + /// 券或者立减优惠 ID。 + /// + /// + /// 示例值: 109519 + /// + [JsonProperty("promotion_id")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string PromotionId { get; set; } + + /// + /// 优惠范围。 + /// + /// + /// 枚举值,参考类型 。 + /// + /// + /// 示例值: SINGLE () + /// + [JsonProperty("scope")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string Scope { get; set; } + + /// + /// 优惠类型。 + /// + /// + /// 枚举值,参考类型 。 + /// + /// + /// 示例值: DISCOUNT () + /// + [JsonProperty("type")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string Type { get; set; } + + /// + /// 优惠券面额。 + /// + /// + /// 用户享受优惠的金额(优惠券面额=微信出资金额+商家出资金额+其他出资方金额 ),单位为分。 + /// + /// + /// 示例值: 5 + /// + [JsonProperty("amount")] + [Required] + public int Amount { get; set; } + + /// + /// 优惠退款金额。 + /// + /// + /// 优惠退款金额小于等于退款金额,退款金额-代金券或立减优惠退款金额为用户支付的现金,说明详见代金券或立减优惠,单位为分。 + /// + /// + /// 示例值: 100 + /// + [JsonProperty("refund_amount")] + [Required] + public int RefundAmount { get; set; } + + /// + /// 商品列表。 + /// + /// + /// 优惠商品发生退款时返回商品信息。 + /// + [JsonProperty("goods_detail")] + public List GoodsDetail { get; set; } + + public class GoodsDetailModel + { + /// + /// 商户侧商品编码。 + /// + /// + /// 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成。 + /// + /// + /// 示例值: 1217752501201407033233368018 + /// + [JsonProperty("merchant_goods_id")] + [Required] + [StringLength(32, MinimumLength = 1)] + public string MerchantGoodsId { get; set; } + + /// + /// 微信支付商品编码。 + /// + /// + /// 微信支付定义的统一商品编号(没有可不传)。 + /// + /// + /// 示例值: 1001 + /// + [JsonProperty("wechatpay_goods_id")] + [StringLength(32, MinimumLength = 1)] + public string WechatPayGoodsId { get; set; } + + /// + /// 商品名称。 + /// + /// + /// 商品的实际名称。 + /// + /// + /// 示例值: iPhone6s 16G + /// + [JsonProperty("goods_name")] + [StringLength(256, MinimumLength = 1)] + public string GoodsName { get; set; } + + /// + /// 商品单价。 + /// + /// + /// 商品单价金额,单位为分。 + /// + /// + /// 示例值: 528800 + /// + [JsonProperty("unit_price")] + [Required] + public int UnitPrice { get; set; } + + /// + /// 商品退款金额。 + /// + /// + /// 商品退款金额,单位为分。 + /// + /// + /// 示例值: 528800 + /// + [JsonProperty("refund_amount")] + [Required] + public int RefundAmount { get; set; } + + /// + /// 商品退货数量。 + /// + /// + /// 单品的退款数量。 + /// + /// + /// 示例值: 1 + /// + [JsonProperty("refund_quantity")] + [Required] + public int RefundQuantity { get; set; } + } + } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs new file mode 100644 index 0000000..d104255 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs @@ -0,0 +1,52 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.ErrorCodes; + +public class BasicPaymentErrorCode : WeChatPayCommonErrorCodes +{ + /// + /// 描述: 账号异常。 + /// 解决方案: 用户账号异常,无需更多操作。 + /// + public const string AccountError = "ACCOUNT_ERROR"; + + /// + /// 描述: 业务规则限制。 + /// 解决方案: 因业务规则限制请求频率,请查看接口返回的详细信息。 + /// + public const string RuleLimit = "RULE_LIMIT"; + + /// + /// 描述: 余额不足。 + /// 解决方案: 用户账号余额不足,请用户充值或更换支付卡后再支付。 + /// + public const string NotEnough = "NOT_ENOUGH"; + + /// + /// 描述: 商户无权限。 + /// 解决方案: 请商户前往申请此接口相关权限。 + /// + public const string NoAuth = "NO_AUTH"; + + /// + /// 描述: 系统错误。 + /// 解决方案: 系统异常,请用相同参数重新调用。 + /// + public const string SystemError = "SYSTEM_ERROR"; + + /// + /// 描述: OpenId 和 AppId 不匹配。 + /// 解决方案: 请确认 OpenId 和 AppId 是否匹配。 + /// + public const string OpenIdMismatch = "OPENID_MISMATCH"; + + /// + /// 描述: 订单号非法。 + /// 解决方案: 请检查微信支付订单号是否正确。 + /// + public const string InvalidTransactionId = "INVALID_TRANSACTIONID"; + + /// + /// 描述: 银行系统异常。 + /// 解决方案: 银行系统异常,请用相同参数重新调用。 + /// + public const string BankError = "BANK_ERROR"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BillErrorCode.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BillErrorCode.cs new file mode 100644 index 0000000..f2e50e7 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BillErrorCode.cs @@ -0,0 +1,16 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.ErrorCodes; + +public class BillErrorCode : BasicPaymentErrorCode +{ + /// + /// 描述: 账单文件不存在。
+ /// 解决方案: 请检查当前商户号是否在指定日期有交易或退款发生。 + ///
+ public const string NoStatementExist = "NO_STATEMENT_EXIST"; + + /// + /// 描述: 账单文件正在生成。
+ /// 解决方案: 请先检查当前商户号在指定日期内是否有成功的交易或退款,若有,则在T+1日上午8点后再重新下载。 + ///
+ public const string StatementCreating = "STATEMENT_CREATING"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/RefundErrorCode.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/RefundErrorCode.cs new file mode 100644 index 0000000..5cc4e53 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/RefundErrorCode.cs @@ -0,0 +1,16 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.ErrorCodes; + +public class RefundErrorCode : BasicPaymentErrorCode +{ + /// + /// 描述: 退款请求失败。 + /// 解决方案: 此状态代表退款申请失败,商户可自行处理退款。 + /// + public const string UserAccountAbnormal = "USER_ACCOUNT_ABNORMAL"; + + /// + /// 描述: 订单号不存在。 + /// 解决方案: 请检查你的订单号是否正确且是否已支付,未支付的订单不能发起退款。 + /// + public const string ResourceNotExists = "RESOURCE_NOT_EXISTS"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/WeChatPayCommonErrorCodes.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/WeChatPayCommonErrorCodes.cs index 486d2f6..bf9450d 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/WeChatPayCommonErrorCodes.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/WeChatPayCommonErrorCodes.cs @@ -67,55 +67,4 @@ public class WeChatPayCommonErrorCodes /// 解决方案: 请降低请求接口频率。 ///
public const string FrequencyLimit = "FREQUENCY_LIMITED"; -} - -public class BasicPaymentErrorCode : WeChatPayCommonErrorCodes -{ - /// - /// 描述: 账号异常。 - /// 解决方案: 用户账号异常,无需更多操作。 - /// - public const string AccountError = "ACCOUNT_ERROR"; - - /// - /// 描述: 业务规则限制。 - /// 解决方案: 因业务规则限制请求频率,请查看接口返回的详细信息。 - /// - public const string RuleLimit = "RULE_LIMIT"; - - /// - /// 描述: 余额不足。 - /// 解决方案: 用户账号余额不足,请用户充值或更换支付卡后再支付。 - /// - public const string NotEnough = "NOTENOUGH"; - - /// - /// 描述: 商户无权限。 - /// 解决方案: 请商户前往申请此接口相关权限。 - /// - public const string NoAuth = "NO_AUTH"; - - /// - /// 描述: 系统错误。 - /// 解决方案: 系统异常,请用相同参数重新调用。 - /// - public const string SystemError = "SYSTEM_ERROR"; - - /// - /// 描述: OpenId 和 AppId 不匹配。 - /// 解决方案: 请确认 OpenId 和 AppId 是否匹配。 - /// - public const string OpenIdMismatch = "OPENID_MISMATCH"; - - /// - /// 描述: 订单号非法。 - /// 解决方案: 请检查微信支付订单号是否正确。 - /// - public const string InvalidTransactionId = "INVALID_TRANSACTIONID"; - - /// - /// 描述: 银行系统异常。 - /// 解决方案: 银行系统异常,请用相同参数重新调用。 - /// - public const string BankError = "BANK_ERROR"; } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ParametersModel/WeChatPayCommonErrorResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ParametersModel/WeChatPayCommonErrorResponse.cs index 9fa4512..75e0ebf 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ParametersModel/WeChatPayCommonErrorResponse.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ParametersModel/WeChatPayCommonErrorResponse.cs @@ -1,3 +1,4 @@ +using EasyAbp.Abp.WeChat.Pay.Services.ErrorCodes; using Newtonsoft.Json; namespace EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; @@ -5,7 +6,7 @@ namespace EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; public abstract class WeChatPayCommonErrorResponse { /// - /// 错误代码,具体定义可以参考 命名空间下的常量定义。 + /// 错误代码,具体定义可以参考 命名空间下的常量定义。 /// [JsonProperty("code")] public string Code { get; set; }