use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklBankAccountExtractServiceImplTest method updateBankAccountToken_shouldSendEmailNotification_whenMiraklExceptionIsThrown.
@Test
void updateBankAccountToken_shouldSendEmailNotification_whenMiraklExceptionIsThrown() {
when(hyperwalletBankAccount.getToken()).thenReturn(TOKEN_VALUE);
when(sellerModelMock.getClientUserId()).thenReturn("12345");
final MiraklApiException miraklApiException = new MiraklApiException(new MiraklErrorResponseBean(1, "Something went wrong"));
doThrow(miraklApiException).when(miraklMarketplacePlatformOperatorApiClientMock).updateShops(any(MiraklUpdateShopsRequest.class));
testObj.updateBankAccountToken(sellerModelMock, hyperwalletBankAccount);
verify(mailNotificationUtilMock).sendPlainTextEmail(eq("Issue detected updating bank token in Mirakl"), eq(String.format(ERROR_MESSAGE_PREFIX + "Something went wrong updating bank token of shop [12345]%n%s", MiraklLoggingErrorsUtil.stringify(miraklApiException))));
}
use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class AbstractKYCUserStatusExecutorNotificationStrategyTest method updateShop_whenMiraklAPIReturnsAnException_shouldLogTheErrorAndSendAnEmail.
@Test
void updateShop_whenMiraklAPIReturnsAnException_shouldLogTheErrorAndSendAnEmail() {
when(kycUserStatusNotificationBodyModelMock.getClientUserId()).thenReturn(SHOP_ID);
final MiraklApiException exception = new MiraklApiException(new MiraklErrorResponseBean(100, "Something went wrong"));
when(testObj.expectedKycMiraklStatus(kycUserStatusNotificationBodyModelMock)).thenReturn(MiraklShopKycStatus.APPROVED);
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(any(MiraklUpdateShopsRequest.class))).thenThrow(exception);
final Throwable throwable = catchThrowable(() -> testObj.updateShop(kycUserStatusNotificationBodyModelMock));
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected updating KYC information in Mirakl", String.format(ERROR_MESSAGE_PREFIX + "Something went wrong updating KYC information of shop [%s]%n%s", SHOP_ID, MiraklLoggingErrorsUtil.stringify(exception)));
assertThat(throwable).isEqualTo(exception);
}
use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklCreditNotesExtractServiceImplTest method getAccountingDocuments_whenMiraklExceptionIsThrown_shouldSendEmailNotification.
@Test
void getAccountingDocuments_whenMiraklExceptionIsThrown_shouldSendEmailNotification() {
final LocalDateTime now = LocalDateTime.now();
TimeMachine.useFixedClockAt(now);
final Date nowAsDate = DateUtil.convertToDate(now, ZoneId.systemDefault());
final CreditNoteModel creditNoteOne = CreditNoteModel.builder().shopId(SHOP_ID_ONE).destinationToken(TOKEN_1).hyperwalletProgram(HYPERWALLET_PROGRAM).build();
final List<CreditNoteModel> creditNoteList = List.of(creditNoteOne);
doReturn(creditNoteList).when(testObj).getAccountingDocuments(nowAsDate);
final MiraklApiException miraklApiException = new MiraklApiException(new MiraklErrorResponseBean(1, "Something went wrong"));
doThrow(miraklApiException).when(miraklMarketplacePlatformOperatorApiClientMock).getShops(any(MiraklGetShopsRequest.class));
testObj.extractAccountingDocument(nowAsDate);
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected getting shops in Mirakl", String.format("Something went wrong getting information of " + "shops" + " [2000]%n%s", MiraklLoggingErrorsUtil.stringify(miraklApiException)));
}
use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderExtractServiceImplTest method updateUserToken_shouldSendEmailNotification_whenMiraklExceptionIsThrown.
@Test
void updateUserToken_shouldSendEmailNotification_whenMiraklExceptionIsThrown() {
when(sellerModelMock.getClientUserId()).thenReturn("12345");
when(sellerModelMock.getBusinessStakeHolderDetails()).thenReturn(List.of(businessStakeHolderModelMock));
final MiraklApiException miraklApiException = new MiraklApiException(new MiraklErrorResponseBean(1, "Something went wrong"));
doThrow(miraklApiException).when(miraklMarketplacePlatformOperatorApiClientMock).updateShops(any(MiraklUpdateShopsRequest.class));
testObj.updateBusinessStakeholderToken(sellerModelMock.getClientUserId(), sellerModelMock.getBusinessStakeHolderDetails());
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected getting shop information in Mirakl", String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting information of shop [12345]%n%s", MiraklLoggingErrorsUtil.stringify(miraklApiException)));
}
use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImplTest method extractSellers_shouldSendEmailNotification_whenMiraklExceptionIsThrown.
@Test
void extractSellers_shouldSendEmailNotification_whenMiraklExceptionIsThrown() {
final MiraklApiException miraklApiException = new MiraklApiException(new MiraklErrorResponseBean(1, "Something went wrong"));
doThrow(miraklApiException).when(miraklMarketplacePlatformOperatorApiClientMock).getShops(any(MiraklGetShopsRequest.class));
testObj.extractSellers(dateMock);
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue detected getting shop information in Mirakl", String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting shop information since [dateMock]%n%s", MiraklLoggingErrorsUtil.stringify(miraklApiException)));
}
Aggregations