Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-15402] Remove TaxInfoComponent from trial-initiation.module.ts #12996

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { SecretsManagerTrialFreeStepperComponent } from "../../auth/trial-initiation/secrets-manager/secrets-manager-trial-free-stepper.component";
import { SecretsManagerTrialPaidStepperComponent } from "../../auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component";
import { SecretsManagerTrialComponent } from "../../auth/trial-initiation/secrets-manager/secrets-manager-trial.component";
import { PaymentComponent, TaxInfoComponent } from "../../billing";
import { PaymentComponent } from "../../billing";

Check warning on line 13 in apps/web/src/app/auth/trial-initiation/trial-initiation.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/trial-initiation/trial-initiation.module.ts#L13

Added line #L13 was not covered by tests
import { TrialBillingStepComponent } from "../../billing/accounts/trial-initiation/trial-billing-step.component";
import { EnvironmentSelectorModule } from "../../components/environment-selector/environment-selector.module";
import { SharedModule } from "../../shared";
Expand Down Expand Up @@ -52,7 +52,6 @@
OrganizationCreateModule,
EnvironmentSelectorModule,
PaymentComponent,
TaxInfoComponent,
TrialBillingStepComponent,
InputPasswordComponent,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ <h2 class="tw-mb-3 tw-text-base tw-font-semibold">{{ "paymentType" | i18n }}</h2
*ngIf="deprecateStripeSourcesAPI"
[showAccountCredit]="false"
></app-payment-v2>
<app-tax-info [trialFlow]="true" (countryChanged)="changedCountry()"></app-tax-info>
<app-manage-tax-information
(taxInformationChanged)="changedCountry()"
></app-manage-tax-information>
</div>
<div class="tw-flex tw-space-x-2">
<button type="submit" buttonType="primary" bitButton [loading]="form.loading">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms";

import { ManageTaxInformationComponent } from "@bitwarden/angular/billing/components";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import {
BillingInformation,
Expand All @@ -19,7 +20,7 @@
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { ToastService } from "@bitwarden/components";

import { BillingSharedModule, PaymentComponent, TaxInfoComponent } from "../../shared";
import { BillingSharedModule, PaymentComponent } from "../../shared";
import { PaymentV2Component } from "../../shared/payment/payment-v2.component";

export type TrialOrganizationType = Exclude<ProductTierType, ProductTierType.Free>;
Expand Down Expand Up @@ -54,7 +55,7 @@
export class TrialBillingStepComponent implements OnInit {
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
@ViewChild(PaymentV2Component) paymentV2Component: PaymentV2Component;
@ViewChild(TaxInfoComponent) taxInfoComponent: TaxInfoComponent;
@ViewChild(ManageTaxInformationComponent) taxInfoComponent: ManageTaxInformationComponent;
@Input() organizationInfo: OrganizationInfo;
@Input() subscriptionProduct: SubscriptionProduct = SubscriptionProduct.PasswordManager;
@Output() steppedBack = new EventEmitter();
Expand Down Expand Up @@ -98,8 +99,7 @@
}

async submit(): Promise<void> {
if (!this.taxInfoComponent.taxFormGroup.valid && this.taxInfoComponent?.taxFormGroup.touched) {
this.taxInfoComponent.taxFormGroup.markAllAsTouched();
if (!this.taxInfoComponent.validate()) {
return;
}

Expand All @@ -125,15 +125,16 @@

protected changedCountry() {
if (this.deprecateStripeSourcesAPI) {
this.paymentV2Component.showBankAccount = this.taxInfoComponent.country === "US";
this.paymentV2Component.showBankAccount =

Check warning on line 128 in apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts#L128

Added line #L128 was not covered by tests
this.taxInfoComponent.getTaxInformation().country === "US";
if (
!this.paymentV2Component.showBankAccount &&
this.paymentV2Component.selected === PaymentMethodType.BankAccount
) {
this.paymentV2Component.select(PaymentMethodType.Card);
}
} else {
this.paymentComponent.hideBank = this.taxInfoComponent.taxFormGroup.value.country !== "US";
this.paymentComponent.hideBank = this.taxInfoComponent.getTaxInformation().country !== "US";

Check warning on line 137 in apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/accounts/trial-initiation/trial-billing-step.component.ts#L137

Added line #L137 was not covered by tests
if (
this.paymentComponent.hideBank &&
this.paymentComponent.method === PaymentMethodType.BankAccount
Expand Down Expand Up @@ -236,13 +237,13 @@

private getBillingInformationFromTaxInfoComponent(): BillingInformation {
return {
postalCode: this.taxInfoComponent.taxFormGroup?.value.postalCode,
country: this.taxInfoComponent.taxFormGroup?.value.country,
taxId: this.taxInfoComponent.taxFormGroup?.value.taxId,
addressLine1: this.taxInfoComponent.taxFormGroup?.value.line1,
addressLine2: this.taxInfoComponent.taxFormGroup?.value.line2,
city: this.taxInfoComponent.taxFormGroup?.value.city,
state: this.taxInfoComponent.taxFormGroup?.value.state,
postalCode: this.taxInfoComponent.getTaxInformation()?.postalCode,
country: this.taxInfoComponent.getTaxInformation()?.country,
taxId: this.taxInfoComponent.getTaxInformation()?.taxId,
addressLine1: this.taxInfoComponent.getTaxInformation()?.line1,
addressLine2: this.taxInfoComponent.getTaxInformation()?.line2,
city: this.taxInfoComponent.getTaxInformation()?.city,
state: this.taxInfoComponent.getTaxInformation()?.state,
};
}

Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/app/billing/shared/tax-info.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"

import { SharedModule } from "../../shared";

/**
* @deprecated Use `ManageTaxInformationComponent` instead.
*/
@Component({
selector: "app-tax-info",
templateUrl: "tax-info.component.html",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { SearchModule } from "@bitwarden/components";
import { DangerZoneComponent } from "@bitwarden/web-vault/app/auth/settings/account/danger-zone.component";
import { OrganizationPlansComponent, TaxInfoComponent } from "@bitwarden/web-vault/app/billing";
import { OrganizationPlansComponent } from "@bitwarden/web-vault/app/billing";

Check warning on line 9 in bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/admin-console/providers/providers.module.ts#L9

Added line #L9 was not covered by tests
import { OssModule } from "@bitwarden/web-vault/app/oss.module";

import {
Expand Down Expand Up @@ -46,7 +46,6 @@
OrganizationPlansComponent,
SearchModule,
ProvidersLayoutComponent,
TaxInfoComponent,
DangerZoneComponent,
ScrollingModule,
],
Expand Down
Loading