Skip to content

Commit

Permalink
Merge pull request #3 from BrianHenryIE/ExpectedDeliveryDate
Browse files Browse the repository at this point in the history
Add fields required for ExpectedDeliveryDate to be returned
  • Loading branch information
GeNyaa authored Apr 15, 2022
2 parents a20d994 + 06e33db commit a245bad
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion src/TrackConfirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ class TrackConfirm extends USPSBase
* @var string - the api version used for this type of call
*/
protected $apiVersion = 'TrackV2';
/**
* @var string - revision version for including additional response fields
*/
protected $revision = '';
/**
* @var string - User IP address. Required when TrackFieldRequest[Revision=’1’].
*/
protected $clientIp = '';
/**
* @var string - Internal User Identification. Required when TrackFieldRequest[Revision=’1’].
*/
protected $sourceId = '';
/**
* @var array - list of all packages added so far
*/
Expand Down Expand Up @@ -38,7 +50,12 @@ public function getTracking()
*/
public function getPostFields()
{
return $this->packages;
$postFields = array();
if ( !empty($this->revision) ) { $postFields['Revision'] = $this->revision; }
if ( !empty($this->revision) ) { $postFields['ClientIp'] = $this->clientIp; }
if ( !empty($this->revision) ) { $postFields['SourceId'] = $this->sourceId; }

return array_merge($postFields, $this->packages);
}

/**
Expand All @@ -52,4 +69,46 @@ public function addPackage($id)
{
$this->packages['TrackID'][] = ['@attributes' => ['ID' => $id]];
}

/**
* Set the revision value
*
* @param string|int $value
*
* @return object AddressVerify
*/
public function setRevision($value)
{
$this->revision = (string)$value;

return $this;
}

/**
* Set the ClientIp value
*
* @param string $value
*
* @return object AddressVerify
*/
public function setClientIp($value)
{
$this->clientIp = (string)$value;

return $this;
}

/**
* Set the SourceId value
*
* @param string $value
*
* @return object AddressVerify
*/
public function setSourceId($value)
{
$this->sourceId = (string)$value;

return $this;
}
}

0 comments on commit a245bad

Please sign in to comment.