Skip to content

Commit

Permalink
Merge pull request #24 from andrewtweber/master
Browse files Browse the repository at this point in the history
Optional statement_descriptor parameter
  • Loading branch information
greydnls committed Nov 10, 2015
2 parents 72fe306 + 0381651 commit 54b816a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ public function setApplicationFee($value)
return $this->setParameter('applicationFee', $value);
}

public function getStatementDescriptor()
{
return $this->getParameter('statementDescriptor');
}

public function setStatementDescriptor($value)
{
$value = str_replace(array('<', '>', '"', '\''), '', $value);

return $this->setParameter('statementDescriptor', $value);
}

public function getData()
{
$this->validate('amount', 'currency');
Expand All @@ -143,6 +155,9 @@ public function getData()
$data['metadata'] = $this->getMetadata();
$data['capture'] = 'false';

if ($this->getStatementDescriptor()) {
$data['statement_descriptor'] = $this->getStatementDescriptor();
}
if ($this->getDestination()) {
$data['destination'] = $this->getDestination();
}
Expand Down
8 changes: 8 additions & 0 deletions tests/Message/AuthorizeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public function testDataWithCardReference()
$this->assertSame('xyz', $data['source']);
}

public function testDataWithStatementDescriptor()
{
$this->request->setStatementDescriptor('OMNIPAY');
$data = $this->request->getData();

$this->assertSame('OMNIPAY', $data['statement_descriptor']);
}

public function testDataWithToken()
{
$this->request->setToken('xyz');
Expand Down

0 comments on commit 54b816a

Please sign in to comment.