use of com.salesmanager.core.model.system.MerchantConfiguration in project shopizer by shopizer-ecommerce.
the class ShippingServiceImpl method getShippingConfiguration.
@Override
public ShippingConfiguration getShippingConfiguration(MerchantStore store) throws ServiceException {
MerchantConfiguration configuration = merchantConfigurationService.getMerchantConfiguration(ShippingConstants.SHIPPING_CONFIGURATION, store);
ShippingConfiguration shippingConfiguration = null;
if (configuration != null) {
String value = configuration.getValue();
ObjectMapper mapper = new ObjectMapper();
try {
shippingConfiguration = mapper.readValue(value, ShippingConfiguration.class);
} catch (Exception e) {
throw new ServiceException("Cannot parse json string " + value);
}
}
return shippingConfiguration;
}
use of com.salesmanager.core.model.system.MerchantConfiguration in project shopizer by shopizer-ecommerce.
the class EmailServiceImpl method saveEmailConfiguration.
@Override
public void saveEmailConfiguration(EmailConfig emailConfig, MerchantStore store) throws ServiceException {
MerchantConfiguration configuration = merchantConfigurationService.getMerchantConfiguration(Constants.EMAIL_CONFIG, store);
if (configuration == null) {
configuration = new MerchantConfiguration();
configuration.setMerchantStore(store);
configuration.setKey(Constants.EMAIL_CONFIG);
}
String value = emailConfig.toJSONString();
configuration.setValue(value);
merchantConfigurationService.saveOrUpdate(configuration);
}
use of com.salesmanager.core.model.system.MerchantConfiguration in project shopizer by shopizer-ecommerce.
the class MerchantConfigurationServiceImpl method saveMerchantConfig.
@Override
public void saveMerchantConfig(MerchantConfig config, MerchantStore store) throws ServiceException {
MerchantConfiguration configuration = merchantConfigurationRepository.findByMerchantStoreAndKey(store.getId(), MerchantConfigurationType.CONFIG.name());
if (configuration == null) {
configuration = new MerchantConfiguration();
configuration.setMerchantStore(store);
configuration.setKey(MerchantConfigurationType.CONFIG.name());
configuration.setMerchantConfigurationType(MerchantConfigurationType.CONFIG);
}
String value = config.toJSONString();
configuration.setValue(value);
if (configuration.getId() != null && configuration.getId() > 0) {
super.update(configuration);
} else {
super.create(configuration);
}
}
Aggregations