Search in sources :

Example 1 with Configs

use of com.salesmanager.shop.model.system.Configs in project shopizer by shopizer-ecommerce.

the class MerchantConfigurationFacadeImpl method getMerchantConfig.

@Override
public Configs getMerchantConfig(MerchantStore merchantStore, Language language) {
    MerchantConfig configs = getMerchantConfig(merchantStore);
    Configs readableConfig = new Configs();
    readableConfig.setAllowOnlinePurchase(configs.isAllowPurchaseItems());
    readableConfig.setDisplaySearchBox(configs.isDisplaySearchBox());
    readableConfig.setDisplayContactUs(configs.isDisplayContactUs());
    readableConfig.setDisplayCustomerSection(configs.isDisplayCustomerSection());
    readableConfig.setDisplayAddToCartOnFeaturedItems(configs.isDisplayAddToCartOnFeaturedItems());
    readableConfig.setDisplayCustomerAgreement(configs.isDisplayCustomerAgreement());
    readableConfig.setDisplayPagesMenu(configs.isDisplayPagesMenu());
    Optional<String> facebookConfigValue = getConfigValue(KEY_FACEBOOK_PAGE_URL, merchantStore);
    facebookConfigValue.ifPresent(readableConfig::setFacebook);
    Optional<String> googleConfigValue = getConfigValue(KEY_GOOGLE_ANALYTICS_URL, merchantStore);
    googleConfigValue.ifPresent(readableConfig::setGa);
    Optional<String> instagramConfigValue = getConfigValue(KEY_INSTAGRAM_URL, merchantStore);
    instagramConfigValue.ifPresent(readableConfig::setInstagram);
    Optional<String> pinterestConfigValue = getConfigValue(KEY_PINTEREST_PAGE_URL, merchantStore);
    pinterestConfigValue.ifPresent(readableConfig::setPinterest);
    readableConfig.setDisplayShipping(false);
    try {
        if (!StringUtils.isBlank(displayShipping)) {
            readableConfig.setDisplayShipping(Boolean.valueOf(displayShipping));
        }
    } catch (Exception e) {
        LOGGER.error("Cannot parse value of " + displayShipping);
    }
    return readableConfig;
}
Also used : Configs(com.salesmanager.shop.model.system.Configs) MerchantConfig(com.salesmanager.core.model.system.MerchantConfig) ServiceException(com.salesmanager.core.business.exception.ServiceException) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException)

Aggregations

ServiceException (com.salesmanager.core.business.exception.ServiceException)1 MerchantConfig (com.salesmanager.core.model.system.MerchantConfig)1 Configs (com.salesmanager.shop.model.system.Configs)1 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)1