def __init__(self, config: Mapping[str, Any]): plaid_config = plaid.Configuration( host=SPEC_ENV_TO_PLAID_ENV[config["plaid_env"]], api_key={"clientId": config["client_id"], "secret": config["api_key"]} ) api_client = plaid.ApiClient(plaid_config) self.client = plaid_api.PlaidApi(api_client) self.access_token = config["access_token"] self.start_date = datetime.datetime.strptime(config.get("start_date"), "%Y-%m-%d").date() if config.get("start_date") else None
def __init__(self, config: Mapping[str, Any]): plaid_config = plaid.Configuration( host=SPEC_ENV_TO_PLAID_ENV[config["plaid_env"]], api_key={ "clientId": config["client_id"], "secret": config["api_key"] }) api_client = plaid.ApiClient(plaid_config) self.client = plaid_api.PlaidApi(api_client) self.access_token = config["access_token"]
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Optional[Any]]: try: plaid_config = plaid.Configuration( host=SPEC_ENV_TO_PLAID_ENV[config["plaid_env"]], api_key={"clientId": config["client_id"], "secret": config["api_key"]} ) api_client = plaid.ApiClient(plaid_config) client = plaid_api.PlaidApi(api_client) try: request = AccountsBalanceGetRequest(access_token=config["access_token"]) client.accounts_balance_get(request) return True, None except plaid.ApiException as e: response = json.loads(e.body) return False, response except Exception as error: return False, error
# # Set PLAID_REDIRECT_URI to 'http://localhost:3000/' # The OAuth redirect flow requires an endpoint on the developer's website # that the bank website should redirect to. You will need to configure # this redirect URI for your client ID through the Plaid developer dashboard # at https://dashboard.plaid.com/team/api. PLAID_REDIRECT_URI = empty_to_none('PLAID_REDIRECT_URI') configuration = plaid.Configuration(host=plaid.Environment.Sandbox, api_key={ 'clientId': PLAID_CLIENT_ID, 'secret': PLAID_SECRET, 'plaidVersion': '2020-09-14' }) api_client = plaid.ApiClient(configuration) client = plaid_api.PlaidApi(api_client) products = [] for product in PLAID_PRODUCTS: products.append(Products(product)) # We store the access_token in memory - in production, store it in a secure # persistent data store. access_token = None # The payment_id is only relevant for the UK Payment Initiation product. # We store the payment_id in memory - in production, store it in a secure # persistent data store. payment_id = None item_id = None