/** * 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); } } }
/** * This method will copy the shipping address of the first fulfillment group on the order * to the billing address on the PaymentInfoForm that is passed in. */ protected void copyShippingAddressToBillingAddress(Order order, PaymentInfoForm paymentInfoForm) { if (fulfillmentGroupService.getFirstShippableFulfillmentGroup(order) != null) { Address shipping = fulfillmentGroupService.getFirstShippableFulfillmentGroup(order).getAddress(); if (shipping != null) { Address billing = addressService.copyAddress(shipping) ; paymentInfoForm.setAddress(billing); } } }
protected void copyCustomerPaymentAddressToBillingAddress(PaymentInfoForm paymentForm) { CustomerPayment customerPayment = customerPaymentService.readCustomerPaymentById(paymentForm.getCustomerPaymentId()); if (customerPayment != null) { Address address = customerPayment.getBillingAddress(); if (address != null) { paymentForm.setAddress(addressService.copyAddress(address)); } } }
/** * This method will copy the billing address of any CREDIT CARD order payment on the order * to the shipping address on the ShippingInfoForm that is passed in. */ protected void copyBillingAddressToShippingAddress(Order order, ShippingInfoForm shippingInfoForm) { if (order.getPayments() != null) { for (OrderPayment payment : order.getPayments()) { if (payment.isActive() && PaymentType.CREDIT_CARD.equals(payment.getType())) { Address billing = payment.getBillingAddress(); if (billing != null) { Address shipping = addressService.copyAddress(billing); shippingInfoForm.setAddress(shipping); } } } } }
OrderPayment orderPayment = create(); orderPayment.setOrder(order); orderPayment.setBillingAddress(addressService.copyAddress(customerPayment.getBillingAddress()));
@Override @Transactional(value = TransactionUtils.DEFAULT_TRANSACTION_MANAGER) public CustomerPayment createCustomerPaymentFromPaymentTransaction(PaymentTransaction transaction) { CustomerPayment customerPayment = customerPaymentService.create(); customerPayment.setCustomer(transaction.getOrderPayment().getOrder().getCustomer()); customerPayment.setBillingAddress(addressService.copyAddress(transaction.getOrderPayment().getBillingAddress())); customerPayment.setPaymentType(transaction.getOrderPayment().getType()); customerPayment.setPaymentGatewayType(transaction.getOrderPayment().getGatewayType()); customerPayment.setAdditionalFields(transaction.getAdditionalFields()); populateCustomerPaymentToken(customerPayment, transaction); return customerPaymentService.saveCustomerPayment(customerPayment); }
Address address = customerPayment.getBillingAddress(); if (address != null) { billingForm.setAddress(addressService.copyAddress(address)); p.setBillingAddress(billingForm.getAddress()); } else { Address updatedAddress = addressService.copyAddress(p.getBillingAddress(), billingForm.getAddress()); p.setBillingAddress(updatedAddress);