additional stripe settings

This commit is contained in:
Corey Blais
2026-04-16 21:04:08 -04:00
parent 96e5694b01
commit 53f9b09d28
4 changed files with 80 additions and 16 deletions
@@ -106,7 +106,7 @@ export const ensurePersonalWorkspaceForUser = async (user: UserRow) => {
if (!unclaimed.rowCount) {
await db.query(
`INSERT INTO workspaces (id, name, workspace_type, billing_plan, billing_interval, billing_email, subscription_status, rescue_verification_status)
VALUES ($1, $2, 'standard', 'household_basic', 'monthly', $3, 'active', 'not_required')`,
VALUES ($1, $2, 'standard', 'household_basic', 'monthly', $3, 'none', 'not_required')`,
[workspaceId, `${user.name}'s Flock`, user.email],
);
} else {
@@ -117,7 +117,7 @@ export const ensurePersonalWorkspaceForUser = async (user: UserRow) => {
billing_plan = 'household_basic',
billing_interval = 'monthly',
billing_email = $3,
subscription_status = 'active',
subscription_status = 'none',
rescue_verification_status = 'not_required',
updated_at = CURRENT_TIMESTAMP
WHERE id = $1`,
@@ -178,7 +178,7 @@ export const createWorkspace = async ({
billingEmail,
billingPlan,
billingInterval,
workspaceType === 'rescue' ? 'active' : 'active',
workspaceType === 'rescue' ? 'active' : 'none',
workspaceType === 'rescue' ? 'pending' : 'not_required',
],
);
@@ -412,6 +412,10 @@ export const updateRescueVerificationStatus = async (workspaceId: number, status
WHEN $2 = 'rejected' THEN 'monthly'
ELSE billing_interval
END,
subscription_status = CASE
WHEN $2 = 'rejected' THEN 'none'
ELSE subscription_status
END,
rescue_verification_status = CASE
WHEN $2 = 'rejected' THEN 'not_required'
ELSE $2
@@ -432,6 +436,7 @@ export const cancelRescueVerificationRequest = async (workspaceId: number) => {
SET workspace_type = 'standard',
billing_plan = 'household_basic',
billing_interval = 'monthly',
subscription_status = 'none',
rescue_verification_status = 'not_required',
updated_at = CURRENT_TIMESTAMP
WHERE id = $1