Browse Source

Cleanup.

pull/366/head
Pēteris Caune 5 years ago
parent
commit
c057dbfb2c
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 20 additions and 5 deletions
  1. +15
    -0
      hc/payments/models.py
  2. +5
    -5
      templates/accounts/billing.html

+ 15
- 0
hc/payments/models.py View File

@ -70,6 +70,21 @@ class Subscription(models.Model):
self._pm = braintree.PaymentMethod.find(o.payment_method_token) self._pm = braintree.PaymentMethod.find(o.payment_method_token)
return self._pm return self._pm
@property
def is_supporter(self):
return self.plan_id in ("S5", "S48")
@property
def is_business(self):
return self.plan_id in ("P20", "Y192")
@property
def is_business_plus(self):
return self.plan_id in ("P80", "Y768")
def is_annual(self):
return self.plan_id in ("S48", "Y192", "Y768")
def _get_braintree_subscription(self): def _get_braintree_subscription(self):
if not hasattr(self, "_sub"): if not hasattr(self, "_sub"):
self._sub = braintree.Subscription.find(self.subscription_id) self._sub = braintree.Subscription.find(self.subscription_id)


+ 5
- 5
templates/accounts/billing.html View File

@ -192,7 +192,7 @@
</div> </div>
</div> </div>
<div class="col-sm-6 col-md-3"> <div class="col-sm-6 col-md-3">
<div id="plan-supporter" class="panel plan {% if sub.plan_id == "S5" or sub.plan_id == "S48" %}selected{% endif %}">
<div id="plan-supporter" class="panel plan {% if sub.is_supporter %}selected{% endif %}">
<div class="marker">Selected Plan</div> <div class="marker">Selected Plan</div>
<h2>Supporter</h2> <h2>Supporter</h2>
@ -208,7 +208,7 @@
</div> </div>
</div> </div>
<div class="col-sm-6 col-md-3"> <div class="col-sm-6 col-md-3">
<div id="plan-business" class="panel plan {% if sub.plan_id == "P20" or sub.plan_id == "Y192" %}selected{% endif %}">
<div id="plan-business" class="panel plan {% if sub.is_business %}selected{% endif %}">
<div class="marker">Selected Plan</div> <div class="marker">Selected Plan</div>
<h2>Business</h2> <h2>Business</h2>
@ -224,7 +224,7 @@
</div> </div>
</div> </div>
<div class="col-sm-6 col-md-3"> <div class="col-sm-6 col-md-3">
<div id="plan-business-plus" class="panel plan {% if sub.plan_id == "P80" or sub.plan_id == "Y768" %}selected{% endif %}">
<div id="plan-business-plus" class="panel plan {% if sub.is_business_plus %}selected{% endif %}">
<div class="marker">Selected Plan</div> <div class="marker">Selected Plan</div>
<h2>Business Plus</h2> <h2>Business Plus</h2>
@ -251,7 +251,7 @@
type="radio" type="radio"
name="billing_period" name="billing_period"
value="monthly" value="monthly"
{% if sub.plan_id == "Y192" or sub.plan_id == "Y768" %}{% else %}checked{% endif %}>
{% if not sub.is_annual %}checked{% endif %}>
<span class="radiomark"></span> <span class="radiomark"></span>
Monthly Monthly
</label> </label>
@ -261,7 +261,7 @@
type="radio" type="radio"
name="billing_period" name="billing_period"
value="annual" value="annual"
{% if sub.plan_id == "Y192" or sub.plan_id == "Y768" %} checked {% endif %}>
{% if sub.is_annual %} checked {% endif %}>
<span class="radiomark"></span> <span class="radiomark"></span>
Annual, 20% off Annual, 20% off
</label> </label>


Loading…
Cancel
Save