ProductAccount
Disable Dedicate Account
URL
domain + /order/thirdFacade/account/disableDedicatedAccount
REQUEST
| PARAMETER | TYPE | REQUIRED | MAX LENGTH | DESCRIPTION | EXAMPLE VALUE |
|---|---|---|---|---|---|
| merchantUserId | String | true | 255 | Merchant user ID | 18 |
| phoneNumber | String | true | 20 | Merchant user's phone number | 78901234567 |
| idNumber | String | true | 64 | Merchant user's ID number | 12345678890764333 |
| idNumberType | Integer | true | 2 | 1:bvn 2:nin |
1 |
| accountNumber | String | true | 20 | Account number | 90812345661 |
RESPONSE
| PARAMETER | TYPE | DESCRIPTION |
|---|---|---|
| data | Boolean | true or false |
Implementation method
SDK
public static void main(String[] args) {
// Create an instance of the AccountBean with the DeepxinPayConfig implementation
AccountBean accountBean = new AccountBean(new DeepxinPayConfig() {
@Override
public String getMerchantCode() {
return "Your merchant code";
}
@Override
public String getPublicKey() {
return "Your public key";
}
@Override
public String getPrivateKey() {
return "Your private key";
}
@Override
public String getServerAddress() {
return "https://tenn.deepxin.com";
}
});
// Create a DisableDedicatedAccountParam instance
DisableDedicatedAccountParam param = DisableDedicatedAccountParam.builder()
.merchantUserId("11112023101909873")
.phoneNumber("78901238901")
.idNumber("12345678901")
.accountNumber("90812345661")
.build();
// Make a request to obtain the URL of the payment page
R<Boolean> disableDedicatedAccount = accountBean.disableDedicatedAccount(param);
// Get the transactionNumber from the response data
Boolean result = disableDedicatedAccount.getData();
System.out.println("disableDedicatedAccount result: " + result);
}
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/disableDedicatedAccount";
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("merchantUserId", "11112023101909873");
paramMap.put("phoneNumber", "78901238901");
paramMap.put("idNumber", "12345678901");
paramMap.put("idNumberType", 1);
paramMap.put("accountNumber", "90812345661");
return paramMap;
}