Search in sources :

Example 1 with ExpeditionConfiguration

use of com.salesmanager.shop.model.shipping.ExpeditionConfiguration in project shopizer by shopizer-ecommerce.

the class ShippingFacadeImpl method getExpeditionConfiguration.

@Override
public ExpeditionConfiguration getExpeditionConfiguration(MerchantStore store, Language language) {
    ExpeditionConfiguration expeditionConfiguration = new ExpeditionConfiguration();
    try {
        ShippingConfiguration config = getDbConfig(store);
        if (config != null) {
            expeditionConfiguration.setIternationalShipping(config.getShipType() != null && config.getShipType().equals(ShippingType.INTERNATIONAL.name()) ? true : false);
            expeditionConfiguration.setTaxOnShipping(config.isTaxOnShipping());
        }
        List<String> countries = shippingService.getSupportedCountries(store);
        if (!CollectionUtils.isEmpty(countries)) {
            List<String> countryCode = countries.stream().sorted(Comparator.comparing(n -> n.toString())).collect(Collectors.toList());
            expeditionConfiguration.setShipToCountry(countryCode);
        }
    } catch (ServiceException e) {
        LOGGER.error("Error while getting expedition configuration", e);
        throw new ServiceRuntimeException("Error while getting Expedition configuration for store[" + store.getCode() + "]", e);
    }
    return expeditionConfiguration;
}
Also used : ExpeditionConfiguration(com.salesmanager.shop.model.shipping.ExpeditionConfiguration) ServiceException(com.salesmanager.core.business.exception.ServiceException) ShippingConfiguration(com.salesmanager.core.model.shipping.ShippingConfiguration) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException)

Aggregations

ServiceException (com.salesmanager.core.business.exception.ServiceException)1 ShippingConfiguration (com.salesmanager.core.model.shipping.ShippingConfiguration)1 ExpeditionConfiguration (com.salesmanager.shop.model.shipping.ExpeditionConfiguration)1 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)1