# Generated by Django 3.0.5 on 2020-04-12 19:28

import uuid

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Order',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name='ID',
                    ),
                ),
                (
                    'name',
                    models.CharField(
                        default='Lock, Stock and Two Smoking Barrels',
                        max_length=100,
                    ),
                ),
                (
                    'total',
                    models.DecimalField(
                        decimal_places=2, default='199.99', max_digits=8
                    ),
                ),
                ('currency', models.CharField(default='EUR', max_length=3)),
                (
                    'status',
                    models.CharField(
                        blank=True,
                        choices=[
                            ('W', 'Waiting for payment'),
                            ('P', 'Payment complete'),
                        ],
                        default='W',
                        max_length=1,
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CustomPayment',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    'amount_required',
                    models.DecimalField(
                        decimal_places=2,
                        help_text='Amount required to fulfill the payment; in selected currency, normal notation',
                        max_digits=20,
                        verbose_name='amount required',
                    ),
                ),
                (
                    'currency',
                    models.CharField(max_length=3, verbose_name='currency'),
                ),
                (
                    'status',
                    models.CharField(
                        choices=[
                            ('new', 'new'),
                            ('in_progress', 'in progress'),
                            ('accepted_for_proc', 'accepted for processing'),
                            ('partially_paid', 'partially paid'),
                            ('paid', 'paid'),
                            ('cancelled', 'cancelled'),
                            ('failed', 'failed'),
                            ('refund_started', 'refund started'),
                            ('refunded', 'refunded'),
                        ],
                        db_index=True,
                        default='new',
                        max_length=20,
                        verbose_name='status',
                    ),
                ),
                (
                    'backend',
                    models.CharField(
                        db_index=True, max_length=100, verbose_name='backend'
                    ),
                ),
                (
                    'created_on',
                    models.DateTimeField(
                        auto_now_add=True,
                        db_index=True,
                        verbose_name='created on',
                    ),
                ),
                (
                    'last_payment_on',
                    models.DateTimeField(
                        blank=True,
                        db_index=True,
                        default=None,
                        null=True,
                        verbose_name='paid on',
                    ),
                ),
                (
                    'amount_locked',
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        help_text='Amount locked with this payment, ready to charge.',
                        max_digits=20,
                        verbose_name='amount paid',
                    ),
                ),
                (
                    'amount_paid',
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        help_text='Amount actually paid.',
                        max_digits=20,
                        verbose_name='amount paid',
                    ),
                ),
                (
                    'refunded_on',
                    models.DateTimeField(
                        blank=True,
                        db_index=True,
                        default=None,
                        null=True,
                        verbose_name='refunded on',
                    ),
                ),
                (
                    'amount_refunded',
                    models.DecimalField(
                        decimal_places=4,
                        default=0,
                        max_digits=20,
                        verbose_name='amount refunded',
                    ),
                ),
                (
                    'external_id',
                    models.CharField(
                        blank=True,
                        db_index=True,
                        default='',
                        max_length=64,
                        verbose_name='external id',
                    ),
                ),
                (
                    'description',
                    models.CharField(
                        blank=True,
                        default='',
                        max_length=128,
                        verbose_name='description',
                    ),
                ),
                (
                    'fraud_status',
                    models.CharField(
                        choices=[
                            ('unknown', 'unknown'),
                            ('accepted', 'accepted'),
                            ('rejected', 'rejected'),
                            ('check', 'check'),
                        ],
                        db_index=True,
                        default='unknown',
                        max_length=20,
                        verbose_name='fraud status',
                    ),
                ),
                (
                    'fraud_message',
                    models.TextField(blank=True, verbose_name='fraud message'),
                ),
                ('custom', models.BooleanField(default=True, editable=False)),
                (
                    'order',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='payments',
                        to='orders.Order',
                        verbose_name='order',
                    ),
                ),
            ],
            options={
                'verbose_name': 'Payment',
                'verbose_name_plural': 'Payments',
                'ordering': ['-created_on'],
                'abstract': False,
            },
        ),
    ]
