Skip to content

Commit

Permalink
Fixes error, validators are not defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
wjames111 committed Dec 9, 2024
1 parent 70864c2 commit cbf07d1
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,22 @@ class ExistingPaymentMethodsController {
waitForFormInitialization () {
const unregister = this.$scope.$watch('$ctrl.creditCardPaymentForm.securityCode', () => {
if (this.creditCardPaymentForm && this.creditCardPaymentForm.securityCode) {
this.switchPayment()
unregister()
this.addCvvValidators()
this.switchPayment()
}
})
}

addCvvValidators () {
this.$scope.$watch('$ctrl.creditCardPaymentForm.securityCode.$viewValue', (number) => {
this.creditCardPaymentForm.securityCode.$validators.minLength = cruPayments.creditCard.cvv.validate.minLength
this.creditCardPaymentForm.securityCode.$validators.maxLength = cruPayments.creditCard.cvv.validate.maxLength
if (this.selectedPaymentMethod?.['card-type']) {
this.creditCardPaymentForm.securityCode.$validators.minLength = cruPayments.creditCard.cvv.validate.minLength
this.creditCardPaymentForm.securityCode.$validators.maxLength = cruPayments.creditCard.cvv.validate.maxLength

this.enableContinue({ $event: cruPayments.creditCard.cvv.validate.minLength(number) && cruPayments.creditCard.cvv.validate.maxLength(number) })
this.selectedPaymentMethod.cvv = number
this.enableContinue({ $event: cruPayments.creditCard.cvv.validate.minLength(number) && cruPayments.creditCard.cvv.validate.maxLength(number) })
this.selectedPaymentMethod.cvv = number
}
})
}

Expand Down

0 comments on commit cbf07d1

Please sign in to comment.