|
|
@ -15,19 +15,6 @@ Multiple packages can be added to get additional rates.
|
|
|
|
All code (including tests) conform to the PSR-2 coding standards.
|
|
|
|
All code (including tests) conform to the PSR-2 coding standards.
|
|
|
|
The namespace and autoloader are using the PSR-4 standard.
|
|
|
|
The namespace and autoloader are using the PSR-4 standard.
|
|
|
|
|
|
|
|
|
|
|
|
All pull requests are processed by Travis CI to conform to PSR-2 and to verify all unit tests pass.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Add the following lines to your ``composer.json`` file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```JSON
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"require": {
|
|
|
|
|
|
|
|
"pdt256/shipping": "1.0.*"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Example
|
|
|
|
## Example
|
|
|
|
|
|
|
|
|
|
|
@ -56,7 +43,7 @@ $shipment->addPackage($package);
|
|
|
|
|
|
|
|
|
|
|
|
## UPS (Stub) Example
|
|
|
|
## UPS (Stub) Example
|
|
|
|
|
|
|
|
|
|
|
|
Below is an example request to get shipping rates from the UPS API.
|
|
|
|
Below is an example request to get shipping rates from the UPS API.
|
|
|
|
|
|
|
|
|
|
|
|
Notice: The below line uses a stub class to fake a response from the UPS API.
|
|
|
|
Notice: The below line uses a stub class to fake a response from the UPS API.
|
|
|
|
You can immediately use this method in your code until you get an account with UPS.
|
|
|
|
You can immediately use this method in your code until you get an account with UPS.
|
|
|
@ -93,7 +80,7 @@ Output array sorted by cost: (in cents)
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
```php
|
|
|
|
array (
|
|
|
|
array (
|
|
|
|
0 =>
|
|
|
|
0 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => '03',
|
|
|
|
'code' => '03',
|
|
|
|
'name' => 'UPS Ground',
|
|
|
|
'name' => 'UPS Ground',
|
|
|
@ -102,7 +89,7 @@ array (
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'carrier' => 'ups',
|
|
|
|
'carrier' => 'ups',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
1 =>
|
|
|
|
1 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => '02',
|
|
|
|
'code' => '02',
|
|
|
|
'name' => 'UPS 2nd Day Air',
|
|
|
|
'name' => 'UPS 2nd Day Air',
|
|
|
@ -111,7 +98,7 @@ array (
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'carrier' => 'ups',
|
|
|
|
'carrier' => 'ups',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
2 =>
|
|
|
|
2 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => '13',
|
|
|
|
'code' => '13',
|
|
|
|
'name' => 'UPS Next Day Air Saver',
|
|
|
|
'name' => 'UPS Next Day Air Saver',
|
|
|
@ -120,7 +107,7 @@ array (
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'carrier' => 'ups',
|
|
|
|
'carrier' => 'ups',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
3 =>
|
|
|
|
3 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => '01',
|
|
|
|
'code' => '01',
|
|
|
|
'name' => 'UPS Next Day Air',
|
|
|
|
'name' => 'UPS Next Day Air',
|
|
|
@ -157,7 +144,7 @@ Output array sorted by cost: (in cents)
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
```php
|
|
|
|
array (
|
|
|
|
array (
|
|
|
|
0 =>
|
|
|
|
0 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => '4',
|
|
|
|
'code' => '4',
|
|
|
|
'name' => 'Parcel Post',
|
|
|
|
'name' => 'Parcel Post',
|
|
|
@ -166,7 +153,7 @@ array (
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'carrier' => 'usps',
|
|
|
|
'carrier' => 'usps',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
1 =>
|
|
|
|
1 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => '1',
|
|
|
|
'code' => '1',
|
|
|
|
'name' => 'Priority Mail',
|
|
|
|
'name' => 'Priority Mail',
|
|
|
@ -209,7 +196,7 @@ Output array sorted by cost: (in cents)
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
```php
|
|
|
|
array (
|
|
|
|
array (
|
|
|
|
0 =>
|
|
|
|
0 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => 'GROUND_HOME_DELIVERY',
|
|
|
|
'code' => 'GROUND_HOME_DELIVERY',
|
|
|
|
'name' => 'Ground Home Delivery',
|
|
|
|
'name' => 'Ground Home Delivery',
|
|
|
@ -218,13 +205,13 @@ array (
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'deliveryEstimate' => NULL,
|
|
|
|
'carrier' => 'fedex',
|
|
|
|
'carrier' => 'fedex',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
1 =>
|
|
|
|
1 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => 'FEDEX_EXPRESS_SAVER',
|
|
|
|
'code' => 'FEDEX_EXPRESS_SAVER',
|
|
|
|
'name' => 'Fedex Express Saver',
|
|
|
|
'name' => 'Fedex Express Saver',
|
|
|
|
'cost' => 2989,
|
|
|
|
'cost' => 2989,
|
|
|
|
'transitTime' => NULL,
|
|
|
|
'transitTime' => NULL,
|
|
|
|
'deliveryEstimate' =>
|
|
|
|
'deliveryEstimate' =>
|
|
|
|
DateTime::__set_state(array(
|
|
|
|
DateTime::__set_state(array(
|
|
|
|
'date' => '2014-09-30 20:00:00',
|
|
|
|
'date' => '2014-09-30 20:00:00',
|
|
|
|
'timezone_type' => 3,
|
|
|
|
'timezone_type' => 3,
|
|
|
@ -232,13 +219,13 @@ array (
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
'carrier' => 'fedex',
|
|
|
|
'carrier' => 'fedex',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
2 =>
|
|
|
|
2 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => 'FEDEX_2_DAY',
|
|
|
|
'code' => 'FEDEX_2_DAY',
|
|
|
|
'name' => 'Fedex 2 Day',
|
|
|
|
'name' => 'Fedex 2 Day',
|
|
|
|
'cost' => 4072,
|
|
|
|
'cost' => 4072,
|
|
|
|
'transitTime' => NULL,
|
|
|
|
'transitTime' => NULL,
|
|
|
|
'deliveryEstimate' =>
|
|
|
|
'deliveryEstimate' =>
|
|
|
|
DateTime::__set_state(array(
|
|
|
|
DateTime::__set_state(array(
|
|
|
|
'date' => '2014-09-29 20:00:00',
|
|
|
|
'date' => '2014-09-29 20:00:00',
|
|
|
|
'timezone_type' => 3,
|
|
|
|
'timezone_type' => 3,
|
|
|
@ -246,13 +233,13 @@ array (
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
'carrier' => 'fedex',
|
|
|
|
'carrier' => 'fedex',
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
3 =>
|
|
|
|
3 =>
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
pdt256\Shipping\Quote::__set_state(array(
|
|
|
|
'code' => 'STANDARD_OVERNIGHT',
|
|
|
|
'code' => 'STANDARD_OVERNIGHT',
|
|
|
|
'name' => 'Standard Overnight',
|
|
|
|
'name' => 'Standard Overnight',
|
|
|
|
'cost' => 7834,
|
|
|
|
'cost' => 7834,
|
|
|
|
'transitTime' => NULL,
|
|
|
|
'transitTime' => NULL,
|
|
|
|
'deliveryEstimate' =>
|
|
|
|
'deliveryEstimate' =>
|
|
|
|
DateTime::__set_state(array(
|
|
|
|
DateTime::__set_state(array(
|
|
|
|
'date' => '2014-09-26 20:00:00',
|
|
|
|
'date' => '2014-09-26 20:00:00',
|
|
|
|
'timezone_type' => 3,
|
|
|
|
'timezone_type' => 3,
|
|
|
|