fix: add check for allowing access to european region (#24394)

This commit is contained in:
Saqib
2021-01-18 16:40:10 +05:30
committed by GitHub
parent 04b106a515
commit f6d61f2dec
2 changed files with 13 additions and 3 deletions

View File

@@ -31,11 +31,12 @@ class PlaidConnector():
return access_token return access_token
def get_token_request(self, update_mode=False): def get_token_request(self, update_mode=False):
country_codes = ["US", "CA", "FR", "IE", "NL", "ES", "GB"] if self.settings.enable_european_access else ["US", "CA"]
args = { args = {
"client_name": self.client_name, "client_name": self.client_name,
# only allow Plaid-supported languages and countries (LAST: Sep-19-2020) # 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", "language": frappe.local.lang if frappe.local.lang in ["en", "fr", "es", "nl"] else "en",
"country_codes": ["US", "CA", "ES", "FR", "GB", "IE", "NL"], "country_codes": country_codes,
"user": { "user": {
"client_user_id": frappe.generate_hash(frappe.session.user, length=32) "client_user_id": frappe.generate_hash(frappe.session.user, length=32)
} }

View File

@@ -1,4 +1,5 @@
{ {
"actions": [],
"creation": "2018-10-25 10:02:48.656165", "creation": "2018-10-25 10:02:48.656165",
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 1, "editable_grid": 1,
@@ -11,7 +12,8 @@
"plaid_client_id", "plaid_client_id",
"plaid_secret", "plaid_secret",
"column_break_7", "column_break_7",
"plaid_env" "plaid_env",
"enable_european_access"
], ],
"fields": [ "fields": [
{ {
@@ -58,10 +60,17 @@
{ {
"fieldname": "column_break_7", "fieldname": "column_break_7",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "enable_european_access",
"fieldtype": "Check",
"label": "Enable European Access"
} }
], ],
"issingle": 1, "issingle": 1,
"modified": "2020-09-12 02:31:44.542385", "links": [],
"modified": "2020-10-29 20:24:56.916104",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "ERPNext Integrations", "module": "ERPNext Integrations",
"name": "Plaid Settings", "name": "Plaid Settings",