Skip to content

Commit

Permalink
improvement/add billing type per subscription (#283)
Browse files Browse the repository at this point in the history
* Added subscription type (Chargebee or xero)
Added notes for subscriptions

* Updated dashboard to show sub type

* fixed as per PR comments
  • Loading branch information
benrometsch authored Sep 13, 2021
1 parent edfe620 commit aef8a9b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
27 changes: 27 additions & 0 deletions api/organisations/migrations/0026_auto_20210907_1232.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 2.2.24 on 2021-09-07 12:32

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("organisations", "0025_auto_20210223_1603"),
]

operations = [
migrations.AddField(
model_name="subscription",
name="notes",
field=models.CharField(blank=True, max_length=500, null=True),
),
migrations.AddField(
model_name="subscription",
name="payment_method",
field=models.CharField(
choices=[("CHARGEBEE", "Chargebee"), ("XERO", "Xero")],
default="CHARGEBEE",
max_length=20,
),
),
]
13 changes: 13 additions & 0 deletions api/organisations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ class Subscription(models.Model):
cancellation_date = models.DateTimeField(blank=True, null=True)
customer_id = models.CharField(max_length=100, blank=True, null=True)

CHARGEBEE = "CHARGEBEE"
XERO = "XERO"
PAYMENT_METHODS = [
(CHARGEBEE, "Chargebee"),
(XERO, "Xero"),
]
payment_method = models.CharField(
max_length=20,
choices=PAYMENT_METHODS,
default=CHARGEBEE,
)
notes = models.CharField(max_length=500, blank=True, null=True)

def update_plan(self, plan_id):
self.cancellation_date = None
self.plan = plan_id
Expand Down
8 changes: 7 additions & 1 deletion api/sales_dashboard/templates/sales_dashboard/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ <h1 class="h2">Organisations</h1>
<tr>
<td>{{org.id}}</td>
<td><a href="/sales-dashboard/organisations/{{org.id}}">{{org.name}}</a></td>
<td>{{org.subscription.plan|default:"Free"}}</td>
<td>
{% if org.has_subscription %}
{{org.subscription.plan}} - {{org.subscription.payment_method}}
{% else %}
Free
{% endif %}
</td>
<td>{{org.num_users}}</td>
<td>{{org.num_projects}}</td>
<td>{{org.num_features}}</td>
Expand Down

0 comments on commit aef8a9b

Please sign in to comment.