1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

Combined subscription and payment method pages in provider portal (#9828)

This commit is contained in:
Alex Morask
2024-06-26 09:08:25 -04:00
committed by GitHub
parent 93a57e6724
commit 679c25b082
9 changed files with 160 additions and 140 deletions

View File

@@ -1,29 +1,38 @@
import { SubscriptionSuspensionResponse } from "@bitwarden/common/billing/models/response/subscription-suspension.response";
import { TaxInfoResponse } from "@bitwarden/common/billing/models/response/tax-info.response";
import { BaseResponse } from "../../../models/response/base.response";
export class ProviderSubscriptionResponse extends BaseResponse {
status: string;
currentPeriodEndDate: Date;
currentPeriodEndDate: string;
discountPercentage?: number | null;
plans: ProviderPlanResponse[] = [];
collectionMethod: string;
unpaidPeriodEndDate?: string;
gracePeriod?: number | null;
suspensionDate?: string;
plans: ProviderPlanResponse[] = [];
accountCredit: number;
taxInformation?: TaxInfoResponse;
cancelAt?: string;
suspension?: SubscriptionSuspensionResponse;
constructor(response: any) {
super(response);
this.status = this.getResponseProperty("status");
this.currentPeriodEndDate = new Date(this.getResponseProperty("currentPeriodEndDate"));
this.currentPeriodEndDate = this.getResponseProperty("currentPeriodEndDate");
this.discountPercentage = this.getResponseProperty("discountPercentage");
this.collectionMethod = this.getResponseProperty("collectionMethod");
this.unpaidPeriodEndDate = this.getResponseProperty("unpaidPeriodEndDate");
this.gracePeriod = this.getResponseProperty("gracePeriod");
this.suspensionDate = this.getResponseProperty("suspensionDate");
this.cancelAt = this.getResponseProperty("cancelAt");
const plans = this.getResponseProperty("plans");
if (plans != null) {
this.plans = plans.map((i: any) => new ProviderPlanResponse(i));
this.plans = plans.map((plan: any) => new ProviderPlanResponse(plan));
}
this.accountCredit = this.getResponseProperty("accountCredit");
const taxInformation = this.getResponseProperty("taxInformation");
if (taxInformation != null) {
this.taxInformation = new TaxInfoResponse(taxInformation);
}
this.cancelAt = this.getResponseProperty("cancelAt");
const suspension = this.getResponseProperty("suspension");
if (suspension != null) {
this.suspension = new SubscriptionSuspensionResponse(suspension);
}
}
}

View File

@@ -0,0 +1,15 @@
import { BaseResponse } from "@bitwarden/common/models/response/base.response";
export class SubscriptionSuspensionResponse extends BaseResponse {
suspensionDate: string;
unpaidPeriodEndDate: string;
gracePeriod: number;
constructor(response: any) {
super(response);
this.suspensionDate = this.getResponseProperty("suspensionDate");
this.unpaidPeriodEndDate = this.getResponseProperty("unpaidPeriodEndDate");
this.gracePeriod = this.getResponseProperty("gracePeriod");
}
}