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

Added ability to include Revision tag for AddressVerify requests #54

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}