From 6703694ae45efa7270edad6b2b3d88b297d526fe Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 19:44:23 +0800 Subject: [PATCH 1/7] feat: Completed the JS payment interface for closing orders. --- .../JSPayment/JsPaymentService.cs | 15 ++++-- .../BasicPayment/Models/CloseOrderRequest.cs | 35 +++++++++++++ .../ErrorCodes/BasicPaymentErrorCode.cs | 52 +++++++++++++++++++ .../ErrorCodes/WeChatPayCommonErrorCodes.cs | 51 ------------------ .../WeChatPayCommonErrorResponse.cs | 3 +- 5 files changed, 100 insertions(+), 56 deletions(-) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/CloseOrderRequest.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs 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..10c4df9 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 @@ -3,6 +3,7 @@ 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; @@ -12,11 +13,11 @@ 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 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 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 JsPaymentService(AbpWeChatPayOptions options, IAbpLazyServiceProvider lazyServiceProvider) : base(options, @@ -40,4 +41,10 @@ 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); + } } \ 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/ErrorCodes/BasicPaymentErrorCode.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs new file mode 100644 index 0000000..e877394 --- /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 = "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/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; } From 74266c590e77e05c5909e8fbb80c0fa602063530 Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 22:02:51 +0800 Subject: [PATCH 2/7] feat: Added the refund application interface for JS payment. --- .../Services/BasicPayment/CouponTypeEnum.cs | 17 + .../Services/BasicPayment/FundsAccountEnum.cs | 32 ++ .../JSPayment/JsPaymentService.cs | 9 +- .../BasicPayment/Models/QueryOrderResponse.cs | 4 +- .../BasicPayment/Models/RefundOrderRequest.cs | 279 +++++++++++ .../Models/RefundOrderResponse.cs | 456 ++++++++++++++++++ .../BasicPayment/PromotionTypeEnum.cs | 10 +- .../BasicPayment/RefundChannelEnum.cs | 27 ++ .../Services/BasicPayment/RefundStatusEnum.cs | 27 ++ .../ErrorCodes/BasicPaymentErrorCode.cs | 2 +- .../Services/ErrorCodes/RefundErrorCode.cs | 16 + 11 files changed, 868 insertions(+), 11 deletions(-) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundChannelEnum.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundStatusEnum.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/RefundErrorCode.cs diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs new file mode 100644 index 0000000..b87bdd4 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs @@ -0,0 +1,17 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +/// +/// 代金券的枚举值定义。 +/// +public static class CouponTypeEnum +{ + /// + /// 充值型代金券。 + /// + public const string Cash = "CASH"; + + /// + /// 免充值型代金券。 + /// + public const string NoCash = "NOCASH"; +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs new file mode 100644 index 0000000..b86b4b6 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs @@ -0,0 +1,32 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +/// +/// 退款资金来源枚举。 +/// +public static class FundsAccountEnum +{ + /// + /// 可用余额账户。 + /// + 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/JSPayment/JsPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs index 10c4df9..34e4940 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 @@ -12,12 +12,10 @@ 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 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 JsPaymentService(AbpWeChatPayOptions options, IAbpLazyServiceProvider lazyServiceProvider) : base(options, @@ -47,4 +45,9 @@ public Task CloseOrderAsync(CloseOrderRequest requ 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); + } } \ 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..202bca2 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 @@ -308,10 +308,10 @@ public class QueryOrderPromotionDetailModel /// 优惠类型。 /// /// - /// 枚举值,取值范围请参考 。 + /// 枚举值,取值范围请参考 。 /// /// - /// 示例值: CASH。() + /// 示例值: CASH。() /// [StringLength(32)] [JsonProperty("type")] 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..5965565 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs @@ -0,0 +1,279 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +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..e90fb11 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs @@ -0,0 +1,456 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +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/BasicPayment/PromotionTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs index 0dac064..72521ce 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs @@ -6,12 +6,12 @@ namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; public static class PromotionTypeEnum { /// - /// 充值型代金券。 + /// 代金券,需要走结算资金的充值型代金券。 /// - public const string Cash = "CASH"; - + public const string Coupon = "COUPON"; + /// - /// 免充值型代金券。 + /// 优惠券,不走结算资金的免充值型优惠券。 /// - public const string NoCash = "NOCASH"; + public const string Discount = "DISCOUNT"; } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundChannelEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundChannelEnum.cs new file mode 100644 index 0000000..9cd7eef --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundChannelEnum.cs @@ -0,0 +1,27 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +/// +/// 退款渠道枚举。 +/// +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/RefundStatusEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundStatusEnum.cs new file mode 100644 index 0000000..99401b9 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundStatusEnum.cs @@ -0,0 +1,27 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +/// +/// 退款状态枚举。 +/// +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/ErrorCodes/BasicPaymentErrorCode.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs index e877394..d104255 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BasicPaymentErrorCode.cs @@ -18,7 +18,7 @@ public class BasicPaymentErrorCode : WeChatPayCommonErrorCodes /// 描述: 余额不足。 /// 解决方案: 用户账号余额不足,请用户充值或更换支付卡后再支付。 /// - public const string NotEnough = "NOTENOUGH"; + public const string NotEnough = "NOT_ENOUGH"; /// /// 描述: 商户无权限。 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 From 35a08e67519077b97a34e35fc1fdbdabd57f70ce Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 22:11:54 +0800 Subject: [PATCH 3/7] feat: Added the refund query interface for JS payment. --- .../JSPayment/JsPaymentService.cs | 7 +++++++ .../Models/QueryRefundOrderRequest.cs | 21 +++++++++++++++++++ .../Models/RefundOrderResponse.cs | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/QueryRefundOrderRequest.cs 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 34e4940..595137c 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 @@ -16,6 +16,7 @@ public class JsPaymentService : WeChatPayServiceBase 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 JsPaymentService(AbpWeChatPayOptions options, IAbpLazyServiceProvider lazyServiceProvider) : base(options, @@ -50,4 +51,10 @@ 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); + } } \ No newline at end of file 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/RefundOrderResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs index e90fb11..e95c09e 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs @@ -398,7 +398,7 @@ public class GoodsDetailModel /// [JsonProperty("wechatpay_goods_id")] [StringLength(32, MinimumLength = 1)] - public string WechatpayGoodsId { get; set; } + public string WechatPayGoodsId { get; set; } /// /// 商品名称。 From 2314bb4ad7a8d286a35b445ee51992827b4b3a0d Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 22:27:17 +0800 Subject: [PATCH 4/7] feat: Added an API for applying for transaction statements. --- .../Services/BasicPayment/BillTypeEnum.cs | 22 ++++++++ .../JSPayment/JsPaymentService.cs | 6 +++ .../Models/GetTransactionBillRequest.cs | 50 ++++++++++++++++++ .../Models/GetTransactionBillResponse.cs | 51 +++++++++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillResponse.cs diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs new file mode 100644 index 0000000..10e030e --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs @@ -0,0 +1,22 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +/// +/// 账单类型枚举。 +/// +public static class BillTypeEnum +{ + /// + /// 回当日所有订单信息 (不含充值退款订单)。 + /// + 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 595137c..6020e2f 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 @@ -17,6 +17,7 @@ public class JsPaymentService : WeChatPayServiceBase 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 JsPaymentService(AbpWeChatPayOptions options, IAbpLazyServiceProvider lazyServiceProvider) : base(options, @@ -57,4 +58,9 @@ public Task QueryRefundOrderAsync(QueryRefundOrderRequest r 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); + } } \ 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..3f38064 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs @@ -0,0 +1,50 @@ +using System.ComponentModel.DataAnnotations; +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 () + /// + [Required] + [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/GetTransactionBillResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillResponse.cs new file mode 100644 index 0000000..c7631e0 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillResponse.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 GetTransactionBillResponse : 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 From 18ae6bd447fc434d117977cfd2e0dfd44367c5c5 Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 22:38:17 +0800 Subject: [PATCH 5/7] feat: Added an API for requesting financial statements. --- .../BasicPayment/FundAccountTypeEnum.cs | 22 +++++++++ .../JSPayment/JsPaymentService.cs | 10 +++- ...tionBillResponse.cs => GetBillResponse.cs} | 2 +- .../Models/GetFundFlowBillRequest.cs | 49 +++++++++++++++++++ .../Models/GetTransactionBillRequest.cs | 5 +- .../BasicPayment/Models/RefundOrderRequest.cs | 8 +-- .../Models/RefundOrderResponse.cs | 4 +- ...countEnum.cs => RefundFundsAccountEnum.cs} | 2 +- ...TypeEnum.cs => TransactionBillTypeEnum.cs} | 6 +-- .../Services/ErrorCodes/BillErrorCode.cs | 16 ++++++ 10 files changed, 108 insertions(+), 16 deletions(-) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundAccountTypeEnum.cs rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/{GetTransactionBillResponse.cs => GetBillResponse.cs} (95%) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{FundsAccountEnum.cs => RefundFundsAccountEnum.cs} (94%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{BillTypeEnum.cs => TransactionBillTypeEnum.cs} (92%) create mode 100644 src/Pay/EasyAbp.Abp.WeChat.Pay/Services/ErrorCodes/BillErrorCode.cs diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundAccountTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundAccountTypeEnum.cs new file mode 100644 index 0000000..7f75b35 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundAccountTypeEnum.cs @@ -0,0 +1,22 @@ +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +/// +/// 资金账户类型枚举。 +/// +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/JSPayment/JsPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs index 6020e2f..acc433c 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 @@ -18,6 +18,7 @@ public class JsPaymentService : WeChatPayServiceBase 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, @@ -59,8 +60,13 @@ public Task QueryRefundOrderAsync(QueryRefundOrderRequest r return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl); } - public Task GetTransactionBillAsync(GetTransactionBillRequest request) + public Task GetTransactionBillAsync(GetTransactionBillRequest request) { - return ApiRequester.RequestAsync(HttpMethod.Get, GetTransactionBillUrl, request); + return ApiRequester.RequestAsync(HttpMethod.Get, GetTransactionBillUrl, request); + } + + public Task GetFundFlowBillAsync(GetFundFlowBillRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Get, GetFundFlowBillUrl, request); } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillResponse.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetBillResponse.cs similarity index 95% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillResponse.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetBillResponse.cs index c7631e0..d4d6ab1 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillResponse.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetBillResponse.cs @@ -4,7 +4,7 @@ namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; -public class GetTransactionBillResponse : WeChatPayCommonErrorResponse +public class GetBillResponse : WeChatPayCommonErrorResponse { /// /// 哈希类型。 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..4ecca94 --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs @@ -0,0 +1,49 @@ +using System.ComponentModel.DataAnnotations; +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 index 3f38064..ce35c15 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs @@ -24,12 +24,11 @@ public class GetTransactionBillRequest /// 账单类型。 ///
/// - /// 枚举值,具体定义参考类型 ,不填则默认是 ALL。 + /// 枚举值,具体定义参考类型 ,不填则默认是 ALL。 /// /// - /// 示例值: ALL () + /// 示例值: ALL () /// - [Required] [StringLength(32, MinimumLength = 1)] [JsonProperty("bill_type")] public string BillType { get; set; } 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 index 5965565..7a903e5 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs @@ -78,10 +78,10 @@ public class RefundOrderRequest ///
/// /// 若传递此参数则使用对应的资金账户退款,否则默认使用未结算资金退款 (仅对老资金流商户适用)。 - /// 仅支持取值为 。 + /// 仅支持取值为 。 /// /// - /// 示例值: AVAILABLE () + /// 示例值: AVAILABLE () /// [JsonProperty("funds_account")] [StringLength(32)] @@ -170,10 +170,10 @@ public class RefundSource /// 出资账户类型。 ///
/// - /// 参考类型 的定义。 + /// 参考类型 的定义。 /// /// - /// 示例值: AVAILABLE () + /// 示例值: AVAILABLE () /// [JsonProperty("account")] [Required] 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 index e95c09e..ebfecea 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs @@ -140,10 +140,10 @@ public class RefundOrderResponse : WeChatPayCommonErrorResponse /// 资金账户。 /// /// - /// 退款所使用资金对应的资金账户类型,请参考类型 的定义。 + /// 退款所使用资金对应的资金账户类型,请参考类型 的定义。 /// /// - /// 示例值: UNSETTLED () + /// 示例值: UNSETTLED () /// [JsonProperty("funds_account")] [StringLength(32, MinimumLength = 1)] diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundFundsAccountEnum.cs similarity index 94% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundFundsAccountEnum.cs index b86b4b6..5ee7705 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundsAccountEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundFundsAccountEnum.cs @@ -3,7 +3,7 @@ namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; /// /// 退款资金来源枚举。 /// -public static class FundsAccountEnum +public static class RefundFundsAccountEnum { /// /// 可用余额账户。 diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TransactionBillTypeEnum.cs similarity index 92% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TransactionBillTypeEnum.cs index 10e030e..f5e7153 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BillTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TransactionBillTypeEnum.cs @@ -3,18 +3,18 @@ namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; /// /// 账单类型枚举。 /// -public static class BillTypeEnum +public static class TransactionBillTypeEnum { /// /// 回当日所有订单信息 (不含充值退款订单)。 /// public const string All = "ALL"; - + /// /// 返回当日成功支付的订单 (不含充值退款订单)。 /// public const string Success = "SUCCESS"; - + /// /// 返回当日退款订单 (不含充值退款订单)。 /// 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 From 2ccd3d56ac8de8ec3b9c4cc90eda409b050d7240 Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 22:51:10 +0800 Subject: [PATCH 6/7] feat: Added an API for downloading billing files. --- .../DefaultWeChatPayApiRequester.cs | 32 ++++++++++--------- .../ApiRequests/IWeChatPayApiRequester.cs | 2 ++ .../JSPayment/JsPaymentService.cs | 8 ++++- 3 files changed, 26 insertions(+), 16 deletions(-) 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/JSPayment/JsPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs index acc433c..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,4 +1,5 @@ -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; @@ -69,4 +70,9 @@ 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 From 9d45015673c3f380c5a941745f17b0c2bed8b8a9 Mon Sep 17 00:00:00 2001 From: real-zony Date: Sat, 6 Jan 2024 22:53:03 +0800 Subject: [PATCH 7/7] chore: Adjusted the location of the enum class. --- .../Services/BasicPayment/{ => Enums}/CouponTypeEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/FundAccountTypeEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/PromotionScopeEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/PromotionTypeEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/RefundChannelEnum.cs | 2 +- .../BasicPayment/{ => Enums}/RefundFundsAccountEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/RefundStatusEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/TradeStateEnum.cs | 2 +- .../Services/BasicPayment/{ => Enums}/TradeTypeEnum.cs | 2 +- .../BasicPayment/{ => Enums}/TransactionBillTypeEnum.cs | 2 +- .../Services/BasicPayment/Models/GetFundFlowBillRequest.cs | 1 + .../Services/BasicPayment/Models/GetTransactionBillRequest.cs | 1 + .../Services/BasicPayment/Models/QueryOrderResponse.cs | 1 + .../Services/BasicPayment/Models/RefundOrderRequest.cs | 3 ++- .../Services/BasicPayment/Models/RefundOrderResponse.cs | 1 + 15 files changed, 16 insertions(+), 11 deletions(-) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/CouponTypeEnum.cs (83%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/FundAccountTypeEnum.cs (87%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/PromotionScopeEnum.cs (83%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/PromotionTypeEnum.cs (86%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/RefundChannelEnum.cs (90%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/RefundFundsAccountEnum.cs (91%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/RefundStatusEnum.cs (89%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/TradeStateEnum.cs (93%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/TradeTypeEnum.cs (92%) rename src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/{ => Enums}/TransactionBillTypeEnum.cs (89%) diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/CouponTypeEnum.cs similarity index 83% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/CouponTypeEnum.cs index b87bdd4..ce21a8f 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/CouponTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/CouponTypeEnum.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/FundAccountTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/FundAccountTypeEnum.cs similarity index 87% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundAccountTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/FundAccountTypeEnum.cs index 7f75b35..c2e27f4 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/FundAccountTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/FundAccountTypeEnum.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/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/PromotionTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionTypeEnum.cs similarity index 86% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionTypeEnum.cs index 72521ce..abead99 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/PromotionTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/PromotionTypeEnum.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/RefundChannelEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundChannelEnum.cs similarity index 90% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundChannelEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundChannelEnum.cs index 9cd7eef..a77def2 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundChannelEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundChannelEnum.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/RefundFundsAccountEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundFundsAccountEnum.cs similarity index 91% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundFundsAccountEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundFundsAccountEnum.cs index 5ee7705..9034597 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundFundsAccountEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundFundsAccountEnum.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/RefundStatusEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundStatusEnum.cs similarity index 89% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundStatusEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundStatusEnum.cs index 99401b9..e77920e 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/RefundStatusEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/RefundStatusEnum.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/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/TransactionBillTypeEnum.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TransactionBillTypeEnum.cs similarity index 89% rename from src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TransactionBillTypeEnum.cs rename to src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TransactionBillTypeEnum.cs index f5e7153..844353e 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/TransactionBillTypeEnum.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Enums/TransactionBillTypeEnum.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/Models/GetFundFlowBillRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs index 4ecca94..aa5cc0e 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetFundFlowBillRequest.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; using Newtonsoft.Json; namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; 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 index ce35c15..06cab99 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/GetTransactionBillRequest.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Enums; using Newtonsoft.Json; namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; 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 202bca2..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; 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 index 7a903e5..bae4652 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderRequest.cs @@ -1,5 +1,6 @@ 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; @@ -78,7 +79,7 @@ public class RefundOrderRequest /// /// /// 若传递此参数则使用对应的资金账户退款,否则默认使用未结算资金退款 (仅对老资金流商户适用)。 - /// 仅支持取值为 。 + /// 仅支持取值为 。 /// /// /// 示例值: AVAILABLE () 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 index ebfecea..c552c73 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/Models/RefundOrderResponse.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;