Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stripe: Make process_initial_upgrade have keyword arguments.

Lauryn Menard367899eedd84
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 0bdc876fcd9..eaa8dfb63f6 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -1797,6 +1797,7 @@ class BillingSession(ABC):
@catch_stripe_errors
def process_initial_upgrade(
self,
+ *,
plan_tier: int,
licenses: int,
automanage_licenses: bool,
@@ -2124,14 +2125,14 @@ class BillingSession(ABC):
# Create NEVER_STARTED plan for complimentary access plans.
if upgrade_when_complimentary_access_plan_ends or free_trial:
self.process_initial_upgrade(
- upgrade_request.tier,
- licenses,
- automanage_licenses,
- billing_schedule,
- charge_automatically,
- free_trial,
- complimentary_access_plan,
- upgrade_when_complimentary_access_plan_ends,
+ plan_tier=upgrade_request.tier,
+ licenses=licenses,
+ automanage_licenses=automanage_licenses,
+ billing_schedule=billing_schedule,
+ charge_automatically=charge_automatically,
+ free_trial=free_trial,
+ complimentary_access_plan=complimentary_access_plan,
+ upgrade_when_complimentary_access_plan_ends=upgrade_when_complimentary_access_plan_ends,
)
data["organization_upgrade_successful"] = True
else:
diff --git a/corporate/lib/stripe_event_handler.py b/corporate/lib/stripe_event_handler.py
index c55eedd461f..abad155382e 100644
--- a/corporate/lib/stripe_event_handler.py
+++ b/corporate/lib/stripe_event_handler.py
@@ -196,9 +196,9 @@ def handle_invoice_paid_event(stripe_invoice: stripe.Invoice, invoice: Invoice)
assert get_current_plan_by_customer(customer) is None
billing_session.process_initial_upgrade(
- plan_tier,
- int(metadata["licenses"]),
- metadata["license_management"] == "automatic",
+ plan_tier=plan_tier,
+ licenses=int(metadata["licenses"]),
+ automanage_licenses=metadata["license_management"] == "automatic",
billing_schedule=billing_schedule,
charge_automatically=charge_automatically,
free_trial=False,
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 3b1b360b987..0342a192c26 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -784,12 +784,12 @@ class StripeTestCase(ZulipTestCase):
hamlet = self.example_user("hamlet")
billing_session = RealmBillingSession(hamlet)
return billing_session.process_initial_upgrade(
- CustomerPlan.TIER_CLOUD_STANDARD,
- licenses,
- automanage_licenses,
- billing_schedule,
- charge_automatically,
- free_trial,
+ plan_tier=CustomerPlan.TIER_CLOUD_STANDARD,
+ licenses=licenses,
+ automanage_licenses=automanage_licenses,
+ billing_schedule=billing_schedule,
+ charge_automatically=charge_automatically,
+ free_trial=free_trial,
stripe_invoice_paid=stripe_invoice_paid,
)