Skip to content
Snippets Groups Projects
Commit a0b7802a authored by Rémi Rahir's avatar Rémi Rahir
Browse files

[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.
parent 09287027
Branches
Tags
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment