2019-04-26 13:15:11 +02:00
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
from django.conf import settings
|
2023-10-12 19:43:45 +02:00
|
|
|
from typing_extensions import override
|
2019-04-26 13:15:11 +02:00
|
|
|
|
2024-04-23 21:30:37 +02:00
|
|
|
from zerver.lib.management import ZulipBaseCommand, abort_unless_locked
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2019-04-26 13:15:11 +02:00
|
|
|
if settings.BILLING_ENABLED:
|
|
|
|
from corporate.lib.stripe import invoice_plans_as_needed
|
|
|
|
|
2021-02-12 08:19:30 +01:00
|
|
|
|
2019-04-26 13:15:11 +02:00
|
|
|
class Command(ZulipBaseCommand):
|
|
|
|
help = """Generates invoices for customers if needed."""
|
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2024-04-23 21:30:37 +02:00
|
|
|
@abort_unless_locked
|
2019-04-26 13:15:11 +02:00
|
|
|
def handle(self, *args: Any, **options: Any) -> None:
|
|
|
|
if settings.BILLING_ENABLED:
|
2024-04-05 13:58:08 +02:00
|
|
|
# Uncomment to test with a specific date.
|
|
|
|
# from datetime import datetime, timezone
|
|
|
|
# date = datetime(2024, 5, 7, tzinfo=timezone.utc)
|
2019-04-26 13:15:11 +02:00
|
|
|
invoice_plans_as_needed()
|