- 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:
parent
e205d8d07c
commit
b7aa1c6971
81 changed files with 5079 additions and 810 deletions
30
matrixhosting/migrations/0001_initial.py
Normal file
30
matrixhosting/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Generated by Django 3.2.4 on 2021-06-30 07:42
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='VMPricing',
|
||||
fields=[
|
||||
('id', models.BigAutoField(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=5, default=0, max_digits=7)),
|
||||
('cores_unit_price', models.DecimalField(decimal_places=5, default=0, max_digits=7)),
|
||||
('ram_unit_price', models.DecimalField(decimal_places=5, default=0, max_digits=7)),
|
||||
('storage_unit_price', models.DecimalField(decimal_places=5, 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)),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-01 08:48
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('matrixhosting', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='VMPricing',
|
||||
new_name='MatrixVMPricing',
|
||||
),
|
||||
]
|
||||
33
matrixhosting/migrations/0003_auto_20210703_1523.py
Normal file
33
matrixhosting/migrations/0003_auto_20210703_1523.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-03 15:23
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('matrixhosting', '0002_rename_vmpricing_matrixvmpricing'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='matrixvmpricing',
|
||||
name='cores_unit_price',
|
||||
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='matrixvmpricing',
|
||||
name='ram_unit_price',
|
||||
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='matrixvmpricing',
|
||||
name='set_up_fees',
|
||||
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='matrixvmpricing',
|
||||
name='storage_unit_price',
|
||||
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
|
||||
),
|
||||
]
|
||||
43
matrixhosting/migrations/0004_matrixhostingorder_vmspecs.py
Normal file
43
matrixhosting/migrations/0004_matrixhostingorder_vmspecs.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-05 06:52
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_pay', '0014_auto_20210703_1747'),
|
||||
('matrixhosting', '0003_auto_20210703_1523'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='VMSpecs',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('cores', models.IntegerField(default=1)),
|
||||
('memory', models.IntegerField(default=2)),
|
||||
('storage', models.IntegerField(default=100)),
|
||||
('matrix_domain', models.CharField(max_length=255)),
|
||||
('homeserver_domain', models.CharField(max_length=255)),
|
||||
('webclient_domain', models.CharField(max_length=255)),
|
||||
('is_open_registration', models.BooleanField(default=False, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='MatrixHostingOrder',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('vm_id', models.IntegerField(default=0)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('status', models.CharField(choices=[('draft', 'Draft'), ('declined', 'Declined'), ('approved', 'Approved')], default='draft', max_length=100)),
|
||||
('stripe_charge_id', models.CharField(max_length=100, null=True)),
|
||||
('price', models.FloatField()),
|
||||
('billing_address', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='uncloud_pay.billingaddress')),
|
||||
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.stripecustomer')),
|
||||
('specs', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='matrixhosting.vmspecs')),
|
||||
('vm_pricing', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='matrixhosting.matrixvmpricing')),
|
||||
],
|
||||
),
|
||||
]
|
||||
19
matrixhosting/migrations/0005_auto_20210705_0849.py
Normal file
19
matrixhosting/migrations/0005_auto_20210705_0849.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-05 08:49
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('matrixhosting', '0004_matrixhostingorder_vmspecs'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='MatrixHostingOrder',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='VMSpecs',
|
||||
),
|
||||
]
|
||||
16
matrixhosting/migrations/0006_delete_matrixvmpricing.py
Normal file
16
matrixhosting/migrations/0006_delete_matrixvmpricing.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-06 13:21
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('matrixhosting', '0005_auto_20210705_0849'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='MatrixVMPricing',
|
||||
),
|
||||
]
|
||||
31
matrixhosting/migrations/0007_vminstance.py
Normal file
31
matrixhosting/migrations/0007_vminstance.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-09 09:14
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('uncloud_pay', '0021_auto_20210709_0914'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('matrixhosting', '0006_delete_matrixvmpricing'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='VMInstance',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ip', models.TextField(default='')),
|
||||
('config', models.JSONField()),
|
||||
('creation_date', models.DateTimeField(auto_now_add=True)),
|
||||
('termination_date', models.DateTimeField(blank=True, null=True)),
|
||||
('order', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='instance_id', to='uncloud_pay.order')),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
||||
17
matrixhosting/migrations/0008_remove_vminstance_ip.py
Normal file
17
matrixhosting/migrations/0008_remove_vminstance_ip.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-10 14:29
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('matrixhosting', '0007_vminstance'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='vminstance',
|
||||
name='ip',
|
||||
),
|
||||
]
|
||||
19
matrixhosting/migrations/0009_vminstance_vm_id.py
Normal file
19
matrixhosting/migrations/0009_vminstance_vm_id.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.2.4 on 2021-07-13 10:20
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('matrixhosting', '0008_remove_vminstance_ip'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='vminstance',
|
||||
name='vm_id',
|
||||
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
|
||||
),
|
||||
]
|
||||
0
matrixhosting/migrations/__init__.py
Normal file
0
matrixhosting/migrations/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue