UPS icon indicating copy to clipboard operation
UPS copied to clipboard

Function build_location() incorrectly process destination set as an array

Open KoulSlou opened this issue 9 years ago • 0 comments

Class Ups_Live_Rates has functions for setting destination and origin. These 2 functions are based on the build_location() method. You can pass just zipcode string (for US) or more detailed address in array format.

For zipcode function will return array with 1 element address:

'address' => array( 'state' => FL, 'postal_code' => 32548, 'country_code' => US )

And this array will be correctly transformed to XML for calling UPS API.

But when you pass array to build_location function, address details are not enclosed in 'address' element. Let's say I pass this array to build_location

array( 'state' => OK, 'postal_code' => 33010, 'country_code' => US )

I expect to get

'address' => array( 'state' => OK, 'postal_code' => 33010, 'country_code' => US )

but I get just

array( 'state' => OK, 'postal_code' => 33010, 'country_code' => US )

And it causes error in calling API -"No packages added"

KoulSlou avatar Apr 15 '15 03:04 KoulSlou