ProductAccount
Get Account With TENN
URL
domain + /order/thirdFacade/account/findByAccountNumber
REQUEST
| PARAMETER | TYPE | REQUIRED | MAX LENGTH | DESCRIPTION | EXAMPLE VALUE |
|---|---|---|---|---|---|
| accountNumber | String | true | 11 | tenn account number | 2389656826 |
RESPONSE
| PARAMETER | TYPE | DESCRIPTION |
|---|---|---|
| firstName | String | first name |
| middleName | String | The middle name may be empty. |
| lastName | String | last name |
| accountNumber | String | account number |
| status | Integer | 0:Normal 1: Block 3:Stop collection 4:Stop payment 5:Close |
Implementation method
SDK
AccountBean accountBean = new AccountBean(new DeepxinPayConfig() {
@Override
public String getMerchantCode() {
return "";
}
@Override
public String getPublicKey() {
return "";
}
@Override
public String getPrivateKey() {
return "";
}
@Override
public String getServerAddress() {
return "";
}
});
MerchantAccountQO accountQO = new MerchantAccountQO();
accountQO.setAccountNumber("4364168585");
R byAccountNumber =accountBean.findByAccountNumber(accountQO);
}
HTTP
public static void main(String[] args) {
// Replace with the merchant's public key for either the testing environment or the production environment
String merchantPublicKey = "your public key";
// Replace with the merchant's private key for either the testing environment or the production environment
String merchantPrivateKey = "your private key";
// MerchantCode
String merchantCode = "your merchant code";
// Parameters
Map<String, Object> paramMap = getParamMap();
// Encrypt the parameters using the merchant's public key.
String encryptStr = encryptWithPublicKey(paramMap, merchantPublicKey);
// Sign the encrypted parameters using the merchant's public key.
String sign = sign(encryptStr, merchantPublicKey);
// Get Request parameters
Map<String, Object> requestMap = getRequestMap(encryptStr, merchantCode, sign);
String requestStr = JSONUtil.toJsonStr(requestMap);
String tennServerUrl = "https://tenn.deepxin.com//order/thirdFacade/account/findByAccountNumber";
try {
String result = HttpUtil.post(tennServerUrl, requestStr);
if (!JSONUtil.isTypeJSON(result)) {
System.out.println("Result is not a JSON type.");
return;
}
JSONObject entries = JSONUtil.parseObj(result);
String toDecryptStr = entries.getStr("data");
String responseSign = entries.getStr("sign");
if (SUCCESS_CODE == entries.getInt("code")) {
boolean verifySign = verify(responseSign, toDecryptStr, merchantPublicKey);
if (verifySign) {
String decryptStr = decryptWithPrivateKey(toDecryptStr, merchantPrivateKey);
System.out.println(decryptStr);
} else {
System.out.println("Signature verification failed.");
}
}else{
System.out.println(result);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public static Map<String, Object> getParamMap() {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("accountNumber", "12345678901");
return paramMap;
}