Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Tiered Pricing Plans #629

Open
wants to merge 14 commits into
base: original
Choose a base branch
from
Prev Previous commit
Next Next commit
Update Tier to Use Decimal Fields
  • Loading branch information
jksimoniii committed Feb 1, 2019
commit b323f9e7c032b8954881eb84c394e93a2d09c3d9
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-01-31 12:08
from __future__ import unicode_literals
# Generated by Django 2.2a1 on 2019-02-01 21:19

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -13,15 +11,6 @@ class Migration(migrations.Migration):
]

operations = [
migrations.CreateModel(
name='Tier',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.IntegerField()),
('flat_amount', models.IntegerField()),
('up_to', models.IntegerField(blank=True, null=True)),
],
),
migrations.AddField(
model_name='plan',
name='billing_scheme',
Expand All @@ -32,14 +21,14 @@ class Migration(migrations.Migration):
name='tiers_mode',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AlterField(
model_name='plan',
name='amount',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True),
),
migrations.AddField(
model_name='tier',
name='plan',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tiers', to='pinax_stripe.Plan'),
migrations.CreateModel(
name='Tier',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.DecimalField()),
('flat_amount', models.DecimalField()),
('up_to', models.DecimalField(blank=True, null=True)),
('plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tiers', to='pinax_stripe.Plan')),
],
),
]
6 changes: 3 additions & 3 deletions pinax/stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,9 @@ def stripe_bankaccount(self):
class Tier(models.Model):

plan = models.ForeignKey(Plan, related_name="tiers", on_delete=models.CASCADE)
amount = models.IntegerField()
flat_amount = models.IntegerField()
up_to = models.IntegerField(blank=True, null=True)
amount = models.DecimalField()
flat_amount = models.DecimalField()
up_to = models.DecimalField(blank=True, null=True)

objects = models.Manager()
pricing = TieredPricingManager()
Expand Down