if user is trialing, set payment method to trial
This commit is contained in:
parent
d96931eeae
commit
d4e3405d0a
@ -118,8 +118,15 @@ async def stream_code(websocket: WebSocket):
|
||||
# TODO: Rename does_user_have_subscription_credits
|
||||
res = await does_user_have_subscription_credits(auth_token)
|
||||
if res.status != "not_subscriber":
|
||||
if res.status == "subscriber_has_credits":
|
||||
payment_method = PaymentMethod.SUBSCRIPTION
|
||||
if (
|
||||
res.status == "subscriber_has_credits"
|
||||
or res.status == "subscriber_is_trialing"
|
||||
):
|
||||
payment_method = (
|
||||
PaymentMethod.SUBSCRIPTION
|
||||
if res.status == "subscriber_has_credits"
|
||||
else PaymentMethod.TRIAL
|
||||
)
|
||||
openai_api_key = os.environ.get("PLATFORM_OPENAI_API_KEY")
|
||||
print("Subscription - using platform API key")
|
||||
elif res.status == "subscriber_has_no_credits":
|
||||
|
||||
@ -13,6 +13,7 @@ class PaymentMethod(Enum):
|
||||
UNKNOWN = "unknown"
|
||||
OPENAI_API_KEY = "openai_api_key"
|
||||
SUBSCRIPTION = "subscription"
|
||||
TRIAL = "trial"
|
||||
|
||||
|
||||
async def send_to_saas_backend(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user