[FIX] payment_payulatam: cancel transaction can be set to done
Steps to reproduce: A) Share a payment link and pay with PayU Latam (you'll be redirected to their checkout page) B) Make sure that your first payment attempt with Pay U Latam fails (they provide the cards info to simulate successful and failed payments) C) After the first failed attempt, stay on the same checkout page and do a second attempt (this time a successful attempt) D) Click on 'Go back to the website of the shop' (still on the checkout page). Current behavior: Odoo will show 'Your payment has been canceled' Expected behvavior: Odoo will show 'Your payment has been confirmed' Explanation: After the first payment failure payulatam calls the webhook to cancel the transaction but after it lets the user the possibilty to retry the same payment again and if the payment succeed it calls the webhook again to confirm the transaction but it can not as the transaction is already in a canceled state. To prevent this issue we allow the payulatam webhook to set the transaction from canceled to done by adding canceled in the allowed states of _set_done() opw-2994527 closes odoo/odoo#103066 X-original-commit: 162b4a4fb958b8568a2d99625934b9b4f4dfa103 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
@@ -666,7 +666,7 @@ class PaymentTransaction(models.Model):
|
||||
:return: The updated transactions.
|
||||
:rtype: recordset of `payment.transaction`
|
||||
"""
|
||||
allowed_states = ('draft', 'pending', 'authorized', 'error')
|
||||
allowed_states = ('draft', 'pending', 'authorized', 'error', 'cancel') # 'cancel' for Payulatam
|
||||
target_state = 'done'
|
||||
txs_to_process = self._update_state(allowed_states, target_state, state_message)
|
||||
txs_to_process._log_received_message()
|
||||
|
||||
Reference in New Issue
Block a user