# Generated by Django 2.2.4 on 2019-11-15 06:19

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Invoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('total', models.DecimalField(decimal_places=2, max_digits=11, verbose_name='total')),
                ('captured_total', models.DecimalField(decimal_places=2, max_digits=11, null=True, verbose_name='captured total')),
                ('expires_at', models.DateTimeField(blank=True, null=True, verbose_name='expires at')),
                ('success_callback', models.CharField(max_length=128, verbose_name='success callback')),
                ('fail_callback', models.CharField(blank=True, max_length=128, null=True, verbose_name='fail callback')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'PAID'), (2, 'EXPIRED'), (3, 'CANCELLED'), (4, 'ERROR')], verbose_name='status')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('details', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='details')),
            ],
            options={
                'verbose_name': 'invoice',
                'verbose_name_plural': 'invoices',
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('money_amount', models.DecimalField(decimal_places=2, max_digits=11, verbose_name='money amount')),
                ('type', models.PositiveSmallIntegerField(choices=[(0, 'DUMMY'), (1, 'WALLETONE')], verbose_name='type')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'SUCCESS'), (2, 'DECLINED'), (3, 'INVALID_MONEY_AMOUNT'), (4, 'INVOICE_EXPIRED'), (5, 'ERROR')], verbose_name='status')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified at')),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='payment_gateway.Invoice', verbose_name='invoice')),
            ],
            options={
                'verbose_name': 'transaction',
                'verbose_name_plural': 'transactions',
            },
        ),
        migrations.CreateModel(
            name='WalletOneTransaction',
            fields=[
                ('transaction', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='payment_gateway.Transaction')),
                ('WMI_ORDER_ID', models.CharField(max_length=255, unique=True)),
                ('WMI_MERCHANT_ID', models.CharField(max_length=255)),
                ('WMI_PAYMENT_AMOUNT', models.DecimalField(decimal_places=2, max_digits=10)),
                ('WMI_COMMISSION_AMOUNT', models.DecimalField(decimal_places=2, max_digits=10)),
                ('WMI_CURRENCY_ID', models.IntegerField()),
                ('WMI_TO_USER_ID', models.CharField(max_length=255, null=True)),
                ('WMI_PAYMENT_NO', models.CharField(max_length=255)),
                ('WMI_DESCRIPTION', models.CharField(max_length=255, null=True)),
                ('WMI_SUCCESS_URL', models.URLField(blank=True)),
                ('WMI_FAIL_URL', models.URLField(blank=True)),
                ('WMI_EXPIRED_DATE', models.DateTimeField()),
                ('WMI_CREATE_DATE', models.DateTimeField()),
                ('WMI_UPDATE_DATE', models.DateTimeField()),
                ('WMI_ORDER_STATE', models.CharField(max_length=255)),
                ('WMI_NOTIFY_COUNT', models.IntegerField(null=True)),
                ('WMI_EXTERNAL_ACCOUNT_ID', models.CharField(max_length=50, null=True)),
                ('WMI_AUTO_ACCEPT', models.CharField(max_length=10)),
                ('WMI_LAST_NOTIFY_DATE', models.DateTimeField(null=True)),
                ('WMI_INVOICE_OPERATIONS', models.TextField(null=True)),
                ('WMI_PAYMENT_TYPE', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'walletone transaction',
                'verbose_name_plural': 'walletone transactions',
            },
            bases=('payment_gateway.transaction',),
        ),
        migrations.CreateModel(
            name='TransactionStatusChange',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('from_status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'PAID'), (2, 'EXPIRED'), (3, 'CANCELLED'), (4, 'ERROR')], verbose_name='from status')),
                ('to_status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'PAID'), (2, 'EXPIRED'), (3, 'CANCELLED'), (4, 'ERROR')], verbose_name='to status')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='modified at')),
                ('details', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='details')),
                ('transaction', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payment_gateway.Transaction', verbose_name='transaction')),
            ],
            options={
                'verbose_name': 'transaction status change',
                'verbose_name_plural': 'transaction status changes',
            },
        ),
        migrations.CreateModel(
            name='InvoiceStatusChange',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('from_status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'PAID'), (2, 'EXPIRED'), (3, 'CANCELLED'), (4, 'ERROR')], verbose_name='from status')),
                ('to_status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'PAID'), (2, 'EXPIRED'), (3, 'CANCELLED'), (4, 'ERROR')], verbose_name='to status')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='modified at')),
                ('details', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='details')),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payment_gateway.Invoice', verbose_name='invoice')),
            ],
            options={
                'verbose_name': 'invoice status change',
                'verbose_name_plural': 'invoice status changes',
            },
        ),
        migrations.AddField(
            model_name='invoice',
            name='success_transaction',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='success_invoice', to='payment_gateway.Transaction', verbose_name='transaction'),
        ),
    ]
