1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

[PM-17138][Defect] Submitting blank payment method is displaying unreadable validation message for Bank Account and Account Credit (#12937)

* Changes to display descriptive message for bank account

* resolve message for invalid message display

* Add the paymentMethodType credit

---------

Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
This commit is contained in:
cyprain-okeke
2025-01-17 18:32:29 +01:00
committed by GitHub
parent 3b4eb40990
commit ce2ec07f74
3 changed files with 27 additions and 10 deletions

View File

@@ -605,6 +605,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
submit = async () => { submit = async () => {
if (this.taxComponent && !this.taxComponent.validate()) { if (this.taxComponent && !this.taxComponent.validate()) {
this.taxComponent.markAllAsTouched();
return; return;
} }

View File

@@ -113,6 +113,8 @@ export class PaymentV2Component implements OnInit, OnDestroy {
const clientSecret = await this.billingApiService.createSetupIntent(type); const clientSecret = await this.billingApiService.createSetupIntent(type);
if (this.usingBankAccount) { if (this.usingBankAccount) {
this.formGroup.markAllAsTouched();
if (this.formGroup.valid) {
const token = await this.stripeService.setupBankAccountPaymentMethod(clientSecret, { const token = await this.stripeService.setupBankAccountPaymentMethod(clientSecret, {
accountHolderName: this.formGroup.value.bankInformation.accountHolderName, accountHolderName: this.formGroup.value.bankInformation.accountHolderName,
routingNumber: this.formGroup.value.bankInformation.routingNumber, routingNumber: this.formGroup.value.bankInformation.routingNumber,
@@ -123,6 +125,9 @@ export class PaymentV2Component implements OnInit, OnDestroy {
type, type,
token, token,
}; };
} else {
throw "Invalid input provided, Please ensure all required fields are filled out correctly and try again.";
}
} }
if (this.usingCard) { if (this.usingCard) {
@@ -142,6 +147,13 @@ export class PaymentV2Component implements OnInit, OnDestroy {
}; };
} }
if (this.usingAccountCredit) {
return {
type: PaymentMethodType.Credit,
token: null,
};
}
return null; return null;
} }

View File

@@ -72,6 +72,10 @@ export class ManageTaxInformationComponent implements OnInit, OnDestroy {
} }
} }
markAllAsTouched() {
this.formGroup.markAllAsTouched();
}
async ngOnInit() { async ngOnInit() {
if (this.startWith) { if (this.startWith) {
this.formGroup.controls.country.setValue(this.startWith.country); this.formGroup.controls.country.setValue(this.startWith.country);