[WIP] iap: adapt the charge to trail system.
We added the possibility to provide the dbuuid of the client when trying to authorize a transaction. This will allow to automatically credit the client accounts that can beneficiate from free trial credits. This improvement will ease the life of the client as they will not have to go to iap.odoo.com to charge their account.
This commit is contained in:
@@ -78,7 +78,7 @@ class IapTransaction(object):
|
||||
self.credit = None
|
||||
|
||||
@contextlib.contextmanager
|
||||
def charge(env, key, account_token, credit, description=None, credit_template=None):
|
||||
def charge(env, key, account_token, credit, dbuuid=False, description=None, credit_template=None):
|
||||
"""
|
||||
Account charge context manager: takes a hold for ``credit``
|
||||
amount before executing the body, then captures it if there
|
||||
@@ -103,6 +103,8 @@ def charge(env, key, account_token, credit, description=None, credit_template=No
|
||||
'key': key,
|
||||
'description': description,
|
||||
}
|
||||
if dbuuid:
|
||||
params.update({'dbuuid': dbuuid})
|
||||
try:
|
||||
transaction_token = jsonrpc(endpoint + '/iap/1/authorize', params=params)
|
||||
except InsufficientCreditError as e:
|
||||
|
||||
Reference in New Issue
Block a user