Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// external deps
var config = require('config');
var plaid = require('plaid');
var moment = require('moment');
var PLAID_CLIENT_ID = config.get('PLAID.CLIENT_ID');
var PLAID_SECRET = config.get('PLAID.SECRET');
var PLAID_PUBLIC_KEY = config.get('PLAID.PUBLIC_KEY');
var PLAID_ENV = config.get('PLAID.ENV');
// Initialize the Plaid client
var client = new plaid.Client(
PLAID_CLIENT_ID,
PLAID_SECRET,
PLAID_PUBLIC_KEY,
plaid.environments[PLAID_ENV]
);
const SIMULTANEOUS_REQS = 3;
exports.getItems = (accessTokens) => {
let promises = accessTokens.map((token) => {
return client.getItem(token);
}, {concurrency: SIMULTANEOUS_REQS});
return Promise.all(promises);
}
exports.validateItem = (accessToken) => {
return client.getAccounts(accessToken)
.then(() => true)
.catch((e) => {
console.log("Looks like item is unlinked");
constructor() {
// Initialize the Plaid client.
this.client = new plaid.Client(
PLAID_CLIENT_ID,
PLAID_SECRET,
PLAID_PUBLIC_KEY,
plaid.environments[PLAID_ENV],
OPTIONS
);
// Wrap the Plaid client methods to add a logging function.
forEach(clientMethodLoggingFns, (logFn, method) => {
this[method] = this.createWrappedClientMethod(method, logFn);
});
}
'use strict';
// external deps
var config = require('config');
var plaid = require('plaid');
var moment = require('moment');
var PLAID_CLIENT_ID = config.get('PLAID.CLIENT_ID');
var PLAID_SECRET = config.get('PLAID.SECRET');
var PLAID_PUBLIC_KEY = config.get('PLAID.PUBLIC_KEY');
var PLAID_ENV = config.get('PLAID.ENV');
// Initialize the Plaid client
var client = new plaid.Client(
PLAID_CLIENT_ID,
PLAID_SECRET,
PLAID_PUBLIC_KEY,
plaid.environments[PLAID_ENV]
);
const SIMULTANEOUS_REQS = 3;
exports.getItems = (accessTokens) => {
let promises = accessTokens.map((token) => {
return client.getItem(token);
}, {concurrency: SIMULTANEOUS_REQS});
return Promise.all(promises);
}
exports.validateItem = (accessToken) => {
constructor() {
// Initialize the Plaid client.
this.client = new plaid.Client(
PLAID_CLIENT_ID,
PLAID_SECRET,
PLAID_PUBLIC_KEY,
plaid.environments[PLAID_ENV],
OPTIONS
);
// Wrap the Plaid client methods to add a logging function.
forEach(clientMethodLoggingFns, (logFn, method) => {
this[method] = this.createWrappedClientMethod(method, logFn);
});
}
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}