use of com.hyperwallet.clientsdk.HyperwalletException in project mirakl-hyperwallet-connector by paypal.
the class AbstractHyperwalletSellerRetryApiStrategyTest method execute_shouldSendEmailNotificationHyperwalletExceptionIsThrown.
@Test
void execute_shouldSendEmailNotificationHyperwalletExceptionIsThrown() {
final HyperwalletException hyperwalletException = new HyperwalletException("Something went wrong");
when(sellerModelMock.getClientUserId()).thenReturn("2001");
when(sellerModelHyperwalletUserConverterMock.convert(sellerModelMock)).thenReturn(hyperwalletUserMock);
doNothing().when(testObj).callToIncludeIntoRetryProcess(sellerModelMock, Boolean.FALSE);
doThrow(hyperwalletException).when(testObj).createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl(hyperwalletUserMock);
testObj.execute(sellerModelMock);
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected when creating or updating seller in Hyperwallet", String.format(ERROR_MESSAGE_PREFIX + "Seller not created or updated with clientId [%s]%n%s", "2001", HyperwalletLoggingErrorsUtil.stringify(hyperwalletException)));
verify(testObj).callToIncludeIntoRetryProcess(sellerModelMock, Boolean.FALSE);
}
use of com.hyperwallet.clientsdk.HyperwalletException in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletCreateBusinessStakeHolderServiceStrategyTest method execute_shouldSendEmailNotificationHyperwalletExceptionIsThrown.
@Test
void execute_shouldSendEmailNotificationHyperwalletExceptionIsThrown() {
when(businessStakeHolderModelHyperwalletBusinessStakeholderConverterMock.convert(businessStakeHolderMock)).thenReturn(hyperwalletBusinessStakeholderMock);
when(businessStakeHolderMock.getClientUserId()).thenReturn(CLIENT_ID);
when(businessStakeHolderMock.getUserToken()).thenReturn(TOKEN);
when(businessStakeHolderMock.getHyperwalletProgram()).thenReturn(HYPERWALLET_PROGRAM);
when(hyperwalletSDKServiceMock.getHyperwalletInstanceByHyperwalletProgram(HYPERWALLET_PROGRAM)).thenReturn(hyperwalletClientMock);
final HyperwalletException hyperwalletException = new HyperwalletException("Something went wrong");
doThrow(hyperwalletException).when(hyperwalletClientMock).createBusinessStakeholder(TOKEN, hyperwalletBusinessStakeholderMock);
testObj.execute(businessStakeHolderMock);
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected when creating business stakeholder in Hyperwallet", String.format(ERROR_MESSAGE_PREFIX + "Business stakeholder not created for clientId [%s]%n%s", CLIENT_ID, HyperwalletLoggingErrorsUtil.stringify(hyperwalletException)));
}
use of com.hyperwallet.clientsdk.HyperwalletException in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletUpdateBusinessStakeHolderServiceStrategyTest method execute_shouldSendEmailNotificationHyperwalletExceptionIsThrown.
@Test
void execute_shouldSendEmailNotificationHyperwalletExceptionIsThrown() {
when(businessStakeHolderModelHyperwalletBusinessStakeholderConverterMock.convert(businessStakeHolderMock)).thenReturn(hyperwalletBusinessStakeholderMock);
when(businessStakeHolderMock.getUserToken()).thenReturn(TOKEN);
when(businessStakeHolderMock.getClientUserId()).thenReturn(CLIENT_ID);
when(businessStakeHolderMock.getHyperwalletProgram()).thenReturn(HYPERWALLET_PROGRAM);
when(hyperwalletSDKService.getHyperwalletInstanceByHyperwalletProgram(HYPERWALLET_PROGRAM)).thenReturn(hyperwalletClientMock);
final HyperwalletException hyperwalletException = new HyperwalletException("Something went wrong");
doThrow(hyperwalletException).when(hyperwalletClientMock).updateBusinessStakeholder(TOKEN, hyperwalletBusinessStakeholderMock);
testObj.execute(businessStakeHolderMock);
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected when updating business stakeholder in Hyperwallet", String.format(ERROR_MESSAGE_PREFIX + "Business stakeholder not updated for clientId [%s]%n%s", CLIENT_ID, HyperwalletLoggingErrorsUtil.stringify(hyperwalletException)));
}
use of com.hyperwallet.clientsdk.HyperwalletException in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletPaymentExtractServiceImplTest method createPayment_shouldSendAnEmailWhenAnExceptionIsThrown.
@Test
void createPayment_shouldSendAnEmailWhenAnExceptionIsThrown() {
final HyperwalletException hyperwalletException = new HyperwalletException("Something went wrong");
doThrow(hyperwalletException).when(hyperwalletMock).createPayment(paymentOneMock);
when(paymentOneMock.getClientPaymentId()).thenReturn("000001234");
when(paymentOneMock.getProgramToken()).thenReturn(PROGRAM_TOKEN);
when(hyperwalletSDKService.getHyperwalletInstanceWithProgramToken(PROGRAM_TOKEN)).thenReturn(hyperwalletMock);
testObj.createPayment(paymentOneMock);
verify(mailNotificationUtil).sendPlainTextEmail("Issue detected when creating payment for an invoice in Hyperwallet", String.format("Something went wrong creating payment " + "for" + " invoice [000001234]%n%s", HyperwalletLoggingErrorsUtil.stringify(hyperwalletException)));
}
use of com.hyperwallet.clientsdk.HyperwalletException in project mirakl-hyperwallet-connector by paypal.
the class AbstractHyperwalletSellerRetryApiStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public HyperwalletUser execute(final SellerModel seller) {
boolean includedAsFailed = false;
HyperwalletUser hyperwalletUser = null;
final HyperwalletUser hwUserRequest = sellerModelHyperwalletUserConverter.convert(seller);
try {
hyperwalletUser = createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl(hwUserRequest);
log.info("Seller 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 seller in Hyperwallet", String.format(ERROR_MESSAGE_PREFIX + "Seller not created or updated with clientId [%s]%n%s", seller.getClientUserId(), HyperwalletLoggingErrorsUtil.stringify(e)));
log.error("Seller not created or updated with clientId [{}]", seller.getClientUserId());
log.error(HyperwalletLoggingErrorsUtil.stringify(e));
} finally {
callToIncludeIntoRetryProcess(seller, includedAsFailed);
}
return hyperwalletUser;
}
Aggregations