mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-12-29 18:04:42 +08:00
feat(tenpayv3): 构造器模式
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Services.HttpClients.Implements
|
||||
{
|
||||
internal partial class WechatTenpayClientFactory : IWechatTenpayClientFactory
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly Options.TenpayOptions _tenpayOptions;
|
||||
private readonly IWechatTenpayCertificateManagerFactory _tenpayCertificateManagerFactory;
|
||||
|
||||
public WechatTenpayClientFactory(
|
||||
IHttpClientFactory httpClientFactory,
|
||||
IOptions<Options.TenpayOptions> tenpayOptions,
|
||||
IWechatTenpayCertificateManagerFactory tenpayCertificateManagerFactory)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_tenpayOptions = tenpayOptions.Value;
|
||||
_tenpayCertificateManagerFactory = tenpayCertificateManagerFactory;
|
||||
}
|
||||
@@ -37,7 +41,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Services.HttpClients.Imple
|
||||
AutoEncryptRequestSensitiveProperty = false,
|
||||
AutoDecryptResponseSensitiveProperty = false
|
||||
};
|
||||
var wechatTenpayClient = new WechatTenpayClient(wechatTenpayClientOptions);
|
||||
var wechatTenpayClient = WechatTenpayClientBuilder.Create(wechatTenpayClientOptions)
|
||||
.UseHttpClient(_httpClientFactory.CreateClient(), disposeClient: false)
|
||||
.Build();
|
||||
return wechatTenpayClient;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user