Skip to content

Commit 5ce19d3

Browse files
authored
Merge pull request #136 from tonywagner/master
support cancelled plans before their expiration date
2 parents bbc9323 + ce00f82 commit 5ce19d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

services/nfl-handler.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export type TOtherAuth = 'prime' | 'tve' | 'peacock' | 'sunday_ticket';
165165

166166
interface INFLJwt {
167167
dmaCode: string;
168-
plans: {plan: string; status: string}[];
168+
plans: {plan: string; status: string; expirationDate: string}[];
169169
networks?: {[key: string]: string};
170170
}
171171

@@ -508,7 +508,7 @@ class NflHandler {
508508

509509
if (plans) {
510510
const redZoneAccess =
511-
plans.findIndex(p => p.plan === 'NFL_PLUS_PREMIUM' && p.status === 'ACTIVE') > -1 || networks?.NFLRZ
511+
plans.findIndex(p => p.plan === 'NFL_PLUS_PREMIUM' && (p.status === 'ACTIVE' || (p.status === 'CANCELLED' && p.expirationDate >= (new Date()).toISOString().split('T')[0]))) > -1 || networks?.NFLRZ
512512
? true
513513
: false;
514514

@@ -558,7 +558,7 @@ class NflHandler {
558558

559559
if (plans) {
560560
hasPlus =
561-
plans.findIndex(p => (p.plan === 'NFL_PLUS' || p.plan === 'NFL_PLUS_PREMIUM') && p.status === 'ACTIVE') > -1
561+
plans.findIndex(p => (p.plan === 'NFL_PLUS' || p.plan === 'NFL_PLUS_PREMIUM') && (p.status === 'ACTIVE' || (p.status === 'CANCELLED' && p.expirationDate >= (new Date()).toISOString().split('T')[0]))) > -1
562562
? true
563563
: false;
564564
}

0 commit comments

Comments
 (0)