[FIX] payment_paypal: log only if tx exists
Log an error only if a transaction exists. opw-2071862 closes odoo/odoo#36946 X-original-commit: 903bd53d5f11dc9a9cfea246e6c5c0a088ad02ba Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
committed by
fw-bot
parent
df28690c04
commit
6c97d73adb
@@ -76,14 +76,16 @@ class PaypalController(http.Controller):
|
||||
if resp in ['VERIFIED', 'SUCCESS']:
|
||||
_logger.info('Paypal: validated data')
|
||||
res = request.env['payment.transaction'].sudo().form_feedback(post, 'paypal')
|
||||
if not res:
|
||||
if not res and tx:
|
||||
tx.sudo()._set_transaction_error('Validation error occured. Please contact your administrator.')
|
||||
elif resp in ['INVALID', 'FAIL']:
|
||||
_logger.warning('Paypal: answered INVALID/FAIL on data verification')
|
||||
tx.sudo()._set_transaction_error('Invalid response from Paypal. Please contact your administrator.')
|
||||
if tx:
|
||||
tx.sudo()._set_transaction_error('Invalid response from Paypal. Please contact your administrator.')
|
||||
else:
|
||||
_logger.warning('Paypal: unrecognized paypal answer, received %s instead of VERIFIED/SUCCESS or INVALID/FAIL (validation: %s)' % (resp, 'PDT' if pdt_request else 'IPN/DPN'))
|
||||
tx.sudo()._set_transaction_error('Unrecognized error from Paypal. Please contact your administrator.')
|
||||
if tx:
|
||||
tx.sudo()._set_transaction_error('Unrecognized error from Paypal. Please contact your administrator.')
|
||||
return res
|
||||
|
||||
@http.route('/payment/paypal/ipn/', type='http', auth='none', methods=['POST'], csrf=False)
|
||||
|
||||
Reference in New Issue
Block a user