{% macro card_expiring_warning() -%} {% if current_user.is_authenticated and current_user.subscription and current_user.credit_card.is_expiring %} {% endif %} {%- endmacro %} {% macro plan(plan) -%}

{{ plan.name }}

{{ caller () }} {% if current_user.is_authenticated %} {% if current_user.subscription %} {% if plan == active_plan %} Current plan {% else %} {% endif %} {% else %} Continue {% endif %} {% else %} Sign up {% endif %}

${{ plan.amount | format_currency }} / {{ plan.interval }}

{%- endmacro %} {% macro coupon_data(coupon) -%} {% if coupon.amount_off %} {% set discount = '$' + coupon.amount_off | format_currency %} {% else %} {% set discount = coupon.percent_off | string + '%' %} {% endif %} {% if coupon.duration == 'forever' %} {% set label = 'It is saving you ' + discount + ' per month forever.' %} {% elif coupon.duration == 'once' %} {% set label = 'It saved you ' + discount + ' this month.' %} {% else %} {% set label = 'It is saving you ' + discount + ' for the next ' + coupon.duration_in_months | string + ' months.' %} {% endif %} {{ label }} {%- endmacro %} {% macro coupon_duration_tag_for(coupon) -%} {% if coupon.duration == 'forever' %} Forever {% elif coupon.duration == 'once' %} Once {% else %} {{ coupon.duration_in_months }} months {% endif %} {%- endmacro %} {% macro coupon_expiration(coupon) -%} {% if coupon.redeem_by %} {% elif coupon.duration_in_months %} — {% else %} Never {% endif %} {%- endmacro %} {% macro coupon_redeemed(times_redeemed, max_redemptions) -%} {% set total = max_redemptions if max_redemptions else '∞' | safe %} {{ times_redeemed }} / {{ total }} {%- endmacro %} {% macro coupon_discount(amount_off, percent_off) -%} {% if amount_off %} ${{ amount_off | format_currency }} {% else %} {{ percent_off }}% {% endif %} {%- endmacro %} {% macro subscription_details(coupon) -%}

Subscription details

{% if coupon %}
Coupon code {{ coupon.code }} is applied to your subscription.
{{ coupon_data(coupon) }}

{% endif %} {%- endmacro %} {% macro upcoming_invoice(invoice) -%} {% if invoice == None %}

No upcoming payments

You are not currently subscribed, so there's nothing to see here.

{% else %}
Subscription Description Next billing date Price
{{ invoice.plan }} {{ invoice.description }} ${{ invoice.amount_due | format_currency }} / {{ invoice.interval }}
{% endif %} {%- endmacro %} {% macro invoices(invoices) -%}

Recent billing history

{% if invoices.count() == 0 %}

No invoices found

This isn't an error. You just haven't been invoiced yet.

{% else %} {% for invoice in invoices %} {% endfor %}
Date Method Description Service period Tax Total
{{ invoice.brand }} ****{{ invoice.last4 }} {{ invoice.description }} {{ '$' + invoice.tax | format_currency if invoice.tax }} ${{ invoice.total | format_currency }}
{% endif %} {%- endmacro %}