From c411e1f03be53aa9a46926028543b8b2f6fdd01a Mon Sep 17 00:00:00 2001
From: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
Date: Wed, 4 Oct 2023 08:29:20 -0400
Subject: [PATCH] [AC-1404] incorrect pricing shows for 2019 teams customers
(#6462)
* Refactor seat count calculation in subscription adjust component
* Defaulting additionalSeatCount to 0 when falsy
---
.../adjust-subscription.component.html | 4 ++--
.../adjust-subscription.component.ts | 18 ++++++++++++++----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/apps/web/src/app/billing/organizations/adjust-subscription.component.html b/apps/web/src/app/billing/organizations/adjust-subscription.component.html
index 148d507a6a..6f0da67375 100644
--- a/apps/web/src/app/billing/organizations/adjust-subscription.component.html
+++ b/apps/web/src/app/billing/organizations/adjust-subscription.component.html
@@ -14,7 +14,7 @@
required
/>
- {{ "total" | i18n }}: {{ newSeatCount || 0 }} ×
+ {{ "total" | i18n }}: {{ additionalSeatCount || 0 }} ×
{{ seatPrice | currency : "$" }} = {{ adjustedSeatTotal | currency : "$" }} /
{{ interval | i18n }}
@@ -50,7 +50,7 @@
[required]="limitSubscription"
/>
- {{ "maxSeatCost" | i18n }}: {{ newMaxSeats || 0 }} ×
+ {{ "maxSeatCost" | i18n }}: {{ additionalMaxSeatCount || 0 }} ×
{{ seatPrice | currency : "$" }} = {{ maxSeatTotal | currency : "$" }} /
{{ interval | i18n }}
diff --git a/apps/web/src/app/billing/organizations/adjust-subscription.component.ts b/apps/web/src/app/billing/organizations/adjust-subscription.component.ts
index c82f30665d..a6f67e0138 100644
--- a/apps/web/src/app/billing/organizations/adjust-subscription.component.ts
+++ b/apps/web/src/app/billing/organizations/adjust-subscription.component.ts
@@ -38,8 +38,10 @@ export class AdjustSubscription {
async submit() {
try {
- const seatAdjustment = this.newSeatCount - this.currentSeatCount;
- const request = new OrganizationSubscriptionUpdateRequest(seatAdjustment, this.newMaxSeats);
+ const request = new OrganizationSubscriptionUpdateRequest(
+ this.additionalSeatCount,
+ this.newMaxSeats
+ );
this.formPromise = this.organizationApiService.updatePasswordManagerSeats(
this.organizationId,
request
@@ -64,11 +66,19 @@ export class AdjustSubscription {
}
}
+ get additionalSeatCount(): number {
+ return this.newSeatCount ? this.newSeatCount - this.currentSeatCount : 0;
+ }
+
+ get additionalMaxSeatCount(): number {
+ return this.newMaxSeats ? this.newMaxSeats - this.currentSeatCount : 0;
+ }
+
get adjustedSeatTotal(): number {
- return this.newSeatCount * this.seatPrice;
+ return this.additionalSeatCount * this.seatPrice;
}
get maxSeatTotal(): number {
- return this.newMaxSeats * this.seatPrice;
+ return this.additionalMaxSeatCount * this.seatPrice;
}
}