wp-e-commerce / WP-e-Commerce

WP eCommerce - The most popular independent eCommerce platform for WordPress
https://wpecommerce.org
GNU General Public License v2.0
213 stars 216 forks source link

ZIP+4 usps calculation broken #1361

Open PxT opened 10 years ago

PxT commented 10 years ago

Not sure if it's something specific to my setup, but when a customer enters a ZIP+4 code in the shipping calculator it doesn't return an accurate quote, instead they just get back a zero.

Wordpress 3.9.1, wp-e-commerce 3.8.14

ReactorShop commented 10 years ago

USPS only requires a 5 digit ZIP code to provide rates. If you are sending more than 5 digits, this may be causing the situation described.

PxT commented 10 years ago

Can't control what a customer enters into the checkout so if the backend requires only 5 digits then the front-end should enforce it or strip the extra characters before sending.

mihaijoldis commented 10 years ago

we should consider 3`rd party gateways too, for example in romania postal codes have 6 digits

JeffPyeBrook commented 10 years ago

I disagree with @PxT, the back-end can't blow it's brains out on bad user input, the new shipping component needs to support some type of parameter validation and error handling. Postal codes are a great example of something that should have validation by region.

PxT commented 10 years ago

By "back-end" I meant USPS. If their servers go crazy when you send zip+4 (unconfirmed, but that's the behavior I am seeing) then wpec should take care to only send 5 digits.

Romania isn't really relevant to this specific bug but could be part of a larger region validation idea.