Skip to content

Commit 54b816a

Browse files
committed
Merge pull request #24 from andrewtweber/master
Optional statement_descriptor parameter
2 parents 72fe306 + 0381651 commit 54b816a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Message/AuthorizeRequest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ public function setApplicationFee($value)
131131
return $this->setParameter('applicationFee', $value);
132132
}
133133

134+
public function getStatementDescriptor()
135+
{
136+
return $this->getParameter('statementDescriptor');
137+
}
138+
139+
public function setStatementDescriptor($value)
140+
{
141+
$value = str_replace(array('<', '>', '"', '\''), '', $value);
142+
143+
return $this->setParameter('statementDescriptor', $value);
144+
}
145+
134146
public function getData()
135147
{
136148
$this->validate('amount', 'currency');
@@ -143,6 +155,9 @@ public function getData()
143155
$data['metadata'] = $this->getMetadata();
144156
$data['capture'] = 'false';
145157

158+
if ($this->getStatementDescriptor()) {
159+
$data['statement_descriptor'] = $this->getStatementDescriptor();
160+
}
146161
if ($this->getDestination()) {
147162
$data['destination'] = $this->getDestination();
148163
}

tests/Message/AuthorizeRequestTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ public function testDataWithCardReference()
5555
$this->assertSame('xyz', $data['source']);
5656
}
5757

58+
public function testDataWithStatementDescriptor()
59+
{
60+
$this->request->setStatementDescriptor('OMNIPAY');
61+
$data = $this->request->getData();
62+
63+
$this->assertSame('OMNIPAY', $data['statement_descriptor']);
64+
}
65+
5866
public function testDataWithToken()
5967
{
6068
$this->request->setToken('xyz');

0 commit comments

Comments
 (0)