[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user