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
|
# TODO: Rename does_user_have_subscription_credits
|
||||||
res = await does_user_have_subscription_credits(auth_token)
|
res = await does_user_have_subscription_credits(auth_token)
|
||||||
if res.status != "not_subscriber":
|
if res.status != "not_subscriber":
|
||||||
if res.status == "subscriber_has_credits":
|
if (
|
||||||
payment_method = PaymentMethod.SUBSCRIPTION
|
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")
|
openai_api_key = os.environ.get("PLATFORM_OPENAI_API_KEY")
|
||||||
print("Subscription - using platform API key")
|
print("Subscription - using platform API key")
|
||||||
elif res.status == "subscriber_has_no_credits":
|
elif res.status == "subscriber_has_no_credits":
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class PaymentMethod(Enum):
|
|||||||
UNKNOWN = "unknown"
|
UNKNOWN = "unknown"
|
||||||
OPENAI_API_KEY = "openai_api_key"
|
OPENAI_API_KEY = "openai_api_key"
|
||||||
SUBSCRIPTION = "subscription"
|
SUBSCRIPTION = "subscription"
|
||||||
|
TRIAL = "trial"
|
||||||
|
|
||||||
|
|
||||||
async def send_to_saas_backend(
|
async def send_to_saas_backend(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user