mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-16 07:59:44 +08:00
test(tenpayv3): 修改配置项
This commit is contained in:
parent
afd6418cee
commit
492b7e4df3
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Options
|
||||
@ -22,9 +22,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Options
|
||||
|
||||
public string SecretV3 { get; set; } = string.Empty;
|
||||
|
||||
public string CertSerialNumber { get; set; } = string.Empty;
|
||||
public string CertificateSerialNumber { get; set; } = string.Empty;
|
||||
|
||||
public string CertPrivateKey { get; set; } = string.Empty;
|
||||
public string CertificatePrivateKey { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -35,8 +35,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Services.HttpClients.Imple
|
||||
{
|
||||
MerchantId = tenpayMerchantConfig.MerchantId,
|
||||
MerchantV3Secret = tenpayMerchantConfig.SecretV3,
|
||||
MerchantCertificateSerialNumber = tenpayMerchantConfig.CertSerialNumber,
|
||||
MerchantCertificatePrivateKey = tenpayMerchantConfig.CertPrivateKey,
|
||||
MerchantCertificateSerialNumber = tenpayMerchantConfig.CertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = tenpayMerchantConfig.CertificatePrivateKey,
|
||||
PlatformCertificateManager = _tenpayCertificateManagerFactory.Create(tenpayMerchantConfig.MerchantId),
|
||||
AutoEncryptRequestSensitiveProperty = true,
|
||||
AutoDecryptResponseSensitiveProperty = true
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@ -14,8 +14,8 @@
|
||||
{
|
||||
"MerchantId": "填写商户号",
|
||||
"SecretV3": "填写商户 V3 API 密钥",
|
||||
"CertSerialNumber": "填写商户证书序列号",
|
||||
"CertPrivateKey": "填写商户证书文件内容"
|
||||
"CertificateSerialNumber": "填写商户证书序列号",
|
||||
"CertificatePrivateKey": "填写商户证书文件内容"
|
||||
}
|
||||
],
|
||||
"NotifyUrl": "https://localhost:5001"
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Options
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Options
|
||||
{
|
||||
public partial class TenpayOptions
|
||||
{
|
||||
@ -17,8 +17,8 @@
|
||||
{
|
||||
MerchantId = WebConfigurationManager.AppSettings[$"TenpayOptions_Merchant_{i}_MerchantId"],
|
||||
SecretV3 = WebConfigurationManager.AppSettings[$"TenpayOptions_Merchant_{i}_SecretV3"],
|
||||
CertSerialNumber = WebConfigurationManager.AppSettings[$"TenpayOptions_Merchant_{i}_CertSerialNumber"],
|
||||
CertPrivateKey = WebConfigurationManager.AppSettings[$"TenpayOptions_Merchant_{i}_CertPrivateKey"],
|
||||
CertificateSerialNumber = WebConfigurationManager.AppSettings[$"TenpayOptions_Merchant_{i}_CertificateSerialNumber"],
|
||||
CertificatePrivateKey = WebConfigurationManager.AppSettings[$"TenpayOptions_Merchant_{i}_CertificatePrivateKey"],
|
||||
})
|
||||
.ToArray(),
|
||||
NotifyUrl = WebConfigurationManager.AppSettings[$"TenpayOptions_NotifyUrl"]
|
||||
@ -43,9 +43,9 @@
|
||||
|
||||
public string SecretV3 { get; set; } = string.Empty;
|
||||
|
||||
public string CertSerialNumber { get; set; } = string.Empty;
|
||||
public string CertificateSerialNumber { get; set; } = string.Empty;
|
||||
|
||||
public string CertPrivateKey { get; set; } = string.Empty;
|
||||
public string CertificatePrivateKey { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="TenpayOptions_Merchant_0_MerchantId" value="填写商户号" />
|
||||
<add key="TenpayOptions_Merchant_0_SecretV3" value="填写商户 V3 API 密钥" />
|
||||
<add key="TenpayOptions_Merchant_0_CertSerialNumber" value="填写商户证书序列号" />
|
||||
<add key="TenpayOptions_Merchant_0_CertPrivateKey" value="填写商户证书文件内容" />
|
||||
<add key="TenpayOptions_Merchant_0_CertificateSerialNumber" value="填写商户证书序列号" />
|
||||
<add key="TenpayOptions_Merchant_0_CertificatePrivateKey" value="填写商户证书文件内容" />
|
||||
<add key="TenpayOptions_NotifyUrl" value="https://localhost:5001" />
|
||||
</appSettings>
|
||||
|
||||
|
@ -26,8 +26,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
{
|
||||
MerchantId = TestConfigs.WechatMerchantId,
|
||||
MerchantV3Secret = TestConfigs.WechatMerchantSecret,
|
||||
MerchantCertificateSerialNumber = TestConfigs.WechatMerchantCertSerialNumber,
|
||||
MerchantCertificatePrivateKey = TestConfigs.WechatMerchantCertPrivateKey,
|
||||
MerchantCertificateSerialNumber = TestConfigs.WechatMerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = TestConfigs.WechatMerchantCertificatePrivateKey,
|
||||
AutoEncryptRequestSensitiveProperty = true,
|
||||
AutoDecryptResponseSensitiveProperty = true
|
||||
});
|
||||
@ -39,8 +39,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
{
|
||||
MerchantId = TestConfigs.WechatMerchantId,
|
||||
MerchantV3Secret = TestConfigs.WechatMerchantSecret,
|
||||
MerchantCertificateSerialNumber = TestConfigs.WechatMerchantCertSerialNumber,
|
||||
MerchantCertificatePrivateKey = TestConfigs.WechatMerchantCertPrivateKey,
|
||||
MerchantCertificateSerialNumber = TestConfigs.WechatMerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = TestConfigs.WechatMerchantCertificatePrivateKey,
|
||||
AutoEncryptRequestSensitiveProperty = false,
|
||||
AutoDecryptResponseSensitiveProperty = false
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
@ -11,8 +12,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
{
|
||||
MerchantId = TestConfigs.WechatMerchantId,
|
||||
MerchantV3Secret = TestConfigs.WechatMerchantSecret,
|
||||
MerchantCertificateSerialNumber = TestConfigs.WechatMerchantCertSerialNumber,
|
||||
MerchantCertificatePrivateKey = TestConfigs.WechatMerchantCertPrivateKey,
|
||||
MerchantCertificateSerialNumber = TestConfigs.WechatMerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = TestConfigs.WechatMerchantCertificatePrivateKey,
|
||||
PlatformCertificateManager = certificateManager
|
||||
});
|
||||
}
|
||||
@ -21,6 +22,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
{
|
||||
var request = new Models.QueryCertificatesRequest();
|
||||
var response = await Instance.ExecuteQueryCertificatesAsync(request);
|
||||
|
||||
if (!response.IsSuccessful())
|
||||
throw new Exception();
|
||||
|
||||
foreach (var certificate in Instance.DecryptResponseSensitiveProperty(response).CertificateList)
|
||||
{
|
||||
Instance.PlatformCertificateManager.AddEntry(new Settings.CertificateEntry(certificate));
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
@ -19,8 +19,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
var config = jdoc.RootElement.GetProperty("TestConfig");
|
||||
WechatMerchantId = config.GetProperty("MerchantId").GetString()!;
|
||||
WechatMerchantSecret = config.GetProperty("MerchantSecret").GetString()!;
|
||||
WechatMerchantCertSerialNumber = config.GetProperty("MerchantCertSerialNumber").GetString()!;
|
||||
WechatMerchantCertPrivateKey = config.GetProperty("MerchantCertPrivateKey").GetString()!;
|
||||
WechatMerchantCertificateSerialNumber = config.GetProperty("MerchantCertificateSerialNumber").GetString()!;
|
||||
WechatMerchantCertificatePrivateKey = config.GetProperty("MerchantCertificatePrivateKey").GetString()!;
|
||||
WechatAppId = config.GetProperty("AppId").GetString()!;
|
||||
WechatOpenId = config.GetProperty("OpenId").GetString()!;
|
||||
|
||||
@ -35,8 +35,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
|
||||
public static readonly string WechatMerchantId;
|
||||
public static readonly string WechatMerchantSecret;
|
||||
public static readonly string WechatMerchantCertSerialNumber;
|
||||
public static readonly string WechatMerchantCertPrivateKey;
|
||||
public static readonly string WechatMerchantCertificateSerialNumber;
|
||||
public static readonly string WechatMerchantCertificatePrivateKey;
|
||||
public static readonly string WechatAppId;
|
||||
public static readonly string WechatOpenId;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
{
|
||||
"TestConfig": {
|
||||
"MerchantId": "请在此填写用于测试的微信商户号",
|
||||
"MerchantSecret": "请在此填写用于测试的微信商户 API v3 密钥",
|
||||
"MerchantCertSerialNumber": "请在此填写用于测试的微信商户 API 证书序列号",
|
||||
"MerchantCertPrivateKey": "请在此填写用于测试的微信商户 API 证书私钥(字符串格式)",
|
||||
"MerchantCertificateSerialNumber": "请在此填写用于测试的微信商户 API 证书序列号",
|
||||
"MerchantCertificatePrivateKey": "请在此填写用于测试的微信商户 API 证书私钥(字符串格式)",
|
||||
"AppId": "请在此填写用于测试的微信 AppId",
|
||||
"OpenId": "请在此填写用于测试的微信用户唯一标识"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user