0

我按照 Broadleaf 的文档(这里是链接:http : //docs.broadleafcommerce.org/2.2/PayPal-Quick-Start.html )将 Broadleaf 的 DemoSite 环境与 Paypal express 模块集成。为了在开发环境中实现这一点,我创建了一个沙盒帐户并将其相关值设置为站点。

但是,当我通过将商品添加到购物车并单击“快速结帐”按钮来测试我的 DemoSite 时,它​​导致我的 DemoSite 出现以下错误:

org.broadleafcommerce.core.payment.service.exception.PaymentException: Unable to execute payment for order -- id: 1
    at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePayment(CompositePaymentServiceImpl.java:69)
    at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePayment(CompositePaymentServiceImpl.java:74)
    at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePaymentForGateway(CompositePaymentServiceImpl.java:90)
    at org.broadleafcommerce.vendor.paypal.service.payment.PayPalCheckoutServiceImpl.initiateExpressCheckout(PayPalCheckoutServiceImpl.java:87)
    at org.broadleafcommerce.vendor.paypal.web.controller.BroadleafPayPalController.paypalCheckout(BroadleafPayPalController.java:84)
    at com.mycompany.controller.paypal.PayPalController.paypalCheckout(PayPalController.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:643)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.broadleafcommerce.cms.web.URLHandlerFilter.doFilterInternal(URLHandlerFilter.java:74)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1302)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.broadleafcommerce.profile.web.core.security.SessionFixationProtectionFilter.doFilter(SessionFixationProtectionFilter.java:96)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.broadleafcommerce.core.web.order.security.CartStateFilter.doFilter(CartStateFilter.java:58)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.broadleafcommerce.profile.web.core.security.CustomerStateFilter.doFilter(CustomerStateFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.broadleafcommerce.common.security.handler.CsrfFilter.doFilter(CsrfFilter.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1302)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.broadleafcommerce.common.web.BroadleafRequestFilter.doFilterInternal(BroadleafRequestFilter.java:98)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1302)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:448)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1067)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:377)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1001)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
    at org.eclipse.jetty.server.Server.handle(Server.java:360)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.broadleafcommerce.core.workflow.WorkflowException: org.broadleafcommerce.core.workflow.WorkflowException: org.broadleafcommerce.core.payment.service.exception.PaymentException: The PaymentResponseItem instance did not contain one or more of the following: transactionAmount, transactionTimestamp or transactionSuccess
    at org.broadleafcommerce.core.workflow.DefaultErrorHandler.handleError(DefaultErrorHandler.java:57)
    at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:84)
    at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePayment(CompositePaymentServiceImpl.java:55)
    ... 101 more
Caused by: org.broadleafcommerce.core.workflow.WorkflowException: org.broadleafcommerce.core.payment.service.exception.PaymentException: The PaymentResponseItem instance did not contain one or more of the following: transactionAmount, transactionTimestamp or transactionSuccess
    at org.broadleafcommerce.core.workflow.DefaultErrorHandler.handleError(DefaultErrorHandler.java:57)
    at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:84)
    at org.broadleafcommerce.core.payment.service.workflow.CompositeActivity.execute(CompositeActivity.java:35)
    at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:75)
    ... 102 more
Caused by: org.broadleafcommerce.core.payment.service.exception.PaymentException: The PaymentResponseItem instance did not contain one or more of the following: transactionAmount, transactionTimestamp or transactionSuccess
    at org.broadleafcommerce.core.payment.service.workflow.PaymentActivity.execute(PaymentActivity.java:151)
    at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:75)
    ... 104 more

因此,谁能指导我如何解决上述问题。提前致谢。

顺便说一句,我的 DemoSite 是根据 Broadleaf 2.2 和 Broadleaf-paypal 2.0.1 构建的。

4

3 回答 3

1

问题出在方法 PayPalPaymentModule.reverseAuthorize() 中。在第一行 responseItem.setAmountPaid(paymentContext.getPaymentInfo().getAmount()); 它使用不推荐使用的方法 setAmountPaid()。我认为应该有 setTransactionAmount()。也许您可以将其发布到阔叶论坛!

我正在使用 Broadleaf 2.3.0-SNAPSHOT 和 BL paypal 2.2.0-SNAPSHOT

于 2013-04-14T09:43:10.310 回答
0

我为这个问题编写了一个解决方法!

package de.naschkammer.payment.service.module;

import org.broadleafcommerce.core.payment.domain.PaymentResponseItem;
import org.broadleafcommerce.core.payment.service.PaymentContext;
import org.broadleafcommerce.core.payment.service.exception.PaymentException;
import org.broadleafcommerce.payment.service.module.PayPalPaymentModule;
import org.broadleafcommerce.vendor.paypal.service.payment.type.PayPalTransactionType;

// TODO remove this workaround for paypal, don't forget to adjust /site/src/main/webapp/WEB-INF/applicationContext.xml
public class NaschkammerPayPalPaymentModule extends PayPalPaymentModule {

    @Override
    public PaymentResponseItem authorizeAndDebit(PaymentContext paymentContext) throws PaymentException {
        PaymentResponseItem item = commonAuthorizeOrSale(paymentContext, PayPalTransactionType.AUTHORIZEANDCAPTURE);
        if ( item != null ) {
            item.setTransactionAmount(item.getAmountPaid());
        }
        return item;
    }

}

将以下代码段添加到文件 /site/src/main/webapp/WEB-INF/applicationContext.xml

<!-- workaround for paypal -->
<bean id="blPayPalModule" class="de.naschkammer.payment.service.module.NaschkammerPayPalPaymentModule">
    <property name="payPalPaymentService" ref="blPayPalVendorOrientedPaymentService"/>
</bean>
于 2013-04-14T12:33:18.937 回答
0

看起来目前还有其他问题使 PayPal 模块无法用于 Broadleaf 2.3 版。这些在GitHub 问题页面中进行了概述。

另一个注意事项:我们已经更改了 PayPal 模块的一些版本控制。如果您的目标是 Broadleaf 版本 2.3.0-SNAPSHOT,那么您应该使用 PayPal 版本 2.4.0-SNAPSHOT(这是GitHub 上的“开发”分支。

如果您对那里列出的这些问题有一些修复,我们希望您提交拉取请求。否则,我们将尝试在下周的某个时间修复这些问题。

于 2013-04-17T15:37:56.430 回答