~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/templates/billing.html -rw-r--r-- 7.8 KiB
72548bd7Drew DeVault API: Updates per core-go auth changes 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
{% extends "meta.html" %}
{% block title %}
<title>Billing - {{cfg("sr.ht", "site-name")}} meta</title>
{% endblock %}
{% block content %}
<div class="row">
  <div class="col-md-12">
    <h3>Billing Information</h3>
    {% if message %}
    <div class="alert alert-info">{{message}}</div>
    {% endif %}

    {% if current_user.user_type == UserType.active_non_paying %}

    <div class="alert alert-info">
      You are currently using an <strong>unpaid</strong>
      {{cfg("sr.ht", "site-name")}} account. Some site features may be
      unavailable to your account.
    </div>

    {% elif current_user.user_type == UserType.active_free %}

    <div class="alert alert-info">
      Your account is <strong>exempt</strong> from billing. All features are
      available to you free of charge. You may choose to set up billing
      if you wish to support the site.
    </div>

    {% elif current_user.user_type == UserType.active_paying %}

    {% if current_user.payment_cents == 0 %}

    <div class="alert alert-warning">
      Your paid service has been cancelled. At the end of your current term,
      {{current_user.payment_due | date}}, your account will be downgraded to a
      non-paying account.
    </div>

    {% else %}

    <div class="alert alert-success">
      {% if invoices %}
      Your account is <strong>paid</strong> and up-to-date, and your last
      payment of {{"${:.2f}".format(invoices[0].cents/100)}}
      was made {{invoices[0].created | date}}. Your current
      {{current_user.payment_interval.value}} payment is
      {{"${:.2f}".format(current_user.payment_cents/100
        if current_user.payment_interval.value == "monthly"
        else current_user.payment_cents*10/100)}} and will be billed
      {{invoices[0].valid_thru | date}}.
      {% else %}
      Your account is <strong>paid</strong> and up-to-date. Your
      current {{current_user.payment_interval.value}} payment is
      {{"${:.2f}".format(current_user.payment_cents/100
        if current_user.payment_interval.value == "monthly"
        else current_user.payment_cents*10/100)}}.
      {% endif %}
    </div>

    {% endif %}

    {% elif current_user.user_type == UserType.active_delinquent %}

    <div class="alert alert-danger">
      <strong>Notice</strong>: Your payment is past due. Please check that your
      payment information is correct or your service may be impacted.
    </div>

    {% elif current_user.user_type == UserType.admin %}

    <div class="alert alert-info">
      Admins are exempt from billing.
    </div>

    {% endif %}

    <div style="margin-bottom: 1rem">
      <div class="progress">
        <div class="progress-bar"
          role="progressbar"
          style="width: {{paid_pct}}%;"
          aria-valuenow="{{paid_pct}}"
          aria-valuemin="0" aria-valuemax="100"
        >{{paid_pct}}% paid</div>
        <div
          class="goal"
          style="left: 13.37%"
          title="Presented without comment"
        >13.37%</div>
        <div class="progress-bar total">of {{total_users}} registered users</div>
      </div>
      <small class="text-muted pull-right">
        Current number of paid accounts on {{cfg("sr.ht", "site-name")}}
      </small>
    </div>
  </div>
</div>
{% if current_user.user_type == UserType.active_paying
  and current_user.payment_cents != 0 %}
<div class="row" style="margin-bottom: 1rem">
  <div class="col-md-3 offset-md-6">
    <a
      href="{{url_for("billing.billing_initial_GET")}}"
      class="btn btn-default btn-block"
    >Change your plan {{icon('caret-right')}}</a>
  </div>
  <div class="col-md-3">
    <form method="POST" action="{{url_for("billing.cancel_POST")}}">
      {{csrf_token()}}
      <button class="btn btn-danger btn-block">
        Cancel your plan {{icon('caret-right')}}
      </button>
    </form>
  </div>
</div>
{% elif current_user.user_type == UserType.active_delinquent %}
<div class="row" style="margin-bottom: 1rem">
  <div class="col-md-3 offset-md-3">
    <a
      href="{{url_for("billing.billing_initial_GET")}}"
      class="btn btn-default btn-block"
    >Change your plan {{icon('caret-right')}}</a>
  </div>
  <div class="col-md-3">
    <form method="POST" action="{{url_for("billing.cancel_POST")}}">
      {{csrf_token()}}
      <button class="btn btn-danger btn-block">
        Cancel your plan {{icon('caret-right')}}
      </button>
    </form>
  </div>
  <div class="col-md-3">
    <a
      href="{{url_for("billing.new_payment_GET")}}"
      class="btn btn-primary btn-block"
    >Add payment method {{icon('caret-right')}}</a>
  </div>
</div>
{% elif current_user.user_type == UserType.active_paying
  and current_user.payment_cents == 0 %}
<div class="row" style="margin-bottom: 1rem">
  <div class="col-md-3 offset-md-9">
    <a
      href="{{url_for("billing.billing_initial_GET")}}"
      class="btn btn-primary btn-block"
    >Renew your account {{icon('caret-right')}}</a>
  </div>
</div>
{% elif current_user.user_type in [
  UserType.active_non_paying,
  UserType.active_free
] %}
<div class="row" style="margin-bottom: 1rem">
  <div class="col-md-3 offset-md-9">
    <a
      href="{{url_for("billing.billing_initial_GET")}}"
      class="btn btn-primary btn-block"
    >Set up billing {{icon('caret-right')}}</a>
  </div>
</div>
{% endif %}
<div class="row">
  <div class="col-md-6">
    {% if current_user.user_type in [
      UserType.active_paying,
      UserType.active_delinquent
    ] %}
    <h3>Payment methods</h3>
    <div class="event-list">
      {% for source in customer.sources %}
      <div class="event row">
        <div class="col-md-8">
          {{source.brand}} ending in {{source.last4}}
          <br />
          <span class="text-muted">
            {% if source.address_zip %}
            Post code {{source.address_zip}}.
            {% endif %}
            Expires {{source.exp_month}}/{{source.exp_year}}.
          </span>
        </div>
        <div class="col-md-4">
          <div style="text-align: right">
            {% if source.stripe_id == customer.default_source %}
            {{icon('check', cls="text-success")}} Default
            {% else %}
            <form style="margin: 0;" method="POST"
              action="{{url_for("billing.payment_source_remove",
                source_id=source.id)}}">
              {{csrf_token()}}
              <button class="btn btn-link">
                Remove {{icon('times')}}
              </button>
            </form>
            <form method="POST"
              action="{{url_for("billing.payment_source_make_default",
                source_id=source.id)}}">
              {{csrf_token()}}
              <button class="btn btn-link">
                Make default {{icon('caret-right')}}
              </button>
            </form>
            {% endif %}
          </div>
        </div>
      </div>
      {% endfor %}
    </div>
    <a
      href="{{url_for("billing.new_payment_GET")}}"
      class="btn btn-primary pull-right"
    >New payment method {{icon('caret-right')}}</a>
    {% endif %}
  </div>
  {% if len(invoices) != 0 %}
  <div class="col-md-6">
    <h3>Invoices</h3>
    <div class="event-list">
      {% for invoice in invoices %}
      <div class="event invoice">
        <h4>
          <small class="text-success" style="margin-left: 0">
            {{icon('check')}}
          </small>
          ${{"{:.2f}".format(invoice.cents/100)}}
          <small>
            with {{invoice.source}}
          </small>
          <small>
            <a
              class="pull-right"
              href="{{url_for("billing.invoice_GET", invoice_id=invoice.id)}}"
            >Export as PDF</a>
          </small>
        </h4>
        <p>
          Paid {{invoice.created | date}}<br />
          Valid for service until {{invoice.valid_thru | date}}
          {% if invoice.comment %}
          <br />
          {{invoice.comment}}
          {% endif %}
        </p>
      </div>
      {% endfor %}
    </div>
  </div>
  {% endif %}
</div>
{% endblock %}