1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

Fix input errors on provider setup (#14799)

This commit is contained in:
Alex Morask
2025-05-16 14:47:42 -04:00
committed by GitHub
parent b4b452f5d1
commit d2cce5b997
4 changed files with 33 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ import { first, takeUntil } from "rxjs/operators";
import { ManageTaxInformationComponent } from "@bitwarden/angular/billing/components";
import { ProviderApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/provider/provider-api.service.abstraction";
import { ProviderSetupRequest } from "@bitwarden/common/admin-console/models/request/provider/provider-setup.request";
import { PaymentMethodType } from "@bitwarden/common/billing/enums";
import { ExpandedTaxInfoUpdateRequest } from "@bitwarden/common/billing/models/request/expanded-tax-info-update.request";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
@@ -118,7 +119,10 @@ export class SetupComponent implements OnInit, OnDestroy {
try {
this.formGroup.markAllAsTouched();
if (!this.taxInformationComponent.validate() || !this.formGroup.valid) {
const paymentValid = this.paymentComponent.validate();
const taxInformationValid = this.taxInformationComponent.validate();
if (!paymentValid || !taxInformationValid || !this.formGroup.valid) {
return;
}
@@ -162,8 +166,20 @@ export class SetupComponent implements OnInit, OnDestroy {
await this.router.navigate(["/providers", provider.id]);
} catch (e) {
e.message = this.i18nService.translate(e.message) || e.message;
this.validationService.showError(e);
if (
this.paymentComponent.selected === PaymentMethodType.PayPal &&
typeof e === "string" &&
e === "No payment method is available."
) {
this.toastService.showToast({
variant: "error",
title: null,
message: this.i18nService.t("clickPayWithPayPal"),
});
} else {
e.message = this.i18nService.translate(e.message) || e.message;
this.validationService.showError(e);
}
}
};
}