|
|
|
@ -7,6 +7,7 @@ use pdt256\Shipping\Arr;
|
|
|
|
|
use pdt256\Shipping\Quote;
|
|
|
|
|
use pdt256\Shipping\RateAdapter;
|
|
|
|
|
use pdt256\Shipping\RateRequest;
|
|
|
|
|
use pdt256\Shipping\Validator;
|
|
|
|
|
use DOMDocument;
|
|
|
|
|
use Exception;
|
|
|
|
|
|
|
|
|
@ -15,10 +16,10 @@ class Rate extends RateAdapter
|
|
|
|
|
private $urlDev = 'https://gatewaybeta.fedex.com/web-services/';
|
|
|
|
|
private $urlProd = 'https://gateway.fedex.com/web-services/';
|
|
|
|
|
|
|
|
|
|
private $key = 'XXX';
|
|
|
|
|
private $password = 'XXX';
|
|
|
|
|
private $accountNumber = 'XXX';
|
|
|
|
|
private $meterNumber = 'XXX';
|
|
|
|
|
private $key;
|
|
|
|
|
private $password;
|
|
|
|
|
private $accountNumber;
|
|
|
|
|
private $meterNumber;
|
|
|
|
|
private $dropOffType = 'BUSINESS_SERVICE_CENTER';
|
|
|
|
|
|
|
|
|
|
public $approvedCodes = [
|
|
|
|
@ -66,7 +67,26 @@ class Rate extends RateAdapter
|
|
|
|
|
|
|
|
|
|
$this->setRequestAdapter(Arr::get($options, 'requestAdapter', new RateRequest\Post()));
|
|
|
|
|
}
|
|
|
|
|
protected function validate()
|
|
|
|
|
{
|
|
|
|
|
foreach ($this->shipment->getPackages() as $package) {
|
|
|
|
|
Validator::checkIfNull($package->getWeight(), 'weight');
|
|
|
|
|
Validator::checkIfNull($package->getLength(), 'length');
|
|
|
|
|
Validator::checkIfNull($package->getHeight(), 'height');
|
|
|
|
|
}
|
|
|
|
|
Validator::checkIfNull($this->key, 'key');
|
|
|
|
|
Validator::checkIfNull($this->password, 'password');
|
|
|
|
|
Validator::checkIfNull($this->accountNumber, 'accountNumber');
|
|
|
|
|
Validator::checkIfNull($this->meterNumber, 'meterNumber');
|
|
|
|
|
Validator::checkIfNull($this->shipment->getFromPostalCode(), 'fromPostalCode');
|
|
|
|
|
Validator::checkIfNull($this->shipment->getFromCountryCode(), 'fromCountryCode');
|
|
|
|
|
Validator::checkIfNull($this->shipment->getFromIsResidential(), 'fromIsResidential');
|
|
|
|
|
Validator::checkIfNull($this->shipment->getToPostalCode(), 'toPostalCode');
|
|
|
|
|
Validator::checkIfNull($this->shipment->getToCountryCode(), 'toCountryCode');
|
|
|
|
|
Validator::checkIfNull($this->shipment->getToIsResidential(), 'toIsResidential');
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
protected function prepare()
|
|
|
|
|
{
|
|
|
|
|
$date = time();
|
|
|
|
@ -103,7 +123,6 @@ class Rate extends RateAdapter
|
|
|
|
|
'</Dimensions>' .
|
|
|
|
|
'</RequestedPackageLineItems>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->data = '<?xml version="1.0"?>' .
|
|
|
|
|
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ' .
|
|
|
|
|
'xmlns="http://fedex.com/ws/rate/v13">' .
|
|
|
|
|