Skip to content

Commit 0eaba7b

Browse files
authored
Merge pull request #40 from VladReshet/master
New example
2 parents f667f48 + 34bc9ff commit 0eaba7b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

examples/track-by-id.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
require_once 'credentials.php';
4+
require_once 'bootstrap.php';
5+
6+
use FedEx\TrackService,
7+
FedEx\TrackService\ComplexType,
8+
FedEx\TrackService\SimpleType;
9+
10+
$trackingId = 123456789012;
11+
12+
$userCredential = new ComplexType\WebAuthenticationCredential();
13+
$userCredential->setKey(FEDEX_KEY)
14+
->setPassword(FEDEX_PASSWORD);
15+
16+
$webAuthenticationDetail = new ComplexType\WebAuthenticationDetail();
17+
$webAuthenticationDetail->setUserCredential($userCredential);
18+
19+
$clientDetail = new ComplexType\ClientDetail();
20+
$clientDetail->setAccountNumber(FEDEX_ACCOUNT_NUMBER)
21+
->setMeterNumber(FEDEX_METER_NUMBER);
22+
23+
$version = new ComplexType\VersionId();
24+
$version->setMajor(5)
25+
->setIntermediate(0)
26+
->setMinor(0)
27+
->setServiceId('trck');
28+
29+
$identifier = new ComplexType\TrackPackageIdentifier();
30+
$identifier->setType(SimpleType\TrackIdentifierType::_TRACKING_NUMBER_OR_DOORTAG)
31+
->setValue($trackingId);
32+
33+
$request = new ComplexType\TrackRequest();
34+
$request->setWebAuthenticationDetail($webAuthenticationDetail)
35+
->setClientDetail($clientDetail)
36+
->setVersion($version)
37+
->setPackageIdentifier($identifier);
38+
39+
$response = (new TrackService\Request())->getTrackReply($request);
40+
41+
var_dump($response);
42+

0 commit comments

Comments
 (0)