def unlink(): fbId = getFbId() if not fbId: return "", 403 key = redis.get(fbId) redis.delete(fbId) plaid = Plaid(PLAID_ID, PLAID_KEY, key) plaid.delete() return redirect("/", code=302)
def mfa(): fbId = getFbId() if not fbId: return "", 403 key = redis.get(fbId) answer = request.form['answer'] plaid = Plaid(PLAID_ID, PLAID_KEY, key) plaid_resp = plaid.answerMFA('chase', answer) if not plaid_resp: return "", 403 return "", 200
def transactions(): print "Called transactions" fbId = getFbId() if not fbId: return "", 403 key = redis.get(fbId) daterange = request.form['daterange'] dates = daterange.split("-") start = "-".join(dates[0].split("/")) end = "-".join(dates[1].split("/")) plaid = Plaid(PLAID_ID, PLAID_KEY, key) transactions = plaid.getTransactions(options={ 'gte':start, 'lte':end }) if not transactions: return "", 403 print(transactions) map_key = os.environ.get("GOOGLE_KEY", "") return render_template('map.html', map_key=map_key, transactions=json.dumps(transactions['transactions']))
def auth(): print "Called auth" fbId = getFbId() if not fbId: return "", 403 accntype = request.form['type'] username = request.form['username'] password = request.form['password'] email = request.form['email'] plaid = Plaid(PLAID_ID, PLAID_KEY) plaid_resp = plaid.connect(accntype, username, password, email) if not plaid_resp: return "", 403 redis.set(fbId, plaid_resp['access_token']) if plaid_resp['mfa']: return plaid_resp['mfa']['message'], 201 else: return "", 200