Skip to content

Commit dd3b0e8

Browse files
authored
Update readme.md
1 parent f8380ce commit dd3b0e8

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

readme.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,40 @@ Install with composer
3434
```php
3535
<?php
3636

37-
use RahulGodiyal\PhpUpsApiWrapper\AddressValidation;
37+
use RahulGodiyal\PhpUpsApiWrapper\Entity\ValidateAddressQuery;
38+
use RahulGodiyal\PhpUpsApiWrapper\ValidateAddress;
3839

3940
require_once('./vendor/autoload.php');
4041

41-
$client_id = "xxxxxxxxxxxxxxxx"; // UPS Client ID
42-
$client_secret = "xxxxxxxxxxxxxxx"; // UPS Client Secret
42+
$client_id = "******************************"; // UPS Client ID
43+
$client_secret = "*****************************************"; // UPS Client Secret
4344

44-
// Address to be validated
45-
$address = [
46-
"AddressLine" => [
47-
"785 GODDARD CT"
48-
],
49-
"PoliticalDivision2" => "ALPHARATTA",
50-
"PoliticalDivision1" => "CA",
51-
"PostcodePrimaryLow" => "30005",
52-
"CountryCode" => "US"
53-
];
45+
46+
/********* Query *********/
47+
$query = new ValidateAddressQuery(); // optional
48+
$query->setRegionalRequestIndicator("False"); // optional
49+
$query->setMaximumCandidateListSize("1"); //optional
50+
/********* End Query *********/
51+
52+
/******** Set Address ********/
53+
$validateAddress = new ValidateAddress();
54+
$validateAddress->setQuery($query); // optional
55+
$validateAddress->setAddressLines([
56+
"8001 S Orange Blossom Trl", // address line 1
57+
"SPACE K113iokio" // address line 2
58+
]);
59+
$validateAddress->setPoliticalDivision2("Orlando"); // City
60+
$validateAddress->setPoliticalDivision1("FL"); // State Code
61+
$validateAddress->setPostcodePrimaryLow("32809"); // Postal Code
62+
$validateAddress->setCountryCode("US");
63+
/******** End Set Address ********/
64+
65+
$validateAddress->setMode('PROD'); // optional
5466

5567
echo '<pre>';
56-
print_r(AddressValidation::setAddress($address)->validate($client_id, $client_secret)); // For Dev Api
57-
print_r(AddressValidation::setAddress($address)->setMode('PROD')->validate($client_id, $client_secret)); // For Prod Api
68+
print_r($validateAddress->validate($client_id, $client_secret));
5869
echo '</pre>';
5970
die();
60-
6171
```
6272

6373
<a name="create-shipment"></a>
@@ -269,20 +279,29 @@ echo '<pre>'; print_r($shipRes); echo '</pre>';
269279
```php
270280
<?php
271281

282+
use RahulGodiyal\PhpUpsApiWrapper\Entity\TrackingQuery;
272283
use RahulGodiyal\PhpUpsApiWrapper\Tracking;
273284

274285
require_once('./vendor/autoload.php');
275286

276-
$client_id = "xxxxxxxxxxxxxxxx"; // UPS Client ID
277-
$client_secret = "xxxxxxxxxxxxxxx"; // UPS Client Secret
287+
$client_id = "******************************"; // UPS Client ID
288+
$client_secret = "*****************************************"; // UPS Client Secret
278289

279-
$trackingRes = Tracking::setTrackingNumber("123456789")->fetch($client_id, $client_secret); // For Dev Api
280-
$trackingRes = Tracking::setTrackingNumber("123456789")->setMode('PROD')->fetch($client_id, $client_secret); // For PROD Api
290+
/********* Tracking Query *********/
291+
$query = new TrackingQuery(); // optional
292+
$query->setLocale("en_US"); // optional
293+
$query->setReturnSignature("false"); //optional
294+
$query->setReturnSignature("false"); //optional
295+
$query->setReturnSignature("false"); //optional
296+
/********* End Tracking Query *********/
281297

282-
echo '<pre>';
283-
print_r($trackingRes);
284-
echo '</pre>';
285-
die();
298+
$tracking = new Tracking();
299+
$trackingRes = $tracking
300+
->setQuery($query) // optional
301+
// ->setMode('PROD') // optional
302+
->setTrackingNumber("123456789")->fetch($client_id, $client_secret);
303+
304+
echo '<pre>'; print_r($trackingRes); echo '</pre>'; die();
286305
```
287306

288307
<a name="api-docs"></a>

0 commit comments

Comments
 (0)