|
| 1 | +# Generated by Django 4.2.11 on 2024-07-04 14:13 |
| 2 | + |
| 3 | +import uuid |
| 4 | + |
| 5 | +import django.db.models.deletion |
| 6 | +from django.db import migrations, models |
| 7 | + |
| 8 | + |
| 9 | +class Migration(migrations.Migration): |
| 10 | + |
| 11 | + replaces = [ |
| 12 | + ("payments", "0001_initial"), |
| 13 | + ("payments", "0002_submissionpayment_public_order_id"), |
| 14 | + ("payments", "0003_set_public_order_id"), |
| 15 | + ("payments", "0004_auto_20211028_1141"), |
| 16 | + ("payments", "0005_remove_submissionpayment_form_url"), |
| 17 | + ("payments", "0006_auto_20211111_1614"), |
| 18 | + ("payments", "0007_alter_submissionpayment_plugin_options"), |
| 19 | + ("payments", "0008_auto_20240130_1436"), |
| 20 | + ] |
| 21 | + |
| 22 | + initial = True |
| 23 | + |
| 24 | + dependencies = [ |
| 25 | + ("submissions", "0001_initial_to_openforms_v230"), |
| 26 | + ] |
| 27 | + |
| 28 | + operations = [ |
| 29 | + migrations.CreateModel( |
| 30 | + name="SubmissionPayment", |
| 31 | + fields=[ |
| 32 | + ( |
| 33 | + "id", |
| 34 | + models.AutoField( |
| 35 | + auto_created=True, |
| 36 | + primary_key=True, |
| 37 | + serialize=False, |
| 38 | + verbose_name="ID", |
| 39 | + ), |
| 40 | + ), |
| 41 | + ( |
| 42 | + "uuid", |
| 43 | + models.UUIDField( |
| 44 | + default=uuid.uuid4, unique=True, verbose_name="UUID" |
| 45 | + ), |
| 46 | + ), |
| 47 | + ("created", models.DateTimeField(auto_now_add=True)), |
| 48 | + ( |
| 49 | + "plugin_id", |
| 50 | + models.CharField(max_length=100, verbose_name="Payment backend"), |
| 51 | + ), |
| 52 | + ( |
| 53 | + "plugin_options", |
| 54 | + models.JSONField( |
| 55 | + blank=True, |
| 56 | + help_text="Copy of payment options at time of initializing payment.", |
| 57 | + null=True, |
| 58 | + verbose_name="Payment options", |
| 59 | + ), |
| 60 | + ), |
| 61 | + ( |
| 62 | + "amount", |
| 63 | + models.DecimalField( |
| 64 | + decimal_places=2, |
| 65 | + default=0, |
| 66 | + help_text="Total payment amount.", |
| 67 | + max_digits=8, |
| 68 | + verbose_name="payment amount", |
| 69 | + ), |
| 70 | + ), |
| 71 | + ( |
| 72 | + "status", |
| 73 | + models.CharField( |
| 74 | + choices=[ |
| 75 | + ("started", "Started by user"), |
| 76 | + ("processing", "Backend is processing"), |
| 77 | + ("failed", "Cancelled or failed"), |
| 78 | + ("completed", "Completed by user"), |
| 79 | + ("registered", "Completed and registered"), |
| 80 | + ], |
| 81 | + default="started", |
| 82 | + help_text="Status of the payment process in the configured backend.", |
| 83 | + max_length=32, |
| 84 | + verbose_name="payment status", |
| 85 | + ), |
| 86 | + ), |
| 87 | + ( |
| 88 | + "submission", |
| 89 | + models.ForeignKey( |
| 90 | + on_delete=django.db.models.deletion.CASCADE, |
| 91 | + related_name="payments", |
| 92 | + to="submissions.submission", |
| 93 | + ), |
| 94 | + ), |
| 95 | + ( |
| 96 | + "public_order_id", |
| 97 | + models.CharField( |
| 98 | + blank=True, |
| 99 | + help_text="The order ID to be sent to the payment provider. This ID is built by concatenating an optional global prefix, the submission public reference and a unique incrementing ID.", |
| 100 | + max_length=32, |
| 101 | + verbose_name="Order ID", |
| 102 | + ), |
| 103 | + ), |
| 104 | + ], |
| 105 | + options={ |
| 106 | + "verbose_name": "submission payment details", |
| 107 | + "verbose_name_plural": "submission payment details", |
| 108 | + }, |
| 109 | + ), |
| 110 | + migrations.AddConstraint( |
| 111 | + model_name="submissionpayment", |
| 112 | + constraint=models.UniqueConstraint( |
| 113 | + condition=models.Q(("public_order_id", ""), _negated=True), |
| 114 | + fields=("public_order_id",), |
| 115 | + name="unique_public_order_id", |
| 116 | + ), |
| 117 | + ), |
| 118 | + ] |
0 commit comments