From 1354aecafa7d397c7d560e3757be163a639c4b59 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Wed, 4 Nov 2020 12:42:02 +0530 Subject: [PATCH] fix: add check for allowing access to european region (#23770) --- .../doctype/plaid_settings/plaid_connector.py | 3 ++- .../doctype/plaid_settings/plaid_settings.json | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py index a033a2a722..8d4b510490 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py @@ -31,6 +31,7 @@ class PlaidConnector(): return access_token def get_link_token(self): + country_codes = ["US", "CA", "FR", "IE", "NL", "ES", "GB"] if self.settings.enable_european_access else ["US", "CA"] token_request = { "client_name": self.client_name, "client_id": self.settings.plaid_client_id, @@ -38,7 +39,7 @@ class PlaidConnector(): "products": self.products, # only allow Plaid-supported languages and countries (LAST: Sep-19-2020) "language": frappe.local.lang if frappe.local.lang in ["en", "fr", "es", "nl"] else "en", - "country_codes": ["US", "CA", "FR", "IE", "NL", "ES", "GB"], + "country_codes": country_codes, "user": { "client_user_id": frappe.generate_hash(frappe.session.user, length=32) } diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.json b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.json index 2706217223..122aa41f4b 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.json +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.json @@ -1,4 +1,5 @@ { + "actions": [], "creation": "2018-10-25 10:02:48.656165", "doctype": "DocType", "editable_grid": 1, @@ -11,7 +12,8 @@ "plaid_client_id", "plaid_secret", "column_break_7", - "plaid_env" + "plaid_env", + "enable_european_access" ], "fields": [ { @@ -58,10 +60,17 @@ { "fieldname": "column_break_7", "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "enable_european_access", + "fieldtype": "Check", + "label": "Enable European Access" } ], "issingle": 1, - "modified": "2020-09-12 02:31:44.542385", + "links": [], + "modified": "2020-10-29 20:24:56.916104", "modified_by": "Administrator", "module": "ERPNext Integrations", "name": "Plaid Settings",