Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
Added ability to include Revision tag for AddressVerify requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmauzyk committed Oct 27, 2020
1 parent 5787470 commit 3788784
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/AddressVerify.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class AddressVerify extends USPSBase
* @var string - the api version used for this type of call
*/
protected $apiVersion = 'Verify';
/**
* @var string - revision version for including additional response fields
*/
protected $revision = '';
/**
* @var array - list of all addresses added so far
*/
Expand All @@ -38,7 +42,8 @@ public function verify()
*/
public function getPostFields()
{
return $this->addresses;
$postFields = !empty($this->revision) ? ['Revision' => $this->revision] : [];
return array_merge($postFields, $this->addresses);
}

/**
Expand All @@ -53,4 +58,18 @@ public function addAddress(Address $data, $id = null)

$this->addresses['Address'][] = array_merge(['@attributes' => ['ID' => $packageId]], $data->getAddressInfo());
}

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

return $this;
}
}

0 comments on commit 3788784

Please sign in to comment.