Page 1 of 1

PayPal Quick Start Problem

Posted: Mon Mar 18, 2013 3:10 am
by abiieez
I am trying to incorporate Broadleaf PayPal API into my Spring MVC application. Below what I have done:

My web.xml

Code: Select all

<context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
          /WEB-INF/broadleaf/bl-paypal-applicationContext.xml,
          /WEB-INF/spring/root-context.xml,
          /WEB-INF/spring/appServlet/*-context.xml
      </param-value>
   </context-param>


My root-context.xml

Code: Select all

<bean id="blConfiguration"
      class="org.broadleafcommerce.common.config.RuntimeEnvironmentPropertiesConfigurer" />


The last part would be the bl-paypal-applicationContext.xml which is not described clearly in http://docs.broadleafcommerce.org/current/PayPal-Quick-Start.html. So what I did was search the particular xml in google and found the following:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <context:component-scan base-package="org.broadleafcommerce.common.web"/>
    <context:component-scan base-package="org.broadleafcommerce.core.web"/>
    <context:component-scan base-package="org.broadleafcommerce.profile.web"/>
    <context:component-scan base-package="org.broadleafcommerce.vendor.paypal"/>

    <!-- In order to use the pre-configured properties files, you should override this bean yourself in your own applicationContext.xml -->
    <!--
    <bean id="blConfiguration" class="org.broadleafcommerce.common.config.RuntimeEnvironmentPropertiesConfigurer">
        <property name="propertyLocations">
            <set>
                <value>classpath:config/bc/paypal/</value>
            </set>
        </property>
    </bean>
    -->

    <bean id="blPayPalCheckoutService" class="org.broadleafcommerce.vendor.paypal.service.payment.PayPalCheckoutServiceImpl"/>

    <bean id="blPayPalPaymentService" class="org.broadleafcommerce.core.payment.service.PaymentServiceImpl">
        <property name="paymentModule" ref="blPayPalModule"/>
    </bean>

    <bean id="blPayPalModule" class="org.broadleafcommerce.payment.service.module.PayPalPaymentModule">
        <property name="payPalPaymentService" ref="blPayPalVendorOrientedPaymentService"/>
    </bean>

    <bean id="blPayPalVendorOrientedPaymentService" class="org.broadleafcommerce.vendor.paypal.service.payment.PayPalPaymentServiceImpl">
        <property name="serverUrl" value="${paypal.api.url}"/>
        <property name="failureReportingThreshold" value="1"/>
        <property name="requestGenerator">
            <bean class="org.broadleafcommerce.vendor.paypal.service.payment.PayPalRequestGeneratorImpl">
                <property name="libVersion" value="${paypal.version}"/>
                <property name="password" value="${paypal.password}"/>
                <property name="user" value="${paypal.user}"/>
                <property name="signature" value="${paypal.signature}"/>
                <property name="returnUrl" value="${paypal.return.url}"/>
                <property name="cancelUrl" value="${paypal.cancel.url}"/>
                <!-- 0 : PayPal displays the shipping address passed in. -->
                <!-- 1 : PayPal does not display the shipping fields at all. (Default) -->
                <!-- 2 : PayPal will obtain the shipping address from the buyer's profile.-->
                <property name="shippingDisplayType" value="${paypal.shipping.display}"/>
                <property name="additionalConfig">
                    <map>
                        <entry key="HDRIMG" value="${paypal.additional.HDRIMG}"/>
                        <entry key="HDRBORDERCOLOR" value="${paypal.additional.HDRBORDERCOLOR}"/>
                        <entry key="HDRBACKCOLOR" value="${paypal.additional.HDRBACKCOLOR}"/>
                        <entry key="PAYFLOWCOLOR" value="${paypal.additional.PAYFLOWCOLOR}"/>
                    </map>
                </property>
            </bean>
        </property>
        <property name="responseGenerator">
            <bean class="org.broadleafcommerce.vendor.paypal.service.payment.PayPalResponseGeneratorImpl">
                <property name="userRedirectUrl" value="${paypal.user.redirect.url}"/>
            </bean>
        </property>
    </bean>

    <!-- This is a default AuthorizeAndDebitWorkflow that includes a PayPal payment activity -->
    <!-- This assumes a basic configuration and will need to be overriden if there are any custom activities -->
    <bean id="blAuthorizeAndDebitWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
        <property name="processContextFactory">
            <bean class="org.broadleafcommerce.core.payment.service.workflow.PaymentProcessContextFactory">
                <property name="paymentActionType" value="AUTHORIZEANDDEBIT"/>
            </bean>
        </property>
        <property name="activities">
            <list>
                <bean class="org.broadleafcommerce.core.payment.service.workflow.PaymentActivity">
                    <property name="paymentService" ref="blPayPalPaymentService"/>
                    <property name="userName" value="web"/>
                </bean>
                <bean class="org.broadleafcommerce.core.payment.service.workflow.PaymentActivity">
                    <property name="paymentService" ref="blCreditCardService"/>
                    <property name="userName" value="web"/>
                </bean>
            </list>
        </property>
        <property name="defaultErrorHandler" ref="blDefaultErrorHandler"/>
    </bean>

</beans>


After adding the above bl-paypal-applicationContext.xml, I am unable to start my App and found the following error:

Code: Select all

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'blLocaleService' is defined


The error will go away if I add the following into the xml:

Code: Select all

<context:component-scan base-package="org.broadleafcommerce.common.locale.service"/>
    <context:component-scan base-package="org.broadleafcommerce.common.locale.dao"/>


However now a new error appears when I start my tomcat:

Code: Select all

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'blPU' is defined


What should I do to eliminate all this error ? I would like to enable broadleaf paypal api with its most basic setting. Once I get familiar with it, I'd try to use the advance configuration.

Many thanks.

Re: PayPal Quick Start Problem

Posted: Fri Apr 12, 2013 3:23 pm
by jefffischer
Try removing these lines from bl-paypal-applicationContext.xml

Code: Select all

<context:component-scan base-package="org.broadleafcommerce.common.web"/>
<context:component-scan base-package="org.broadleafcommerce.core.web"/>
<context:component-scan base-package="org.broadleafcommerce.profile.web"/>