feat(tenpayv3): 升级公共组件

This commit is contained in:
Fu Diwei
2024-01-29 23:12:37 +08:00
committed by RHQYZ
parent 84ee19d614
commit a6763ca683
348 changed files with 4397 additions and 3878 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@@ -15,23 +15,23 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Controllers
{
private readonly ILogger _logger;
private readonly Options.TenpayOptions _tenpayOptions;
private readonly Services.HttpClients.IWechatTenpayHttpClientFactory _tenpayHttpClientFactory;
private readonly Services.HttpClients.IWechatTenpayClientFactory _wechatTenpayClientFactory;
public TenpayOrderController(
ILoggerFactory loggerFactory,
IOptions<Options.TenpayOptions> tenpayOptions,
Services.HttpClients.IWechatTenpayHttpClientFactory tenpayHttpClientFactory)
Services.HttpClients.IWechatTenpayClientFactory wechatTenpayClientFactory)
{
_logger = loggerFactory.CreateLogger(GetType());
_tenpayOptions = tenpayOptions.Value;
_tenpayHttpClientFactory = tenpayHttpClientFactory;
_wechatTenpayClientFactory = wechatTenpayClientFactory;
}
[HttpPost]
[Route("jsapi")]
public async Task<IActionResult> CreateOrderByJsapi([FromBody] Models.CreateOrderByJsapiRequest requestModel)
{
var client = _tenpayHttpClientFactory.Create(requestModel.MerchantId);
using var client = _wechatTenpayClientFactory.Create(requestModel.MerchantId);
var request = new CreatePayTransactionJsapiRequest()
{
OutTradeNumber = "SAMPLE_OTN_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"),
@@ -46,7 +46,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Controllers
{
_logger.LogWarning(
"JSAPI 下单失败(状态码:{0},错误代码:{1},错误描述:{2})。",
response.RawStatus, response.ErrorCode, response.ErrorMessage
response.GetRawStatus(), response.ErrorCode, response.ErrorMessage
);
}