Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'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 plaid = require('plaid')
const environment = () => {
switch (process.env.PLAID_ENVIRONMENT) {
case 'sandbox':
return plaid.environments.sandbox
case 'production':
return plaid.environments.production
default:
return plaid.environments.development
}
}
module.exports = new plaid.Client(
process.env.PLAID_CLIENT_ID,
process.env.PLAID_SECRET,
process.env.PLAID_PUBLIC_KEY,
environment(),
{
version: '2018-05-22'
}
)
const pMapSeries = require('p-map-series')
const plaid = require('plaid')
const _ = require('lodash')
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 PLAID_CLIENT = new plaid.Client(
process.env.PLAID_CLIENT_ID,
process.env.PLAID_SECRET,
process.env.PLAID_PUBLIC_KEY,
environment(),
{
version: '2018-05-22'
}
)
const fetchTransactions = (startDate, endDate, pageSize, offset) => {
const accounts = getAccountTokens()
const options = [
format(startDate, 'YYYY-MM-DD'),
format(endDate, 'YYYY-MM-DD'),
{