Search in sources :

Example 6 with BankAccountModel

use of com.paypal.sellers.bankaccountextract.model.BankAccountModel in project mirakl-hyperwallet-connector by paypal.

the class MiraklShopToCanadianBankAccountModelConverterStrategyTest method execute_ShouldTransformFromMiraklShopToCanadianAccountModel.

@Test
void execute_ShouldTransformFromMiraklShopToCanadianAccountModel() {
    when(miraklShopMock.getContactInformation()).thenReturn(contactInformationMock);
    when(miraklShopMock.getPaymentInformation()).thenReturn(miraklCanadianBankAccountInformationMock);
    when(miraklShopMock.getCurrencyIsoCode()).thenReturn(MiraklIsoCurrencyCode.USD);
    when(miraklShopMock.getProfessionalInformation()).thenReturn(miraklProfessionalInformationMock);
    when(miraklShopMock.getAdditionalFieldValues()).thenReturn(List.of(miraklBankAccountTokenFieldValueMock, miraklBankAccountStateFieldValueMock, miraklBankAccountStateFieldValueMock, miraklHyperwalletProgramFieldValueMock));
    when(miraklBankAccountTokenFieldValueMock.getCode()).thenReturn(HYPERWALLET_BANK_ACCOUNT_TOKEN);
    when(miraklBankAccountTokenFieldValueMock.getValue()).thenReturn(TOKEN);
    when(miraklBankAccountStateFieldValueMock.getCode()).thenReturn(HYPERWALLET_BANK_ACCOUNT_STATE);
    when(miraklBankAccountStateFieldValueMock.getValue()).thenReturn(STATE);
    when(miraklHyperwalletProgramFieldValueMock.getCode()).thenReturn(SellerModelConstants.HYPERWALLET_PROGRAM);
    when(miraklHyperwalletProgramFieldValueMock.getValue()).thenReturn(HYPERWALLET_PROGRAM);
    when(contactInformationMock.getFirstname()).thenReturn(FIRST_NAME);
    when(contactInformationMock.getLastname()).thenReturn(LAST_NAME);
    when(contactInformationMock.getStreet1()).thenReturn(STREET_1);
    when(contactInformationMock.getStreet2()).thenReturn(STREET_2);
    when(contactInformationMock.getCountry()).thenReturn(COUNTRY);
    when(miraklCanadianBankAccountInformationMock.getInstitutionNumber()).thenReturn(INSTITUTION_NUMBER);
    when(miraklCanadianBankAccountInformationMock.getTransitNumber()).thenReturn(TRANSIT_NUMBER);
    when(miraklCanadianBankAccountInformationMock.getBankCity()).thenReturn(CITY_NAME);
    when(miraklCanadianBankAccountInformationMock.getBankAccountNumber()).thenReturn(BANK_ACCOUNT_NUMBER);
    when(miraklProfessionalInformationMock.getCorporateName()).thenReturn(BUSINESS_NAME);
    final BankAccountModel result = testObj.execute(miraklShopMock);
    // @formatter:off
    assertThat(result).hasFieldOrPropertyWithValue("transferMethodCountry", USA_COUNTRY_ISO).hasFieldOrPropertyWithValue("transferMethodCurrency", USD_CURRENCY).hasFieldOrPropertyWithValue("transferType", TransferType.BANK_ACCOUNT).hasFieldOrPropertyWithValue("type", BankAccountType.CANADIAN).hasFieldOrPropertyWithValue("businessName", BUSINESS_NAME).hasFieldOrPropertyWithValue("firstName", FIRST_NAME).hasFieldOrPropertyWithValue("lastName", LAST_NAME).hasFieldOrPropertyWithValue("country", USA_COUNTRY_ISO).hasFieldOrPropertyWithValue("addressLine1", STREET_1).hasFieldOrPropertyWithValue("addressLine2", STREET_2).hasFieldOrPropertyWithValue("stateProvince", STATE).hasFieldOrPropertyWithValue("token", TOKEN).hasFieldOrPropertyWithValue("branchId", TRANSIT_NUMBER).hasFieldOrPropertyWithValue("bankId", INSTITUTION_NUMBER).hasFieldOrPropertyWithValue("bankAccountNumber", BANK_ACCOUNT_NUMBER).hasFieldOrPropertyWithValue("city", CITY_NAME).hasFieldOrPropertyWithValue("hyperwalletProgram", HYPERWALLET_PROGRAM);
// @formatter:on
}
Also used : BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel) Test(org.junit.jupiter.api.Test)

Example 7 with BankAccountModel

use of com.paypal.sellers.bankaccountextract.model.BankAccountModel in project mirakl-hyperwallet-connector by paypal.

the class MiraklShopToCanadianBankAccountModelConverterStrategyTest method execute_shouldEnsureThatOptionalFieldLineAddress2IsFilledWithAnEmptyString.

@Test
void execute_shouldEnsureThatOptionalFieldLineAddress2IsFilledWithAnEmptyString() {
    when(miraklShopMock.getContactInformation()).thenReturn(contactInformationMock);
    when(miraklShopMock.getPaymentInformation()).thenReturn(miraklCanadianBankAccountInformationMock);
    when(miraklShopMock.getCurrencyIsoCode()).thenReturn(MiraklIsoCurrencyCode.USD);
    when(miraklShopMock.getProfessionalInformation()).thenReturn(miraklProfessionalInformationMock);
    when(miraklShopMock.getAdditionalFieldValues()).thenReturn(List.of(miraklBankAccountTokenFieldValueMock, miraklBankAccountStateFieldValueMock, miraklBankAccountStateFieldValueMock, miraklHyperwalletProgramFieldValueMock));
    when(miraklBankAccountTokenFieldValueMock.getCode()).thenReturn(HYPERWALLET_BANK_ACCOUNT_TOKEN);
    when(miraklBankAccountTokenFieldValueMock.getValue()).thenReturn(TOKEN);
    when(miraklBankAccountStateFieldValueMock.getCode()).thenReturn(HYPERWALLET_BANK_ACCOUNT_STATE);
    when(miraklBankAccountStateFieldValueMock.getValue()).thenReturn(STATE);
    when(miraklHyperwalletProgramFieldValueMock.getCode()).thenReturn(SellerModelConstants.HYPERWALLET_PROGRAM);
    when(miraklHyperwalletProgramFieldValueMock.getValue()).thenReturn(HYPERWALLET_PROGRAM);
    when(contactInformationMock.getFirstname()).thenReturn(FIRST_NAME);
    when(contactInformationMock.getLastname()).thenReturn(LAST_NAME);
    when(contactInformationMock.getStreet1()).thenReturn(STREET_1);
    when(contactInformationMock.getStreet2()).thenReturn(null);
    when(contactInformationMock.getCountry()).thenReturn(COUNTRY);
    when(miraklCanadianBankAccountInformationMock.getInstitutionNumber()).thenReturn(INSTITUTION_NUMBER);
    when(miraklCanadianBankAccountInformationMock.getTransitNumber()).thenReturn(TRANSIT_NUMBER);
    when(miraklCanadianBankAccountInformationMock.getBankCity()).thenReturn(CITY_NAME);
    when(miraklCanadianBankAccountInformationMock.getBankAccountNumber()).thenReturn(BANK_ACCOUNT_NUMBER);
    when(miraklProfessionalInformationMock.getCorporateName()).thenReturn(BUSINESS_NAME);
    final BankAccountModel result = testObj.execute(miraklShopMock);
    // @formatter:off
    assertThat(result).hasFieldOrPropertyWithValue("transferMethodCountry", USA_COUNTRY_ISO).hasFieldOrPropertyWithValue("transferMethodCurrency", USD_CURRENCY).hasFieldOrPropertyWithValue("transferType", TransferType.BANK_ACCOUNT).hasFieldOrPropertyWithValue("type", BankAccountType.CANADIAN).hasFieldOrPropertyWithValue("businessName", BUSINESS_NAME).hasFieldOrPropertyWithValue("firstName", FIRST_NAME).hasFieldOrPropertyWithValue("lastName", LAST_NAME).hasFieldOrPropertyWithValue("country", USA_COUNTRY_ISO).hasFieldOrPropertyWithValue("addressLine1", STREET_1).hasFieldOrPropertyWithValue("addressLine2", StringUtils.EMPTY).hasFieldOrPropertyWithValue("stateProvince", STATE).hasFieldOrPropertyWithValue("token", TOKEN).hasFieldOrPropertyWithValue("branchId", TRANSIT_NUMBER).hasFieldOrPropertyWithValue("bankId", INSTITUTION_NUMBER).hasFieldOrPropertyWithValue("bankAccountNumber", BANK_ACCOUNT_NUMBER).hasFieldOrPropertyWithValue("city", CITY_NAME).hasFieldOrPropertyWithValue("hyperwalletProgram", HYPERWALLET_PROGRAM);
// @formatter:on
}
Also used : BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel) Test(org.junit.jupiter.api.Test)

Example 8 with BankAccountModel

use of com.paypal.sellers.bankaccountextract.model.BankAccountModel in project mirakl-hyperwallet-connector by paypal.

the class MiraklToBankAccountModelExecutorTest method execute_shouldReturnNullWhenNoPaymentDetailsIsDefined.

@Test
void execute_shouldReturnNullWhenNoPaymentDetailsIsDefined() {
    final BankAccountModel result = testObj.execute(miraklShopMock);
    assertThat(result).isNull();
}
Also used : BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel) Test(org.junit.jupiter.api.Test)

Aggregations

BankAccountModel (com.paypal.sellers.bankaccountextract.model.BankAccountModel)8 Test (org.junit.jupiter.api.Test)5 IBANBankAccountModel (com.paypal.sellers.bankaccountextract.model.IBANBankAccountModel)2 HyperwalletBankAccount (com.hyperwallet.clientsdk.model.HyperwalletBankAccount)1 MiraklAdditionalFieldValue (com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue)1 MiraklContactInformation (com.mirakl.client.mmp.domain.shop.MiraklContactInformation)1