mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-12-29 09:54:44 +08:00
feat(tenpayv3): 新增商家转账确认模式相关接口
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"out_bill_no": "plfk2020042013"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"state": "GENERATING",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"transfer_bill_no": "1330000071100999991182020050700019480001"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"state": "GENERATING",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"state": "GENERATING",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"update_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"hash_type": "SHA256",
|
||||
"hash_value": "DE731F35146A0BEFADE5DB9D1E468D96C01CA8898119C674FEE9F11F4DBE5529",
|
||||
"download_url": "https://api.mch.weixin.qq.com/v3/transferbilldownload/file?token=xxx",
|
||||
"fail_reason": "\"转账单据不存在\""
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"state": "GENERATING",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"update_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"hash_type": "SHA256",
|
||||
"hash_value": "DE731F35146A0BEFADE5DB9D1E468D96C01CA8898119C674FEE9F11F4DBE5529",
|
||||
"download_url": "https://api.mch.weixin.qq.com/v3/transferbilldownload/file?token=xxx",
|
||||
"fail_reason": "\"转账单据不存在\""
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"out_bill_no": "plfk2020042013",
|
||||
"transfer_bill_no": "1330000071100999991182020050700019480001",
|
||||
"state": "CANCELING",
|
||||
"update_time": "2015-05-20T13:29:35.120+08:00"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"appid": "wxf636efh567hg4356",
|
||||
"out_bill_no": "plfk2020042013",
|
||||
"transfer_scene_id": "1000",
|
||||
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
|
||||
"user_name": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
|
||||
"transfer_amount": 400000,
|
||||
"transfer_remark": "2020年4月报销",
|
||||
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php",
|
||||
"user_recv_perception": "现金奖励",
|
||||
"transfer_scene_report_infos": [
|
||||
{
|
||||
"info_type": "活动名称",
|
||||
"info_content": "新会员有礼"
|
||||
},
|
||||
{
|
||||
"info_type": "奖励说明",
|
||||
"info_content": "注册会员抽奖一等奖"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"out_bill_no": "plfk2020042013",
|
||||
"transfer_bill_no": "1330000071100999991182020050700019480001",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"state": "ACCEPTED",
|
||||
"fail_reason": "PAYEE_ACCOUNT_ABNORMAL",
|
||||
"package_info": "affffddafdfafddffda=="
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mch_id": "1900001109",
|
||||
"out_bill_no": "plfk2020042013",
|
||||
"transfer_bill_no": "1330000071100999991182020050700019480001",
|
||||
"appid": "wxf636efh567hg4356",
|
||||
"state": "ACCEPTED",
|
||||
"transfer_amount": 400000,
|
||||
"transfer_remark": "2020年4月报销",
|
||||
"fail_reason": "PAYEE_ACCOUNT_ABNORMAL",
|
||||
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"update_time": "2015-05-20T13:29:35.120+08:00"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mch_id": "1900001109",
|
||||
"out_bill_no": "plfk2020042013",
|
||||
"transfer_bill_no": "1330000071100999991182020050700019480001",
|
||||
"appid": "wxf636efh567hg4356",
|
||||
"state": "ACCEPTED",
|
||||
"transfer_amount": 400000,
|
||||
"transfer_remark": "2020年4月报销",
|
||||
"fail_reason": "PAYEE_ACCOUNT_ABNORMAL",
|
||||
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
|
||||
"create_time": "2015-05-20T13:29:35.120+08:00",
|
||||
"update_time": "2015-05-20T13:29:35.120+08:00"
|
||||
}
|
||||
@@ -801,6 +801,59 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /fund-app/mch-transfer/transfer-bills)")]
|
||||
public async Task TestEncryptRequestSensitiveProperty_CreateFundAppMerchantTransferBillRequest()
|
||||
{
|
||||
static Models.CreateFundAppMerchantTransferBillRequest GenerateMockRequestModel()
|
||||
{
|
||||
return new Models.CreateFundAppMerchantTransferBillRequest()
|
||||
{
|
||||
UserName = MOCK_PLAIN_STR
|
||||
};
|
||||
}
|
||||
|
||||
static void AssertMockRequestModel(Models.CreateFundAppMerchantTransferBillRequest request, Func<string, string> decryptor)
|
||||
{
|
||||
Assert.NotEqual(MOCK_PLAIN_STR, request.UserName!);
|
||||
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.UserName!));
|
||||
Assert.Equal(MOCK_CERT_SN, request.WechatpaySerialNumber!, 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.ExecuteCreateFundAppMerchantTransferBillAsync(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.ExecuteCreateFundAppMerchantTransferBillAsync(request);
|
||||
AssertMockRequestModel(request, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, (EncodedString)cipher)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /marketing/membercard-open/cards/{card_id}/phone-membercard/import)")]
|
||||
public async Task TestEncryptRequestSensitiveProperty_ImportMarketingMemberCardOpenCardPhoneRequest()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user