- Added PricingPlan Model

- Implement a complete cycle for buying a Matrix Chat Host
- Refactor the Payement cycle and stripe related methods
This commit is contained in:
amalelshihaby 2021-07-19 16:36:10 +02:00 committed by Nico Schottelius
commit b7aa1c6971
81 changed files with 5079 additions and 810 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 3.2.4 on 2021-06-30 07:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0011_auto_20210101_1308'),
]
operations = [
migrations.AddField(
model_name='billingaddress',
name='vat_number_verified',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='payment',
name='source',
field=models.CharField(choices=[('wire', 'Wire Transfer'), ('stripe', 'Stripe'), ('voucher', 'Voucher'), ('referral', 'Referral')], max_length=256),
),
]

View file

@ -0,0 +1,21 @@
# Generated by Django 3.2.4 on 2021-07-03 15:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0012_auto_20210630_0742'),
]
operations = [
migrations.AlterField(
model_name='billingaddress',
name='owner',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='billing_addresses', to=settings.AUTH_USER_MODEL),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 3.2.4 on 2021-07-03 17:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0013_alter_billingaddress_owner'),
]
operations = [
migrations.AddField(
model_name='billingaddress',
name='stripe_tax_id',
field=models.CharField(blank=True, default='', max_length=100),
),
migrations.AddField(
model_name='billingaddress',
name='vat_number_validated_on',
field=models.DateTimeField(blank=True, null=True),
),
]

View file

@ -0,0 +1,34 @@
# Generated by Django 3.2.4 on 2021-07-05 08:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0014_auto_20210703_1747'),
]
operations = [
migrations.AddField(
model_name='order',
name='customer',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.stripecustomer'),
),
migrations.AddField(
model_name='order',
name='status',
field=models.CharField(choices=[('draft', 'Draft'), ('declined', 'Declined'), ('approved', 'Approved')], default='draft', max_length=100),
),
migrations.AddField(
model_name='order',
name='stripe_charge_id',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='order',
name='vm_id',
field=models.IntegerField(default=0),
),
]

View file

@ -0,0 +1,29 @@
# Generated by Django 3.2.4 on 2021-07-06 13:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0015_auto_20210705_0849'),
]
operations = [
migrations.CreateModel(
name='PricingPlan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
('vat_inclusive', models.BooleanField(default=True)),
('vat_percentage', models.DecimalField(blank=True, decimal_places=5, default=0, max_digits=7)),
('set_up_fees', models.DecimalField(decimal_places=2, default=0, max_digits=7)),
('cores_unit_price', models.DecimalField(decimal_places=2, default=0, max_digits=7)),
('ram_unit_price', models.DecimalField(decimal_places=2, default=0, max_digits=7)),
('storage_unit_price', models.DecimalField(decimal_places=2, default=0, max_digits=7)),
('discount_name', models.CharField(blank=True, max_length=255, null=True)),
('discount_amount', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
('stripe_coupon_id', models.CharField(blank=True, max_length=255, null=True)),
],
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 3.2.4 on 2021-07-06 17:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0016_pricingplan'),
]
operations = [
migrations.RemoveField(
model_name='paymentmethod',
name='owner',
),
migrations.DeleteModel(
name='Payment',
),
migrations.DeleteModel(
name='PaymentMethod',
),
]

View file

@ -0,0 +1,30 @@
# Generated by Django 3.2.4 on 2021-07-06 17:47
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '0017_auto_20210706_1728'),
]
operations = [
migrations.CreateModel(
name='Payment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
('source', models.CharField(choices=[('wire', 'Wire Transfer'), ('stripe', 'Stripe'), ('voucher', 'Voucher'), ('referral', 'Referral')], max_length=256)),
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
('currency', models.CharField(choices=[('CHF', 'Swiss Franc')], default='CHF', max_length=32)),
('external_reference', models.CharField(blank=True, default='', max_length=256, null=True)),
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View file

@ -0,0 +1,19 @@
# Generated by Django 3.2.4 on 2021-07-06 19:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0018_payment'),
]
operations = [
migrations.AddField(
model_name='order',
name='pricing_plan',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.pricingplan'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 3.2.4 on 2021-07-07 20:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0019_order_pricing_plan'),
]
operations = [
migrations.RenameField(
model_name='bill',
old_name='is_final',
new_name='is_closed',
),
]

View file

@ -0,0 +1,21 @@
# Generated by Django 3.2.4 on 2021-07-09 09:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0020_rename_is_final_bill_is_closed'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='stripe_charge_id',
),
migrations.RemoveField(
model_name='order',
name='vm_id',
),
]

View file

@ -0,0 +1,17 @@
# Generated by Django 3.2.4 on 2021-07-11 08:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0021_auto_20210709_0914'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='status',
),
]