Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/main/java/Data/ConfigurationForBankAccountValidation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package Data;

import java.util.Properties;

public class ConfigurationForBankAccountValidation {
public static Properties getMerchantDetailsForBankAccountValidation() {

Properties props = new Properties();

// MLE (Message Level Encryption) is only supported with JWT authentication. For the Bank Account Validation API, MLE is mandatory, and the SDK defaults to encrypted requests for such APIs.
props.setProperty("authenticationType", "JWT");
props.setProperty("merchantID", "testcasmerchpd01001");
props.setProperty("runEnvironment", "apitest.cybersource.com");

// JWT Parameters
props.setProperty("keyAlias", "testcasmerchpd01001");
props.setProperty("keyPass", "Authnet101!");
props.setProperty("keyFileName", "testcasmerchpd01001");
// P12 key path. Enter the folder path where the .p12 file is located.
props.setProperty("keysDirectory", "src/main/resources");

return props;

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package samples.VisaBankAccountValidation;

import Api.BankAccountValidationApi;
import Data.ConfigurationForBankAccountValidation;
import Invokers.ApiClient;
import Invokers.ApiException;
import Model.*;
import com.cybersource.authsdk.core.MerchantConfig;

import java.lang.invoke.MethodHandles;
import java.util.Properties;

// The Bank Account Validation API requires encrypted requests as a mandatory requirement. The SDK by default sends encrypted requests for APIs where Request MLE (Message Level Encryption) is mandatory.
//MLE is supported only on the JWT authentication type
// For additional configuration options related to MLE, refer to the documentation at https://github.com/CyberSource/cybersource-rest-client-java/blob/master/MLE.md
// For MLE related sample codes look in the folder samples/MLEFeature
public class BankAccountValidationValidated {
private static String responseCode = null;
private static String status = null;
private static Properties merchantProp;
public static boolean userCapture = false;

public static void WriteLogAudit(int status) {
String filename = MethodHandles.lookup().lookupClass().getSimpleName();
System.out.println("[Sample Code Testing] [" + filename + "] " + status);
}

public static void main(String args[]) throws Exception {
run();
}

public static InlineResponse20013 run() {

AccountValidationsRequest accountValidationRequestObj = new AccountValidationsRequest();

Bavsv1accountvalidationsClientReferenceInformation clientReferenceInformation = new Bavsv1accountvalidationsClientReferenceInformation();
clientReferenceInformation.code("TC50171_100");
accountValidationRequestObj.clientReferenceInformation(clientReferenceInformation);

Bavsv1accountvalidationsProcessingInformation processingInformation = new Bavsv1accountvalidationsProcessingInformation();
processingInformation.validationLevel(1);
accountValidationRequestObj.processingInformation(processingInformation);

Bavsv1accountvalidationsPaymentInformationBankAccount paymentInformationBankAccount = new Bavsv1accountvalidationsPaymentInformationBankAccount();
paymentInformationBankAccount.number("99970");
Bavsv1accountvalidationsPaymentInformationBank paymentInformationBank = new Bavsv1accountvalidationsPaymentInformationBank();
paymentInformationBank.routingNumber("041210163");
paymentInformationBank.account(paymentInformationBankAccount);
Bavsv1accountvalidationsPaymentInformation paymentInformation = new Bavsv1accountvalidationsPaymentInformation();
paymentInformation.bank(paymentInformationBank);
accountValidationRequestObj.paymentInformation(paymentInformation);

InlineResponse20013 result = null;
try {
merchantProp = ConfigurationForBankAccountValidation.getMerchantDetailsForBankAccountValidation();
ApiClient apiClient = new ApiClient();
MerchantConfig merchantConfig = new MerchantConfig(merchantProp);
apiClient.merchantConfig = merchantConfig;
BankAccountValidationApi apiInstance = new BankAccountValidationApi(apiClient);
result = apiInstance.bankAccountValidationRequest(accountValidationRequestObj);

responseCode = apiClient.responseCode;
status = apiClient.status;
System.out.println("ResponseCode :" + responseCode);
System.out.println("ResponseMessage :" + status);
System.out.println(result);
WriteLogAudit(Integer.parseInt(responseCode));

} catch (ApiException e) {
e.printStackTrace();
WriteLogAudit(e.getCode());
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
Binary file added src/main/resources/testcasmerchpd01001.p12
Binary file not shown.