[IMP] payment: Log error message on payment transaction failure

Currently when the payment is initiated there is a message in
sale order for waiting for confirmation.

But when the payment returns an error there is no message on
sales order so it's not clear for the end user that payment
is still pending.

Related Task ID : 58741
This commit is contained in:
Barad Mahendra
2019-02-13 06:12:39 +00:00
committed by Yannick Tivisse
parent f735951d5c
commit 4ef4aa2083
@@ -673,6 +673,9 @@ class PaymentTransaction(models.Model):
elif self.state == 'cancel' and self.state_message:
message = _('The transaction %s with %s for %s has been cancelled with the following message: %s')
message_vals.append(self.state_message)
elif self.state == 'error' and self.state_message:
message = _('The transaction %s with %s for %s has return failed with the following error message: %s')
message_vals.append(self.state_message)
else:
message = _('The transaction %s with %s for %s has been cancelled.')
return message % tuple(message_vals)
@@ -771,6 +774,7 @@ class PaymentTransaction(models.Model):
'date': datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT),
'state_message': msg,
})
self._log_payment_transaction_received()
@api.multi
def _post_process_after_done(self):