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

NZ account number wrong length error message #203

Open
tjbarker opened this issue Jul 26, 2021 · 0 comments
Open

NZ account number wrong length error message #203

tjbarker opened this issue Jul 26, 2021 · 0 comments

Comments

@tjbarker
Copy link

tjbarker commented Jul 26, 2021

I've been trying to return error messages to New Zealand bank account users when they provide an incorrect account/suffix number and it seems like the wording in the error message is unhelpful.

for a valid NZ IBAN everything seems fine

iban = Ibandit::IBAN.new('NZ ZZ 12 1234 1234567 123')
iban.valid? => true
iban.account_number => '1234567'
iban.account_number_suffix => '123'

but for an incorrect suffix number

iban = Ibandit::IBAN.new('NZ ZZ 12 1234 1234567 1')
iban.valid? => false
iban.account_number => '1234567'
iban.account_number_suffix => '1'
iban.errors => {:account_number=>"is the wrong length (should be 10 characters)"}

My confusion is that the account number in both cases is 7 digits, but the error is asking for a 10 digit account number.

It seems as though iban.account_number.length should be 10 or the error should be that account number needs to be 7 and suffix needs to be 3 digits.

I don't know if this is an issue and if it is I'm happy be the one who submits a solution, but I'm unsure what the desired functionality would be.

Thanks


versions:

  • ibandit: 1.6.0
  • ruby: 2.7.3
  • rails: 5.2.6

EDIT:

  • updated code block styles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant