[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.
This commit is contained in:
Damien Bouvy 2016-09-12 09:24:38 +02:00
parent 40691d31f3
commit 3e4206b4d4
No known key found for this signature in database
GPG Key ID: 1D0AB759B4B928E3
1 changed files with 1 additions and 1 deletions

View File

@ -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