mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[PM-28173] Only send 1 seat in Families tax calculation (#17368)
* Fix family seat count in calculation * Fix test
This commit is contained in:
@@ -436,7 +436,7 @@ describe("UpgradePaymentService", () => {
|
|||||||
tier: "families",
|
tier: "families",
|
||||||
passwordManager: {
|
passwordManager: {
|
||||||
additionalStorage: 0,
|
additionalStorage: 0,
|
||||||
seats: 6,
|
seats: 1,
|
||||||
sponsored: false,
|
sponsored: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -98,22 +98,17 @@ export class UpgradePaymentService {
|
|||||||
planDetails: PlanDetails,
|
planDetails: PlanDetails,
|
||||||
billingAddress: BillingAddress,
|
billingAddress: BillingAddress,
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
try {
|
const isFamiliesPlan = planDetails.tier === PersonalSubscriptionPricingTierIds.Families;
|
||||||
const isOrganizationPlan = planDetails.tier === PersonalSubscriptionPricingTierIds.Families;
|
|
||||||
const isPremiumPlan = planDetails.tier === PersonalSubscriptionPricingTierIds.Premium;
|
const isPremiumPlan = planDetails.tier === PersonalSubscriptionPricingTierIds.Premium;
|
||||||
|
|
||||||
let taxClientCall: Promise<TaxAmounts> | null = null;
|
let taxClientCall: Promise<TaxAmounts> | null = null;
|
||||||
|
|
||||||
if (isOrganizationPlan) {
|
if (isFamiliesPlan) {
|
||||||
const seats = this.getPasswordManagerSeats(planDetails);
|
|
||||||
if (seats === 0) {
|
|
||||||
throw new Error("Seats must be greater than 0 for organization plan");
|
|
||||||
}
|
|
||||||
// Currently, only Families plan is supported for organization plans
|
// Currently, only Families plan is supported for organization plans
|
||||||
const request: OrganizationSubscriptionPurchase = {
|
const request: OrganizationSubscriptionPurchase = {
|
||||||
tier: "families",
|
tier: "families",
|
||||||
cadence: "annually",
|
cadence: "annually",
|
||||||
passwordManager: { seats, additionalStorage: 0, sponsored: false },
|
passwordManager: { seats: 1, additionalStorage: 0, sponsored: false },
|
||||||
};
|
};
|
||||||
|
|
||||||
taxClientCall = this.taxClient.previewTaxForOrganizationSubscriptionPurchase(
|
taxClientCall = this.taxClient.previewTaxForOrganizationSubscriptionPurchase(
|
||||||
@@ -130,9 +125,10 @@ export class UpgradePaymentService {
|
|||||||
throw new Error("Tax client call is not defined");
|
throw new Error("Tax client call is not defined");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const preview = await taxClientCall;
|
const preview = await taxClientCall;
|
||||||
return preview.tax;
|
return preview.tax;
|
||||||
} catch (error: unknown) {
|
} catch (error) {
|
||||||
this.logService.error("Tax calculation failed:", error);
|
this.logService.error("Tax calculation failed:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user