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:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"sub_mchid": "1900000109",
|
||||
"individual_auth_id": "1900000110",
|
||||
"out_refund_no": "1217752501201407033233368018",
|
||||
"type": "USER_BANK_CARD",
|
||||
"bank_type": "ICBC_DEBIT",
|
||||
"bank_account": "d+xT+MQCvrLHUVDWv/8MR/dB7TkXLVfSrUxMPZy6jWWYzpRrEEaYQE8ZRGYoeorwC+w==",
|
||||
"real_name": "UPgQcZSdq3zOayJwZ5XLrHY2dZU1W2Cd"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"refund_id": "1217752501201407033233368018",
|
||||
"out_refund_no": "1217752501201407033233368018",
|
||||
"transaction_id": "1217752501201407033233368018",
|
||||
"out_trade_no": "1217752501201407033233368018",
|
||||
"channel": "ORIGINAL",
|
||||
"user_received_account": "招商银行信用卡0403",
|
||||
"success_time": "2018-06-08T10:34:56+08:00",
|
||||
"create_time": "2018-06-08T10:34:56+08:00",
|
||||
"status": "SUCCESS",
|
||||
"amount": {
|
||||
"refund": 888,
|
||||
"from": [
|
||||
{
|
||||
"account": "AVAILABLE",
|
||||
"amount": 444
|
||||
}
|
||||
],
|
||||
"payer_refund": 888,
|
||||
"discount_refund": 888,
|
||||
"currency": "CNY",
|
||||
"advance": 888
|
||||
},
|
||||
"promotion_detail": [
|
||||
{
|
||||
"promotion_id": "109519",
|
||||
"scope": "SINGLE",
|
||||
"type": "DISCOUNT",
|
||||
"amount": 5,
|
||||
"refund_amount": 100
|
||||
}
|
||||
],
|
||||
"refund_account": "REFUND_SOURCE_SUB_MERCHANT",
|
||||
"funds_account": "UNSETTLED"
|
||||
}
|
||||
@@ -677,6 +677,62 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /ecommerce/refunds/{refund_id}/apply-abnormal-refund)")]
|
||||
public async Task TestEncryptRequestSensitiveProperty_CreateEcommerceAbnormalRefundApplyRequest()
|
||||
{
|
||||
static Models.CreateEcommerceAbnormalRefundApplyRequest GenerateMockRequestModel()
|
||||
{
|
||||
return new Models.CreateEcommerceAbnormalRefundApplyRequest()
|
||||
{
|
||||
BankAccountNumber = MOCK_PLAIN_STR,
|
||||
RealName = MOCK_PLAIN_STR
|
||||
};
|
||||
}
|
||||
|
||||
static void AssertMockRequestModel(Models.CreateEcommerceAbnormalRefundApplyRequest request, Func<string, string> decryptor)
|
||||
{
|
||||
Assert.NotEqual(MOCK_PLAIN_STR, request.BankAccountNumber!);
|
||||
Assert.NotEqual(MOCK_PLAIN_STR, request.RealName!);
|
||||
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.BankAccountNumber!));
|
||||
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.RealName!));
|
||||
Assert.Equal(MOCK_CERT_SN, request.WechatpayCertificateSerialNumber!, ignoreCase: true);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(TestConfigs.WechatMerchantRSACertificatePrivateKey))
|
||||
{
|
||||
using (var client = CreateMockClientUseRSA(autoEncrypt: false))
|
||||
{
|
||||
var request = GenerateMockRequestModel();
|
||||
client.EncryptRequestSensitiveProperty(request);
|
||||
AssertMockRequestModel(request, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, (EncodedString)cipher)!);
|
||||
}
|
||||
|
||||
using (var client = CreateMockClientUseRSA(autoEncrypt: true))
|
||||
{
|
||||
var request = GenerateMockRequestModel();
|
||||
await client.ExecuteCreateEcommerceAbnormalRefundApplyAsync(request);
|
||||
AssertMockRequestModel(request, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, (EncodedString)cipher)!);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(TestConfigs.WechatMerchantSM2CertificatePrivateKey))
|
||||
{
|
||||
using (var client = CreateMockClientUseSM2(autoEncrypt: false))
|
||||
{
|
||||
var request = GenerateMockRequestModel();
|
||||
client.EncryptRequestSensitiveProperty(request);
|
||||
AssertMockRequestModel(request, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, (EncodedString)cipher)!);
|
||||
}
|
||||
|
||||
using (var client = CreateMockClientUseSM2(autoEncrypt: true))
|
||||
{
|
||||
var request = GenerateMockRequestModel();
|
||||
await client.ExecuteCreateEcommerceAbnormalRefundApplyAsync(request);
|
||||
AssertMockRequestModel(request, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, (EncodedString)cipher)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /eduschoolpay/contracts/presign)")]
|
||||
public async Task TestEncryptRequestSensitiveProperty_PresignEducationSchoolPayContractRequest()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user