mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	billing: Rename RealmAuditLog.REALM_PLAN_QUANTITY_RESET.
This commit is contained in:
		| @@ -2171,7 +2171,7 @@ class RealmAuditLog(models.Model): | |||||||
|     STRIPE_CUSTOMER_CREATED = 'stripe_customer_created' |     STRIPE_CUSTOMER_CREATED = 'stripe_customer_created' | ||||||
|     STRIPE_CARD_ADDED = 'stripe_card_added' |     STRIPE_CARD_ADDED = 'stripe_card_added' | ||||||
|     STRIPE_PLAN_CHANGED = 'stripe_plan_changed' |     STRIPE_PLAN_CHANGED = 'stripe_plan_changed' | ||||||
|     REALM_PLAN_QUANTITY_RESET = 'realm_plan_quantity_reset' |     STRIPE_PLAN_QUANTITY_RESET = 'stripe_plan_quantity_reset' | ||||||
|  |  | ||||||
|     USER_CREATED = 'user_created' |     USER_CREATED = 'user_created' | ||||||
|     USER_ACTIVATED = 'user_activated' |     USER_ACTIVATED = 'user_activated' | ||||||
|   | |||||||
| @@ -175,7 +175,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.REALM_PLAN_QUANTITY_RESET, |                 event_type=RealmAuditLog.STRIPE_PLAN_QUANTITY_RESET, | ||||||
|                 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})) | ||||||
|   | |||||||
| @@ -194,7 +194,7 @@ class StripeTest(ZulipTestCase): | |||||||
|             }], |             }], | ||||||
|             prorate=True, |             prorate=True, | ||||||
|             tax_percent=0) |             tax_percent=0) | ||||||
|         # Check that we have the REALM_PLAN_QUANTITY_RESET entry, and that we |         # Check that we have the STRIPE_PLAN_QUANTITY_RESET 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', | ||||||
| @@ -203,10 +203,10 @@ class StripeTest(ZulipTestCase): | |||||||
|             (RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created), False), |             (RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created), False), | ||||||
|             (RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created), False), |             (RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created), False), | ||||||
|             (RealmAuditLog.STRIPE_PLAN_CHANGED, timestamp_to_datetime(self.subscription_created), False), |             (RealmAuditLog.STRIPE_PLAN_CHANGED, timestamp_to_datetime(self.subscription_created), False), | ||||||
|             (RealmAuditLog.REALM_PLAN_QUANTITY_RESET, timestamp_to_datetime(self.subscription_created), True), |             (RealmAuditLog.STRIPE_PLAN_QUANTITY_RESET, timestamp_to_datetime(self.subscription_created), True), | ||||||
|         ]) |         ]) | ||||||
|         self.assertEqual(ujson.loads(RealmAuditLog.objects.filter( |         self.assertEqual(ujson.loads(RealmAuditLog.objects.filter( | ||||||
|             event_type=RealmAuditLog.REALM_PLAN_QUANTITY_RESET).values_list('extra_data', flat=True).first()), |             event_type=RealmAuditLog.STRIPE_PLAN_QUANTITY_RESET).values_list('extra_data', flat=True).first()), | ||||||
|             {'quantity': new_seat_count}) |             {'quantity': new_seat_count}) | ||||||
|  |  | ||||||
|     def test_upgrade_with_tampered_seat_count(self) -> None: |     def test_upgrade_with_tampered_seat_count(self) -> None: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user