61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from enum import StrEnum
|
|
|
|
from app.db.schemas import COMMERCE_SCHEMA, pg_enum
|
|
|
|
|
|
class SubscriptionStatus(StrEnum):
|
|
PENDING = "pending"
|
|
ACTIVE = "active"
|
|
GRACE_PERIOD = "grace_period"
|
|
EXPIRED = "expired"
|
|
CANCELLED = "cancelled"
|
|
REFUNDED = "refunded"
|
|
SUSPENDED = "suspended"
|
|
|
|
|
|
class EntitlementStatus(StrEnum):
|
|
ACTIVE = "active"
|
|
EXPIRED = "expired"
|
|
REVOKED = "revoked"
|
|
|
|
|
|
class PlanType(StrEnum):
|
|
FREE = "free"
|
|
SUBSCRIPTION = "subscription"
|
|
ONE_TIME = "one_time"
|
|
BUNDLE = "bundle"
|
|
|
|
|
|
class BillingPeriod(StrEnum):
|
|
NONE = "none"
|
|
MONTHLY = "monthly"
|
|
QUARTERLY = "quarterly"
|
|
YEARLY = "yearly"
|
|
LIFETIME = "lifetime"
|
|
|
|
|
|
class PaymentStatus(StrEnum):
|
|
PENDING = "pending"
|
|
SUCCESS = "success"
|
|
FAILED = "failed"
|
|
REVERSED = "reversed"
|
|
|
|
|
|
SUBSCRIPTION_STATUS_ENUM = pg_enum(
|
|
SubscriptionStatus, "subscription_status_enum", COMMERCE_SCHEMA
|
|
)
|
|
ENTITLEMENT_STATUS_ENUM = pg_enum(
|
|
EntitlementStatus, "entitlement_status_enum", COMMERCE_SCHEMA
|
|
)
|
|
PLAN_TYPE_ENUM = pg_enum(PlanType, "plan_type_enum", COMMERCE_SCHEMA)
|
|
BILLING_PERIOD_ENUM = pg_enum(BillingPeriod, "billing_period_enum", COMMERCE_SCHEMA)
|
|
PAYMENT_STATUS_ENUM = pg_enum(PaymentStatus, "payment_status_enum", COMMERCE_SCHEMA)
|
|
|
|
__all__ = [
|
|
"SubscriptionStatus", "EntitlementStatus", "PlanType", "BillingPeriod",
|
|
"PaymentStatus", "SUBSCRIPTION_STATUS_ENUM", "ENTITLEMENT_STATUS_ENUM",
|
|
"PLAN_TYPE_ENUM", "BILLING_PERIOD_ENUM", "PAYMENT_STATUS_ENUM",
|
|
]
|