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