[IMP] payment_razorpay: authorize only when manual capture is enabled

Before this commit razorpay provider handle both authorized
and done event for transaction even though razorpay return
both authorized and done event at same time and there is no
need to handle authorize event if capture manual is disabled
on razorpay and because if handling both events at same time
it causing serialization issue and it might cause serious
issue if other operation are being executed on same time.

This commit handle authorized event only when capture manuallly
option is enabled on razorpay so it will not try to write on
operation at same time and avoid concurrency issues.

task-3652228

closes odoo/odoo#147534

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
kcv-odoo
2024-01-08 21:58:28 +00:00
parent a394d39332
commit 03cd074ee8
@@ -394,7 +394,8 @@ class PaymentTransaction(models.Model):
if entity_status in const.PAYMENT_STATUS_MAPPING['pending']:
self._set_pending()
elif entity_status in const.PAYMENT_STATUS_MAPPING['authorized']:
self._set_authorized()
if self.provider_id.capture_manually:
self._set_authorized()
elif entity_status in const.PAYMENT_STATUS_MAPPING['done']:
if self.tokenize:
self._razorpay_tokenize_from_notification_data(notification_data)