Examples of CustomerAddress


Examples of com.jada.jpa.entity.CustomerAddress

        }
        shippingOrderTotal = shippingTotal - shippingDiscountTotal;
  }
 
  private float calculateShippingTotal(ShippingMethod shippingMethod) {
    CustomerAddress address = getEffectiveShippingAddress();
      Iterator<?> iterator = shippingMethod.getShippingMethodRegions().iterator();
      ShippingMethodRegion shippingMethodRegion = null;
      boolean found = false;
      while (iterator.hasNext() && !found) {
        ShippingMethodRegion smRegion = (ShippingMethodRegion) iterator.next();
        if (smRegion.getPublished() == Constants.PUBLISHED_NO) {
          continue;
        }
        if (smRegion.getShippingRegion().getPublished() == Constants.PUBLISHED_NO) {
          continue;
        }
        if (smRegion.getShippingRegion().getSystemRecord() == Constants.VALUE_YES) {
          shippingMethodRegion = smRegion;
        }
        Iterator<?> countries = smRegion.getShippingRegion().getCountries().iterator();
        while (countries.hasNext()) {
          Country country = (Country) countries.next();
          if (country.getCountryId().equals(address.getCountry().getCountryId())) {
            shippingMethodRegion = smRegion;
            found = true;
            break;
          }
        }
        if (!found) {
            Iterator<?> states = smRegion.getShippingRegion().getStates().iterator();
            while (states.hasNext()) {
              State state = (State) states.next();
              if (state.getStateId().equals(address.getState().getStateId())) {
                shippingMethodRegion = smRegion;
                found = true;
                break;
              }
            }
        }
          String zipCode = address.getCustZipCode();
          if (!found && !Format.isNullOrEmpty(zipCode)) {
            for (ShippingRegionZip shippingRegionZip : smRegion.getShippingRegion().getZipCodes()) {
              if (shippingRegionZip.getZipCodeExpression() == Constants.VALUE_YES) {
                if (zipCode.matches(shippingRegionZip.getZipCodeStart())) {
                    shippingMethodRegion = smRegion;
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

        customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        customer.setRecCreateBy(Constants.USERNAME_CUSTOMER);
        customer.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        customer.setCustomerClass(customerClass);
       
        CustomerAddress customerAddress = shoppingCart.getEstimateAddress();
        if (customerAddress == null) {
          customerAddress = new CustomerAddress();
        }
        customer.setCustAddress(customerAddress);
        customer.getCustAddresses().add(customerAddress);
        customerAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
        customerAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_CUST);
        customerAddress.setRecUpdateBy(Constants.USERNAME_CUSTOMER);
        customerAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        customerAddress.setRecCreateBy(Constants.USERNAME_CUSTOMER);
        customerAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        em.persist(customerAddress);

        em.persist(customer);
        em.flush();
       
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

            em.merge(customerAddress);
        }
    }

    public void deleteCustomerAddressById(Long customerAddressId) {
        CustomerAddress customerAddress = readCustomerAddressById(customerAddressId);
        if (customerAddress != null) {
            em.remove(customerAddress);
        }
    }
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

     * @return customer created
     */
    public Customer createCustomerWithAddresses() {
        createCountry();
        createState();
        CustomerAddress ca1 = new CustomerAddressImpl();
        Address address1 = new AddressImpl();
        address1.setAddressLine1("1234 Merit Drive");
        address1.setCity("Bozeman");
        address1.setPostalCode("75251");
        ca1.setAddress(address1);
        ca1.setAddressName("address1");
        CustomerAddress caResult = createCustomerWithAddress(ca1);
        assert caResult != null;
        assert caResult.getCustomer() != null;
        Customer customer = caResult.getCustomer();

        CustomerAddress ca2 = new CustomerAddressImpl();
        Address address2 = new AddressImpl();
        address2.setAddressLine1("12 Testing Drive");
        address2.setCity("Portland");
        address2.setPostalCode("75251");
        ca2.setAddress(address2);
        ca2.setAddressName("address2");
        ca2.setCustomer(customer);
        CustomerAddress addResult = saveCustomerAddress(ca2);
        assert addResult != null;
        return customer;
    }
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

public class CustomerAddressDataProvider {

    @DataProvider(name = "setupCustomerAddress")
    public static Object[][] createCustomerAddress() {
        CustomerAddress ca1 = new CustomerAddressImpl();
        Address address1 = new AddressImpl();
        address1.setAddressLine1("1234 Merit Drive");
        address1.setCity("Bozeman");
        address1.setPostalCode("75251");
        ca1.setAddress(address1);
        ca1.setAddressName("address4");

        CustomerAddress ca2 = new CustomerAddressImpl();
        Address address2 = new AddressImpl();
        address2.setAddressLine1("12 Testing Drive");
        address2.setCity("Portland");
        address2.setPostalCode("75251");
        ca2.setAddress(address2);
        ca2.setAddressName("address5");

        return new Object[][] { new Object[] { ca1 }, new Object[] { ca2 } };
    }
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

     * @return customer created
     */
    public Customer createCustomerWithAddresses() {
        createCountry();
        createState();
        CustomerAddress ca1 = new CustomerAddressImpl();
        Address address1 = new AddressImpl();
        address1.setAddressLine1("1234 Merit Drive");
        address1.setCity("Bozeman");
        address1.setPostalCode("75251");
        ca1.setAddress(address1);
        ca1.setAddressName("address1");
        CustomerAddress caResult = createCustomerWithAddress(ca1);
        assert caResult != null;
        assert caResult.getCustomer() != null;
        Customer customer = caResult.getCustomer();

        CustomerAddress ca2 = new CustomerAddressImpl();
        Address address2 = new AddressImpl();
        address2.setAddressLine1("12 Testing Drive");
        address2.setCity("Portland");
        address2.setPostalCode("75251");
        ca2.setAddress(address2);
        ca2.setAddressName("address2");
        ca2.setCustomer(customer);
        CustomerAddress addResult = saveCustomerAddress(ca2);
        assert addResult != null;
        return customer;
    }
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

   
    @Test(groups = "testCustomerAddress")
    @Transactional
    public void createNewDefaultAddress() {
        Customer customer = createCustomerWithAddresses();
        CustomerAddress ca = new CustomerAddressImpl();
        Address address = new AddressImpl();
        address.setAddressLine1("123 Main");
        address.setCity("Dallas");
        address.setPostalCode("75201");
        address.setDefault(true);
        ca.setAddress(address);
        ca.setCustomer(customer);
        ca.setAddressName("address3");
        CustomerAddress savedAddress = saveCustomerAddress(ca);
       
        List<CustomerAddress> customerAddressList = customerAddressService.readActiveCustomerAddressesByCustomerId(customer.getId());
        for (CustomerAddress customerAddress : customerAddressList) {
            if (customerAddress.getId().equals(savedAddress.getId())) {
                assert customerAddress.getAddress().isDefault();
            } else {
                assert !customerAddress.getAddress().isDefault();
            }
        }
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

            //if the cart has already has fulfillment information
            if (firstShippableFulfillmentGroup.getAddress()!=null) {
                shippingForm.setAddress(firstShippableFulfillmentGroup.getAddress());
            } else {
                //check for a default address for the customer
                CustomerAddress defaultAddress = customerAddressService.findDefaultCustomerAddress(CustomerState.getCustomer().getId());
                if (defaultAddress != null) {
                    shippingForm.setAddress(defaultAddress.getAddress());
                    shippingForm.setAddressName(defaultAddress.getAddressName());
                }
            }

            FulfillmentOption fulfillmentOption = firstShippableFulfillmentGroup.getFulfillmentOption();
            if (fulfillmentOption != null) {
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

        multishipAddAddressFormValidator.validate(addressForm, result);
        if (result.hasErrors()) {
            return showMultishipAddAddress(request, response, model);
        }

        CustomerAddress customerAddress = customerAddressService.create();
        customerAddress.setAddressName(addressForm.getAddressName());
        customerAddress.setAddress(addressForm.getAddress());
        customerAddress.setCustomer(CustomerState.getCustomer());
        customerAddressService.saveCustomerAddress(customerAddress);

        //append current time to redirect to fix a problem with ajax caching in IE
        return getMultishipAddAddressSuccessView() + "?_=" + System.currentTimeMillis();
    }
View Full Code Here

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress

        model.addAttribute("customerAddressForm", new CustomerAddressForm());
        return getCustomerAddressesView();
    }
   
    public String viewCustomerAddress(HttpServletRequest request, Model model, Long customerAddressId) {
        CustomerAddress customerAddress = customerAddressService.readCustomerAddressById(customerAddressId);
        if (customerAddress == null) {
            throw new IllegalArgumentException("Customer Address not found with the specified customerAddressId");
        }
        CustomerAddressForm form = new CustomerAddressForm();
        form.setAddress(customerAddress.getAddress());
        form.setAddressName(customerAddress.getAddressName());
        form.setCustomerAddressId(customerAddress.getId());
        model.addAttribute("customerAddressForm", form);
        return getCustomerAddressesView();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.