# Generated by Django 4.2.11 on 2026-05-21 11:19

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('invoice_discounting', '0001_initial'),
        ('purchase_order', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentGatewayConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('gateway_name', models.CharField(choices=[('STRIPE', 'Stripe'), ('PAYPAL', 'PayPal'), ('YOUR_CODING', 'YourCoding Payment Gateway')], max_length=50, unique=True)),
                ('is_active', models.BooleanField(default=True)),
                ('api_key', models.CharField(max_length=255)),
                ('api_secret', models.CharField(max_length=255)),
                ('webhook_secret', models.CharField(blank=True, max_length=255)),
                ('environment', models.CharField(choices=[('TEST', 'Test/Sandbox'), ('LIVE', 'Live Production')], default='TEST', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'payment_gateway_configs',
            },
        ),
        migrations.CreateModel(
            name='PaymentTransaction',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('transaction_id', models.CharField(max_length=100, unique=True)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=15)),
                ('payment_method', models.CharField(choices=[('CARD', 'Credit/Debit Card'), ('EFT', 'Electronic Transfer'), ('PAYPAL', 'PayPal'), ('MOMO', 'Mobile Money'), ('CASH', 'Cash')], max_length=20)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed'), ('REFUNDED', 'Refunded'), ('CANCELLED', 'Cancelled')], default='PENDING', max_length=20)),
                ('stripe_payment_intent_id', models.CharField(blank=True, max_length=100)),
                ('paypal_order_id', models.CharField(blank=True, max_length=100)),
                ('customer_name', models.CharField(max_length=200)),
                ('customer_email', models.EmailField(max_length=254)),
                ('payment_date', models.DateTimeField(blank=True, null=True)),
                ('metadata', models.JSONField(blank=True, default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('invoice', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payment_transactions', to='invoice_discounting.invoice')),
                ('purchase_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payment_transactions', to='purchase_order.purchaseorder')),
            ],
            options={
                'db_table': 'payment_transactions',
                'ordering': ['-created_at'],
            },
        ),
    ]
