mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 13:23:34 +00:00
[PM-19180] Calculate sales tax correctly for sponsored plans (#14129)
* [PM-19180] Sponsored family org no sales tax because they're free * [PM-19180][DRAFT] Calculate sales tax correctly for sponsored plans with additional storage --------- Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
This commit is contained in:
@@ -43,6 +43,8 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
|
|||||||
value.plan = PlanType.FamiliesAnnually;
|
value.plan = PlanType.FamiliesAnnually;
|
||||||
value.productTier = ProductTierType.Families;
|
value.productTier = ProductTierType.Families;
|
||||||
value.acceptingSponsorship = true;
|
value.acceptingSponsorship = true;
|
||||||
|
value.planSponsorshipType = PlanSponsorshipType.FamiliesForEnterprise;
|
||||||
|
|
||||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
value.onSuccess.subscribe(this.onOrganizationCreateSuccess.bind(this));
|
value.onSuccess.subscribe(this.onOrganizationCreateSuccess.bind(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
|
|||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions";
|
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions";
|
||||||
import { TaxServiceAbstraction } from "@bitwarden/common/billing/abstractions/tax.service.abstraction";
|
import { TaxServiceAbstraction } from "@bitwarden/common/billing/abstractions/tax.service.abstraction";
|
||||||
import { PaymentMethodType, PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
|
import {
|
||||||
|
PaymentMethodType,
|
||||||
|
PlanSponsorshipType,
|
||||||
|
PlanType,
|
||||||
|
ProductTierType,
|
||||||
|
} from "@bitwarden/common/billing/enums";
|
||||||
import { TaxInformation } from "@bitwarden/common/billing/models/domain";
|
import { TaxInformation } from "@bitwarden/common/billing/models/domain";
|
||||||
import { ExpandedTaxInfoUpdateRequest } from "@bitwarden/common/billing/models/request/expanded-tax-info-update.request";
|
import { ExpandedTaxInfoUpdateRequest } from "@bitwarden/common/billing/models/request/expanded-tax-info-update.request";
|
||||||
import { PreviewOrganizationInvoiceRequest } from "@bitwarden/common/billing/models/request/preview-organization-invoice.request";
|
import { PreviewOrganizationInvoiceRequest } from "@bitwarden/common/billing/models/request/preview-organization-invoice.request";
|
||||||
@@ -83,6 +88,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
@Input() showFree = true;
|
@Input() showFree = true;
|
||||||
@Input() showCancel = false;
|
@Input() showCancel = false;
|
||||||
@Input() acceptingSponsorship = false;
|
@Input() acceptingSponsorship = false;
|
||||||
|
@Input() planSponsorshipType?: PlanSponsorshipType;
|
||||||
@Input() currentPlan: PlanResponse;
|
@Input() currentPlan: PlanResponse;
|
||||||
|
|
||||||
selectedFile: File;
|
selectedFile: File;
|
||||||
@@ -682,11 +688,6 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private refreshSalesTax(): void {
|
private refreshSalesTax(): void {
|
||||||
if (this.formGroup.controls.plan.value == PlanType.Free) {
|
|
||||||
this.estimatedTax = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.taxComponent.validate()) {
|
if (!this.taxComponent.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -696,6 +697,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
|||||||
passwordManager: {
|
passwordManager: {
|
||||||
additionalStorage: this.formGroup.controls.additionalStorage.value,
|
additionalStorage: this.formGroup.controls.additionalStorage.value,
|
||||||
plan: this.formGroup.controls.plan.value,
|
plan: this.formGroup.controls.plan.value,
|
||||||
|
sponsoredPlan: this.planSponsorshipType,
|
||||||
seats: this.formGroup.controls.additionalSeats.value,
|
seats: this.formGroup.controls.additionalSeats.value,
|
||||||
},
|
},
|
||||||
taxInformation: {
|
taxInformation: {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { PlanType } from "../../enums";
|
import { PlanSponsorshipType, PlanType } from "../../enums";
|
||||||
|
|
||||||
export class PreviewOrganizationInvoiceRequest {
|
export class PreviewOrganizationInvoiceRequest {
|
||||||
organizationId?: string;
|
organizationId?: string;
|
||||||
@@ -21,6 +21,7 @@ export class PreviewOrganizationInvoiceRequest {
|
|||||||
|
|
||||||
class PasswordManager {
|
class PasswordManager {
|
||||||
plan: PlanType;
|
plan: PlanType;
|
||||||
|
sponsoredPlan?: PlanSponsorshipType;
|
||||||
seats: number;
|
seats: number;
|
||||||
additionalStorage: number;
|
additionalStorage: number;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user