use of com.mirakl.client.mmp.domain.shop.bank.MiraklCanadianBankAccountInformation in project mirakl-hyperwallet-connector by paypal.
the class MiraklShopToCanadianBankAccountModelConverterStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public BankAccountModel execute(final MiraklShop source) {
final MiraklPaymentInformation paymentInformation = source.getPaymentInformation();
final MiraklCanadianBankAccountInformation miraklCanadianBankAccountInformation = (MiraklCanadianBankAccountInformation) paymentInformation;
final MiraklContactInformation contactInformation = source.getContactInformation();
// @formatter:off
return CanadianBankAccountModel.builder().bankId(miraklCanadianBankAccountInformation.getInstitutionNumber()).branchId(miraklCanadianBankAccountInformation.getTransitNumber()).transferMethodCountry(contactInformation.getCountry()).transferMethodCurrency(source.getCurrencyIsoCode().name()).transferType(TransferType.BANK_ACCOUNT).type(BankAccountType.CANADIAN).bankAccountNumber(miraklCanadianBankAccountInformation.getBankAccountNumber()).businessName(Optional.ofNullable(source.getProfessionalInformation()).map(MiraklProfessionalInformation::getCorporateName).orElse(null)).firstName(contactInformation.getFirstname()).lastName(contactInformation.getLastname()).country(contactInformation.getCountry()).city(miraklCanadianBankAccountInformation.getBankCity()).stateProvince(source.getAdditionalFieldValues()).postalCode(miraklCanadianBankAccountInformation.getBankZip()).addressLine1(contactInformation.getStreet1()).addressLine2(Optional.ofNullable(contactInformation.getStreet2()).orElse(StringUtils.EMPTY)).token(source.getAdditionalFieldValues()).hyperwalletProgram(source.getAdditionalFieldValues()).build();
// @formatter:on
}
Aggregations