Skip to content

Commit

Permalink
chore(membership): Temporarily pause membership payments (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira authored Jan 1, 2025
1 parent 86ab47b commit af555e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions src/app/(account)/settings/tabs/MembershipSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export default function MembershipSettings({
},
});

const handlePayment = async () => {
pay.trigger({
product: 'membership',
customerId: user!.id,
redirectUrl: window.location.href,
});
};
// const handlePayment = async () => {
// pay.trigger({
// product: 'membership',
// customerId: user!.id,
// redirectUrl: window.location.href,
// });
// };

return (
<div>
Expand All @@ -43,6 +43,10 @@ export default function MembershipSettings({
) : (
<>
<p>
Membership payments will resume later this year. Please check back for
updates.
</p>
{/* <p>
Finalise your membership by completing the required payment either online
below, at a club event, or contact one of the{' '}
<Link href="/about" className="underline">
Expand All @@ -61,7 +65,7 @@ export default function MembershipSettings({
loading={pay.isMutating}
>
Pay Online
</Button>
</Button> */}
</>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/server/verify-membership-payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const verifyMembershipPayment = cache(async (clerkId: string) => {
})
.from(memberTable)
.where(eq(memberTable.clerkId, clerkId));
// If membership expiry date exists, return the existing date
if (member && member.membershipExpiresAt) {
// If membership expiry date exists and hasn't passed, user has paid
if (member && member.membershipExpiresAt && new Date(member.membershipExpiresAt) > new Date()) {
return { paid: true as const, membershipExpiresAt: member.membershipExpiresAt };
}

Expand Down

0 comments on commit af555e4

Please sign in to comment.