mirror of
https://github.com/kennethreitz-archive/www.gittip.com.git
synced 2026-06-21 15:50:59 +00:00
28cb48c72a
I sort of did this one with the blast shield down. I haven't even run
the tests yet. The sorts of things I changed:
- SQL {elsewhere,exchanges}.participant_id => .participant
- SQL participants.id => .username
- ORM {user,participant,self}.id => .username
223 lines
7.3 KiB
HTML
223 lines
7.3 KiB
HTML
import traceback
|
|
from datetime import datetime, timedelta
|
|
|
|
import balanced
|
|
from aspen import json, log, Response
|
|
from gittip import billing, MONTHS
|
|
from gittip.elsewhere import github
|
|
|
|
# ========================================================================== ^L
|
|
balanced_account_uri = None
|
|
account = None
|
|
bank_account = None
|
|
status = ". . ."
|
|
|
|
if not user.ANON:
|
|
balanced_account_uri = user.balanced_account_uri
|
|
|
|
status = "not connected"
|
|
if balanced_account_uri:
|
|
working = user.last_ach_result == ""
|
|
status = "connected" if working else "not connected"
|
|
account = balanced.Account.find(balanced_account_uri)
|
|
|
|
bank_account = billing.BalancedBankAccount(balanced_account_uri)
|
|
if bank_account.is_setup:
|
|
|
|
# Factored out to aid debugging. This extra var will show up in the
|
|
# context on Sentry so we can compare the two values. See:
|
|
#
|
|
# https://github.com/gittip/www.gittip.com/issues/791
|
|
|
|
_bank_account_account_uri = bank_account['account_uri']
|
|
|
|
assert balanced_account_uri == _bank_account_account_uri
|
|
|
|
username = user.username
|
|
|
|
title = "Bank Account"
|
|
# ========================================================================== ^L
|
|
{% extends templates/base.html %}
|
|
|
|
{% block heading %}
|
|
|
|
<h2 class="top"><span>Your bank account is <em id="status">{{ status }}</em></span></h2>
|
|
|
|
<p>When you receive money on Gittip we
|
|
{% if bank_account and bank_account.is_setup %}will{% else %}can{% end %}
|
|
automatically deposit it into your bank account. If you don't connect
|
|
a bank account then your money will accumulate within Gittip unless you
|
|
regift it to others.<p>
|
|
|
|
{% end %}
|
|
|
|
{% block box %}
|
|
{% if user.ANON %}
|
|
<div class="as-content">
|
|
|
|
<p>Sign in using
|
|
<a href="{{ twitter.oauth_url(website, u'opt-in', u'/bank-account.html') }}">Twitter</a> or
|
|
<a href="{{ github.oauth_url(website, u'opt-in', u'/bank-account.html') }}">GitHub</a>,
|
|
and then you'll be able to add or change your bank account.</p>
|
|
|
|
<p>Thanks! :-)</p>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
<script>
|
|
$(document).ready(function()
|
|
{
|
|
Gittip.initPayout("{{ balanced.Marketplace.my_marketplace.uri }}", "{{ user.username }}");
|
|
});
|
|
</script>
|
|
<style>
|
|
{% if not balanced_account_uri %}
|
|
#delete {
|
|
display: none;
|
|
}
|
|
{% end %}
|
|
</style>
|
|
<div class="on-form">
|
|
<form id="payout" autocomplete="off">
|
|
<div class="constrain-width group">
|
|
|
|
{% if bank_account and bank_account.is_setup %}
|
|
<h2>Current: {{ bank_account['bank_name'] }}
|
|
******{{ bank_account['last_four'] }}</h2>
|
|
{% end %}
|
|
|
|
<div id="feedback">{% if user.last_ach_result %}
|
|
<h2><span>Failure</span></h2>
|
|
<div class="details"><p>{{ user.last_ach_result }}</p></div>
|
|
{% end %}</div>
|
|
|
|
{% if account and 'merchant' in account.roles %}
|
|
<h2>Identity Verification <span>✔</span></h2>
|
|
<h2>Routing Information</h2>
|
|
{% end %}
|
|
|
|
|
|
{% if not account or 'merchant' not in account.roles %}
|
|
<h2>Identity Verification</h2>
|
|
|
|
<div>
|
|
<label for="name">Your Legal Name</label>
|
|
<input id="name" value="" />
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
<div>
|
|
<label for="address_1">Street Address</label>
|
|
<input id="address_1" value="" />
|
|
</div>
|
|
|
|
<div>
|
|
<label for="address_1">City</label>
|
|
<input id="address_1" value="" />
|
|
</div>
|
|
|
|
<div class="half left">
|
|
<label for="state">State or Province</label>
|
|
<input id="state" value="" />
|
|
</div>
|
|
|
|
<div class="half right">
|
|
<label for="zip">ZIP or Postal Code</label>
|
|
<input id="zip" value="" />
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
<div>
|
|
<label for="address_1">Country (<a href="https://github.com/gittip/www.gittip.com/issues/126">non-US?</a>)</label>
|
|
<input id="zip" value="United States of America" disabled="true"
|
|
class="disabled" />
|
|
</div>
|
|
|
|
<div>
|
|
<label for="phone_number">Contact Phone Number</label>
|
|
<input id="phone_number" value="" />
|
|
</div>
|
|
|
|
<div class="left">
|
|
<label for="dob-year">Date of Birth</label>
|
|
<select id="dob-month">
|
|
{% for i in range(1, 13) %}
|
|
<option value="{{ i }}">{{ MONTHS[i] }}</option>
|
|
{% end %}
|
|
</select>
|
|
<select id="dob-day">
|
|
{% for i in range(1, 32) %}
|
|
<option value="{{ i }}">{{ i }}</option>
|
|
{% end %}
|
|
</select>
|
|
<select id="dob-year">
|
|
{% for i in range(1900, datetime.utcnow().year - 17) %}
|
|
<option value="{{ i }}" {{ 'selected="selected"' if i == 1990 else '' }}>{{ i }}</option>
|
|
{% end %}
|
|
</select>
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
|
|
<h2>Routing Information</h2>
|
|
{% end %}
|
|
|
|
|
|
<div class="float">
|
|
<label for="account_name">Name on Bank Account</label>
|
|
<input id="account_name" autofocus="autofocus" />
|
|
</div>
|
|
|
|
<div class="float account_number">
|
|
<label for="account_number">Bank Account Number</label>
|
|
<input id="account_number" />
|
|
</div>
|
|
|
|
<div class="float routing_number">
|
|
<label for="routing_number">Routing Number</label>
|
|
<input id="routing_number" />
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
<div class="nav level-1">
|
|
<button class="selected larger" id="save"
|
|
type="submit">Save</button>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
{% if bank_account and bank_account.is_setup %}
|
|
<div id="delete" class="nav level-2">
|
|
<form action="bank-account.json" class="special" method="POST">
|
|
<input type="hidden" name="action" value="delete">
|
|
<button>Disconnect My Bank Account</button>
|
|
</form>
|
|
</div>
|
|
{% end %}
|
|
|
|
</div>
|
|
{% end %}
|
|
{% end %}
|
|
|
|
{% block page %}
|
|
<div class="col0 payment-footer">
|
|
|
|
<p>Bank account information is stored and processed by <a
|
|
href="https://www.balancedpayments.com/">Balanced Payments</a>.<br />
|
|
|
|
Here are their <a href="https://www.balancedpayments.com/terms">Terms of
|
|
Service</a> and <a
|
|
href="https://www.balancedpayments.com/privacy">Privacy Policy</a>.</p>
|
|
|
|
<a href="https://www.balancedpayments.com/"><img
|
|
src="/assets/{{ __version__ }}/balanced.png" /></a>
|
|
|
|
</div>
|
|
{% end %}
|