use of com.salesmanager.shop.populator.customer.CustomerEntityPopulator in project shopizer by shopizer-ecommerce.
the class CustomerFacadeImpl method getCustomerDataByUserName.
/**
* Method used to fetch customer based on the username and storecode. Customer username is unique
* to each store.
*
* @param userName
* @param store
* @throws ConversionException
*/
@Override
public CustomerEntity getCustomerDataByUserName(final String userName, final MerchantStore store, final Language language) throws Exception {
LOG.info("Fetching customer with userName" + userName);
Customer customer = customerService.getByNick(userName);
if (customer != null) {
LOG.info("Found customer, converting to CustomerEntity");
try {
CustomerEntityPopulator customerEntityPopulator = new CustomerEntityPopulator();
// store, language
return customerEntityPopulator.populate(customer, store, language);
} catch (ConversionException ex) {
LOG.error("Error while converting Customer to CustomerEntity", ex);
throw new Exception(ex);
}
}
return null;
}
Aggregations