[mobile][web] Ignore cancelled subscriptions while computing past-due status
This commit is contained in:
parent
a15e9b0c9a
commit
1020366c3a
2 changed files with 7 additions and 1 deletions
|
@ -30,8 +30,13 @@ class Subscription {
|
|||
return expiryTime > DateTime.now().microsecondsSinceEpoch;
|
||||
}
|
||||
|
||||
bool isCancelled() {
|
||||
return attributes?.isCancelled ?? false;
|
||||
}
|
||||
|
||||
bool isPastDue() {
|
||||
return expiryTime < DateTime.now().microsecondsSinceEpoch &&
|
||||
return !isCancelled() &&
|
||||
expiryTime < DateTime.now().microsecondsSinceEpoch &&
|
||||
expiryTime >=
|
||||
DateTime.now()
|
||||
.subtract(const Duration(days: 30))
|
||||
|
|
|
@ -155,6 +155,7 @@ export function hasExceededStorageQuota(userDetails: UserDetails) {
|
|||
export function isSubscriptionPastDue(subscription: Subscription) {
|
||||
const currentTime = Date.now() * 1000;
|
||||
return (
|
||||
!isSubscriptionCancelled(subscription) &&
|
||||
subscription.expiryTime < currentTime &&
|
||||
subscription.expiryTime > currentTime - THIRTY_DAYS_IN_MICROSECONDS
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue