mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	invoice_paid_event: Verify invoice before activating fixed-price plan.
Earlier, we were not verifying that the invoice which got paid is for the fixed-price plan. That could result in a bug where another support invoice with collection_method = "send_invoice" got paid while a fixed-price plam is already configured. The fixed-price plan would be falsely activated. This commit verifies the invoice before activating the fixed-price plan.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							823f732132
						
					
				
				
					commit
					14415dfa90
				
			@@ -133,7 +133,11 @@ def handle_invoice_paid_event(stripe_invoice: stripe.Invoice, invoice: Invoice)
 | 
			
		||||
            customer, customer.required_plan_tier
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    if stripe_invoice.collection_method == "send_invoice" and configured_fixed_price_plan:
 | 
			
		||||
    if (
 | 
			
		||||
        stripe_invoice.collection_method == "send_invoice"
 | 
			
		||||
        and configured_fixed_price_plan
 | 
			
		||||
        and configured_fixed_price_plan.sent_invoice_id == invoice.stripe_invoice_id
 | 
			
		||||
    ):
 | 
			
		||||
        billing_session = get_billing_session_for_stripe_webhook(customer, user_id=None)
 | 
			
		||||
        remote_server_legacy_plan = billing_session.get_remote_server_legacy_plan(customer)
 | 
			
		||||
        assert customer.required_plan_tier is not None
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user