Skip to content

Commit

Permalink
Updated with TimeInTransit example
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandoorn committed May 21, 2015
1 parent 2dc2bee commit d43b607
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,43 @@ The TimeInTransit Class allow you to get all transit times using the UPS TimeInT
$timeInTransit = new Ups\TimeInTransit($access, $userid, $passwd);

try {
$times = $timeInTransit->getTimeInTransit($timeInTransitequest);
$request = new \Ups\Entity\TimeInTransitRequest;

// Addresses
$from = new \Ups\Entity\AddressArtifactFormat;
$from->setPoliticalDivision3('Amsterdam');
$from->setPostcodePrimaryLow('1000AA');
$from->setCountryCode('NL');
$request->setTransitFrom($from);

$to = new \Ups\Entity\AddressArtifactFormat;
$to->setPoliticalDivision3('Amsterdam');
$to->setPostcodePrimaryLow('1000AA');
$to->setCountryCode('NL');
$request->setTransitTo($to);

// Weight
$shipmentWeight = new \Ups\Entity\ShipmentWeight;
$shipmentWeight->setWeight($totalWeight);
$unit = new \Ups\Entity\UnitOfMeasurement;
$unit->setCode(\Ups\Entity\UnitOfMeasurement::UOM_KGS);
$shipmentWeight->setUnitOfMeasurement($unit);
$request->setShipmentWeight($shipmentWeight);

// Packages
$request->setTotalPackagesInShipment(2);

// InvoiceLines
$invoiceLineTotal = new \Ups\Entity\InvoiceLineTotal;
$invoiceLineTotal->setMonetaryValue(100.00);
$invoiceLineTotal->setCurrencyCode('EUR');
$request->setInvoiceLineTotal($invoiceLineTotal);

// Pickup date
$request->setPickupDate(new DateTime);

// Get data
$times = $timeInTransit->getTimeInTransit($request);

foreach($times->ServiceSummary as $serviceSummary) {
var_dump($serviceSummary);
Expand All @@ -208,7 +244,7 @@ try {
<a name="timeintransit-class-parameters"></a>
### Parameters

* `timeInTransitRequest` Mandatory. timeInTransitRequest Object with shipment details
* `timeInTransitRequest` Mandatory. timeInTransitRequest Object with shipment details, see example above.

<a name="shipping-class"></a>
## Shipping Class
Expand Down

0 comments on commit d43b607

Please sign in to comment.