From 294654af71c1408d6d5da54cac9e50071cb5966c Mon Sep 17 00:00:00 2001 From: Alexander Dusenbery Date: Tue, 30 Sep 2025 11:01:16 -0400 Subject: [PATCH] feat: customer uuid and stripe customer id fields added to CheckoutIntent --- .../0006_customer_uuid_stripe_id.py | 33 +++++++++++++++++++ .../apps/customer_billing/models.py | 12 +++++++ .../customer_billing/stripe_event_handlers.py | 1 - 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 enterprise_access/apps/customer_billing/migrations/0006_customer_uuid_stripe_id.py diff --git a/enterprise_access/apps/customer_billing/migrations/0006_customer_uuid_stripe_id.py b/enterprise_access/apps/customer_billing/migrations/0006_customer_uuid_stripe_id.py new file mode 100644 index 00000000..bb67f037 --- /dev/null +++ b/enterprise_access/apps/customer_billing/migrations/0006_customer_uuid_stripe_id.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.24 on 2025-09-30 14:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('customer_billing', '0005_add_terms_metadata_field'), + ] + + operations = [ + migrations.AddField( + model_name='checkoutintent', + name='enterprise_uuid', + field=models.UUIDField(blank=True, help_text='The uuid of the EnterpriseCustomer, once successfully provisioned', null=True), + ), + migrations.AddField( + model_name='checkoutintent', + name='stripe_customer_id', + field=models.CharField(blank=True, db_index=True, help_text='The Stripe Customer identifier associated with this record', max_length=255, null=True), + ), + migrations.AddField( + model_name='historicalcheckoutintent', + name='enterprise_uuid', + field=models.UUIDField(blank=True, help_text='The uuid of the EnterpriseCustomer, once successfully provisioned', null=True), + ), + migrations.AddField( + model_name='historicalcheckoutintent', + name='stripe_customer_id', + field=models.CharField(blank=True, db_index=True, help_text='The Stripe Customer identifier associated with this record', max_length=255, null=True), + ), + ] diff --git a/enterprise_access/apps/customer_billing/models.py b/enterprise_access/apps/customer_billing/models.py index edca3cb3..5d031d8b 100644 --- a/enterprise_access/apps/customer_billing/models.py +++ b/enterprise_access/apps/customer_billing/models.py @@ -109,6 +109,18 @@ class StateChoices(models.TextChoices): validators=[validate_slug], help_text="Checkout intent enterprise customer slug" ) + enterprise_uuid = models.UUIDField( + null=True, + blank=True, + help_text="The uuid of the EnterpriseCustomer, once successfully provisioned", + ) + stripe_customer_id = models.CharField( + null=True, + blank=True, + help_text="The Stripe Customer identifier associated with this record", + db_index=True, + max_length=255, + ) expires_at = models.DateTimeField( db_index=True, help_text="Checkout intent expiration timestamp" diff --git a/enterprise_access/apps/customer_billing/stripe_event_handlers.py b/enterprise_access/apps/customer_billing/stripe_event_handlers.py index 9c94fdb5..e8c68d84 100644 --- a/enterprise_access/apps/customer_billing/stripe_event_handlers.py +++ b/enterprise_access/apps/customer_billing/stripe_event_handlers.py @@ -8,7 +8,6 @@ import stripe from enterprise_access.apps.customer_billing.models import CheckoutIntent -from enterprise_access.apps.customer_billing.stripe_api import get_stripe_subscription from enterprise_access.apps.customer_billing.stripe_event_types import StripeEventType logger = logging.getLogger(__name__)