瀏覽代碼

Adds cancelled flag to subscriptions

main
Eric Amodio 1 年之前
父節點
當前提交
ff34ce8ff6
共有 2 個檔案被更改,包括 6 行新增1 行删除
  1. +2
    -0
      src/plus/subscription/subscriptionService.ts
  2. +4
    -1
      src/subscription.ts

+ 2
- 0
src/plus/subscription/subscriptionService.ts 查看文件

@ -645,6 +645,7 @@ export class SubscriptionService implements Disposable {
license.organizationId,
new Date(license.latestStartDate),
new Date(license.latestEndDate),
license.latestStatus === 'cancelled',
);
}
@ -676,6 +677,7 @@ export class SubscriptionService implements Disposable {
license.organizationId,
new Date(license.latestStartDate),
new Date(license.latestEndDate),
license.latestStatus === 'cancelled',
);
}

+ 4
- 1
src/subscription.ts 查看文件

@ -28,6 +28,7 @@ export interface SubscriptionPlan {
readonly id: SubscriptionPlanId;
readonly name: string;
readonly bundle: boolean;
readonly cancelled: boolean;
readonly startedOn: string;
readonly expiresOn?: string | undefined;
readonly organizationId: string | undefined;
@ -112,11 +113,13 @@ export function getSubscriptionPlan(
organizationId: string | undefined,
startedOn?: Date,
expiresOn?: Date,
cancelled: boolean = false,
): SubscriptionPlan {
return {
id: id,
name: getSubscriptionPlanName(id),
bundle: bundle,
cancelled: cancelled,
organizationId: organizationId,
startedOn: (startedOn ?? new Date()).toISOString(),
expiresOn: expiresOn != null ? expiresOn.toISOString() : undefined,
@ -149,7 +152,7 @@ const plansPriority = new Map([
]);
export function getSubscriptionPlanPriority(id: SubscriptionPlanId | undefined): number {
return plansPriority.get(id)!;
return plansPriority.get(id) ?? -1;
}
export function getSubscriptionTimeRemaining(

||||||
x
 
000:0
Loading…
取消
儲存