Search in sources :

Example 36 with Address

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

the class CheckoutFormServiceImpl method prePopulateBillingInfoForm.

@Override
public BillingInfoForm prePopulateBillingInfoForm(BillingInfoForm billingInfoForm, ShippingInfoForm shippingInfoForm, Order cart) {
    Address orderPaymentBillingAddress = getAddressFromCCOrderPayment(cart);
    if (orderPaymentBillingAddress != null) {
        billingInfoForm.setAddress(orderPaymentBillingAddress);
    }
    boolean shippingAddressUsedForBilling = addressesContentsAreEqual(shippingInfoForm.getAddress(), billingInfoForm.getAddress());
    billingInfoForm.setUseShippingAddress(shippingAddressUsedForBilling);
    return billingInfoForm;
}
Also used : Address(org.broadleafcommerce.profile.core.domain.Address) CustomerAddress(org.broadleafcommerce.profile.core.domain.CustomerAddress)

Example 37 with Address

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

the class BroadleafBillingInfoController method copyShippingAddressToBillingAddress.

/**
 * This method will copy the shipping address of the first fulfillment group on the order
 * to the billing address on the BillingInfoForm that is passed in.
 */
protected void copyShippingAddressToBillingAddress(Order order, BillingInfoForm billingInfoForm) {
    if (order.getFulfillmentGroups().get(0) != null) {
        Address shipping = order.getFulfillmentGroups().get(0).getAddress();
        if (shipping != null) {
            Address billing = addressService.copyAddress(shipping);
            billingInfoForm.setAddress(billing);
        }
    }
}
Also used : Address(org.broadleafcommerce.profile.core.domain.Address)

Aggregations

Address (org.broadleafcommerce.profile.core.domain.Address)37 FulfillmentGroup (org.broadleafcommerce.core.order.domain.FulfillmentGroup)15 Order (org.broadleafcommerce.core.order.domain.Order)15 Customer (org.broadleafcommerce.profile.core.domain.Customer)14 AddressImpl (org.broadleafcommerce.profile.core.domain.AddressImpl)11 CustomerAddress (org.broadleafcommerce.profile.core.domain.CustomerAddress)11 Transactional (org.springframework.transaction.annotation.Transactional)10 Test (org.testng.annotations.Test)10 FulfillmentGroupItem (org.broadleafcommerce.core.order.domain.FulfillmentGroupItem)9 Money (org.broadleafcommerce.common.money.Money)8 ArrayList (java.util.ArrayList)7 DiscreteOrderItem (org.broadleafcommerce.core.order.domain.DiscreteOrderItem)7 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 FulfillmentGroupImpl (org.broadleafcommerce.core.order.domain.FulfillmentGroupImpl)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