Search in sources :

Example 6 with MiraklShops

use of com.mirakl.client.mmp.domain.shop.MiraklShops in project mirakl-hyperwallet-connector by paypal.

the class MiraklSellersExtractServiceImpl method extractSellers.

@Override
public List<SellerModel> extractSellers(@Nullable final Date delta) {
    final MiraklShops shops = retrieveMiraklShopsByDate(delta);
    // @formatter:off
    log.info(SHOPS_RETRIEVED_MESSAGE, Stream.ofNullable(shops.getShops()).flatMap(Collection::stream).map(MiraklShop::getId).collect(Collectors.joining(LoggingConstantsUtil.LIST_LOGGING_SEPARATOR)));
    return Stream.ofNullable(shops.getShops()).flatMap(Collection::stream).map(miraklShopSellerModelStrategyExecutor::execute).filter(SellerModel::hasAcceptedTermsAndConditions).collect(Collectors.toList());
// @formatter:on
}
Also used : MiraklShop(com.mirakl.client.mmp.domain.shop.MiraklShop) MiraklShops(com.mirakl.client.mmp.domain.shop.MiraklShops)

Example 7 with MiraklShops

use of com.mirakl.client.mmp.domain.shop.MiraklShops 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();
    }
}
Also used : MiraklGetShopsRequest(com.mirakl.client.mmp.request.shop.MiraklGetShopsRequest) MiraklApiException(com.mirakl.client.core.exception.MiraklApiException) MiraklShops(com.mirakl.client.mmp.domain.shop.MiraklShops)

Example 8 with MiraklShops

use of com.mirakl.client.mmp.domain.shop.MiraklShops 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();
    }
}
Also used : MiraklGetShopsRequest(com.mirakl.client.mmp.request.shop.MiraklGetShopsRequest) MiraklApiException(com.mirakl.client.core.exception.MiraklApiException) MiraklShops(com.mirakl.client.mmp.domain.shop.MiraklShops)

Aggregations

MiraklShops (com.mirakl.client.mmp.domain.shop.MiraklShops)8 MiraklGetShopsRequest (com.mirakl.client.mmp.request.shop.MiraklGetShopsRequest)7 MiraklShop (com.mirakl.client.mmp.domain.shop.MiraklShop)5 MiraklException (com.mirakl.client.core.exception.MiraklException)3 MiraklMarketplacePlatformOperatorApiClient (com.mirakl.client.mmp.operator.core.MiraklMarketplacePlatformOperatorApiClient)3 MiraklUpdateShop (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdateShop)3 MiraklUpdatedShopReturn (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdatedShopReturn)3 MiraklUpdatedShops (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdatedShops)3 MiraklUpdateShopsRequest (com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest)3 MiraklRequestAdditionalFieldValue (com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue)3 Converter (com.paypal.infrastructure.converter.Converter)3 MailNotificationUtil (com.paypal.infrastructure.mail.MailNotificationUtil)3 LoggingConstantsUtil (com.paypal.infrastructure.util.LoggingConstantsUtil)3 MiraklLoggingErrorsUtil (com.paypal.infrastructure.util.MiraklLoggingErrorsUtil)3 KYCConstants (com.paypal.kyc.model.KYCConstants)3 KYCDocumentInfoModel (com.paypal.kyc.model.KYCDocumentInfoModel)3 java.util (java.util)3 Predicate (java.util.function.Predicate)3 Collectors (java.util.stream.Collectors)3 Stream (java.util.stream.Stream)3