-
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.
Transaction Get result will call the transaction status api automaticly when fields from this api are accessed
- Loading branch information
Andy Pieters
committed
Aug 1, 2018
1 parent
84c4f61
commit bef740c
Showing
4 changed files
with
217 additions
and
5 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,48 @@ | ||
<?php | ||
|
||
namespace Paynl\Api\Transaction; | ||
|
||
use Paynl\Error; | ||
|
||
class Status extends Transaction | ||
{ | ||
protected $apiTokenRequired = true; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $transactionId; | ||
|
||
/** | ||
* Set the transactionId | ||
* | ||
* @param string $transactionId | ||
*/ | ||
public function setTransactionId($transactionId) | ||
{ | ||
$this->transactionId = $transactionId; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) | ||
{ | ||
return parent::doRequest('transaction/status'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @throws Error\Required TransactionId is required | ||
*/ | ||
protected function getData() | ||
{ | ||
if (empty($this->transactionId)) { | ||
throw new Error\Required('TransactionId required'); | ||
} | ||
|
||
$this->data['transactionId'] = $this->transactionId; | ||
|
||
return parent::getData(); | ||
} | ||
} |
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 | ||
/** | ||
* Created by PhpStorm. | ||
* User: andy | ||
* Date: 1-8-18 | ||
* Time: 15:56 | ||
*/ | ||
|
||
namespace Paynl\Result\Transaction; | ||
|
||
|
||
use Paynl\Result\Result; | ||
|
||
class Status extends Result | ||
{ | ||
/** | ||
* @return string The EX-code of the transaction | ||
*/ | ||
public function getTransactionId() | ||
{ | ||
return $this->data['paymentDetails']['transactionId']; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOrderId() | ||
{ | ||
return $this->data['paymentDetails']['orderId']; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getPaymentProfileId() | ||
{ | ||
return $this->data['paymentDetails']['paymentProfileId']; | ||
} | ||
|
||
/** | ||
* @return int the status id | ||
*/ | ||
public function getState() | ||
{ | ||
return $this->data['paymentDetails']['state']; | ||
} | ||
|
||
/** | ||
* @return string The name of the status | ||
*/ | ||
public function getStateName() | ||
{ | ||
return $this->data['paymentDetails']['stateName']; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCurrency() | ||
{ | ||
return $this->data['paymentDetails']['currency']; | ||
} | ||
|
||
/** | ||
* @return float|int The amount in euro | ||
*/ | ||
public function getAmount() | ||
{ | ||
return $this->data['paymentDetails']['amount'] / 100; | ||
} | ||
|
||
/** | ||
* @return float|int The amount in the used currency | ||
*/ | ||
public function getCurrencyAmount() | ||
{ | ||
return $this->data['paymentDetails']['currenyAmount'] / 100; | ||
} | ||
|
||
/** | ||
* @return float|int The paid amount | ||
*/ | ||
public function getPaidAmount() | ||
{ | ||
return $this->data['paymentDetails']['paidAmount'] / 100; | ||
} | ||
|
||
/** | ||
* @return float|int The paid amount in the used currency | ||
*/ | ||
public function getPaidCurrencyAmount() | ||
{ | ||
return $this->data['paymentDetails']['paidCurrenyAmount'] / 100; | ||
} | ||
|
||
/** | ||
* @return float|int The amount that has been refunded | ||
*/ | ||
public function getRefundedAmount() | ||
{ | ||
return $this->data['paymentDetails']['refundAmount'] / 100; | ||
} | ||
|
||
/** | ||
* @return float|int The amount that has been refunded in the used currency | ||
*/ | ||
public function getRefundedCurrencyAmount() | ||
{ | ||
return $this->data['paymentDetails']['refundCurrenyAmount'] / 100; | ||
} | ||
|
||
|
||
} |
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