Don't invoke ManageTaxInformationComponent when CB is disabled (#9614)

This commit is contained in:
Alex Morask 2024-06-12 17:10:20 -04:00 committed by GitHub
parent 4d27824064
commit 7c16410c86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -119,9 +119,15 @@ export class SetupComponent implements OnInit, OnDestroy {
submit = async () => {
try {
const consolidatedBillingEnabled = await firstValueFrom(this.enableConsolidatedBilling$);
this.formGroup.markAllAsTouched();
const taxInformationValid = this.manageTaxInformationComponent.touch();
if (this.formGroup.invalid || !taxInformationValid) {
const formIsValid = consolidatedBillingEnabled
? this.formGroup.valid && this.manageTaxInformationComponent.touch()
: this.formGroup.valid;
if (!formIsValid) {
return;
}
@ -134,9 +140,7 @@ export class SetupComponent implements OnInit, OnDestroy {
request.token = this.token;
request.key = key;
const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$);
if (enableConsolidatedBilling) {
if (consolidatedBillingEnabled) {
request.taxInfo = new ExpandedTaxInfoUpdateRequest();
const taxInformation = this.manageTaxInformationComponent.getTaxInformation();