# Generated by Django 3.2.8 on 2021-11-02 10:38

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import payment.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CardDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('card_number', models.CharField(max_length=16)),
                ('card_type', models.CharField(blank=True, choices=[('mastercard', 'mastercard'), ('visa', 'visa'), ('american_express', 'American Express'), ('discover', 'Discover')], max_length=30, null=True)),
                ('expiry_date', models.DateField(validators=[payment.models.validate_card_expiry])),
                ('action', models.CharField(max_length=30)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_on'],
            },
        ),
        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=9, null=True)),
                ('order_id', models.CharField(max_length=50, verbose_name='order_id')),
                ('transaction_id', models.CharField(max_length=100, unique=True)),
                ('status', models.BooleanField()),
                ('transaction_datetime', models.DateTimeField(auto_now=True)),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Payment Detail',
                'verbose_name_plural': 'Payment Details',
                'ordering': ['-transaction_datetime'],
                'unique_together': {('order_id', 'transaction_id')},
            },
        ),
    ]
