[FIX] payment_mercado_pago: fix traceback when the payment status is 404
This traceback arises when the payment status is 404 A comma at the end is forgotten while creating a tuple with single record, which leads to a typeerror traceback. Error:- "TypeError: 'in <string>' requires string as left operand, not int" https://github.com/odoo/odoo/blob/7e3267fc69324a3c98d36983705a50420b5143f9/addons/payment_mercado_pago/const.py#L35-L39 sentry-5103720097 closes odoo/odoo#159613 X-original-commit: 9094afe724a7ee9771ae8c035fe3829b1c556c59 Signed-off-by: Altaf Shaik (alsh) <alsh@odoo.com>
This commit is contained in:
@@ -65,7 +65,7 @@ TRANSACTION_STATUS_MAPPING = {
|
||||
'pending': ('pending', 'in_process', 'in_mediation', 'authorized'),
|
||||
'done': ('approved', 'refunded'),
|
||||
'canceled': ('cancelled', 'null'),
|
||||
'error': ('rejected'),
|
||||
'error': ('rejected',),
|
||||
}
|
||||
|
||||
# Mapping of error states to Mercado Pago error messages.
|
||||
|
||||
@@ -26,3 +26,6 @@ class MercadoPagoCommon(PaymentCommon):
|
||||
cls.verification_data = {
|
||||
'status': 'approved',
|
||||
}
|
||||
cls.verification_data_for_error_state = {
|
||||
'status': 404,
|
||||
}
|
||||
|
||||
@@ -69,3 +69,15 @@ class TestPaymentTransaction(MercadoPagoCommon, PaymentHttpCommon):
|
||||
):
|
||||
tx._process_notification_data(self.redirect_notification_data)
|
||||
self.assertEqual(tx.state, 'done')
|
||||
|
||||
@mute_logger('odoo.addons.payment_mercado_pago.models.payment_transaction')
|
||||
def test_processing_notification_data_rejects_transaction(self):
|
||||
""" Test that the transaction state is set to 'error' when the notification data indicate a status of
|
||||
404 error payment. """
|
||||
tx = self._create_transaction(flow='redirect')
|
||||
with patch(
|
||||
'odoo.addons.payment_mercado_pago.models.payment_provider.PaymentProvider'
|
||||
'._mercado_pago_make_request', return_value=self.verification_data_for_error_state
|
||||
):
|
||||
tx._process_notification_data(self.redirect_notification_data)
|
||||
self.assertEqual(tx.state, 'error')
|
||||
|
||||
Reference in New Issue
Block a user