import traceback import balanced from aspen import json, log, Response from gittip import billing from gittip.elsewhere import github from gittip.utils import COUNTRIES # ========================================================================== ^L status = ". . ." balanced_account_uri = None if not user.ANON: balanced_account_uri = user.balanced_account_uri stripe_customer_id = user.stripe_customer_id status = "missing" if stripe_customer_id or balanced_account_uri: if user.last_bill_result is not None: status = "working" if user.last_bill_result == "" else "failing" if balanced_account_uri: card = billing.BalancedCard(balanced_account_uri) assert balanced_account_uri == card['id'] else: card = billing.StripeCard(stripe_customer_id) assert stripe_customer_id == card['id'] username = user.username title = "Credit Card" # ========================================================================== ^L {% extends templates/base.html %} {% block heading %}

Your credit card is {{ status }}

When you don't have enough money in your Gittip account to cover your gifts, we {% if balanced_account_uri %}will{% else %}can{% end %} attempt to pull money in using {% if balanced_account_uri %}this{% else %}a{% end %} credit card. If your credit card is missing or fails then your gifts won't go through for that week.

{% end %} {% block box %} {% if user.ANON %}

Sign in using Twitter or GitHub, and then you'll be able to add or change your credit card.

Thanks! :-)

{% else %}
{% if status != "missing" %}

Current: {{ card['card_type'] }} {{ card['last4'] }}

{% end %}
{% if user.last_bill_result %}

Failure

{{ user.last_bill_result }}

{% end %}

Required

Optional

{% end %} {% end %} {% block page %} {% end %}