From d75c866b31281fb5e5ea472f9a541119baac3881 Mon Sep 17 00:00:00 2001 From: Jeffrey Zant Date: Fri, 19 Jul 2019 14:47:18 +0200 Subject: [PATCH] Adding secondsActive to REST --- src/Message/RestPurchaseRequest.php | 28 +++++++++++++++++++++++ tests/Message/RestPurchaseRequestTest.php | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/Message/RestPurchaseRequest.php b/src/Message/RestPurchaseRequest.php index 95c2f62..75ef86c 100644 --- a/src/Message/RestPurchaseRequest.php +++ b/src/Message/RestPurchaseRequest.php @@ -298,6 +298,33 @@ public function setDaysActive($value) return $this->setParameter('days_active', $value); } + /** + * Get seconds active. + * + * The number of seconds the payment link will be active for. + * When not specified the default will be 30 days (2592000 seconds). + * + * @return int|null + */ + public function getSecondsActive() + { + return $this->getParameter('seconds_active'); + } + + /** + * Set seconds active. + * + * The number of seconds the payment link will be active for. + * When not specified the default will be 30 days (2592000 seconds). + * + * @param $value + * @return \Omnipay\Common\Message\AbstractRequest + */ + public function setSecondsActive($value) + { + return $this->setParameter('seconds_active', $value); + } + /** * Get close window. * @@ -529,6 +556,7 @@ public function getData() 'amount' => $this->getAmountInteger(), 'currency' => $this->getCurrency(), 'days_active' => $this->getDaysActive(), + 'seconds_active' => $this->getSecondsActive(), 'description' => $this->getDescription(), 'gateway' => $this->getGateway(), 'google_analytics' => $this->getGoogleAnalyticsCode(), diff --git a/tests/Message/RestPurchaseRequestTest.php b/tests/Message/RestPurchaseRequestTest.php index 03f3d07..6ce11f4 100644 --- a/tests/Message/RestPurchaseRequestTest.php +++ b/tests/Message/RestPurchaseRequestTest.php @@ -27,6 +27,7 @@ protected function setUp() 'return_url' => 'http://localhost/return', 'close_window' => false, 'days_active' => 3, + 'seconds_active' => 100, 'send_mail' => true, 'gateway' => 'IDEAL', 'google_analytics_code' => '123456789', @@ -84,6 +85,7 @@ public function testDataIntegrity() $this->assertEquals('TEST-TRANS-1', $this->request->getTransactionId()); $this->assertEquals(10.00, $this->request->getAmount()); $this->assertEquals(3, $this->request->getDaysActive()); + $this->assertEquals(100, $this->request->getSecondsActive()); $this->assertFalse($this->request->getCloseWindow()); $this->assertFalse($this->request->getManual()); $this->assertTrue($this->request->getSendMail());