From 2dfa8fd0022b0a1fc97b721b3b8c3dd4f28889b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20=28frc=29?= <frc@odoo.com>
Date: Mon, 12 Apr 2021 09:58:02 +0000
Subject: [PATCH] [IMP] iap: Add TTL option for IAP transaction

New optional 'ttl' parameter for the authorize function. It will allow to specify how much time the credits will be reserved.

closes odoo/odoo#69113

Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
---
 addons/iap/models/iap.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/addons/iap/models/iap.py b/addons/iap/models/iap.py
index c32746e9b110..3d99aae52a89 100644
--- a/addons/iap/models/iap.py
+++ b/addons/iap/models/iap.py
@@ -80,13 +80,14 @@ class IapTransaction(object):
     def __init__(self):
         self.credit = None
 
-def authorize(env, key, account_token, credit, dbuuid=False, description=None, credit_template=None):
+def authorize(env, key, account_token, credit, dbuuid=False, description=None, credit_template=None, ttl=4320):
     endpoint = get_endpoint(env)
     params = {
         'account_token': account_token,
         'credit': credit,
         'key': key,
         'description': description,
+        'ttl': ttl
     }
     if dbuuid:
         params.update({'dbuuid': dbuuid})
-- 
GitLab