feat(tenpayv3): 新增品牌红包相关接口

This commit is contained in:
Fu Diwei
2025-07-13 20:37:38 +08:00
parent 3d52f354a1
commit f3f3800547
27 changed files with 970 additions and 5 deletions

View File

@@ -553,6 +553,67 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
}
}
[Fact(DisplayName = "测试用例:解密响应中的敏感数据([GET] /fund-app/mch-transfer/transfer-to-qq-wallet-bills/{out_bill_no}")]
public async Task TestDecryptResponseSensitiveProperty_GetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberResponse()
{
static Models.GetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberResponse GenerateMockResponseModel(Func<string, string> encryptor)
{
return SetMockResponseRawStatusAsOk(new Models.GetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberResponse()
{
UserName = encryptor.Invoke(MOCK_PLAIN_STR)
});
}
static void AssertMockResponseModel(Models.GetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberResponse response)
{
Assert.Equal(MOCK_PLAIN_STR, response.UserName!);
}
if (!string.IsNullOrEmpty(TestConfigs.WechatMerchantRSACertificatePrivateKey))
{
using (var client = CreateMockClientUseRSA(autoDecrypt: false))
{
var response = GenerateMockResponseModel((plain) => Utilities.RSAUtility.EncryptWithECBByCertificate(RSA_PEM_CERTIFICATE, plain)!);
client.DecryptResponseSensitiveProperty(response);
AssertMockResponseModel(response);
}
using (var client = CreateMockClientUseRSA(
autoDecrypt: true,
mockResponseContent: new SystemTextJsonSerializer().Serialize(
GenerateMockResponseModel((plain) => Utilities.RSAUtility.EncryptWithECBByCertificate(RSA_PEM_CERTIFICATE, plain)!)
)
))
{
var request = new Models.GetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberRequest();
var response = await client.ExecuteGetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberAsync(request);
AssertMockResponseModel(response);
}
}
if (!string.IsNullOrEmpty(TestConfigs.WechatMerchantSM2CertificatePrivateKey))
{
using (var client = CreateMockClientUseSM2(autoDecrypt: false))
{
var response = GenerateMockResponseModel((plain) => Utilities.SM2Utility.EncryptByCertificate(SM2_PEM_CERTIFICATE, plain)!);
client.DecryptResponseSensitiveProperty(response);
AssertMockResponseModel(response);
}
using (var client = CreateMockClientUseSM2(
autoDecrypt: true,
mockResponseContent: new SystemTextJsonSerializer().Serialize(
GenerateMockResponseModel((plain) => Utilities.SM2Utility.EncryptByCertificate(SM2_PEM_CERTIFICATE, plain)!)
)
))
{
var request = new Models.GetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberRequest();
var response = await client.ExecuteGetFundAppBrandRedPacketBrandMerchantBatchDetailByOutDetailNumberAsync(request);
AssertMockResponseModel(response);
}
}
}
[Fact(DisplayName = "测试用例:解密响应中的敏感数据([GET] /marketing/shopping-receipt/shoppingreceipts")]
public async Task TestDecryptResponseSensitiveProperty_UploadMarketingShoppingReceiptResponse()
{