Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/quick fixes #10

Merged
merged 4 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions flutter/web/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/flutter/flutter/issues/113140#issuecomment-1302868727
[[redirects]]
from = "/*"
to = "/"
status = 200
5 changes: 3 additions & 2 deletions supabase/functions/get_stripe_url/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ clientRequestHandler(async (req, user) => {
user.id,
).maybeSingle();
let stripeCustomerId = data?.stripe_customer_id;
const activeProducts: string[] = data?.active_products || [];
if (!stripeCustomerId) {
// create stripe customer if doesn't exist
const customer = await stripe.customers.create({
Expand All @@ -35,7 +34,7 @@ clientRequestHandler(async (req, user) => {

// check if user paid for product
const priceObj = price ? await stripe.prices.retrieve(price) : null;
if (priceObj === null || activeProducts.includes(priceObj.product)) {
if (priceObj === null) {
// open billing portal if product/subscription has been purchased
// or if price is null
event = "user opens billing portal";
Expand Down Expand Up @@ -65,6 +64,8 @@ clientRequestHandler(async (req, user) => {
distinctId: user.id,
event,
properties: {
price,
product: priceObj?.product,
$set: {
"stripe_customer_id": stripeCustomerId,
},
Expand Down
Loading