Search in sources :

Example 1 with MiraklAbaBankAccountInformation

use of com.mirakl.client.mmp.domain.shop.bank.MiraklAbaBankAccountInformation in project mirakl-hyperwallet-connector by paypal.

the class MiraklShopToABABankAccountModelConverterStrategy method execute.

/**
 * {@inheritDoc}
 */
@Override
public ABABankAccountModel execute(@NonNull final MiraklShop source) {
    final MiraklPaymentInformation paymentInformation = source.getPaymentInformation();
    final MiraklAbaBankAccountInformation miraklAbaBankAccountInformation = (MiraklAbaBankAccountInformation) paymentInformation;
    final MiraklContactInformation contactInformation = source.getContactInformation();
    // @formatter:off
    return ABABankAccountModel.builder().transferMethodCountry(contactInformation.getCountry()).branchId(miraklAbaBankAccountInformation.getRoutingNumber()).bankAccountPurpose(BankAccountPurposeType.CHECKING.name()).transferMethodCurrency(source.getCurrencyIsoCode().name()).transferType(TransferType.BANK_ACCOUNT).type(BankAccountType.ABA).bankAccountNumber(miraklAbaBankAccountInformation.getBankAccountNumber()).businessName(Optional.ofNullable(source.getProfessionalInformation()).map(MiraklProfessionalInformation::getCorporateName).orElse(null)).firstName(contactInformation.getFirstname()).lastName(contactInformation.getLastname()).country(contactInformation.getCountry()).city(miraklAbaBankAccountInformation.getBankCity()).stateProvince(source.getAdditionalFieldValues()).postalCode(miraklAbaBankAccountInformation.getBankZip()).addressLine1(contactInformation.getStreet1()).addressLine2(Optional.ofNullable(contactInformation.getStreet2()).orElse(StringUtils.EMPTY)).token(source.getAdditionalFieldValues()).hyperwalletProgram(source.getAdditionalFieldValues()).build();
// @formatter:on
}
Also used : MiraklContactInformation(com.mirakl.client.mmp.domain.shop.MiraklContactInformation) MiraklPaymentInformation(com.mirakl.client.mmp.domain.shop.bank.MiraklPaymentInformation) MiraklAbaBankAccountInformation(com.mirakl.client.mmp.domain.shop.bank.MiraklAbaBankAccountInformation)

Aggregations

MiraklContactInformation (com.mirakl.client.mmp.domain.shop.MiraklContactInformation)1 MiraklAbaBankAccountInformation (com.mirakl.client.mmp.domain.shop.bank.MiraklAbaBankAccountInformation)1 MiraklPaymentInformation (com.mirakl.client.mmp.domain.shop.bank.MiraklPaymentInformation)1