Java Rest Api结帐/付款阔叶
在checkoutEndpoint类的addPaymentToOrder方法中,我想使用customerId、addressId和orderId以及任何必要的方法创建OrderPaymentWrapper。有谁能指导我如何创建OrderPaymentWrapper吗?假设您正在谈论自定义现有OrderPaymentWrapper,请创建包装的子类:Java Rest Api结帐/付款阔叶,java,api,rest,broadleaf-commerce,Java,Api,Rest,Broadleaf Commerce,在checkoutEndpoint类的addPaymentToOrder方法中,我想使用customerId、addressId和orderId以及任何必要的方法创建OrderPaymentWrapper。有谁能指导我如何创建OrderPaymentWrapper吗?假设您正在谈论自定义现有OrderPaymentWrapper,请创建包装的子类: @XmlRootElement(name = "customPayment") @XmlAccessorType(value = XmlAccess
@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;
}
}
@XmlRootElement(name=“customPayment”)
@XmlAccessorType(值=XmlAccessType.FIELD)
公共类CustomPaymentWrapper扩展BaseWrapper实现APIWrapper、APIUnwrapper{
@XmlElement
受保护的长地址ID;
@XmlElement
受保护的长客户ID;
public OrderPayment unwrap(HttpServletRequest请求,ApplicationContext上下文){
OrderPayment=super.unwrap(请求、上下文);
//付款时做其他事情
退还款项;
}
}
然后在applicationContext-rest-api.xml中,为OrderPaymentWrapper提供覆盖:
<bean id="org.broadleafcommerce.core.web.api.wrapper.OrderPaymentWrapper" class="com.mycompany.core.api.CustomPaymentWrapper" scope="prototype" />
No。。我想用customerid、addressid和order id等输入填充OrderPayment,而不是将整个OrderPayment作为输入发送到该方法。