# Generated by Django 5.1.7 on 2025-04-29 13:33 import django.core.validators import django.db.models.deletion import django.utils.timezone from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('inventory', '0006_alter_email_object_id_alter_notes_object_id'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='PaymentHistory', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('user_data', models.JSONField(blank=True, null=True)), ('amount', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(0.01)])), ('currency', models.CharField(default='SAR', max_length=3)), ('payment_date', models.DateTimeField(default=django.utils.timezone.now)), ('status', models.CharField(choices=[('initiated', 'initiated'), ('pending', 'Pending'), ('completed', 'Completed'), ('paid', 'Paid'), ('failed', 'Failed'), ('refunded', 'Refunded'), ('cancelled', 'Cancelled')], default='pending', max_length=10)), ('payment_method', models.CharField(choices=[('credit_card', 'Credit Card'), ('debit_card', 'Debit Card'), ('paypal', 'PayPal'), ('bank_transfer', 'Bank Transfer'), ('crypto', 'Cryptocurrency'), ('other', 'Other')], max_length=20)), ('transaction_id', models.CharField(blank=True, max_length=100, null=True, unique=True)), ('invoice_number', models.CharField(blank=True, max_length=50, null=True)), ('order_reference', models.CharField(blank=True, max_length=100, null=True)), ('gateway_response', models.JSONField(blank=True, null=True)), ('gateway_name', models.CharField(blank=True, max_length=50, null=True)), ('description', models.TextField(blank=True, null=True)), ('is_recurring', models.BooleanField(default=False)), ('billing_email', models.EmailField(blank=True, max_length=254, null=True)), ('billing_address', models.TextField(blank=True, null=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name_plural': 'Payment Histories', 'ordering': ['-payment_date'], 'indexes': [models.Index(fields=['transaction_id'], name='inventory_p_transac_9469f3_idx'), models.Index(fields=['user'], name='inventory_p_user_id_c31626_idx'), models.Index(fields=['status'], name='inventory_p_status_abcb77_idx'), models.Index(fields=['payment_date'], name='inventory_p_payment_b3068c_idx')], }, ), ]