dashboard/billing/migrations/0001_initial.py

284 lines
12 KiB
Python

# Generated by Django 4.0.3 on 2022-06-21 15:18
import accounts.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("dash", "0006_auto_20220619_0800"),
]
operations = [
migrations.CreateModel(
name="PaymentDetail",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("first_name", models.CharField(max_length=2000)),
("last_name", models.CharField(max_length=2000)),
("address_1", models.CharField(max_length=2000)),
("address_2", models.CharField(max_length=2000)),
("city", models.CharField(max_length=200)),
("postcode", models.CharField(max_length=10)),
(
"country_code",
models.CharField(
choices=[
("AU", "Australia"),
("AT", "Austria"),
("BE", "Belgium"),
("BR", "Brazil"),
("BG", "Bulgaria"),
("CA", "Canada"),
("HR", "Croatia"),
("CY", "Cyprus"),
("CZ", "Czech Republic"),
("DK", "Denmark"),
("EE", "Estonia"),
("FI", "Finland"),
("FR", "France"),
("DE", "Germany"),
("GI", "Gibraltar"),
("GR", "Greece"),
("HK", "Hong Kong"),
("HU", "Hungary"),
("IN", "India"),
("IE", "Ireland"),
("IT", "Italy"),
("JP", "Japan"),
("LV", "Latvia"),
("LI", "Liechtenstein"),
("LT", "Lithuania"),
("LU", "Luxembourg"),
("MY", "Malaysia"),
("MT", "Malta"),
("MX", "Mexico"),
("NL", "Netherlands"),
("NZ", "New Zealand"),
("NO", "Norway"),
("PL", "Poland"),
("PT", "Portugal"),
("RO", "Romania"),
("SG", "Singapore"),
("SK", "Slovakia"),
("SI", "Slovenia"),
("ES", "Spain"),
("SE", "Sweden"),
("CH", "Switzerland"),
("AE", "United Arab Emirates"),
("GB", "United Kingdom"),
("US", "United States"),
],
max_length=2,
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name="Payment",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("variant", models.CharField(max_length=255)),
(
"status",
models.CharField(
choices=[
("waiting", "Waiting for confirmation"),
("preauth", "Pre-authorized"),
("confirmed", "Confirmed"),
("rejected", "Rejected"),
("refunded", "Refunded"),
("error", "Error"),
("input", "Input"),
],
default="waiting",
max_length=10,
),
),
(
"fraud_status",
models.CharField(
choices=[
("unknown", "Unknown"),
("accept", "Passed"),
("reject", "Rejected"),
("review", "Review"),
],
default="unknown",
max_length=10,
verbose_name="fraud check",
),
),
("fraud_message", models.TextField(blank=True, default="")),
("created", models.DateTimeField(auto_now_add=True)),
("modified", models.DateTimeField(auto_now=True)),
("transaction_id", models.CharField(blank=True, max_length=255)),
("currency", models.CharField(max_length=10)),
(
"total",
models.DecimalField(decimal_places=2, default="0.0", max_digits=9),
),
(
"delivery",
models.DecimalField(decimal_places=2, default="0.0", max_digits=9),
),
(
"tax",
models.DecimalField(decimal_places=2, default="0.0", max_digits=9),
),
("description", models.TextField(blank=True, default="")),
("billing_country_area", models.CharField(blank=True, max_length=256)),
("billing_email", models.EmailField(blank=True, max_length=254)),
(
"billing_phone",
phonenumber_field.modelfields.PhoneNumberField(
blank=True, max_length=128, region=None
),
),
(
"customer_ip_address",
models.GenericIPAddressField(blank=True, null=True),
),
("extra_data", models.TextField(blank=True, default="")),
("message", models.TextField(blank=True, default="")),
("token", models.CharField(blank=True, default="", max_length=36)),
(
"captured_amount",
models.DecimalField(decimal_places=2, default="0.0", max_digits=9),
),
(
"instance_name",
models.CharField(
max_length=200,
verbose_name="Name of this Instance. Also Serves as subdomain",
),
),
("billing_first_name", models.CharField(max_length=2000)),
("billing_last_name", models.CharField(max_length=2000)),
("billing_address_1", models.CharField(max_length=2000)),
("billing_address_2", models.CharField(max_length=2000)),
("billing_city", models.CharField(max_length=200)),
("billing_postcode", models.CharField(max_length=10)),
(
"billing_country_code",
models.CharField(
choices=[
("AU", "Australia"),
("AT", "Austria"),
("BE", "Belgium"),
("BR", "Brazil"),
("BG", "Bulgaria"),
("CA", "Canada"),
("HR", "Croatia"),
("CY", "Cyprus"),
("CZ", "Czech Republic"),
("DK", "Denmark"),
("EE", "Estonia"),
("FI", "Finland"),
("FR", "France"),
("DE", "Germany"),
("GI", "Gibraltar"),
("GR", "Greece"),
("HK", "Hong Kong"),
("HU", "Hungary"),
("IN", "India"),
("IE", "Ireland"),
("IT", "Italy"),
("JP", "Japan"),
("LV", "Latvia"),
("LI", "Liechtenstein"),
("LT", "Lithuania"),
("LU", "Luxembourg"),
("MY", "Malaysia"),
("MT", "Malta"),
("MX", "Mexico"),
("NL", "Netherlands"),
("NZ", "New Zealand"),
("NO", "Norway"),
("PL", "Poland"),
("PT", "Portugal"),
("RO", "Romania"),
("SG", "Singapore"),
("SK", "Slovakia"),
("SI", "Slovenia"),
("ES", "Spain"),
("SE", "Sweden"),
("CH", "Switzerland"),
("AE", "United Arab Emirates"),
("GB", "United Kingdom"),
("US", "United States"),
],
max_length=2,
),
),
(
"public_ref",
models.CharField(
default=accounts.utils.gen_secret,
editable=False,
max_length=32,
unique=True,
verbose_name="Public referent to the payment record",
),
),
("date", models.DateTimeField(auto_now_add=True)),
(
"instance_configuration_id",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to="dash.instanceconfiguration",
),
),
(
"paid_by",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.AddIndex(
model_name="payment",
index=models.Index(
fields=["public_ref"], name="billing_pay_public__ee30a3_idx"
),
),
migrations.AddIndex(
model_name="payment",
index=models.Index(
fields=["paid_by"], name="billing_pay_paid_by_419604_idx"
),
),
]