JeremyDunn / php-fedex-api-wrapper

This library provides a fluid interface for constructing requests to the FedEx web service API.
269 stars 184 forks source link

Set Variable options #82

Closed biswajitpaul01 closed 5 years ago

biswajitpaul01 commented 6 years ago

I am trying to assign variable options in rate request object:

$rateRequest->setVariableOptions( ['SaturdayPickup' => true] );

But it gives me this error: Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Fault in /fedex-api/vendor/jeremy-dunn/php-fedex-api-wrapper/src/FedEx/RateService/Request.php:29 Stack trace: #0 /fedex-api/vendor/jeremy-dunn/php-fedex-api-wrapper/src/FedEx/RateService/Request.php(29): SoapClient->__call('getRates', Array) #1 /fedex-api/mjs.php(108): FedEx\RateService\Request->getGetRatesReply(Object(FedEx\RateService\ComplexType\RateRequest)) #2 {main} thrown in /fedex-api/vendor/jeremy-dunn/php-fedex-api-wrapper/src/FedEx/RateService/Request.php on line 29

Please help how to set special services from this source: http://freegento.com/doc/d0/d44/_fedex_8php-source.html Line 00297.

JeremyDunn commented 5 years ago

First of all "SaturdayPickup" is not a valid service option type. If you mean to use "SATURDAY_DELIVERY" you can set that using the examples below.

$rateRequest->setVariableOptions([FedEx\RateService\SimpleType\ServiceOptionType::_SATURDAY_DELIVERY]);

or

$rateRequest->VariableOptions = [SimpleType\ServiceOptionType::_SATURDAY_DELIVERY];

or

$rateRequest->VariableOptions = ['SATURDAY_DELIVERY'];