From af2f12b136613a4cb50ce5e10a41a7b682debf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Tue, 10 Jul 2018 12:07:04 +0200 Subject: [PATCH] [IMP] iap: generic method to recharge an account manually Up until now, services developed (sms) relied on the get() and InsufficientCreditError mecanism to create iap_accounts on the fly and recharge it. This particular workflow does not work well with automated processes which is why we modify the function get_credit_url such that it will allow the client to generate the 'recharge' link manually for better integration of iap services. --- addons/iap/models/iap.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/iap/models/iap.py b/addons/iap/models/iap.py index 6f24205f8d4..f2417ebb562 100644 --- a/addons/iap/models/iap.py +++ b/addons/iap/models/iap.py @@ -154,8 +154,10 @@ class IapAccount(models.Model): return account @api.model - def get_credits_url(self, base_url, service_name, credit): + def get_credits_url(self, service_name, base_url='', credit=0): dbuuid = self.env['ir.config_parameter'].sudo().get_param('database.uuid') + if not base_url: + base_url = get_endpoint(self.env) account_token = self.get(service_name).account_token d = { 'dbuuid': dbuuid,