# Generated by Django 5.2.9 on 2025-12-02 21:34

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='PayFastPayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('m_payment_id', models.CharField(db_index=True, help_text='Unique payment ID from merchant', max_length=100, unique=True)),
                ('pf_payment_id', models.CharField(blank=True, help_text='PayFast payment ID', max_length=100, null=True)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('amount_gross', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('amount_fee', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('amount_net', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('item_name', models.CharField(max_length=255)),
                ('item_description', models.TextField(blank=True)),
                ('name_first', models.CharField(blank=True, max_length=100)),
                ('name_last', models.CharField(blank=True, max_length=100)),
                ('email_address', models.EmailField(max_length=254)),
                ('cell_number', models.CharField(blank=True, max_length=20)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('complete', 'Complete'), ('failed', 'Failed'), ('cancelled', 'Cancelled')], db_index=True, default='pending', max_length=20)),
                ('payment_status', models.CharField(blank=True, help_text='PayFast payment status', max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('custom_str1', models.CharField(blank=True, max_length=255)),
                ('custom_str2', models.CharField(blank=True, max_length=255)),
                ('custom_str3', models.CharField(blank=True, max_length=255)),
                ('custom_str4', models.CharField(blank=True, max_length=255)),
                ('custom_str5', models.CharField(blank=True, max_length=255)),
                ('custom_int1', models.IntegerField(blank=True, null=True)),
                ('custom_int2', models.IntegerField(blank=True, null=True)),
                ('custom_int3', models.IntegerField(blank=True, null=True)),
                ('custom_int4', models.IntegerField(blank=True, null=True)),
                ('custom_int5', models.IntegerField(blank=True, null=True)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payfast_payments', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'PayFast Payment',
                'verbose_name_plural': 'PayFast Payments',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='PayFastNotification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('raw_data', models.JSONField(default=dict)),
                ('is_valid', models.BooleanField(default=False)),
                ('validation_errors', models.TextField(blank=True)),
                ('ip_address', models.GenericIPAddressField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('payment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to='payfast.payfastpayment')),
            ],
            options={
                'verbose_name': 'PayFast Notification',
                'verbose_name_plural': 'PayFast Notifications',
                'ordering': ['-created_at'],
            },
        ),
    ]
