mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 14:11:46 +00:00
refactor: parse native JSON request args in erpnext_integrations/doctype/plaid_settings/plaid_settings.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints accept native JSON types (list/dict/bool) in addition to JSON strings.
This commit is contained in:
@@ -51,8 +51,8 @@ def get_plaid_configuration():
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def add_institution(token: str, response: str):
|
||||
response = json.loads(response)
|
||||
def add_institution(token: str, response: str | dict):
|
||||
response = frappe.parse_json(response)
|
||||
|
||||
plaid = PlaidConnector()
|
||||
access_token = plaid.get_access_token(token)
|
||||
@@ -81,12 +81,11 @@ def add_institution(token: str, response: str):
|
||||
@frappe.whitelist()
|
||||
def add_bank_accounts(response: str | dict, bank: str | dict, company: str):
|
||||
try:
|
||||
response = json.loads(response)
|
||||
response = frappe.parse_json(response)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
if isinstance(bank, str):
|
||||
bank = json.loads(bank)
|
||||
bank = frappe.parse_json(bank)
|
||||
result = []
|
||||
|
||||
parent_gl_account = frappe.db.get_all(
|
||||
@@ -358,8 +357,8 @@ def get_company(bank_account_name):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_bank_account_ids(response: str):
|
||||
data = json.loads(response)
|
||||
def update_bank_account_ids(response: str | dict):
|
||||
data = frappe.parse_json(response)
|
||||
institution_name = data["institution"]["name"]
|
||||
bank = frappe.get_doc("Bank", institution_name).as_dict()
|
||||
bank_account_name = f"{data['account']['name']} - {institution_name}"
|
||||
|
||||
Reference in New Issue
Block a user