Ejemplo n.º 1
0
  @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);
  }
Ejemplo n.º 2
0
  @Override
  public EmailConfig getEmailConfiguration(MerchantStore store) throws ServiceException {

    MerchantConfiguration configuration =
        merchantConfigurationService.getMerchantConfiguration(Constants.EMAIL_CONFIG, store);
    EmailConfig emailConfig = null;
    if (configuration != null) {
      String value = configuration.getValue();

      ObjectMapper mapper = new ObjectMapper();
      try {
        emailConfig = mapper.readValue(value, EmailConfig.class);
      } catch (Exception e) {
        throw new ServiceException("Cannot parse json string " + value);
      }
    }
    return emailConfig;
  }