0

我想获取客户帐单地址详细信息,并希望将它们记录blCheckoutWorkflow.

我尝试了以下方法。

Order order=context.getOrder();
Customer c=order.getCustomer();
c.getCustomerPayments().get(0).getBillingAddress();

但是这里返回的列表的大小getCustomerPayments()0。所以我得到了ArrayIndexOutOfBoundsException

有没有办法获取客户在/checkout.

请回复我。

4

1 回答 1

0

getCustomerPayments() is designed to hold saved payment information for a particular Customer and is not really applicable to the current Order. This is used when a Customer wants to save payment information for checking out next time (the 'token' property on CustomerPaymentImpl is used to look up the PCI-sensitive data from the payment gateway).

If you are using Broadleaf 3.1.0-GA+ then you should do:

Order order = context.getOrder();
Address billingAddress = order.getOrderPayments().get(0).getBillingAddress();

If you are using Broadleaf 3.0.10-GA or below you should do:

Order order = context.getOrder();
Address billingAddress = order.getPaymentInfos().get(0).getAddress();
于 2014-05-09T16:14:32.340 回答