[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
/>
<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 : "$" }} /
{{ interval | i18n }}
</small>
@ -50,7 +50,7 @@
[required]="limitSubscription"
/>
<small class="d-block text-muted">
<strong>{{ "maxSeatCost" | i18n }}:</strong> {{ newMaxSeats || 0 }} &times;
<strong>{{ "maxSeatCost" | i18n }}:</strong> {{ additionalMaxSeatCount || 0 }} &times;
{{ seatPrice | currency : "$" }} = {{ maxSeatTotal | currency : "$" }} /
{{ interval | i18n }}
</small>

View File

@ -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;
}
}