fix: do not get password if client_secret is not set (#28547)

This commit is contained in:
Saqib 2021-11-25 12:05:29 +05:30 committed by Saqib Ansari
parent c98887d39d
commit 139d5e17a9

View File

@ -646,9 +646,14 @@ class GSPConnector():
request_log.save(ignore_permissions=True)
frappe.db.commit()
def get_client_credentials(self):
if self.e_invoice_settings.client_id and self.e_invoice_settings.client_secret:
return self.e_invoice_settings.client_id, self.e_invoice_settings.get_password('client_secret')
return frappe.conf.einvoice_client_id, frappe.conf.einvoice_client_secret
def fetch_auth_token(self):
client_id = self.e_invoice_settings.client_id or frappe.conf.einvoice_client_id
client_secret = self.e_invoice_settings.get_password('client_secret') or frappe.conf.einvoice_client_secret
client_id, client_secret = self.get_client_credentials()
headers = {
'gspappid': client_id,
'gspappsecret': client_secret