From d43b60701ba8ac9e06bda5d40fb375c6c9ad5599 Mon Sep 17 00:00:00 2001 From: Stefan Doorn Date: Thu, 21 May 2015 23:24:08 +0200 Subject: [PATCH] Updated with TimeInTransit example --- README.md | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c8b9fe9..a6584a4b 100644 --- a/README.md +++ b/README.md @@ -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); @@ -208,7 +244,7 @@ try { ### Parameters - * `timeInTransitRequest` Mandatory. timeInTransitRequest Object with shipment details + * `timeInTransitRequest` Mandatory. timeInTransitRequest Object with shipment details, see example above. ## Shipping Class