mirror of https://github.com/zulip/zulip.git
models: Rename PLAN_QUANITY_UPDATED event type.
This commit is contained in:
parent
975969aa89
commit
51c82b6d4f
|
@ -2161,7 +2161,7 @@ class RealmAuditLog(models.Model):
|
||||||
REALM_STRIPE_INITIALIZED = 'realm_stripe_initialized'
|
REALM_STRIPE_INITIALIZED = 'realm_stripe_initialized'
|
||||||
REALM_CARD_ADDED = 'realm_card_added'
|
REALM_CARD_ADDED = 'realm_card_added'
|
||||||
REALM_PLAN_STARTED = 'realm_plan_started'
|
REALM_PLAN_STARTED = 'realm_plan_started'
|
||||||
PLAN_QUANTITY_UPDATED = 'plan_quantity_updated'
|
REALM_PLAN_QUANTITY_UPDATED = 'realm_plan_quantity_updated'
|
||||||
|
|
||||||
USER_CREATED = 'user_created'
|
USER_CREATED = 'user_created'
|
||||||
USER_ACTIVATED = 'user_activated'
|
USER_ACTIVATED = 'user_activated'
|
||||||
|
|
|
@ -174,7 +174,7 @@ def do_subscribe_customer_to_plan(stripe_customer: stripe.Customer, stripe_plan_
|
||||||
if seat_count != current_seat_count:
|
if seat_count != current_seat_count:
|
||||||
RealmAuditLog.objects.create(
|
RealmAuditLog.objects.create(
|
||||||
realm=customer.realm,
|
realm=customer.realm,
|
||||||
event_type=RealmAuditLog.PLAN_QUANTITY_UPDATED,
|
event_type=RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED,
|
||||||
event_time=timestamp_to_datetime(stripe_subscription.created),
|
event_time=timestamp_to_datetime(stripe_subscription.created),
|
||||||
requires_billing_update=True,
|
requires_billing_update=True,
|
||||||
extra_data=ujson.dumps({'quantity': current_seat_count}))
|
extra_data=ujson.dumps({'quantity': current_seat_count}))
|
||||||
|
|
|
@ -198,7 +198,7 @@ class StripeTest(ZulipTestCase):
|
||||||
}],
|
}],
|
||||||
prorate=True,
|
prorate=True,
|
||||||
tax_percent=0)
|
tax_percent=0)
|
||||||
# Check that we have the PLAN_QUANTITY_UPDATED entry, and that we
|
# Check that we have the REALM_PLAN_QUANTITY_UPDATED entry, and that we
|
||||||
# correctly handled the requires_billing_update field
|
# correctly handled the requires_billing_update field
|
||||||
audit_log_entries = list(RealmAuditLog.objects.order_by('-id')
|
audit_log_entries = list(RealmAuditLog.objects.order_by('-id')
|
||||||
.values_list('event_type', 'event_time',
|
.values_list('event_type', 'event_time',
|
||||||
|
@ -207,10 +207,10 @@ class StripeTest(ZulipTestCase):
|
||||||
(RealmAuditLog.REALM_STRIPE_INITIALIZED, timestamp_to_datetime(self.customer_created), False),
|
(RealmAuditLog.REALM_STRIPE_INITIALIZED, timestamp_to_datetime(self.customer_created), False),
|
||||||
(RealmAuditLog.REALM_CARD_ADDED, timestamp_to_datetime(self.customer_created), False),
|
(RealmAuditLog.REALM_CARD_ADDED, timestamp_to_datetime(self.customer_created), False),
|
||||||
(RealmAuditLog.REALM_PLAN_STARTED, timestamp_to_datetime(self.subscription_created), False),
|
(RealmAuditLog.REALM_PLAN_STARTED, timestamp_to_datetime(self.subscription_created), False),
|
||||||
(RealmAuditLog.PLAN_QUANTITY_UPDATED, timestamp_to_datetime(self.subscription_created), True),
|
(RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED, timestamp_to_datetime(self.subscription_created), True),
|
||||||
])
|
])
|
||||||
self.assertEqual(ujson.loads(RealmAuditLog.objects.filter(
|
self.assertEqual(ujson.loads(RealmAuditLog.objects.filter(
|
||||||
event_type=RealmAuditLog.PLAN_QUANTITY_UPDATED).values_list('extra_data', flat=True).first()),
|
event_type=RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED).values_list('extra_data', flat=True).first()),
|
||||||
{'quantity': new_seat_count})
|
{'quantity': new_seat_count})
|
||||||
|
|
||||||
@mock.patch("zilencer.lib.stripe.STRIPE_PUBLISHABLE_KEY", "stripe_publishable_key")
|
@mock.patch("zilencer.lib.stripe.STRIPE_PUBLISHABLE_KEY", "stripe_publishable_key")
|
||||||
|
|
Loading…
Reference in New Issue