-
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.
Add function Confirm External Payment
- Loading branch information
1 parent
75e3dc6
commit f4ce283
Showing
3 changed files
with
230 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2018 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 Confirm External Payment | ||
* | ||
* @author Marcel Schoolenberg <[email protected]> | ||
*/ | ||
class ConfirmExternalPayment extends Transaction | ||
{ | ||
protected $apiTokenRequired = true; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $transactionId; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $customerId; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $customerName; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $paymentType; | ||
|
||
/** | ||
* Set the transactionId | ||
* | ||
* @param string $transactionId | ||
*/ | ||
public function setTransactionId($transactionId){ | ||
$this->transactionId = $transactionId; | ||
} | ||
|
||
/** | ||
* Set the customerId | ||
* | ||
* @param string $customerId | ||
*/ | ||
public function setCustomerId($customerId){ | ||
$this->customerId = $customerId; | ||
} | ||
|
||
/** | ||
* Set the customerName | ||
* | ||
* @param string $customerName | ||
*/ | ||
public function setCustomerName($customerName){ | ||
$this->customerName = $customerName; | ||
} | ||
|
||
/** | ||
* Set the paymentType | ||
* | ||
* @param string $paymentType | ||
*/ | ||
public function setPaymentType($paymentType){ | ||
$this->paymentType = $paymentType; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @throws Error\Required TransactionId is required | ||
*/ | ||
protected function getData() { | ||
if(empty($this->transactionId)){ | ||
throw new Error\Required('TransactionId required'); | ||
} | ||
|
||
if(empty($this->customerId)){ | ||
throw new Error\Required('CustomerId required'); | ||
} | ||
|
||
$this->data['transactionId'] = $this->transactionId; | ||
$this->data['customerId'] = $this->customerId; | ||
|
||
return parent::getData(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) { | ||
return parent::doRequest('transaction/confirmExternalPayment'); | ||
} | ||
} |
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,85 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2018 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\Result\Transaction; | ||
|
||
use Paynl\Result\Result; | ||
|
||
/** | ||
* Result class for a Confirm External Payment | ||
* | ||
* @author Marcel Schoolenberg <[email protected]> | ||
*/ | ||
class ConfirmExternalPayment extends Result | ||
{ | ||
/** | ||
* @return string The transactionId | ||
*/ | ||
public function getTransactionId() | ||
{ | ||
return $this->data['transactionId']; | ||
} | ||
|
||
/** | ||
* @return string The CustomerId | ||
*/ | ||
public function getCustomerId() | ||
{ | ||
return $this->data['customerId']; | ||
} | ||
|
||
/** | ||
* @return string The CustomerName | ||
*/ | ||
public function getCustomerName() | ||
{ | ||
return $this->data['customerName']; | ||
} | ||
|
||
/** | ||
* @return string The PaymentType | ||
*/ | ||
public function getPaymentType() | ||
{ | ||
return $this->data['paymentType']; | ||
} | ||
|
||
/** | ||
* @return boolean success | ||
*/ | ||
public function getSuccess() | ||
{ | ||
return (boolean) $this->data['result']; | ||
} | ||
|
||
/** | ||
* @return string errorMessage | ||
*/ | ||
public function getErrorMessage() | ||
{ | ||
return $this->data['errorMessage']; | ||
} | ||
|
||
/** | ||
* @return string errorId | ||
*/ | ||
public function getErrorId() | ||
{ | ||
return $this->data['errorId']; | ||
} | ||
} |
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