mirror of https://github.com/zulip/zulip.git
billing: Show licenses_used and better renewal information on /billing.
This commit is contained in:
parent
4ccbeeb4a9
commit
81745ba171
|
@ -427,6 +427,7 @@ class StripeTest(StripeTestCase):
|
||||||
self.assert_not_in_success_response(['Pay annually'], response)
|
self.assert_not_in_success_response(['Pay annually'], response)
|
||||||
for substring in [
|
for substring in [
|
||||||
'Zulip Standard', str(self.seat_count),
|
'Zulip Standard', str(self.seat_count),
|
||||||
|
'You are using', '%s of %s licenses' % (self.seat_count, self.seat_count),
|
||||||
'Your plan will renew on', 'January 2, 2013', '$%s.00' % (80 * self.seat_count,),
|
'Your plan will renew on', 'January 2, 2013', '$%s.00' % (80 * self.seat_count,),
|
||||||
'Visa ending in 4242',
|
'Visa ending in 4242',
|
||||||
'Update card']:
|
'Update card']:
|
||||||
|
@ -510,6 +511,7 @@ class StripeTest(StripeTestCase):
|
||||||
self.assert_not_in_success_response(['Pay annually', 'Update card'], response)
|
self.assert_not_in_success_response(['Pay annually', 'Update card'], response)
|
||||||
for substring in [
|
for substring in [
|
||||||
'Zulip Standard', str(123),
|
'Zulip Standard', str(123),
|
||||||
|
'You are using', '%s of %s licenses' % (self.seat_count, 123),
|
||||||
'Your plan will renew on', 'January 2, 2013', '$9,840.00', # 9840 = 80 * 123
|
'Your plan will renew on', 'January 2, 2013', '$9,840.00', # 9840 = 80 * 123
|
||||||
'Billed by invoice']:
|
'Billed by invoice']:
|
||||||
self.assert_in_response(substring, response)
|
self.assert_in_response(substring, response)
|
||||||
|
|
|
@ -170,8 +170,8 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
||||||
}[plan.tier]
|
}[plan.tier]
|
||||||
now = timezone_now()
|
now = timezone_now()
|
||||||
last_ledger_entry = add_plan_renewal_to_license_ledger_if_needed(plan, now)
|
last_ledger_entry = add_plan_renewal_to_license_ledger_if_needed(plan, now)
|
||||||
# TODO: this is not really correct; need to give the situation as of the "fillstate"
|
|
||||||
licenses = last_ledger_entry.licenses
|
licenses = last_ledger_entry.licenses
|
||||||
|
licenses_used = get_seat_count(user.realm)
|
||||||
# Should do this in javascript, using the user's timezone
|
# Should do this in javascript, using the user's timezone
|
||||||
renewal_date = '{dt:%B} {dt.day}, {dt.year}'.format(dt=next_renewal_date(plan, now))
|
renewal_date = '{dt:%B} {dt.day}, {dt.year}'.format(dt=next_renewal_date(plan, now))
|
||||||
renewal_cents = renewal_amount(plan, now)
|
renewal_cents = renewal_amount(plan, now)
|
||||||
|
@ -196,6 +196,7 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
||||||
context.update({
|
context.update({
|
||||||
'plan_name': plan_name,
|
'plan_name': plan_name,
|
||||||
'licenses': licenses,
|
'licenses': licenses,
|
||||||
|
'licenses_used': licenses_used,
|
||||||
'renewal_date': renewal_date,
|
'renewal_date': renewal_date,
|
||||||
'renewal_amount': '{:,.2f}'.format(renewal_cents / 100.),
|
'renewal_amount': '{:,.2f}'.format(renewal_cents / 100.),
|
||||||
'payment_method': payment_method,
|
'payment_method': payment_method,
|
||||||
|
|
|
@ -31,10 +31,14 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="overview">
|
<div class="tab-pane active" id="overview">
|
||||||
<p>Your current plan is <strong>{{ plan_name }}</strong>.</p>
|
<p>Your current plan is <strong>{{ plan_name }}</strong>.</p>
|
||||||
<p>You are paying for <strong>{{ licenses }} users</strong>.</p>
|
<p>You are using <strong>{{ licenses_used }} of {{ licenses }} licenses</strong>.</p>
|
||||||
<p>
|
<p>
|
||||||
|
{% if renewal_amount %}
|
||||||
Your plan will renew on <strong>{{ renewal_date }}</strong> for
|
Your plan will renew on <strong>{{ renewal_date }}</strong> for
|
||||||
<strong>${{ renewal_amount }}</strong>.
|
<strong>${{ renewal_amount }}</strong>.
|
||||||
|
{% else %}
|
||||||
|
Your plan ends on <strong>{{ renewal_date }}</strong>, and does not renew.
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="payment-method" data-email="{{stripe_email}}" data-key="{{publishable_key}}">
|
<div class="tab-pane" id="payment-method" data-email="{{stripe_email}}" data-key="{{publishable_key}}">
|
||||||
|
|
Loading…
Reference in New Issue