Page 1 of 1

Problem with Paypal Integration in Broadleaf Commerce 2.2

Posted: Mon Jul 22, 2013 2:10 am
by ankitpatni
Hi,
I am working with Broadleaf commerce 2.2, and Paypal 2.2.0-SNAPSHOT.
I wanted to integrate Paypal in my project, I checked the documentation provided in the docs http://docs.broadleafcommerce.org/2.2/PayPal-Environment-Setup.html and configured each and everything as written in the documentation.

I have created a controller named PayPalController in site>main>java>com>mycompany>controller>paypal>PayPalController.java and have congifured all the cml files as stated in the documentation.
I am using developers account of paypal for my testing purpose.

the error which i got on click of paypal image is "[artifact:mvn] [ WARN] 12:12:17 PageNotFound - No mapping found for HTTP request with URI [/paypal/checkout] in DispatcherServlet with name 'mycompany' ".
Pleased if someone can provide me some solution to get rid of this error.

Thanks & Regards
Ankit Patni

Re: Problem with Paypal Integration in Broadleaf Commerce 2.2

Posted: Tue Jul 23, 2013 1:38 am
by Anky
In that PayPalController.java file
do the below changes :-

package com.marketplace.controller.paypal;

import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.broadleafcommerce.core.checkout.service.exception.CheckoutException;
import org.broadleafcommerce.core.checkout.service.workflow.CheckoutResponse;
import org.broadleafcommerce.core.order.domain.NullOrderImpl;
import org.broadleafcommerce.core.order.domain.Order;
import org.broadleafcommerce.core.order.service.OrderService;
import org.broadleafcommerce.core.payment.domain.PaymentInfo;
import org.broadleafcommerce.core.payment.domain.PaymentResponseItem;
import org.broadleafcommerce.core.payment.service.exception.PaymentException;
import org.broadleafcommerce.core.payment.service.module.PaymentResponse;
import org.broadleafcommerce.core.payment.service.type.PaymentInfoType;
import org.broadleafcommerce.core.payment.service.workflow.CompositePaymentResponse;
import org.broadleafcommerce.core.pricing.service.exception.PricingException;
import org.broadleafcommerce.core.web.controller.checkout.BroadleafCheckoutController;
import org.broadleafcommerce.core.web.order.CartState;
import org.broadleafcommerce.vendor.paypal.service.payment.PayPalCheckoutService;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.broadleafcommerce.vendor.paypal.web.controller.BroadleafPayPalController;

@Controller
public class PayPalController extends BroadleafPayPalController {

//This is the URL that will initiate the checkout process with PayPal.
@RequestMapping("/paypal/checkout")
public String paypalCheckout(HttpServletRequest request) throws PaymentException {
return super.paypalCheckout(request);
}

//This is the URL that PayPal will redirect back to on callback.
//This should match ${paypal.return.url} in your properties file.
//For example: ${paypal.return.url}=http://localhost:8080/mycompany/paypal/process
@RequestMapping("/paypal/process")
public String paypalProcess(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam String token, @RequestParam("PayerID") String payerID) throws CheckoutException, PricingException {
return super.paypalProcess(request, response, model, token, payerID);
}

}