use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method deleteLogo.
@Override
public void deleteLogo(String code) {
MerchantStore store = getByCode(code);
String image = store.getStoreLogo();
store.setStoreLogo(null);
try {
updateMerchantStore(store);
if (!StringUtils.isEmpty(image)) {
contentService.removeFile(store.getCode(), image);
}
} catch (ServiceException e) {
throw new ServiceRuntimeException(e.getMessage());
}
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method mergePersistableMerchantStoreToMerchantStore.
private MerchantStore mergePersistableMerchantStoreToMerchantStore(PersistableMerchantStore store, String code, Language language) {
MerchantStore mStore = getMerchantStoreByCode(code);
store.setId(mStore.getId());
try {
mStore = persistableMerchantStorePopulator.populate(store, mStore, language);
} catch (ConversionException e) {
throw new ConversionRuntimeException(e);
}
return mStore;
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class StoreFacadeImpl method createBrand.
@Override
public void createBrand(String merchantStoreCode, PersistableBrand brand) {
MerchantStore mStore = getMerchantStoreByCode(merchantStoreCode);
List<MerchantConfigEntity> createdConfigs = brand.getSocialNetworks();
List<MerchantConfiguration> configurations = createdConfigs.stream().map(config -> convertToMerchantConfiguration(config, MerchantConfigurationType.SOCIAL)).collect(Collectors.toList());
try {
for (MerchantConfiguration mConfigs : configurations) {
mConfigs.setMerchantStore(mStore);
if (!StringUtils.isEmpty(mConfigs.getValue())) {
mConfigs.setMerchantConfigurationType(MerchantConfigurationType.SOCIAL);
merchantConfigurationService.saveOrUpdate(mConfigs);
} else {
// remove if submited blank and exists
MerchantConfiguration config = merchantConfigurationService.getMerchantConfiguration(mConfigs.getKey(), mStore);
if (config != null) {
merchantConfigurationService.delete(config);
}
}
}
} catch (ServiceException se) {
throw new ServiceRuntimeException(se);
}
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class CustomerFacadeImpl method getAllCustomerReviewsByReviewed.
@Override
public List<ReadableCustomerReview> getAllCustomerReviewsByReviewed(Long customerId, MerchantStore store, Language language) {
// customer exist
Customer customer = getCustomerById(customerId);
Validate.notNull(customer, "Reviewed customer cannot be null");
return customerReviewService.getByReviewedCustomer(customer).stream().map(customerReview -> convertCustomerReviewToReadableCustomerReview(customerReview, store, language)).collect(Collectors.toList());
}
use of com.salesmanager.core.model.merchant.MerchantStore in project shopizer by shopizer-ecommerce.
the class CustomerFacadeImpl method convertCustomerListToReadableCustomerList.
private ReadableCustomerList convertCustomerListToReadableCustomerList(CustomerList customerList, MerchantStore store, Language language) {
List<ReadableCustomer> readableCustomers = customerList.getCustomers().stream().map(customer -> convertCustomerToReadableCustomer(customer, store, language)).collect(Collectors.toList());
ReadableCustomerList readableCustomerList = new ReadableCustomerList();
readableCustomerList.setCustomers(readableCustomers);
readableCustomerList.setTotalPages(Math.toIntExact(customerList.getTotalCount()));
return readableCustomerList;
}
Aggregations