From 0b1a1d3a69ab5883b77fc80623cbf2aa7342abef Mon Sep 17 00:00:00 2001 From: Leith Caldwell Date: Wed, 6 Aug 2025 22:14:30 +1200 Subject: [PATCH] Add standard getCreateToken/setCreateToken request methods --- src/Common/Message/AbstractRequest.php | 21 ++++++++++++++++++++ tests/Common/Message/AbstractRequestTest.php | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/src/Common/Message/AbstractRequest.php b/src/Common/Message/AbstractRequest.php index 004a7757..1fb87e72 100644 --- a/src/Common/Message/AbstractRequest.php +++ b/src/Common/Message/AbstractRequest.php @@ -204,6 +204,27 @@ public function setCard($value) return $this->setParameter('card', $value); } + /** + * Set whether you wish to generate and store a card token with this request. + * + * @param bool $value + * @return $this + */ + public function setCreateToken($value) + { + return $this->setParameter('createToken', $value); + } + + /** + * Get whether you wish to generate and store a card token with this request. + * + * @return bool + */ + public function getCreateToken() + { + return $this->getParameter('createToken'); + } + /** * Get the card token. * diff --git a/tests/Common/Message/AbstractRequestTest.php b/tests/Common/Message/AbstractRequestTest.php index 8f196e34..eee1b97c 100644 --- a/tests/Common/Message/AbstractRequestTest.php +++ b/tests/Common/Message/AbstractRequestTest.php @@ -78,6 +78,12 @@ public function testSetCardWithArray() $this->assertSame('1234', $card->getNumber()); } + public function testCreateToken() + { + $this->assertSame($this->request, $this->request->setCreateToken(true)); + $this->assertTrue($this->request->getCreateToken()); + } + public function testToken() { $this->assertSame($this->request, $this->request->setToken('12345'));