Skip to content

Commit d792023

Browse files
committed
Add standard getCreateToken/setCreateToken request methods
1 parent 83552de commit d792023

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Common/Message/AbstractRequest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,27 @@ public function setCard($value)
204204
return $this->setParameter('card', $value);
205205
}
206206

207+
/**
208+
* Set whether you wish to generate and store a card token with this request.
209+
*
210+
* @param bool $value
211+
* @return $this
212+
*/
213+
public function setCreateToken($value)
214+
{
215+
return $this->setParameter('createToken', $value);
216+
}
217+
218+
/**
219+
* Get whether you wish to generate and store a card token with this request.
220+
*
221+
* @return bool
222+
*/
223+
public function getCreateToken()
224+
{
225+
return $this->getParameter('createToken');
226+
}
227+
207228
/**
208229
* Get the card token.
209230
*

tests/Common/Message/AbstractRequestTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ public function testSetCardWithArray()
7878
$this->assertSame('1234', $card->getNumber());
7979
}
8080

81+
public function testCreateToken()
82+
{
83+
$this->assertSame($this->request, $this->request->setCreateToken(true));
84+
$this->assertTrue($this->request->getCreateToken());
85+
}
86+
8187
public function testToken()
8288
{
8389
$this->assertSame($this->request, $this->request->setToken('12345'));

0 commit comments

Comments
 (0)