Search in sources :

Example 1 with AddressImpl

use of org.broadleafcommerce.profile.core.domain.AddressImpl in project BroadleafCommerce by BroadleafCommerce.

the class CheckoutTest method buildAddress.

private Address buildAddress() {
    Address address = new AddressImpl();
    address.setAddressLine1("123 Test Rd");
    address.setCity("Dallas");
    address.setFirstName("Jeff");
    address.setLastName("Fischer");
    address.setPostalCode("75240");
    address.setPrimaryPhone("972-978-9067");
    State state = new StateImpl();
    state.setAbbreviation("ALL");
    state.setName("ALL");
    address.setState(state);
    Country country = new CountryImpl();
    country.setAbbreviation("US");
    country.setName("United States");
    state.setCountry(country);
    address.setCountry(country);
    ISOCountry isoCountry = new ISOCountryImpl();
    isoCountry.setAlpha2("US");
    isoCountry.setName("UNITED STATES");
    address.setIsoCountryAlpha2(isoCountry);
    return address;
}
Also used : Address(org.broadleafcommerce.profile.core.domain.Address) ISOCountryImpl(org.broadleafcommerce.common.i18n.domain.ISOCountryImpl) CountryImpl(org.broadleafcommerce.profile.core.domain.CountryImpl) State(org.broadleafcommerce.profile.core.domain.State) StateImpl(org.broadleafcommerce.profile.core.domain.StateImpl) AddressImpl(org.broadleafcommerce.profile.core.domain.AddressImpl) Country(org.broadleafcommerce.profile.core.domain.Country) ISOCountry(org.broadleafcommerce.common.i18n.domain.ISOCountry) ISOCountryImpl(org.broadleafcommerce.common.i18n.domain.ISOCountryImpl) ISOCountry(org.broadleafcommerce.common.i18n.domain.ISOCountry)

Example 2 with AddressImpl

use of org.broadleafcommerce.profile.core.domain.AddressImpl in project BroadleafCommerce by BroadleafCommerce.

the class OfferTest method createFulfillmentGroups.

private List<FulfillmentGroup> createFulfillmentGroups(FulfillmentOption option, Double shippingPrice, Order order) {
    List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();
    FulfillmentGroup group = new FulfillmentGroupImpl();
    group.setFulfillmentOption(option);
    groups.add(group);
    group.setRetailShippingPrice(new Money(shippingPrice));
    group.setOrder(order);
    Address address = new AddressImpl();
    address.setAddressLine1("123 Test Rd");
    address.setCity("Dallas");
    address.setFirstName("Jeff");
    address.setLastName("Fischer");
    address.setPostalCode("75240");
    address.setPrimaryPhone("972-978-9067");
    Country country = new CountryImpl();
    country.setAbbreviation("US");
    country.setName("United States");
    countryService.save(country);
    ISOCountry isoCountry = new ISOCountryImpl();
    isoCountry.setAlpha2("US");
    isoCountry.setName("UNITED STATES");
    isoService.save(isoCountry);
    State state = new StateImpl();
    state.setAbbreviation("TX");
    state.setName("Texas");
    state.setCountry(country);
    stateService.save(state);
    address.setState(state);
    address.setCountry(country);
    address.setIsoCountrySubdivision("US-TX");
    address.setIsoCountryAlpha2(isoCountry);
    for (OrderItem orderItem : order.getOrderItems()) {
        FulfillmentGroupItem fgItem = new FulfillmentGroupItemImpl();
        fgItem.setFulfillmentGroup(group);
        fgItem.setOrderItem(orderItem);
        fgItem.setQuantity(orderItem.getQuantity());
        group.addFulfillmentGroupItem(fgItem);
    }
    group.setAddress(address);
    return groups;
}
Also used : FulfillmentGroupImpl(org.broadleafcommerce.core.order.domain.FulfillmentGroupImpl) Address(org.broadleafcommerce.profile.core.domain.Address) ArrayList(java.util.ArrayList) StateImpl(org.broadleafcommerce.profile.core.domain.StateImpl) Money(org.broadleafcommerce.common.money.Money) ISOCountryImpl(org.broadleafcommerce.common.i18n.domain.ISOCountryImpl) CountryImpl(org.broadleafcommerce.profile.core.domain.CountryImpl) State(org.broadleafcommerce.profile.core.domain.State) OrderItem(org.broadleafcommerce.core.order.domain.OrderItem) DiscreteOrderItem(org.broadleafcommerce.core.order.domain.DiscreteOrderItem) FulfillmentGroupItem(org.broadleafcommerce.core.order.domain.FulfillmentGroupItem) AddressImpl(org.broadleafcommerce.profile.core.domain.AddressImpl) Country(org.broadleafcommerce.profile.core.domain.Country) ISOCountry(org.broadleafcommerce.common.i18n.domain.ISOCountry) FulfillmentGroup(org.broadleafcommerce.core.order.domain.FulfillmentGroup) ISOCountryImpl(org.broadleafcommerce.common.i18n.domain.ISOCountryImpl) ISOCountry(org.broadleafcommerce.common.i18n.domain.ISOCountry) FulfillmentGroupItemImpl(org.broadleafcommerce.core.order.domain.FulfillmentGroupItemImpl)

Example 3 with AddressImpl

use of org.broadleafcommerce.profile.core.domain.AddressImpl in project BroadleafCommerce by BroadleafCommerce.

the class CommonSetupBaseTest method createCustomerWithAddresses.

/**
 * Creates a country, state, and customer with some CustomerAddresses
 * @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;
}
Also used : CustomerAddressImpl(org.broadleafcommerce.profile.core.domain.CustomerAddressImpl) Address(org.broadleafcommerce.profile.core.domain.Address) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress) Customer(org.broadleafcommerce.profile.core.domain.Customer) AddressImpl(org.broadleafcommerce.profile.core.domain.AddressImpl) CustomerAddressImpl(org.broadleafcommerce.profile.core.domain.CustomerAddressImpl) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress)

Example 4 with AddressImpl

use of org.broadleafcommerce.profile.core.domain.AddressImpl in project BroadleafCommerce by BroadleafCommerce.

the class CustomerAddressTest method createNewDefaultAddress.

@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();
        }
    }
}
Also used : CustomerAddressImpl(org.broadleafcommerce.profile.core.domain.CustomerAddressImpl) Address(org.broadleafcommerce.profile.core.domain.Address) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress) Customer(org.broadleafcommerce.profile.core.domain.Customer) CustomerAddressImpl(org.broadleafcommerce.profile.core.domain.CustomerAddressImpl) AddressImpl(org.broadleafcommerce.profile.core.domain.AddressImpl) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress) Test(org.testng.annotations.Test) CommonSetupBaseTest(org.broadleafcommerce.test.CommonSetupBaseTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with AddressImpl

use of org.broadleafcommerce.profile.core.domain.AddressImpl in project BroadleafCommerce by BroadleafCommerce.

the class CustomerAddressDataProvider method createCustomerAddress.

@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 } };
}
Also used : CustomerAddressImpl(org.broadleafcommerce.profile.core.domain.CustomerAddressImpl) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress) Address(org.broadleafcommerce.profile.core.domain.Address) CustomerAddressImpl(org.broadleafcommerce.profile.core.domain.CustomerAddressImpl) AddressImpl(org.broadleafcommerce.profile.core.domain.AddressImpl) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress) DataProvider(org.testng.annotations.DataProvider)

Aggregations

Address (org.broadleafcommerce.profile.core.domain.Address)11 AddressImpl (org.broadleafcommerce.profile.core.domain.AddressImpl)11 State (org.broadleafcommerce.profile.core.domain.State)7 StateImpl (org.broadleafcommerce.profile.core.domain.StateImpl)7 ISOCountry (org.broadleafcommerce.common.i18n.domain.ISOCountry)6 ISOCountryImpl (org.broadleafcommerce.common.i18n.domain.ISOCountryImpl)6 Money (org.broadleafcommerce.common.money.Money)6 DiscreteOrderItem (org.broadleafcommerce.core.order.domain.DiscreteOrderItem)6 FulfillmentGroup (org.broadleafcommerce.core.order.domain.FulfillmentGroup)6 FulfillmentGroupImpl (org.broadleafcommerce.core.order.domain.FulfillmentGroupImpl)6 FulfillmentGroupItem (org.broadleafcommerce.core.order.domain.FulfillmentGroupItem)6 FulfillmentGroupItemImpl (org.broadleafcommerce.core.order.domain.FulfillmentGroupItemImpl)6 Country (org.broadleafcommerce.profile.core.domain.Country)6 CountryImpl (org.broadleafcommerce.profile.core.domain.CountryImpl)6 Sku (org.broadleafcommerce.core.catalog.domain.Sku)5 SkuImpl (org.broadleafcommerce.core.catalog.domain.SkuImpl)5 DiscreteOrderItemImpl (org.broadleafcommerce.core.order.domain.DiscreteOrderItemImpl)5 Order (org.broadleafcommerce.core.order.domain.Order)5 Customer (org.broadleafcommerce.profile.core.domain.Customer)5 ArrayList (java.util.ArrayList)4