-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCheckBankCardInformation.java
43 lines (33 loc) · 1.83 KB
/
CheckBankCardInformation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.tencentcloud.faceid.example;
import com.alibaba.fastjson.JSON;
import com.tencentcloud.faceid.core.Algorithm;
import com.tencentcloud.faceid.CryptoUtil;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
import com.tencentcloudapi.faceid.v20180301.models.CheckBankCardInformationRequest;
import com.tencentcloudapi.faceid.v20180301.models.CheckBankCardInformationResponse;
import java.util.HashMap;
import java.util.Map;
/**
* 银行卡基础信息查询
*/
public class CheckBankCardInformation {
private static final String REGION = "ap-guangzhou";
private static final String SECRET_ID = ""; // TODO 腾讯云密钥
private static final String SECRET_KEY = ""; // TODO 腾讯云密钥
private static final Algorithm algorithm = Algorithm.SM4GCM; // 选择加密算法 Algorithm.AES256CBC、Algorithm.SM4GCM
public static void main(String[] args) throws Exception {
// Step 1. 组装加密参数并对敏感数据加密
Map<String, String> m = new HashMap<>();
m.put("BankCard", "9802897613438987");
String reqJson = JSON.toJSONString(CryptoUtil.encrypt(algorithm, null, m));
System.out.println("req json: " + reqJson);
// Step 2. 使用Tencent Cloud API SDK组装请求体,填充参数
Credential credential = new Credential(SECRET_ID, SECRET_KEY);
FaceidClient faceidClient = new FaceidClient(credential, REGION);
CheckBankCardInformationRequest request = CheckBankCardInformationRequest.fromJsonString(reqJson, CheckBankCardInformationRequest.class);
// Step 3. 调用接口
CheckBankCardInformationResponse response = faceidClient.CheckBankCardInformation(request);
System.out.println("SDK response: " + CheckBankCardInformationResponse.toJsonString(response));
}
}