php - Array structure to specify Fedex One Rate using Fedex API RateService -
i've got working request rates shipment using standard fedex rates, want use special fedex 1 rate option can flat rate quotes.
unfortunately, code example doesn't show how specify rate request should use fedex 1 rate , i've been unable mentally parse through xml vomit wsdl. i've tried several different array structures pass (what assume) right variables, nothing works.
i generated 2 html versions of wsdl using 3rd party generators (neither incredibly helpful, maybe can read them better i).
the first includes wsdl directly data types linked definitions: http://inadaydevelopment.com/stackoverflow/fedex/rateservice_v16.html
the second more basic, provides hierarchy in more linear fashion valid values @ each level: http://inadaydevelopment.com/stackoverflow/fedex/rateservice_v16_other.html
as far can tell, there 2 ways/places can declare want rate quote use 1 rate:
1) $request['variableoptions'] = 'fedex_one_rate';
and
2) $request['requestedshipment']['specialservicesrequested'] = array( 'specialservicetypes' => array('fedex_one_rate') );
when use (1), success response includes list of prices, aren't 1 rate prices. standard prices.
when use (2), fail response:
stdclass object ( [highestseverity] => warning [notifications] => stdclass object ( [severity] => warning [source] => crs [code] => 556 [message] => there no valid services available. [localizedmessage] => there no valid services available. ) [transactiondetail] => stdclass object ( [customertransactionid] => *** service availability request v5.1 using php *** ) [version] => stdclass object ( [serviceid] => crs [major] => 16 [intermediate] => 0 [minor] => 0 ) )
if use both (1) , (2), (2) error message additional warning saying specified 1 rate in 2 different ways , (2) going override (1).
here full request array:
array ( 'webauthenticationdetail' => array ( 'usercredential' => array ( 'key' => 'xxx', 'password' => 'xxx', ), ), 'clientdetail' => array ( 'accountnumber' => 'xxx', 'meternumber' => 'xxx', ), 'transactiondetail' => array ( 'customertransactionid' => ' *** service availability request v5.1 using php ***', ), 'version' => array ( 'serviceid' => 'crs', 'major' => '16', 'intermediate' => '0', 'minor' => '0', ), 'returntransitandcommit' => true, 'requestedshipment' => array ( 'dropofftype' => 'station', 'shiptimestamp' => '2015-06-14t14:13:46-07:00', 'shipper' => array ( 'contact' => array ( 'personname' => 'kenny wyland', 'companyname' => 'k2 cashflow', 'phonenumber' => 'xxxxxxxxxx', ), 'address' => array ( 'streetlines' => array ( 0 => 'xxxx e xxxxx st', ), 'city' => 'long beach', 'stateorprovincecode' => 'ca', 'postalcode' => '90805', 'countrycode' => 'us', ), ), 'recipient' => array ( 'contact' => array ( 'personname' => 'bob smith', 'phonenumber' => 'xxx-xxx-xxxx', ), 'address' => array ( 'streetlines' => array ( 0 => 'xxxxx xxxxxxx rd', ), 'city' => 'corona', 'stateorprovincecode' => 'ca', 'postalcode' => '92883', 'countrycode' => 'us', 'residential' => true, ), ), 'shippingchargespayment' => array ( 'paymenttype' => 'sender', 'payor' => array ( 'responsibleparty' => array ( 'accountnumber' => 'xxxx', 'contact' => null, 'address' => array ( 'countrycode' => 'us', ), ), ), ), 'packagecount' => '1', 'requestedpackagelineitems' => array ( 0 => array ( 'sequencenumber' => 1, 'grouppackagecount' => 1, 'weight' => array ( 'value' => 0.01, 'units' => 'lb', ), ), ), 'specialservicesrequested' => array ( 'specialservicetypes' => array ( 0 => 'fedex_one_rate', ), ), ), )
the document https://www.fedex.com/templates/components/apps/wpor/secure/downloads/pdf/201408/rateserviceswsdlguide_v2014.pdf, point 2.4.4 states there several requirements 1 rate pricing:
- specify "fedex_one_rate" shipmentspecialservice.
which have (the 1 use specified in fedex freight priority , fedex freight economy, point 2.2.4.1).
the next requirement:
- specify 1 of following packaging types:
fedex_small_box
....
in code should be:
$request['requestedshipment']['packagingtype'] = 'fedex_small_box';
after comes 3rd requirement:
- specify u.s. origin , u.s. destination.
which have in code.
and 4th requirement:
- specify 1 of following fedex express services:
first_overnight
...
which in code:
$request['requestedshipment']['servicetype'] = 'first_overnight';
also, pay attention note @ end:
*note: web services clients can request both 1 rate , weight-based (non-one rate) rates in single raterequest specifying "fedex_one_rate" serviceoptiontype in raterequest.variableoptions.
Comments
Post a Comment