Tighten validation on fields we send to FedEx API #142

Open
mrpollo opened this Issue Jan 22, 2014 · 3 comments

Projects

None yet

3 participants

@mrpollo
mrpollo commented Jan 22, 2014

Currently we saw FedEx enforcing on it's API causing some breaking changes most notably #135 and #141 this got me all paranoid and opened up the FEDEX Developer guide from 2013 (it's the most recent version they have up on their site) and found page 611 (see attached screenshot )

Maximum Field Lengths - Page 611 from the FedEx developer guide 2013

Field Length Format
Commodity Description 70 Varchar
Declared Value 11.2 Numeric only (No commas, decimal points or "$"). Two decimal placed implied.
Dept/Notes 30 Varchar
Freight To Collect Amount 10.2 Numeric only (No commas, decimal points or "$"). Two decimal placed implied.
Height 3 Numeric
Length 3 Numeric
Recipient Address 1 35 Varchar
Recipient Address 2 35 Varchar
Recipient City 20 Varchar
Recipient Code 20 Varchar
Recipient Company Name 35 Varchar
Recipient Contact Name 35 Varchar
Recipient Phone 15 Varchar
Recipient State 2 Varchar
Recipient ZipCode 5 Varchar
Reference 30 Varchar
Sender Address 1 35 Varchar
Sender Address 2 35 Varchar
Sender City 20 Varchar
Sender Code 20 Varchar
Sender Company Name 35 Varchar
Sender Contact Name 35 Varchar
Sender Phone 15 Varchar
Sender State 2 Varchar
Sender ZipCode 5 Varchar
ShipDate 5 CCYYMMDD
Shipment Contents 70 Varchar
Total Weight 8.1 Numeric
Tracking Number 12 Numeric
Width 3 Numeric

recently 6b1eddc removed State from Sender and Recipient because we where affected by the 2 digit limit enforcement, StateOrProvince isn't really required for all countries so we might wan't to do a better check and not actually remove it altogether, and check on all of the other fields and validate?, is active_shipping validating data for the other carriers?

@maartenvg
Member

Yeah I agree removing State it should not be a permanent solution. It was meant as a quick fix and moving to better validation is definitely a great idea.

I'm not sure how comprehensive the validation of the other carriers is, but I suspect that it is not complete.

@jduff
Member
jduff commented Jan 22, 2014

If state is not actually needed for the rate requests I would prefer to just leave it out. Including it is just another piece of data that could potentially be bad. I would like to eliminate anything that isn't needed or affects the rates that are returned (most likely everything except country and postal code).

The is no point in submitting data that does not contribute to the rates being returned and maintain code that can potentially break.

@mrpollo
mrpollo commented Jan 23, 2014

I agree about the state not affecting, I get the feeling it should be considered to get rates, but maybe FedEx doesn't really care, regarding the rest of the fields I'll be submitting a PR only for the required fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment