From bf95f47a7570df62d217ec972ce884d4aafdf0cb Mon Sep 17 00:00:00 2001 From: Derek Finlinson Date: Thu, 29 Feb 2024 10:02:42 -0700 Subject: [PATCH 1/4] Update stripe-function-handler.ts Creating default subscription isn't working since blank defaultPlanId and defaultTrialDays are passed into the getBillingStatus function instead of using the ones passed into the stripeFunctionHandler. Related to #64 --- .../src/providers/stripe/stripe-function-handler.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/supabase/functions/deno-packages/billing-functions/src/providers/stripe/stripe-function-handler.ts b/supabase/functions/deno-packages/billing-functions/src/providers/stripe/stripe-function-handler.ts index 8c16f06..3a35785 100644 --- a/supabase/functions/deno-packages/billing-functions/src/providers/stripe/stripe-function-handler.ts +++ b/supabase/functions/deno-packages/billing-functions/src/providers/stripe/stripe-function-handler.ts @@ -25,8 +25,6 @@ export function stripeFunctionHandler({ accountId, customerId, billingEmail, - defaultTrialDays, - defaultPlanId, subscriptionId, }) { const customer = await findOrCreateCustomer(stripeClient, { From 7b23482f4815fdcbbfeb2fc73ad6ef975f9ac101 Mon Sep 17 00:00:00 2001 From: Derek Finlinson Date: Thu, 29 Feb 2024 14:13:09 -0700 Subject: [PATCH 2/4] Update get-billing-status.ts --- .../billing-functions/src/wrappers/get-billing-status.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/supabase/functions/deno-packages/billing-functions/src/wrappers/get-billing-status.ts b/supabase/functions/deno-packages/billing-functions/src/wrappers/get-billing-status.ts index 51af2c6..779f5d0 100644 --- a/supabase/functions/deno-packages/billing-functions/src/wrappers/get-billing-status.ts +++ b/supabase/functions/deno-packages/billing-functions/src/wrappers/get-billing-status.ts @@ -39,5 +39,6 @@ export default async function getBillingStatus( account_role: roleInfo.account_role, is_primary_owner: roleInfo.is_primary_owner, billing_enabled: roleInfo.billing_enabled, + price_id: billingData?.subscription?.price_id, }; } From e6e939959dac442bd4bc735fdf1ee03df27c9f02 Mon Sep 17 00:00:00 2001 From: Derek Finlinson Date: Thu, 29 Feb 2024 14:15:12 -0700 Subject: [PATCH 3/4] Update billing-functions-wrapper.ts --- .../billing-functions/src/billing-functions-wrapper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts b/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts index 68854ee..2d76148 100644 --- a/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts +++ b/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts @@ -63,6 +63,7 @@ export type GET_BILLING_STATUS_RESPONSE = { account_role: BASEJUMP_DATABASE_SCHEMA["basejump"]["Tables"]["account_user"]["Row"]["account_role"]; is_primary_owner: boolean; billing_enabled: boolean; + price_id: string; }; type BILLING_FUNCTION_WRAPPER_OPTIONS = { From be50947f8d9644dd6b10fc85dbfbabd104e8e000 Mon Sep 17 00:00:00 2001 From: Derek Finlinson Date: Thu, 29 Feb 2024 14:20:50 -0700 Subject: [PATCH 4/4] Update billing-functions-wrapper.ts --- .../src/billing-functions-wrapper.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts b/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts index 2d76148..eebc1c2 100644 --- a/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts +++ b/supabase/functions/deno-packages/billing-functions/src/billing-functions-wrapper.ts @@ -13,17 +13,11 @@ type GET_PLANS_ARGS = { type GET_PLANS_RESPONSE = Array<{ id: string; - name: string; - description?: string; - amount: number; + product_name: string; + product_description?: string; + price: number; currency: string; - interval: "month" | "year" | "one_time"; - interval_count: 1; - trial_period_days?: 30; - active?: boolean; - metadata?: { - [key: string]: string; - }; + interval: "month" | "year" | "one_time"; }>; type GET_BILLING_PORTAL_URL_ARGS = {