Skip to content

Commit

Permalink
tmp switch to product id
Browse files Browse the repository at this point in the history
  • Loading branch information
gioelecerati committed Jun 29, 2023
1 parent 3056fe5 commit 108730e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions packages/api/src/controllers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ app.post(
stripeCustomerId
);

if (
/*if (
stripeProductId !== "prod_0" &&
stripeProductId !== "prod_1" &&
stripeProductId !== "prod_2"
Expand All @@ -837,7 +837,7 @@ app.post(
});
res.send(subscription);
return;
}
}*/

// Update user's product and subscription id in our db
await db.user.update(user.id, {
Expand Down Expand Up @@ -906,7 +906,7 @@ app.post(
);

// Temporarily skip updating the subscription if user is selecting a new plan
if (
/*if (
payload.stripeProductId !== "prod_0" &&
payload.stripeProductId !== "prod_1" &&
payload.stripeProductId !== "prod_2"
Expand All @@ -918,7 +918,7 @@ app.post(
});
res.send(subscription);
return;
}
}*/

// Get the prices associated with the subscription
const subscriptionItems = await req.stripe.subscriptionItems.list({
Expand Down
8 changes: 4 additions & 4 deletions packages/www/components/PlanForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,12 @@ const PlanForm = ({
<Box css={{ mt: "$4" }}>
<Text variant="neutral">
You are currently using the{" "}
{products[user.newStripeProductId]?.name ||
products[stripeProductId]?.name}{" "}
{products[stripeProductId]?.name ||
products[user.newStripeProductId]?.name}{" "}
plan. Do you want to{" "}
{products[stripeProductId].order <
products[user.newStripeProductId]?.order ||
products[stripeProductId]?.order
products[stripeProductId]?.order ||
products[user.newStripeProductId]?.order
? "downgrade"
: "upgrade"}{" "}
to the {products[stripeProductId].name} plan?
Expand Down
4 changes: 2 additions & 2 deletions packages/www/components/UsageSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ const UsageSummary = () => {
variant="neutral"
css={{ letterSpacing: 0, mt: "7px" }}>
{user?.stripeProductId
? products[user.newStripeProductId]?.name ||
products[user.stripeProductId]?.name
? products[user.stripeProductId]?.name ||
products[user.newStripeProductId]?.name
: products["hacker_1"].name}{" "}
Plan
</Badge>
Expand Down
6 changes: 3 additions & 3 deletions packages/www/hooks/use-api/endpoints/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ export const getUser = async (
// Get current Stripe product, allowing for development users that don't have any
export const getUserProduct = (user: User) => {
if (hasStripe) {
return products[user.newStripeProductId] || products[user.stripeProductId];
return products[user.stripeProductId] || products[user.newStripeProductId];
}
return (
products[user.newStripeProductId] ||
products[user.stripeProductId || "prod_O9XuIjn7EqYRVW"]
products[user.stripeProductId] ||
products[user.newStripeProductId || "prod_O9XuIjn7EqYRVW"]
);
};

Expand Down
4 changes: 2 additions & 2 deletions packages/www/pages/dashboard/billing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ const Billing = () => {
variant="neutral"
css={{ mx: "$1", fontWeight: 700, letterSpacing: 0 }}>
{user?.stripeProductId
? products[user.newStripeProductId]?.name ||
products[user.stripeProductId]?.name
? products[user.stripeProductId]?.name ||
products[user.newStripeProductId]?.name
: products["hacker_1"]?.name}
</Badge>
plan.
Expand Down

0 comments on commit 108730e

Please sign in to comment.