feat(tenpayv3): 新增商户风险管理相关接口

This commit is contained in:
Fu Diwei
2023-08-11 16:52:42 +08:00
parent 647725ac3d
commit 65970c98e4
27 changed files with 713 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
{
"sp_mchid": "1900000109",
"acquiring_bank_id": "1356485",
"channel_id": "1900000108\t",
"sub_mchid": "1900009231",
"out_trade_no": "1217752501201407033233368018",
"risk_type": "OTHER_RISK",
"punish_type": "OTHER_PUNISH",
"additional_punish_type": "SUSPEND_SETTLEMENT_NDAYS:10",
"complaints_information": "商家说高额返利,支付很大金额之后发现并没有返利,是骗子"
}

View File

@@ -0,0 +1,11 @@
{
"sp_mchid": "1900000109",
"acquiring_bank_id": "1356485",
"channel_id": "1900000108",
"sub_mchid": "1900009231",
"out_trade_no": "1217752501201407033233368018",
"risk_type": "OTHER_RISK",
"punish_type": "OTHER_PUNISH",
"additional_punish_type": "SUSPEND_SETTLEMENT_NDAYS:10",
"punish_description": "延长商户账期7天"
}

View File

@@ -0,0 +1,37 @@
{
"sp_mchid": "1900000109",
"acquiring_bank_id": "1356485",
"channel_id": "1900000108",
"sub_mchid": "1900009231",
"out_trade_no": "1217752501201407033233368018",
"openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"phone": "ca775af5f841bdf424b2e6eb86a6e21e",
"certificates_number": "ca775af5f841bdf424b2e6eb86a6e21e",
"client_ip": "123.12.12.123",
"risk_level": 1,
"line_type": 1,
"goods_type": 1,
"seller_type": 1,
"is_need_deliver": false,
"device_type": 1,
"userid": "华为的账号260XXX",
"phone_from": 1,
"seller_userid": "抖音的账号XXXXX",
"scene": 1,
"recharge_fields": {
"account_type": 1,
"account": "example_account"
},
"living_expenses_fields": {
"acc_no": "123456",
"type": 1,
"city": "湖南衡阳",
"address": "广东省深圳市南山区海天二路33号",
"acc_name": "詹讯",
"company_name": "深圳电力",
"amount": 500
},
"extra_fields1": "{\"key1\":\"value1\"}",
"extra_fields2": "{\"key1\":\"value1\"}",
"extra_fields3": "{\"key1\":\"value1\"}"
}

View File

@@ -0,0 +1,7 @@
{
"sp_mchid": "1900000109",
"acquiring_bank_id": "1356485",
"channel_id": "1900000108",
"sub_mchid": "1900009231",
"out_trade_no": "1217752501201407033233368018"
}

View File

@@ -0,0 +1,6 @@
{
"risk_score": 1,
"risk_type": "OTHER_RISK",
"punish_type": "OTHER_PUNISH",
"punish_description": "延长商户账期7天"
}

View File

@@ -653,6 +653,44 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
}
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /merchant-risk-manage/report-trade-union-information")]
public async Task TestEncryptRequestSensitiveProperty_CreateMerchantRiskManageTradeUnionInformationReportRequest()
{
static Models.CreateMerchantRiskManageTradeUnionInformationReportRequest GenerateMockRequestModel()
{
return new Models.CreateMerchantRiskManageTradeUnionInformationReportRequest()
{
PhoneNumber = MOCK_PLAIN_STR,
IdCardNumber = MOCK_PLAIN_STR
};
}
static void AssertMockRequestModel(Models.CreateMerchantRiskManageTradeUnionInformationReportRequest request, Func<string, string> decryptor)
{
Assert.NotEqual(MOCK_PLAIN_STR, request.PhoneNumber!);
Assert.NotEqual(MOCK_PLAIN_STR, request.IdCardNumber!);
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.PhoneNumber!));
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.IdCardNumber!));
Assert.Equal(MOCK_CERT_SN, request.WechatpayCertificateSerialNumber!, ignoreCase: true);
}
var reqA1 = GenerateMockRequestModel();
CreateMockClientUseRSA(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA1);
AssertMockRequestModel(reqA1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
var reqA2 = GenerateMockRequestModel();
CreateMockClientUseSM2(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA2);
AssertMockRequestModel(reqA2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
var reqB1 = GenerateMockRequestModel();
await CreateMockClientUseRSA(autoEncrypt: true).ExecuteCreateMerchantRiskManageTradeUnionInformationReportAsync(reqB1);
AssertMockRequestModel(reqB1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
var reqB2 = GenerateMockRequestModel();
await CreateMockClientUseSM2(autoEncrypt: true).ExecuteCreateMerchantRiskManageTradeUnionInformationReportAsync(reqB2);
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
}
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /merchants")]
public async Task TestEncryptRequestSensitiveProperty_AddHKSubMerchantRequest()
{