def managePayment(): if request.method == 'POST': values = { 'routing_number': request.form['routing_number'], 'account_number': request.form['account_number'], 'bank_code':request.form['routing_number'], 'bank_address[name]': request.form['bank_name'], 'bank_address[address_line1]': request.form['bank_address1'], 'bank_address[address_city]': request.form['bank_city'], 'bank_address[address_state]': request.form['bank_state'], 'bank_address[address_zip]': request.form['bank_zip'], 'bank_address[address_country]': "US", 'account_address[name]': request.form['first']+request.form['last'], 'account_address[address_line1]': request.form['address1'], 'account_address[address_line2]': request.form['address2'], 'account_address[address_city]': request.form['city'], 'account_address[address_state]': request.form['state'], 'account_address[address_zip]': request.form['zip'], 'account_address[address_country]': "US" } print values account = helpers.lobPost('https://api.lob.com/v1/bank_accounts', values, 'test_814e892b199d65ef6dbb3e4ad24689559ca') print account client.account.insert({ "user": session.get('user'), "account_id":account["id"], "account_address":account["account_address"] }) redirect(url_for('index')) return render_template('addAccount.html')
def addContact(): if request.method == 'POST': print "test1i" values = {'name': request.form['first'] + " " + request.form['last'], 'address_line1': request.form['address1'], 'address_line2': request.form['address2'], 'address_city': request.form['city'], 'address_state': request.form['state'], 'address_zip': request.form['zip'], 'address_country': "US"} print "test2" address = helpers.lobPost('https://api.lob.com/v1/addresses', values, 'test_814e892b199d65ef6dbb3e4ad24689559ca') client.contacts.insert({ "user": session.get('user'), "first": request.form['first'], "last": request.form['last'], "address1": request.form['address1'], "address2": request.form['address2'], "city": request.form['city'], "state": request.form["state"], "zip": request.form["zip"], "country": "US", "addressId": address['id'], "gifts": [] }) return redirect(url_for('manageContacts')) return render_template('editContact.html')
def run(): for contact in client.contacts: for gift in contact.gifts: if datetime.date(gift[date]) == datetime.today()-5: values = { "name":gift['name'], "to":contact['addressID'], "from":client.account["account_address"], "front":"/static/dist/pdfs/"+gift['front'], "back":gift['message'] } postcard = helpers.lobPost('https://api.lob.com/v1/postcards', values, 'test_814e892b199d65ef6dbb3e4ad24689559ca') values = { "name":gift['name'], "to":contact['addressID'], "from":client.account["account_address"], "object1":postcard, "object2":gift['check'] } call = helpers.lobPost('https://api.lob.com/v1/jobs', values, 'test_814e892b199d65ef6dbb3e4ad24689559ca')
def addCheck(amount, first, last): if request.method == 'POST': for contact in client.contacts.find(): if contact['first']==first and contact['last'] == last: giftee = contact values = { 'bank_account':client.account.find_one({'user': session.get('user')})['account_id'], 'to':giftee['addressId'], 'amount':amount } check=helpers.lobPost('https://api.lob.com/v1/checks', values, 'test_814e892b199d65ef6dbb3e4ad24689559ca') return check
def sendGift(): contacts = client.contacts for contact in contacts.find(): for gift in contact['gifts']: values = { "name":gift['name'], "to": contact['addressId'], "from":client.account.find_one({'user': session.get('user')})["account_address"], # "front":"https://github.com/jromer94/GiftLobber/blob/master/giftlobber/static/dist/pdfs/A.pdf?raw=true", "back": client.gifts.find_one({"title": gift['name']})['message'] } postcard = helpers.lobPost('https://api.lob.com/v1/postcards', values, 'test_814e892b199d65ef6dbb3e4ad24689559ca') addCheck(gift['check'], contact['first'], contact['last'])