-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from EasyAbp/wechatpay-v3-jspayment
Wechatpay v3 jspayment
- Loading branch information
Showing
12 changed files
with
181 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 20 additions & 3 deletions
23
src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/AppPayment/AppPaymentService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.AppPayment; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using EasyAbp.Abp.WeChat.Pay.Options; | ||
using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; | ||
using Volo.Abp.DependencyInjection; | ||
|
||
public class AppPaymentService | ||
namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.AppPayment; | ||
|
||
public class AppPaymentService : BasicPaymentService | ||
{ | ||
|
||
public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/app"; | ||
|
||
public AppPaymentService(AbpWeChatPayOptions options, | ||
IAbpLazyServiceProvider lazyServiceProvider) : base(options, | ||
lazyServiceProvider) | ||
{ | ||
} | ||
|
||
public Task<CreateOrderResponse> CreateOrderAsync(CreateOrderRequest request) | ||
{ | ||
return ApiRequester.RequestAsync<CreateOrderResponse>(HttpMethod.Post, CreateOrderUrl, request); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BasicPaymentService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
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; | ||
|
||
namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; | ||
|
||
public class BasicPaymentService : WeChatPayServiceBase | ||
{ | ||
public const string QueryOrderByWechatNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/id/{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 BasicPaymentService(AbpWeChatPayOptions options, | ||
IAbpLazyServiceProvider lazyServiceProvider) : base(options, | ||
lazyServiceProvider) | ||
{ | ||
} | ||
|
||
public Task<QueryOrderResponse> QueryOrderByWechatNumberAsync(QueryOrderByWechatNumberRequest request) | ||
{ | ||
var requestUrl = QueryOrderByWechatNumberUrl.Replace("{transaction_id}", request.TransactionId); | ||
return ApiRequester.RequestAsync<QueryOrderResponse>(HttpMethod.Get, requestUrl, request); | ||
} | ||
|
||
public Task<QueryOrderResponse> QueryOrderByOutTradeNumberAsync(QueryOrderByOutTradeNumberRequest request) | ||
{ | ||
var requestUrl = QueryOrderByOutTradeNumberUrl.Replace("{out_trade_no}", request.OutTradeNo); | ||
return ApiRequester.RequestAsync<QueryOrderResponse>(HttpMethod.Get, requestUrl, request); | ||
} | ||
|
||
public Task<WeChatPayCommonErrorResponse> CloseOrderAsync(CloseOrderRequest request) | ||
{ | ||
var requestUrl = CloseOrderUrl.Replace("{out_trade_no}", request.OutTradeNo); | ||
return ApiRequester.RequestAsync<WeChatPayCommonErrorResponse>(HttpMethod.Post, requestUrl, request); | ||
} | ||
|
||
public Task<RefundOrderResponse> RefundAsync(RefundOrderRequest orderRequest) | ||
{ | ||
return ApiRequester.RequestAsync<RefundOrderResponse>(HttpMethod.Post, RefundUrl, orderRequest); | ||
} | ||
|
||
public Task<RefundOrderResponse> QueryRefundOrderAsync(QueryRefundOrderRequest request) | ||
{ | ||
var requestUrl = QueryRefundOrderUrl.Replace("{out_refund_no}", request.OutRefundNo); | ||
return ApiRequester.RequestAsync<RefundOrderResponse>(HttpMethod.Get, requestUrl); | ||
} | ||
|
||
public Task<GetBillResponse> GetTransactionBillAsync(GetTransactionBillRequest request) | ||
{ | ||
return ApiRequester.RequestAsync<GetBillResponse>(HttpMethod.Get, GetTransactionBillUrl, request); | ||
} | ||
|
||
public Task<GetBillResponse> GetFundFlowBillAsync(GetFundFlowBillRequest request) | ||
{ | ||
return ApiRequester.RequestAsync<GetBillResponse>(HttpMethod.Get, GetFundFlowBillUrl, request); | ||
} | ||
|
||
public async Task<Stream> DownloadBillFileAsync(string billDownloadUrl) | ||
{ | ||
return await (await ApiRequester.RequestRawAsync(HttpMethod.Get, billDownloadUrl)).Content.ReadAsStreamAsync(); | ||
} | ||
} |
23 changes: 20 additions & 3 deletions
23
src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/H5Payment/H5PaymentService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.H5Payment; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using EasyAbp.Abp.WeChat.Pay.Options; | ||
using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; | ||
using Volo.Abp.DependencyInjection; | ||
|
||
public class H5PaymentService | ||
namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.H5Payment; | ||
|
||
public class H5PaymentService : BasicPaymentService | ||
{ | ||
|
||
public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/h5"; | ||
|
||
public H5PaymentService(AbpWeChatPayOptions options, | ||
IAbpLazyServiceProvider lazyServiceProvider) : base(options, | ||
lazyServiceProvider) | ||
{ | ||
} | ||
|
||
public Task<CreateOrderResponse> CreateOrderAsync(CreateOrderRequest request) | ||
{ | ||
return ApiRequester.RequestAsync<CreateOrderResponse>(HttpMethod.Post, CreateOrderUrl, request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...ay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderPayerModel.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.