From 3e4206b4d45061d051ac778bc680c82ea6a9149a Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Mon, 12 Sep 2016 09:24:38 +0200 Subject: [PATCH] [FIX] payment_paypal: accept GET requests for Paypal DPN Although we have been reluctant to perform this change, a specific use case can cause customers to be redirect to the Odoo DPN url with a GET request. This happens when a Paypal Merchant account has the feature Guest Checkout active; in that case, a customer can pay without having a Paypal account (using only his credit card) and will *not* be subjected to auto-return; as detailed here: https://www.sandbox.paypal.com/be/cgi-bin/webscr?cmd=p/pop/help-account-optional Request coming from that payment flow will always trigger a GET request, causing the customer to be welcomed by a 405 - Method Not allowed error on the Odoo server. The payment is normally correctly processed through IPN, so this does not normally causes loss of data; however this is not a nice way to welcome back your customer right after they pay you. --- addons/payment_paypal/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_paypal/controllers/main.py b/addons/payment_paypal/controllers/main.py index 67f89a8e634..7f9ce75986d 100644 --- a/addons/payment_paypal/controllers/main.py +++ b/addons/payment_paypal/controllers/main.py @@ -68,7 +68,7 @@ class PaypalController(http.Controller): self.paypal_validate_data(**post) return '' - @http.route('/payment/paypal/dpn', type='http', auth="none", methods=['POST']) + @http.route('/payment/paypal/dpn', type='http', auth="none", methods=['POST', 'GET']) def paypal_dpn(self, **post): """ Paypal DPN """ _logger.info('Beginning Paypal DPN form_feedback with post data %s', pprint.pformat(post)) # debug