-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added functions to approve or decline a transaction that is being ver…
…ified
- Loading branch information
Andy Pieters
committed
Jun 27, 2016
1 parent
cfd0adb
commit 42c94af
Showing
5 changed files
with
192 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2015 Andy Pieters <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Paynl\Api\Transaction; | ||
|
||
use Paynl\Error; | ||
/** | ||
* Description of Approve | ||
* | ||
* @author Andy Pieters <[email protected]> | ||
*/ | ||
class Approve extends Transaction | ||
{ | ||
protected $apiTokenRequired = true; | ||
protected $serviceIdRequired = false; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $transactionId; | ||
|
||
/** | ||
* Get data to send to the api | ||
* | ||
* @return array | ||
* @throws Error\Required | ||
*/ | ||
protected function getData() { | ||
if(empty($this->transactionId)){ | ||
throw new Error\Required('TransactionId is niet geset'); | ||
} | ||
$this->data['orderId'] = $this->transactionId; | ||
return parent::getData(); | ||
} | ||
|
||
/** | ||
* Set the transactionId | ||
* | ||
* @param string $transactionId | ||
*/ | ||
public function setTransactionId($transactionId){ | ||
$this->transactionId = $transactionId; | ||
} | ||
|
||
/** | ||
* Do the request | ||
* | ||
* @param null $endpoint | ||
* @param null $version | ||
* @return array the result | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) { | ||
return parent::doRequest('transaction/approve'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2015 Andy Pieters <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Paynl\Api\Transaction; | ||
|
||
use Paynl\Error; | ||
/** | ||
* Description of Approve | ||
* | ||
* @author Andy Pieters <[email protected]> | ||
*/ | ||
class Decline extends Transaction | ||
{ | ||
protected $apiTokenRequired = true; | ||
protected $serviceIdRequired = false; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $transactionId; | ||
|
||
/** | ||
* Get data to send to the api | ||
* | ||
* @return array | ||
* @throws Error\Required | ||
*/ | ||
protected function getData() { | ||
if(empty($this->transactionId)){ | ||
throw new Error\Required('TransactionId is niet geset'); | ||
} | ||
$this->data['orderId'] = $this->transactionId; | ||
return parent::getData(); | ||
} | ||
|
||
/** | ||
* Set the transactionId | ||
* | ||
* @param string $transactionId | ||
*/ | ||
public function setTransactionId($transactionId){ | ||
$this->transactionId = $transactionId; | ||
} | ||
|
||
/** | ||
* Do the request | ||
* | ||
* @param null $endpoint | ||
* @param null $version | ||
* @return array the result | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) { | ||
return parent::doRequest('transaction/decline'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters