billing: Fix idempotency bug in setup_stripe management command.

This commit is contained in:
Rishi Gupta 2018-08-28 15:52:01 -07:00
parent 24b22e7e75
commit bebd93b571
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,5 @@
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
from zilencer.models import Plan, Coupon from zilencer.models import Plan, Coupon, Customer
from zproject.settings import get_secret from zproject.settings import get_secret
from typing import Any from typing import Any
@ -11,7 +11,9 @@ class Command(ZulipBaseCommand):
help = """Script to add the appropriate products and plans to Stripe.""" help = """Script to add the appropriate products and plans to Stripe."""
def handle(self, *args: Any, **options: Any) -> None: def handle(self, *args: Any, **options: Any) -> None:
Customer.objects.all().delete()
Plan.objects.all().delete() Plan.objects.all().delete()
Coupon.objects.all().delete()
# Zulip Cloud offerings # Zulip Cloud offerings
product = stripe.Product.create( product = stripe.Product.create(