populate_billing_realms: Don't create plan for sponsored remote realm.

This commit is contained in:
Aman Agrawal 2023-12-13 15:44:54 +00:00 committed by Tim Abbott
parent 9efb236c35
commit 35b644c564
1 changed files with 4 additions and 2 deletions

View File

@ -364,7 +364,8 @@ def populate_realm(customer_profile: CustomerProfile) -> Optional[Realm]:
# Remote realm billing data on their local server is irrelevant. # Remote realm billing data on their local server is irrelevant.
return realm return realm
if customer_profile.sponsorship_pending: if customer_profile.sponsorship_pending or customer_profile.is_sponsored:
# plan_type is already set correctly above for sponsored realms.
customer = Customer.objects.create( customer = Customer.objects.create(
realm=realm, realm=realm,
sponsorship_pending=customer_profile.sponsorship_pending, sponsorship_pending=customer_profile.sponsorship_pending,
@ -512,6 +513,7 @@ def populate_remote_realms(customer_profile: CustomerProfile) -> Dict[str, str]:
billing_session.do_change_plan_type( billing_session.do_change_plan_type(
tier=customer_profile.tier, is_sponsored=customer_profile.is_sponsored tier=customer_profile.tier, is_sponsored=customer_profile.is_sponsored
) )
if not customer_profile.is_sponsored:
create_plan_for_customer(customer, customer_profile) create_plan_for_customer(customer, customer_profile)
if customer_profile.sponsorship_pending: if customer_profile.sponsorship_pending: