private Payment fillPaymentPrototype(final CustomerOrder order,final Payment templatePayment,final String transactionOperation,final String transactionGatewayLabel){
  Address shippingAddr=order.getShippingAddressDetails();
  Address billingAddr=order.getBillingAddressDetails();
  if (billingAddr != null) {
    PaymentAddress addr=new PaymentAddressImpl();
    BeanUtils.copyProperties(billingAddr,addr);
    templatePayment.setBillingAddress(addr);
  }
  if (shippingAddr != null) {
    PaymentAddress addr=new PaymentAddressImpl();
    BeanUtils.copyProperties(shippingAddr,addr);
    templatePayment.setShippingAddress(addr);
  }
  templatePayment.setBillingAddressString(order.getBillingAddress());
  templatePayment.setShippingAddressString(order.getShippingAddress());
  templatePayment.setBillingEmail(order.getEmail());
  templatePayment.setOrderDate(order.getOrderTimestamp());
  templatePayment.setOrderCurrency(order.getCurrency());
  templatePayment.setOrderLocale(order.getLocale());
  templatePayment.setOrderNumber(order.getOrdernum());
  templatePayment.setTransactionOperation(transactionOperation);
  templatePayment.setTransactionGatewayLabel(transactionGatewayLabel);
  return templatePayment;
}

private Payment fillPaymentPrototype ( final CustomerOrder order , final Payment templatePayment , final String transactionOperation , final String transactionGatewayLabel ) { Address shippingAddr = order . getShippingAddressDetails ( ) ; Address billingAddr = order . getBillingAddressDetails ( ) ; if ( billingAddr != null ) { PaymentAddress addr = new PaymentAddressImpl ( ) ; BeanUtils . copyProperties ( billingAddr , addr ) ; templatePayment . setBillingAddress ( addr ) ; } if ( shippingAddr != null ) { PaymentAddress addr = new PaymentAddressImpl ( ) ; BeanUtils . copyProperties ( shippingAddr , addr ) ; templatePayment . setShippingAddress ( addr ) ; } templatePayment . setBillingAddressString ( order . getBillingAddress ( ) ) ; templatePayment . setShippingAddressString ( order . getShippingAddress ( ) ) ; templatePayment . setBillingEmail ( order . getEmail ( ) ) ; templatePayment . setOrderDate ( order . getOrderTimestamp ( ) ) ; templatePayment . setOrderCurrency ( order . getCurrency ( ) ) ; templatePayment . setOrderLocale ( order . getLocale ( ) ) ; templatePayment . setOrderNumber ( order . getOrdernum ( ) ) ; templatePayment . setTransactionOperation ( transactionOperation ) ; templatePayment . setTransactionGatewayLabel ( transactionGatewayLabel ) ; return templatePayment ; }
add information to template payment object .
