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

Postal code validation does not work #714

Open
RostyslavKhasanov opened this issue May 14, 2024 · 1 comment
Open

Postal code validation does not work #714

RostyslavKhasanov opened this issue May 14, 2024 · 1 comment
Labels

Comments

@RostyslavKhasanov
Copy link

RostyslavKhasanov commented May 14, 2024

General information

  • SDK version: 3.102.0
  • Environment: Sandbox
  • Browser and OS Chrome 124.0.6367.118 on MacOS 14.4.1

Issue description

My question is similar to !425 issue.
I'm able to pass " " (whitespace characters) to the postal code and submit the form. It accepted by braintree-web. But when try to use generated nonce for sale transaction an error occurs on the server: "Addresses must have at least one field filled in".

Do you have any updates on validation for postal code ?

@jplukarski
Copy link
Contributor

Hey @RostyslavKhasanov Thanks for writing in!

It sounds like your issue is slightly different than the previous issue. Your issue is that the client-side is reporting an empty string as a valid postal code whereas when you submit this data to your server-side call our gateway reads it as an empty string, so reporting that it was submitted as empty

The reason for this is that postal codes differ across multiple countries, so the only validation we make on the postal code is to check if it is within the minimum and maximum lengths since, for example, in the UK, valid postal codes do have a whitespace in them. We have built this card-validator module for these checks and you can see that repo for more information on how this works within our SDK -> https://github.com/braintree/card-validator?tab=readme-ov-file#validpostalcodevalue-string-options-object-object

However, I do agree with you that it would be a good idea to report the postal code as invalid if the entire value is whitespace.

Since this is actually an issue with our card-validator module, I've opened the issue there -> braintree/card-validator#121

I'll also keep this issue open until we are able to get this prioritized.

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

No branches or pull requests

3 participants