Validating postal code


We had some code for attempting to take any old string and convert it to a formatted postcode (so we can be permissive with the input when looking up latitude and longitude from a postcode) so that was the first stop.

We've released a new gem for all your postal code formatting and validation needs.

If the zip check has failed, it's because the bank is telling the payment processor that the zip code does not match the one it has on file.

If the cardholder has recently moved, it may take their bank a while to have the correct zip code on file for them.

Armed with this new found knowledge and more, I opened up my editor and started coding.

With a number of Ruby projects, ranging from Rails and Sinatra apps, to quick and dirty scripts, something flexible would be the most useful.

They are in the format A1A 1A1, where A is a letter and 1 is a digit, with a space separating the third and fourth characters.

You must have an account to comment. Please register or login here!