Skip to content

Commit

Permalink
Add invoice past due indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
255kb committed Oct 27, 2023
1 parent 957d869 commit d804e15
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_BACKEND_URL=http://localhost:5003
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_URL=https://billing.stripe.com/p/login/test_00g15lac9bdAasg144
NEXT_PUBLIC_PADDLE_SELLER_ID=14090
NEXT_PUBLIC_PADDLE_RETAIN_AUTH=xxxx
NEXT_PUBLIC_PADDLE_PLAN_SOLO_MONTHLY_PRICE_ID=pri_01h8epyz0sdr29zvnxfssxzygv
NEXT_PUBLIC_PADDLE_PLAN_SOLO_YEARLY_PRICE_ID=pri_01h8eq0hhn7fky8j6fkmv49qz1
NEXT_PUBLIC_PADDLE_PLAN_TEAM_MONTHLY_PRICE_ID=pri_01h8ez018gcqaee9qb1e5dam81
Expand Down
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ NEXT_PUBLIC_FRONTEND_URL=https://mockoon.com
NEXT_PUBLIC_BACKEND_URL=https://api.mockoon.com
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_URL=https://billing.stripe.com/p/login/4gw4iU8VB60g1Ak288
NEXT_PUBLIC_PADDLE_SELLER_ID=176021
NEXT_PUBLIC_PADDLE_RETAIN_AUTH=09b483d383ad9724227a573a5f7b8116
NEXT_PUBLIC_PADDLE_PLAN_SOLO_MONTHLY_PRICE_ID=pri_01h8gwq04cj56q9vadz5qrkawa
NEXT_PUBLIC_PADDLE_PLAN_SOLO_YEARLY_PRICE_ID=pri_01h8gwp21f3y5ypztk8hbf45zs
NEXT_PUBLIC_PADDLE_PLAN_TEAM_MONTHLY_PRICE_ID=pri_01h8gwsp95amj9z03hpeqxwyqm
Expand Down
1 change: 1 addition & 0 deletions components/paddle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const PaddleScript: FunctionComponent = function () {
// @ts-ignore
Paddle.Setup({
seller: parseInt(process.env.NEXT_PUBLIC_PADDLE_SELLER_ID),
pwAuth: process.env.NEXT_PUBLIC_PADDLE_RETAIN_AUTH,
eventCallback: function (data) {
if (data.name === 'checkout.completed') {
setTimeout(() => {
Expand Down
1 change: 1 addition & 0 deletions models/user.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type User = {
frequency: string;
portalEnabled?: boolean;
cancellationScheduled?: boolean;
pastDue?: boolean;
};
};

Expand Down
27 changes: 16 additions & 11 deletions pages/account/subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,25 @@ const AccountSubscription: FunctionComponent = function () {
</p>
)}
</div>
{userData?.plan === 'FREE' && (
<div className='col-auto'>
<div className='col-auto'>
{userData?.plan !== 'FREE' &&
userData.subscription.pastDue && (
<span className='badge bg-warning ms-2'>
Invoice past due
</span>
)}
{userData?.plan === 'FREE' && (
<Link
href={'/account/subscribe/'}
className='btn btn-xs btn-primary'
>
Upgrade plan
</Link>
</div>
)}
{userData?.plan !== 'FREE' &&
displayPlanInfo &&
userData?.subscription?.provider ===
'stripe' && (
<div className='col-auto'>
)}
{userData?.plan !== 'FREE' &&
displayPlanInfo &&
userData?.subscription?.provider ===
'stripe' && (
<Link
href={
process.env
Expand All @@ -142,8 +146,8 @@ const AccountSubscription: FunctionComponent = function () {
>
Manage subscription
</Link>
</div>
)}
)}
</div>
</div>
{userData?.plan === 'FREE' &&
userData?.subscription?.portalEnabled &&
Expand All @@ -166,6 +170,7 @@ const AccountSubscription: FunctionComponent = function () {
)}
</div>
</div>

{!isUserLoading && userData?.plan !== 'FREE' && (
<div className='card card-bleed shadow-light-lg mb-6'>
<div className='card-header'>
Expand Down

0 comments on commit d804e15

Please sign in to comment.