Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: rename + scope error
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Sep 13, 2023
1 parent 89eb688 commit c3f7ab2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pages/account/manage/premium.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function ManageSettings({
<>
<PageHead
title="Manage Profile settings"
description="Here you can manage your LinkFree Proile settings."
description="Here you can manage your BioDrop Proile settings."
/>

<Page>
Expand Down
2 changes: 1 addition & 1 deletion pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const authOptions = {
events: {
async signIn({ profile: githubProfile }) {
await connectMongo();
// associate LinkFree profile to LinkFree account
// associate BioDrop profile to account
const account = await getAccountByProviderAccountId(githubProfile.id);
const user = await User.findOne({ _id: account.userId });

Expand Down
40 changes: 22 additions & 18 deletions pages/api/system/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,22 @@ export async function webhookHandler(req, res) {
case "customer.subscription.resumed":
case "invoice.paid":
case "invoice.payment_succeeded":
const update = { type: "premium" };
// check if they already had a trial
const user = await User.findOne({
stripeCustomerId: event.data.object.customer,
});
if (!user.premiumTrialStartDate) {
update.premiumTrialStartDate = new Date();
}
{
const update = { type: "premium" };
// check if they already had a trial
const user = await User.findOne({
stripeCustomerId: event.data.object.customer,
});
if (!user.premiumTrialStartDate) {
update.premiumTrialStartDate = new Date();
}

// successful payment
await User.findOneAndUpdate(
{ stripeCustomerId: event.data.object.customer },
update
);
// successful payment
await User.findOneAndUpdate(
{ stripeCustomerId: event.data.object.customer },
update
);
}
break;
case "payment_intent.payment_failed":
case "customer.subscription.deleted":
Expand All @@ -289,11 +291,13 @@ export async function webhookHandler(req, res) {
case "customer.subscription.paused":
case "invoice.payment_failed":
case "subscription_schedule.released":
// failed payment
await User.findOneAndUpdate(
{ stripeCustomerId: event.data.object.customer },
{ type: "free" }
);
{
// failed payment
await User.findOneAndUpdate(
{ stripeCustomerId: event.data.object.customer },
{ type: "free" }
);
}
break;
default:
logger.error(`Unhandled event type ${event.type}`);
Expand Down
2 changes: 1 addition & 1 deletion pages/docs/terms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ These Terms are governed by the laws of England and Wales in the United Kingdom.

export default ({ children }) => (
<DocsLayout
title="LinkFree Terms and Conditions"
title="BioDrop Terms and Conditions"
section="Legal"
name="Terms & Conditions"
>
Expand Down
4 changes: 2 additions & 2 deletions pages/pricing.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ export default function Premium({ user }) {
return (
<>
<PageHead
title="LinkFree Premium Features Pricing"
description="LinkFree is 100% Open Source and FREE, but we will have some paid Premium features in the future"
title="BioDrop Premium Features Pricing"
description="BioDrop is 100% Open Source and FREE, but we will have some paid Premium features in the future"
/>
<Page>
<h1 className="text-4xl mb-4 font-bold">Pricing</h1>
Expand Down

0 comments on commit c3f7ab2

Please sign in to comment.