forked from VinceG/USPS-php-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
USPSTrackConfirm.php
45 lines (42 loc) · 1011 Bytes
/
USPSTrackConfirm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Load required classes
*/
require_once('USPSBase.php');
/**
*/
class USPSTrackConfirm extends USPSBase {
/**
* @var string - the api version used for this type of call
*/
protected $apiVersion = 'TrackV2';
/**
* @var array - list of all packages added so far
*/
protected $packages = array();
public function getEndpoint() {
return self::$testMode ? 'http://production.shippingapis.com/ShippingAPITest.dll': 'http://production.shippingapis.com/ShippingAPI.dll';
}
/**
* Perform the API call
* @return string
*/
public function getTracking() {
return $this->doRequest();
}
/**
* returns array of all packages added so far
* @return array
*/
public function getPostFields() {
return $this->packages;
}
/**
* Add Package to the stack
* @param string $id the address unique id
* @return void
*/
public function addPackage($id) {
$this->packages['TrackID'][] = array('@attributes' => array('ID' => $id));
}
}