Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion rate method returns empty array for invalid address - no errors.

MIME-Version: 1.0
Received: by 10.150.117.26 with SMTP id p26mr929774ybc.30.1254861662998; Tue, 
	06 Oct 2009 13:41:02 -0700 (PDT)
Date: Tue, 6 Oct 2009 13:41:02 -0700 (PDT)
In-Reply-To: <e60a4aef-a5c9-4562-8039-a5609b27be53@d9g2000prh.googlegroups.com>
X-IP: 98.247.207.21
References: <29689c04-dea0-41c3-92a5-692e9ad0c411@g1g2000pra.googlegroups.com> 
	<e60a4aef-a5c9-4562-8039-a5609b27be53@d9g2000prh.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14) 
	Gecko/2009090217 Ubuntu/9.04 (jaunty) Firefox/3.0.14,gzip(gfe),gzip(gfe)
Message-ID: <d5621b32-4e62-44fb-b59c-7788965b52f1@s21g2000prm.googlegroups.com>
Subject: Re: rate method returns empty array for invalid address - no errors.
From: Alan <tala...@gmail.com>
To: Shippinglogic <shippinglogic@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Ok, I dug a little deeper and found some interesting findings. Btw, I
appreciate you taking up this library, I'm sure it will end up being
the defacto rails shipping gem once the kinks get worked out.

1. If a service type is specified, the code breaks.
2. If a service type is specified with reworked code, some address
validation errors are thrown(which is I why I was initially confused
as to why it wasn't happening). This doesn't happen if specific
service type is not provided.
3. Because of FedEx's limitations(#2), I'm going to locally tack on
address validation to shippinglogic. If I find that Address Validation
is either too much or otherwise not usable, I might make two calls to
FedEx, the first "fake" request to generate errors, and assuming there
are none, the second request being the standard request(ewww!)


1. Service Type Breaks code.
Unfortunately, the current code breaks if you specify a service type
(:service_type=3D>"FEDEX_GROUND"). The parse code assumes
rate_reply_details to be an array. If a service type is specified, it
actually returns a hash. Quick and dirty fix is below, where
get_rate_info calls your current parsing code.

	  if (response[:rate_reply_details].is_a?(Array))
		response[:rate_reply_details].collect do |details|
			get_rate_info(details)
		end
	    else
		return [].push(get_rate_info(response[:rate_reply_details]))
	    end
	end


2. Specifying a service type gets FedEx to return simple address
validation errors, Example:
{:highest_severity=3D>"ERROR", :notifications=3D>
{:code=3D>"836", :source=3D>"crs", :message=3D>"Destination Postal-State
Mismatch.", :localized_message=3D>"Destination Postal-State
Mismatch.", :severity=3D>"ERROR"}, :"xmlns:xsi"=3D>"http://www.w3.org/2001/
XMLSchema-instance", :version=3D>
{:minor=3D>"0", :service_id=3D>"crs", :intermediate=3D>"0", :major=3D>"6"},=
 :"xmlns:v6"=3D>"http://
fedex.com/ws/rate/v6"}

3. If you have any interest in adding address validation to shipping
logic, I can get shoot you over some code, if anything it will
probably help you save some keystrokes.


On Oct 4, 1:02=A0pm, Alan <tala...@gmail.com> wrote:
> Hi Ben, I'll dig further, but using the latest, an empty array is
> returned, and errors/exceptions are not raised and there doesn't seem
> to be a way to access the error using the API. I tried calling .errors
> and .valid? before and after making the rate request and they weren't
> populated. I have gotten Shippinglogic::FedEx::Error's raised for
> missing input, but nothing for the scenario above.
>
> I have seen the errors returned by FedEx for the scenario I've given
> (using a different FedEx lib) so I'm assuming this is a different
> error type that ShippingLogic is not inspecting. I'll try to post back
> after I have a chance to dig into it a bit more.
>
> On Oct 3, 2:36=A0pm, Alan <tala...@gmail.com> wrote:
>
> > If you pass in an invalid address, such as a zip and state not
> > matching, an empty array is returned, no errors are raised.. Having
> > worked with FedEx web services before, I know the service can return
> > errors for less obvious issues, so the lack of error message coming
> > through is problematic.
>