* 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.create();
billing.setFirstName(shipping.getFirstName());
billing.setLastName(shipping.getLastName());
billing.setAddressLine1(shipping.getAddressLine1());
billing.setAddressLine2(shipping.getAddressLine2());
billing.setCity(shipping.getCity());
billing.setState(shipping.getState());
billing.setPostalCode(shipping.getPostalCode());
billing.setCountry(shipping.getCountry());
billing.setPrimaryPhone(shipping.getPrimaryPhone());
billing.setEmailAddress(shipping.getEmailAddress());
billingInfoForm.setAddress(billing);
}
}
}