use of com.mirakl.client.core.error.MiraklErrorResponseBean 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.error.MiraklErrorResponseBean 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.error.MiraklErrorResponseBean 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