use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImpl method updateUserToken.
/**
* {@inheritDoc}
*/
@Override
public void updateUserToken(final HyperwalletUser hyperwalletUser) {
final MiraklUpdateShop miraklUpdateShop = new MiraklUpdateShop();
final String shopId = hyperwalletUser.getClientUserId();
miraklUpdateShop.setShopId(Long.valueOf(shopId));
final MiraklSimpleRequestAdditionalFieldValue userTokenCustomField = new MiraklSimpleRequestAdditionalFieldValue();
userTokenCustomField.setCode(HYPERWALLET_USER_TOKEN);
userTokenCustomField.setValue(hyperwalletUser.getToken());
miraklUpdateShop.setAdditionalFieldValues(List.of(userTokenCustomField));
final MiraklUpdateShopsRequest request = new MiraklUpdateShopsRequest(List.of(miraklUpdateShop));
log.info("Updating token for shop [{}] to [{}]", shopId, hyperwalletUser.getToken());
try {
miraklOperatorClient.updateShops(request);
} catch (final MiraklApiException ex) {
log.error("Something went wrong getting information of shop [{}]", shopId);
sellerMailNotificationUtil.sendPlainTextEmail(EMAIL_SUBJECT_MESSAGE, String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting information of shop [%s]%n%s", shopId, MiraklLoggingErrorsUtil.stringify(ex)));
}
}
use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImpl method retrieveMiraklShopsByShopIds.
private MiraklShops retrieveMiraklShopsByShopIds(final List<String> shopIds) {
final MiraklGetShopsRequest request = new MiraklGetShopsRequest();
request.setShopIds(shopIds);
request.setPaginate(false);
log.info("Retrieving shops with ids {}", shopIds);
try {
return miraklOperatorClient.getShops(request);
} catch (final MiraklApiException ex) {
log.error("Something went wrong getting s information with ids [{}]", shopIds);
sellerMailNotificationUtil.sendPlainTextEmail(EMAIL_SUBJECT_MESSAGE, String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting shop information with ids [%s]%n%s", shopIds, MiraklLoggingErrorsUtil.stringify(ex)));
return new MiraklShops();
}
}
use of com.mirakl.client.core.exception.MiraklApiException in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImpl method retrieveMiraklShopsByDate.
private MiraklShops retrieveMiraklShopsByDate(@Nullable final Date delta) {
final MiraklGetShopsRequest request = new MiraklGetShopsRequest();
request.setUpdatedSince(delta);
request.setPaginate(false);
log.info("Retrieving shops since {}", delta);
try {
return miraklOperatorClient.getShops(request);
} catch (final MiraklApiException ex) {
log.error("Something went wrong getting shop information since [{}]", delta);
sellerMailNotificationUtil.sendPlainTextEmail(EMAIL_SUBJECT_MESSAGE, String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting shop information since [%s]%n%s", delta, MiraklLoggingErrorsUtil.stringify(ex)));
return new MiraklShops();
}
}
Aggregations