use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.
the class SellerModelToHyperWalletCanadianBankAccountTest method execute_shouldReturnCanadianHyperwalletBankAccount.
@Test
void execute_shouldReturnCanadianHyperwalletBankAccount() {
final HyperwalletBankAccount hyperwalletBankAccount = new HyperwalletBankAccount();
when(sellerModelMock.getBankAccountDetails()).thenReturn(canadianBankAccountModelMock);
when(canadianBankAccountModelMock.getBankId()).thenReturn(BANK_ID);
when(canadianBankAccountModelMock.getBranchId()).thenReturn(BRANCH_ID);
doReturn(hyperwalletBankAccount).when(testObj).callSuperConvert(sellerModelMock);
final HyperwalletBankAccount result = testObj.execute(sellerModelMock);
assertThat(result.getBranchId()).isEqualTo(BRANCH_ID);
assertThat(result.getBankId()).isEqualTo(BANK_ID);
}
use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.
the class SellerModelToHyperWalletIBANBankAccountConverterTest method convert_shouldReturnIBANHyperwalletBankAccount.
@Test
void convert_shouldReturnIBANHyperwalletBankAccount() {
final HyperwalletBankAccount hyperwalletBankAccount = new HyperwalletBankAccount();
when(sellerModelMock.getBankAccountDetails()).thenReturn(ibanBankAccountModelMock);
when(ibanBankAccountModelMock.getBankBic()).thenReturn(BANK_BIC);
doReturn(hyperwalletBankAccount).when(testObj).callSuperConvert(sellerModelMock);
final HyperwalletBankAccount result = testObj.execute(sellerModelMock);
assertThat(result.getBankId()).isEqualTo(BANK_BIC);
}
use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.
the class SellerModelToHyperWalletUKBankAccountTest method convert_shouldReturnUKHyperwalletBankAccount.
@Test
void convert_shouldReturnUKHyperwalletBankAccount() {
final HyperwalletBankAccount hyperwalletBankAccount = new HyperwalletBankAccount();
when(sellerModelMock.getBankAccountDetails()).thenReturn(ukBankAccountModelMock);
when(ukBankAccountModelMock.getBankAccountId()).thenReturn(SORT_CODE);
doReturn(hyperwalletBankAccount).when(testObj).callSuperConvert(sellerModelMock);
final HyperwalletBankAccount result = testObj.execute(sellerModelMock);
assertThat(result.getBankId()).isEqualTo(SORT_CODE);
}
use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletCreateBankAccountServiceStrategyTest method callHyperwalletAPI_shouldCreateBankAccount.
@Test
void callHyperwalletAPI_shouldCreateBankAccount() {
when(hyperwalletMock.createBankAccount(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).createBankAccount(hyperwalletBankAccountRequestMock);
assertThat(result).isEqualTo(hyperwalletBankAccountResultMock);
}
use of com.hyperwallet.clientsdk.model.HyperwalletBankAccount in project mirakl-hyperwallet-connector by paypal.
the class AbstractHyperwalletBankAccountRetryApiStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public Optional<HyperwalletBankAccount> execute(final SellerModel seller) {
boolean includedAsFailed = false;
HyperwalletBankAccount hwCreatedBankAccount = null;
final HyperwalletBankAccount hwBankAccountRequest = sellerModelToHyperwalletBankAccountStrategyExecutor.execute(seller);
if (Objects.nonNull(hwBankAccountRequest)) {
try {
hwCreatedBankAccount = callHyperwalletAPI(seller.getHyperwalletProgram(), hwBankAccountRequest);
log.info("Bank account created or updated for seller with clientId [{}]", seller.getClientUserId());
} catch (final HyperwalletException e) {
if (e.getCause() instanceof IOException) {
includedAsFailed = true;
}
mailNotificationUtil.sendPlainTextEmail("Issue detected when creating or updating bank account in Hyperwallet", String.format(ERROR_MESSAGE_PREFIX + "Bank account not created or updated for seller with clientId [%s]%n%s", seller.getClientUserId(), HyperwalletLoggingErrorsUtil.stringify(e)));
log.error("Bank account not created or updated for seller with clientId [{}]", seller.getClientUserId());
log.error(HyperwalletLoggingErrorsUtil.stringify(e));
} finally {
callToIncludeIntoRetryProcess(seller, includedAsFailed);
}
}
return Optional.ofNullable(hwCreatedBankAccount);
}
Aggregations