Search in sources :

Example 1 with BankAccountModel

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

the class AbstractSellerModelToHyperwalletBankAccount method fillIndividualAttributes.

private void fillIndividualAttributes(final HyperwalletBankAccount hyperwalletBankAccount, final SellerModel source) {
    final BankAccountModel bankAccountDetails = source.getBankAccountDetails();
    hyperwalletBankAccount.setFirstName(bankAccountDetails.getFirstName());
    hyperwalletBankAccount.setLastName(bankAccountDetails.getLastName());
}
Also used : IBANBankAccountModel(com.paypal.sellers.bankaccountextract.model.IBANBankAccountModel) BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel)

Example 2 with BankAccountModel

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

the class AbstractSellerModelToHyperwalletBankAccount method execute.

@Override
public HyperwalletBankAccount execute(final SellerModel source) {
    final BankAccountModel bankAccountDetails = source.getBankAccountDetails();
    if (Objects.isNull(bankAccountDetails)) {
        return null;
    }
    final HyperwalletBankAccount hyperwalletBankAccount = new HyperwalletBankAccount();
    hyperwalletBankAccount.setAddressLine1(bankAccountDetails.getAddressLine1());
    hyperwalletBankAccount.setAddressLine2(bankAccountDetails.getAddressLine2());
    hyperwalletBankAccount.setBankAccountId(bankAccountDetails.getBankAccountNumber());
    hyperwalletBankAccount.setTransferMethodCountry(bankAccountDetails.getTransferMethodCountry());
    hyperwalletBankAccount.setTransferMethodCurrency(bankAccountDetails.getTransferMethodCurrency());
    hyperwalletBankAccount.setType(HyperwalletBankAccount.Type.valueOf(bankAccountDetails.getTransferType().name()));
    hyperwalletBankAccount.setCountry(bankAccountDetails.getCountry());
    hyperwalletBankAccount.setCity(bankAccountDetails.getCity());
    hyperwalletBankAccount.setUserToken(source.getToken());
    hyperwalletBankAccount.setProfileType(ProfileType.valueOf(source.getProfileType().name()));
    hyperwalletBankAccount.setToken(bankAccountDetails.getToken());
    if (SellerProfileType.BUSINESS.equals(source.getProfileType())) {
        fillProfessionalAttributes(hyperwalletBankAccount, source);
    } else {
        fillIndividualAttributes(hyperwalletBankAccount, source);
    }
    return hyperwalletBankAccount;
}
Also used : HyperwalletBankAccount(com.hyperwallet.clientsdk.model.HyperwalletBankAccount) IBANBankAccountModel(com.paypal.sellers.bankaccountextract.model.IBANBankAccountModel) BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel)

Example 3 with BankAccountModel

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

the class MiraklShopToUKBankAccountModelConverterStrategyTest method convert_ShouldTransformFromMiraklShopToUkBankAccountModel.

@Test
void convert_ShouldTransformFromMiraklShopToUkBankAccountModel() {
    when(miraklShopMock.getContactInformation()).thenReturn(contactInformationMock);
    when(miraklShopMock.getPaymentInformation()).thenReturn(miraklUKBankAccountInformationMock);
    when(miraklShopMock.getCurrencyIsoCode()).thenReturn(MiraklIsoCurrencyCode.GBP);
    when(miraklShopMock.getProfessionalInformation()).thenReturn(miraklProfessionalInformationMock);
    when(miraklShopMock.getAdditionalFieldValues()).thenReturn(List.of(miraklBankAccountTokenFieldValueMock, 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(miraklUKBankAccountInformationMock.getBankCity()).thenReturn(CITY_NAME);
    when(contactInformationMock.getCountry()).thenReturn(GB_COUNTRY);
    when(miraklUKBankAccountInformationMock.getBankAccountNumber()).thenReturn(BANK_ACCOUNT_NUMBER);
    when(miraklUKBankAccountInformationMock.getBankSortCode()).thenReturn(SORT_CODE);
    when(miraklProfessionalInformationMock.getCorporateName()).thenReturn(BUSINESS_NAME);
    final BankAccountModel result = testObj.execute(miraklShopMock);
    // @formatter:off
    assertThat(result).hasFieldOrPropertyWithValue("transferMethodCountry", UK_COUNTRY_ISO).hasFieldOrPropertyWithValue("transferMethodCurrency", GBP_CURRENCY).hasFieldOrPropertyWithValue("transferType", TransferType.BANK_ACCOUNT).hasFieldOrPropertyWithValue("type", BankAccountType.UK).hasFieldOrPropertyWithValue("bankAccountId", SORT_CODE).hasFieldOrPropertyWithValue("bankAccountNumber", BANK_ACCOUNT_NUMBER).hasFieldOrPropertyWithValue("businessName", BUSINESS_NAME).hasFieldOrPropertyWithValue("firstName", FIRST_NAME).hasFieldOrPropertyWithValue("lastName", LAST_NAME).hasFieldOrPropertyWithValue("country", UK_COUNTRY_ISO).hasFieldOrPropertyWithValue("addressLine1", STREET_1).hasFieldOrPropertyWithValue("addressLine2", STREET_2).hasFieldOrPropertyWithValue("city", CITY_NAME).hasFieldOrPropertyWithValue("stateProvince", STATE).hasFieldOrPropertyWithValue("token", TOKEN).hasFieldOrPropertyWithValue("hyperwalletProgram", HYPERWALLET_PROGRAM);
// @formatter:on
}
Also used : BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel) Test(org.junit.jupiter.api.Test)

Example 4 with BankAccountModel

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

the class MiraklShopToUKBankAccountModelConverterStrategyTest method convert_shouldEnsureThatOptionalFieldLineAddress2IsFilledWithAnEmptyString.

@Test
void convert_shouldEnsureThatOptionalFieldLineAddress2IsFilledWithAnEmptyString() {
    when(miraklShopMock.getContactInformation()).thenReturn(contactInformationMock);
    when(miraklShopMock.getPaymentInformation()).thenReturn(miraklUKBankAccountInformationMock);
    when(miraklShopMock.getCurrencyIsoCode()).thenReturn(MiraklIsoCurrencyCode.GBP);
    when(miraklShopMock.getProfessionalInformation()).thenReturn(miraklProfessionalInformationMock);
    when(miraklShopMock.getAdditionalFieldValues()).thenReturn(List.of(miraklBankAccountTokenFieldValueMock, miraklHyperwalletProgramFieldValueMock));
    when(miraklBankAccountTokenFieldValueMock.getCode()).thenReturn(HYPERWALLET_BANK_ACCOUNT_TOKEN);
    when(miraklBankAccountTokenFieldValueMock.getValue()).thenReturn(TOKEN);
    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(GB_COUNTRY);
    when(miraklUKBankAccountInformationMock.getBankSortCode()).thenReturn(SORT_CODE);
    when(miraklUKBankAccountInformationMock.getBankAccountNumber()).thenReturn(BANK_ACCOUNT_NUMBER);
    when(miraklUKBankAccountInformationMock.getBankCity()).thenReturn(CITY_NAME);
    when(miraklProfessionalInformationMock.getCorporateName()).thenReturn(BUSINESS_NAME);
    final BankAccountModel result = testObj.execute(miraklShopMock);
    // @formatter:off
    assertThat(result).hasFieldOrPropertyWithValue("transferMethodCountry", UK_COUNTRY_ISO).hasFieldOrPropertyWithValue("transferMethodCurrency", GBP_CURRENCY).hasFieldOrPropertyWithValue("transferType", TransferType.BANK_ACCOUNT).hasFieldOrPropertyWithValue("type", BankAccountType.UK).hasFieldOrPropertyWithValue("bankAccountId", SORT_CODE).hasFieldOrPropertyWithValue("bankAccountNumber", BANK_ACCOUNT_NUMBER).hasFieldOrPropertyWithValue("businessName", BUSINESS_NAME).hasFieldOrPropertyWithValue("firstName", FIRST_NAME).hasFieldOrPropertyWithValue("lastName", LAST_NAME).hasFieldOrPropertyWithValue("country", UK_COUNTRY_ISO).hasFieldOrPropertyWithValue("addressLine1", STREET_1).hasFieldOrPropertyWithValue("addressLine2", StringUtils.EMPTY).hasFieldOrPropertyWithValue("city", CITY_NAME).hasFieldOrPropertyWithValue("token", TOKEN).hasFieldOrPropertyWithValue("hyperwalletProgram", HYPERWALLET_PROGRAM);
// @formatter:on
}
Also used : BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel) Test(org.junit.jupiter.api.Test)

Example 5 with BankAccountModel

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

the class AbstractMiraklShopToSellerModelConverter method getCommonFieldsBuilder.

protected SellerModel.SellerModelBuilder getCommonFieldsBuilder(final MiraklShop source) {
    final MiraklContactInformation contactInformation = source.getContactInformation();
    final List<MiraklAdditionalFieldValue> additionalFieldValues = source.getAdditionalFieldValues();
    final BankAccountModel bankAccountModel = miraklShopBankAccountModelStrategyExecutor.execute(source);
    // @formatter:off
    return SellerModel.builder().clientUserId(source.getId()).businessName(source.getName()).firstName(contactInformation.getFirstname()).lastName(contactInformation.getLastname()).phoneNumber(contactInformation.getPhone()).mobilePhone(contactInformation.getPhoneSecondary()).email(contactInformation.getEmail()).addressLine1(contactInformation.getStreet1()).addressLine2(contactInformation.getStreet2()).city(contactInformation.getCity()).postalCode(contactInformation.getZipCode()).stateProvince(contactInformation.getState()).country(contactInformation.getCountry()).timeZone(sellersMiraklApiConfig.getTimeZone()).dateOfBirth(additionalFieldValues).passportId(additionalFieldValues).countryOfBirth(additionalFieldValues).countryOfNationality(additionalFieldValues).governmentId(additionalFieldValues).governmentIdType(additionalFieldValues).driversLicenseId(additionalFieldValues).businessType(additionalFieldValues).token(additionalFieldValues).bankAccountDetails(bankAccountModel).hwTermsConsent(additionalFieldValues).hyperwalletProgram(additionalFieldValues);
// @formatter:on
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) MiraklContactInformation(com.mirakl.client.mmp.domain.shop.MiraklContactInformation) BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel)

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