1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

[AC-1404] incorrect pricing shows for 2019 teams customers (#6462)

* Refactor seat count calculation in subscription adjust component

* Defaulting additionalSeatCount to 0 when falsy
This commit is contained in:
Conner Turnbull 2023-10-04 08:29:20 -04:00 committed by GitHub
parent 462daab322
commit c411e1f03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -14,7 +14,7 @@
required required
/> />
<small class="d-block text-muted mb-4"> <small class="d-block text-muted mb-4">
<strong>{{ "total" | i18n }}:</strong> {{ newSeatCount || 0 }} &times; <strong>{{ "total" | i18n }}:</strong> {{ additionalSeatCount || 0 }} &times;
{{ seatPrice | currency : "$" }} = {{ adjustedSeatTotal | currency : "$" }} / {{ seatPrice | currency : "$" }} = {{ adjustedSeatTotal | currency : "$" }} /
{{ interval | i18n }} {{ interval | i18n }}
</small> </small>
@ -50,7 +50,7 @@
[required]="limitSubscription" [required]="limitSubscription"
/> />
<small class="d-block text-muted"> <small class="d-block text-muted">
<strong>{{ "maxSeatCost" | i18n }}:</strong> {{ newMaxSeats || 0 }} &times; <strong>{{ "maxSeatCost" | i18n }}:</strong> {{ additionalMaxSeatCount || 0 }} &times;
{{ seatPrice | currency : "$" }} = {{ maxSeatTotal | currency : "$" }} / {{ seatPrice | currency : "$" }} = {{ maxSeatTotal | currency : "$" }} /
{{ interval | i18n }} {{ interval | i18n }}
</small> </small>

View File

@ -38,8 +38,10 @@ export class AdjustSubscription {
async submit() { async submit() {
try { try {
const seatAdjustment = this.newSeatCount - this.currentSeatCount; const request = new OrganizationSubscriptionUpdateRequest(
const request = new OrganizationSubscriptionUpdateRequest(seatAdjustment, this.newMaxSeats); this.additionalSeatCount,
this.newMaxSeats
);
this.formPromise = this.organizationApiService.updatePasswordManagerSeats( this.formPromise = this.organizationApiService.updatePasswordManagerSeats(
this.organizationId, this.organizationId,
request 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 { get adjustedSeatTotal(): number {
return this.newSeatCount * this.seatPrice; return this.additionalSeatCount * this.seatPrice;
} }
get maxSeatTotal(): number { get maxSeatTotal(): number {
return this.newMaxSeats * this.seatPrice; return this.additionalMaxSeatCount * this.seatPrice;
} }
} }