|
| 1 | +package samples.VisaBankAccountValidation; |
| 2 | + |
| 3 | +import Api.BankAccountValidationApi; |
| 4 | +import Data.ConfigurationForBankAccountValidation; |
| 5 | +import Invokers.ApiClient; |
| 6 | +import Invokers.ApiException; |
| 7 | +import Model.*; |
| 8 | +import com.cybersource.authsdk.core.MerchantConfig; |
| 9 | + |
| 10 | +import java.lang.invoke.MethodHandles; |
| 11 | +import java.util.Properties; |
| 12 | + |
| 13 | +// 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. |
| 14 | +//MLE is supported only on the JWT authentication type |
| 15 | +// For additional configuration options related to MLE, refer to the documentation at https://github.com/CyberSource/cybersource-rest-client-java/blob/master/MLE.md |
| 16 | +// For MLE related sample codes look in the folder samples/MLEFeature |
| 17 | +public class BankAccountValidationValidated { |
| 18 | + private static String responseCode = null; |
| 19 | + private static String status = null; |
| 20 | + private static Properties merchantProp; |
| 21 | + public static boolean userCapture = false; |
| 22 | + |
| 23 | + public static void WriteLogAudit(int status) { |
| 24 | + String filename = MethodHandles.lookup().lookupClass().getSimpleName(); |
| 25 | + System.out.println("[Sample Code Testing] [" + filename + "] " + status); |
| 26 | + } |
| 27 | + |
| 28 | + public static void main(String args[]) throws Exception { |
| 29 | + run(); |
| 30 | + } |
| 31 | + |
| 32 | + public static InlineResponse20013 run() { |
| 33 | + |
| 34 | + AccountValidationsRequest accountValidationRequestObj = new AccountValidationsRequest(); |
| 35 | + |
| 36 | + Bavsv1accountvalidationsClientReferenceInformation clientReferenceInformation = new Bavsv1accountvalidationsClientReferenceInformation(); |
| 37 | + clientReferenceInformation.code("TC50171_100"); |
| 38 | + accountValidationRequestObj.clientReferenceInformation(clientReferenceInformation); |
| 39 | + |
| 40 | + Bavsv1accountvalidationsProcessingInformation processingInformation = new Bavsv1accountvalidationsProcessingInformation(); |
| 41 | + processingInformation.validationLevel(1); |
| 42 | + accountValidationRequestObj.processingInformation(processingInformation); |
| 43 | + |
| 44 | + Bavsv1accountvalidationsPaymentInformationBankAccount paymentInformationBankAccount = new Bavsv1accountvalidationsPaymentInformationBankAccount(); |
| 45 | + paymentInformationBankAccount.number("99970"); |
| 46 | + Bavsv1accountvalidationsPaymentInformationBank paymentInformationBank = new Bavsv1accountvalidationsPaymentInformationBank(); |
| 47 | + paymentInformationBank.routingNumber("041210163"); |
| 48 | + paymentInformationBank.account(paymentInformationBankAccount); |
| 49 | + Bavsv1accountvalidationsPaymentInformation paymentInformation = new Bavsv1accountvalidationsPaymentInformation(); |
| 50 | + paymentInformation.bank(paymentInformationBank); |
| 51 | + accountValidationRequestObj.paymentInformation(paymentInformation); |
| 52 | + |
| 53 | + InlineResponse20013 result = null; |
| 54 | + try { |
| 55 | + merchantProp = ConfigurationForBankAccountValidation.getMerchantDetailsForBankAccountValidation(); |
| 56 | + ApiClient apiClient = new ApiClient(); |
| 57 | + MerchantConfig merchantConfig = new MerchantConfig(merchantProp); |
| 58 | + apiClient.merchantConfig = merchantConfig; |
| 59 | + BankAccountValidationApi apiInstance = new BankAccountValidationApi(apiClient); |
| 60 | + result = apiInstance.bankAccountValidationRequest(accountValidationRequestObj); |
| 61 | + |
| 62 | + responseCode = apiClient.responseCode; |
| 63 | + status = apiClient.status; |
| 64 | + System.out.println("ResponseCode :" + responseCode); |
| 65 | + System.out.println("ResponseMessage :" + status); |
| 66 | + System.out.println(result); |
| 67 | + WriteLogAudit(Integer.parseInt(responseCode)); |
| 68 | + |
| 69 | + } catch (ApiException e) { |
| 70 | + e.printStackTrace(); |
| 71 | + WriteLogAudit(e.getCode()); |
| 72 | + } catch (Exception e) { |
| 73 | + e.printStackTrace(); |
| 74 | + } |
| 75 | + return result; |
| 76 | + } |
| 77 | +} |
0 commit comments