Search in sources :

Example 1 with CustomerOptin

use of com.salesmanager.core.model.system.optin.CustomerOptin in project shopizer by shopizer-ecommerce.

the class CustomerFacadeImpl method optinCustomer.

@Override
public void optinCustomer(PersistableCustomerOptin optin, MerchantStore store) {
    // check if customer optin exists
    Optin optinDef = getOptinByCode(store);
    CustomerOptin customerOptin = getCustomerOptinByEmailAddress(optin.getEmail(), store, OptinType.NEWSLETTER);
    if (customerOptin != null) {
        // exists update
        customerOptin.setEmail(optin.getEmail());
        customerOptin.setFirstName(optin.getFirstName());
        customerOptin.setLastName(optin.getLastName());
    } else {
        customerOptin = new com.salesmanager.core.model.system.optin.CustomerOptin();
        customerOptin.setEmail(optin.getEmail());
        customerOptin.setFirstName(optin.getFirstName());
        customerOptin.setLastName(optin.getLastName());
        customerOptin.setOptinDate(new Date());
        customerOptin.setOptin(optinDef);
        customerOptin.setMerchantStore(store);
    }
    saveCustomerOption(customerOptin);
}
Also used : Optin(com.salesmanager.core.model.system.optin.Optin) CustomerOptin(com.salesmanager.core.model.system.optin.CustomerOptin) PersistableCustomerOptin(com.salesmanager.shop.model.customer.optin.PersistableCustomerOptin) CustomerOptin(com.salesmanager.core.model.system.optin.CustomerOptin) CustomerOptin(com.salesmanager.core.model.system.optin.CustomerOptin) PersistableCustomerOptin(com.salesmanager.shop.model.customer.optin.PersistableCustomerOptin) Date(java.util.Date)

Aggregations

CustomerOptin (com.salesmanager.core.model.system.optin.CustomerOptin)1 Optin (com.salesmanager.core.model.system.optin.Optin)1 PersistableCustomerOptin (com.salesmanager.shop.model.customer.optin.PersistableCustomerOptin)1 Date (java.util.Date)1