[FIX] payment_paypal: prevent the IPN feedback to return an HTTP error code
When you enable the IPN notifications in your Paypal account configuration, the default IPN URL is mandatory. You are therefore obliged to put the IPN feedback URL of Odoo in this default URL, even if this is not used because each transaction done by Odoo specifies the URL to which the IPN notifications must be sent. Because of this, if you use your Paypal account for something else, e.g. Ebay, you receive notifications of payments for these other transactions, that have nothing to do with Odoo. In such a case, Odoo returned an HTTP error status code (e.g. 500), because Odoo couldn't find the given transactions, and then Paypal sent emails to the Paypal owner to tell the IPN feedback was failing. Eventually, after several fails, Paypal automatically disabled the IPN notifications of the given account. With this revision, we now avoid to raise the Validation errors in the case of the IPN feedback, and just logs it, to avoid Paypal to sent emails to the owner and to automatically disable the IPN notifications if it receives transactions from other services than Odoo. opw-702403
This commit is contained in:
@@ -8,6 +8,7 @@ import urllib2
|
||||
import werkzeug
|
||||
|
||||
from openerp import http, SUPERUSER_ID
|
||||
from openerp.addons.payment.models.payment_acquirer import ValidationError
|
||||
from openerp.http import request
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -89,7 +90,10 @@ class PaypalController(http.Controller):
|
||||
def paypal_ipn(self, **post):
|
||||
""" Paypal IPN. """
|
||||
_logger.info('Beginning Paypal IPN form_feedback with post data %s', pprint.pformat(post)) # debug
|
||||
self.paypal_validate_data(**post)
|
||||
try:
|
||||
self.paypal_validate_data(**post)
|
||||
except ValidationError:
|
||||
_logger.exception('Unable to validate the Paypal payment')
|
||||
return ''
|
||||
|
||||
@http.route('/payment/paypal/dpn', type='http', auth="none", methods=['POST', 'GET'], csrf=False)
|
||||
|
||||
Reference in New Issue
Block a user