checkoutEndpoint クラスの addPaymentToOrder メソッドで、customerId、addressId、および orderId を使用して OrderPaymentWrapper を作成したいと考えています。OrderPaymentWrapper を作成する方法を教えてもらえますか?
1 に答える
0
既存の OrderPaymentWrapper のカスタマイズについて話していると仮定して、ラッパーのサブクラスを作成します。
@XmlRootElement(name = "customPayment")
@XmlAccessorType(value = XmlAccessType.FIELD)
public class CustomPaymentWrapper extends BaseWrapper implements APIWrapper<OrderPayment>, APIUnwrapper<OrderPayment> {
@XmlElement
protected Long addressId;
@XmlElement
protected Long customerId;
public OrderPayment unwrap(HttpServletRequest request, ApplicationContext context) {
OrderPayment payment = super.unwrap(request, context);
//do other stuff with the payment
return payment;
}
}
次に、applicationContext-rest-api.xml で、OrderPaymentWrapper のオーバーライドを提供します。
<bean id="org.broadleafcommerce.core.web.api.wrapper.OrderPaymentWrapper" class="com.mycompany.core.api.CustomPaymentWrapper" scope="prototype" />
于 2014-07-20T21:20:55.200 に答える