Search in sources :

Example 11 with HyperwalletBankAccount

use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.

the class AbstractSellerModelToHyperwalletBankAccountConverterTest method convert_shouldAddIndividualAttributes_whenIndividualModelIsReceived.

@Test
void convert_shouldAddIndividualAttributes_whenIndividualModelIsReceived() {
    when(sellerModelMock.getBankAccountDetails()).thenReturn(IBANBankAccountModelMock);
    when(IBANBankAccountModelMock.getAddressLine1()).thenReturn(ADDRESS_LINE_ONE);
    when(IBANBankAccountModelMock.getAddressLine2()).thenReturn(ADDRESS_LINE_TWO);
    when(IBANBankAccountModelMock.getBankAccountNumber()).thenReturn(IBAN_ACCOUNT);
    when(IBANBankAccountModelMock.getTransferMethodCountry()).thenReturn(COUNTRY);
    when(IBANBankAccountModelMock.getTransferMethodCurrency()).thenReturn(CURRENCY);
    when(IBANBankAccountModelMock.getTransferType()).thenReturn(TransferType.BANK_ACCOUNT);
    when(IBANBankAccountModelMock.getCountry()).thenReturn(COUNTRY);
    when(IBANBankAccountModelMock.getCity()).thenReturn(CITY);
    when(sellerModelMock.getToken()).thenReturn(USER_TOKEN);
    when(sellerModelMock.getProfileType()).thenReturn(SellerProfileType.INDIVIDUAL);
    when(IBANBankAccountModelMock.getFirstName()).thenReturn(FIRST_NAME);
    when(IBANBankAccountModelMock.getLastName()).thenReturn(SECOND_NAME);
    when(IBANBankAccountModelMock.getToken()).thenReturn(BANK_ACCOUNT_TOKEN);
    final HyperwalletBankAccount result = testObj.execute(sellerModelMock);
    assertThat(result.getAddressLine1()).isEqualTo(ADDRESS_LINE_ONE);
    assertThat(result.getAddressLine2()).isEqualTo(ADDRESS_LINE_TWO);
    assertThat(result.getBankAccountId()).isEqualTo(IBAN_ACCOUNT);
    assertThat(result.getTransferMethodCountry()).isEqualTo(COUNTRY);
    assertThat(result.getTransferMethodCurrency()).isEqualTo(CURRENCY);
    assertThat(result.getType()).isEqualTo(HyperwalletBankAccount.Type.BANK_ACCOUNT);
    assertThat(result.getCountry()).isEqualTo(COUNTRY);
    assertThat(result.getCity()).isEqualTo(CITY);
    assertThat(result.getUserToken()).isEqualTo(USER_TOKEN);
    assertThat(result.getProfileType()).isEqualTo(HyperwalletUser.ProfileType.INDIVIDUAL);
    assertThat(result.getFirstName()).isEqualTo(FIRST_NAME);
    assertThat(result.getLastName()).isEqualTo(SECOND_NAME);
    assertThat(result.getToken()).isEqualTo(BANK_ACCOUNT_TOKEN);
}
Also used : HyperwalletBankAccount(com.hyperwallet.clientsdk.model.HyperwalletBankAccount) AbstractSellerModelToHyperwalletBankAccount(com.paypal.sellers.bankaccountextract.converter.impl.sellermodel.AbstractSellerModelToHyperwalletBankAccount) Test(org.junit.jupiter.api.Test)

Example 12 with HyperwalletBankAccount

use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.

the class HyperWalletUpdateBankAccountServiceStrategyTest method callHyperwalletAPI_shouldCreateBankAccount.

@Test
void callHyperwalletAPI_shouldCreateBankAccount() {
    when(hyperwalletMock.updateBankAccount(hyperwalletBankAccountRequestMock)).thenReturn(hyperwalletBankAccountResultMock);
    when(hyperwalletSDKServiceMock.getHyperwalletInstanceByHyperwalletProgram(HYPERWALLET_PROGRAM)).thenReturn(hyperwalletMock);
    final HyperwalletBankAccount result = testObj.callHyperwalletAPI(HYPERWALLET_PROGRAM, hyperwalletBankAccountRequestMock);
    verify(hyperwalletSDKServiceMock).getHyperwalletInstanceByHyperwalletProgram(HYPERWALLET_PROGRAM);
    verify(hyperwalletMock).updateBankAccount(hyperwalletBankAccountRequestMock);
    assertThat(result).isEqualTo(hyperwalletBankAccountResultMock);
}
Also used : HyperwalletBankAccount(com.hyperwallet.clientsdk.model.HyperwalletBankAccount) Test(org.junit.jupiter.api.Test)

Aggregations

HyperwalletBankAccount (com.hyperwallet.clientsdk.model.HyperwalletBankAccount)12 Test (org.junit.jupiter.api.Test)10 AbstractSellerModelToHyperwalletBankAccount (com.paypal.sellers.bankaccountextract.converter.impl.sellermodel.AbstractSellerModelToHyperwalletBankAccount)4 HyperwalletException (com.hyperwallet.clientsdk.HyperwalletException)1 BankAccountModel (com.paypal.sellers.bankaccountextract.model.BankAccountModel)1 IBANBankAccountModel (com.paypal.sellers.bankaccountextract.model.IBANBankAccountModel)1 IOException (java.io.IOException)1