[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.
This commit is contained in:
Rémi Rahir
2018-07-19 11:53:13 +02:00
parent 8eec939a78
commit af2f12b136
+3 -1
View File
@@ -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,