mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Added changes for downgradenbug (#15045)
This commit is contained in:
@@ -239,13 +239,15 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
.organizations$(userId)
|
||||
.pipe(getOrganizationById(this.organizationId)),
|
||||
);
|
||||
try {
|
||||
const { accountCredit, paymentSource } =
|
||||
await this.billingApiService.getOrganizationPaymentMethod(this.organizationId);
|
||||
this.accountCredit = accountCredit;
|
||||
this.paymentSource = paymentSource;
|
||||
} catch (error) {
|
||||
this.billingNotificationService.handleError(error);
|
||||
if (this.sub?.subscription?.status !== "canceled") {
|
||||
try {
|
||||
const { accountCredit, paymentSource } =
|
||||
await this.billingApiService.getOrganizationPaymentMethod(this.organizationId);
|
||||
this.accountCredit = accountCredit;
|
||||
this.paymentSource = paymentSource;
|
||||
} catch (error) {
|
||||
this.billingNotificationService.handleError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,8 +319,9 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
resolveHeaderName(subscription: OrganizationSubscriptionResponse): string {
|
||||
if (subscription.subscription != null) {
|
||||
this.isSubscriptionCanceled = subscription.subscription.cancelled;
|
||||
if (subscription.subscription.cancelled) {
|
||||
this.isSubscriptionCanceled =
|
||||
subscription.subscription.cancelled && this.sub?.plan.productTier !== ProductTierType.Free;
|
||||
if (this.isSubscriptionCanceled) {
|
||||
return this.i18nService.t("restartSubscription");
|
||||
}
|
||||
}
|
||||
@@ -767,7 +770,12 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
const doSubmit = async (): Promise<string> => {
|
||||
let orgId: string = null;
|
||||
if (this.sub?.subscription?.status === "canceled") {
|
||||
const sub = this.sub?.subscription;
|
||||
const isCanceled = sub?.status === "canceled";
|
||||
const isCancelledDowngradedToFreeOrg =
|
||||
sub?.cancelled && this.organization.productTierType === ProductTierType.Free;
|
||||
|
||||
if (isCanceled || isCancelledDowngradedToFreeOrg) {
|
||||
await this.restartSubscription();
|
||||
orgId = this.organizationId;
|
||||
} else {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<app-subscription-status
|
||||
[organizationSubscriptionResponse]="sub"
|
||||
(reinstatementRequested)="reinstate()"
|
||||
*ngIf="!userOrg.isFreeOrg"
|
||||
></app-subscription-status>
|
||||
<ng-container *ngIf="userOrg.canEditSubscription">
|
||||
<div class="tw-flex-col">
|
||||
@@ -25,7 +26,7 @@
|
||||
>
|
||||
<bit-table>
|
||||
<ng-template body>
|
||||
<ng-container *ngIf="subscription">
|
||||
<ng-container *ngIf="subscription && !userOrg.isFreeOrg">
|
||||
<tr bitRow *ngFor="let i of subscriptionLineItems">
|
||||
<td
|
||||
bitCell
|
||||
|
||||
@@ -496,9 +496,10 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||
|
||||
get showChangePlanButton() {
|
||||
return (
|
||||
!this.showChangePlan &&
|
||||
this.sub.plan.productTier !== ProductTierType.Enterprise &&
|
||||
!this.sub.subscription?.cancelled
|
||||
(!this.showChangePlan &&
|
||||
this.sub.plan.productTier !== ProductTierType.Enterprise &&
|
||||
!this.sub.subscription?.cancelled) ||
|
||||
(this.sub.subscription?.cancelled && this.sub.plan.productTier === ProductTierType.Free)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user