mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
stripe: Only attempt payment if invoice is not paid.
Since it is possible that invoice can be paid before we reach here, so only attempt payment if the invoice is not marked as 'paid'. Fixes invoice already paid error from stripe when running tests.
This commit is contained in:
@@ -1189,8 +1189,8 @@ class BillingSession(ABC):
|
||||
is_created_for_free_trial_upgrade=current_plan_id is not None and on_free_trial,
|
||||
)
|
||||
|
||||
if charge_automatically:
|
||||
# Stripe takes its sweet hour to charge customers after creating an invoice.
|
||||
if stripe_invoice.status != "paid" and charge_automatically:
|
||||
# Stripe can take its sweet hour to charge customers after creating an invoice.
|
||||
# Since we want to charge customers immediately, we charge them manually.
|
||||
# Then poll for the status of the invoice to see if the payment succeeded.
|
||||
stripe_invoice = stripe.Invoice.pay(stripe_invoice.id)
|
||||
|
||||
Reference in New Issue
Block a user