Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/OrderCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$request->setDescription('Order ABC0123456789');
$request->setAmount((float)($_REQUEST['amount'] ?? 5.3));
$request->setCurrency('EUR');
$request->setExpire(date('Y-m-d H:i:s', strtotime('+1 DAY')));
$request->setExpire(date('c', time() + 60));
$request->setReturnurl($_REQUEST['returnUrl'] ?? 'https://yourdomain/finish.php');
$request->setExchangeUrl($_REQUEST['exchangeUrl'] ?? 'https://yourdomain/exchange.php');
$request->setPaymentMethodId((int)($_REQUEST['paymentMethodId'] ?? 10));
Expand Down
1 change: 1 addition & 0 deletions samples/OrderStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
echo 'isRefunded: ' . ($payOrder->isRefunded() ? 'YES' : 'no') . PHP_EOL;
echo 'isPartiallyRefunded: ' . ($payOrder->isRefundedPartial() ? 'YES' : 'no') . PHP_EOL . PHP_EOL;
echo 'isFastcheckout: ' . ($payOrder->isFastcheckout() ? 'YES' : 'no') . PHP_EOL;
echo 'getAmountRefunded: ' . ($payOrder->getAmountRefunded()) . PHP_EOL . PHP_EOL;
echo 'getStatusCode: ' . $payOrder->getStatusCode() . PHP_EOL;
echo 'getStatusName: ' . $payOrder->getStatusName() . PHP_EOL;
echo 'getId: ' . $payOrder->getId() . PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion samples/ServiceGetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
$terminals = $config->getTerminals();
print_r($terminals);

$tguList = $config->getTguList();
$tguList = $config->getCores();
print_r($tguList);

$paymentMethods = $config->getPaymentMethods();
Expand Down
2 changes: 2 additions & 0 deletions samples/TransactionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
echo 'isPartialPayment: ' . ($payOrder->isPartialPayment() ? 'YES' : 'no') . PHP_EOL;
echo 'isRefunded: ' . ($payOrder->isRefunded() ? 'YES' : 'no') . PHP_EOL;
echo 'isPartiallyRefunded: ' . ($payOrder->isRefundedPartial() ? 'YES' : 'no') . PHP_EOL . PHP_EOL;
echo 'getAmount: ' . ($payOrder->getAmount()) . PHP_EOL;
echo 'getAmountRefunded: ' . ($payOrder->getAmountRefunded()) . PHP_EOL . PHP_EOL;
echo 'getStatusCode: ' . $payOrder->getStatusCode() . PHP_EOL;
echo 'getStatusName: ' . $payOrder->getStatusName() . PHP_EOL;
echo 'getId: ' . $payOrder->getId() . PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function setOptions(array $options): self
*/
public function getSettings(): array
{
return $this->settings;
return $this->settings ?? [];
}

/**
Expand Down
26 changes: 26 additions & 0 deletions src/Model/Pay/PayOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class PayOrder implements ModelInterface
*/
protected $completedAt;

/**
* @var Amount
*/
protected $amountRefunded;

/**
* @var array
*/
Expand All @@ -153,6 +158,27 @@ public function __construct($payload = null)
}
}

/**
* @return mixed
*/
public function getAmountRefunded()
{
if (!empty($this->amountRefunded) && $this->amountRefunded instanceof Amount) {
return $this->amountRefunded->getValue() / 100;
}
return null;
}

/**
* @param $amountRefunded
* @return $this
*/
public function setAmountRefunded($amountRefunded): self
{
$this->amountRefunded = $amountRefunded;
return $this;
}

/**
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Response/ServiceGetConfigResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function setCategory(array $category): void
*/
public function getTguList(): array
{
return $this->tguList;
return $this->tguList ?? [];
}

/**
Expand Down
5 changes: 2 additions & 3 deletions src/Util/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace PayNL\Sdk\Util;

use PayNL\Sdk\Config\Config as PayConfig;
use PayNL\Sdk\Config\Config;
use PayNL\Sdk\Model\Amount;
use PayNL\Sdk\Model\Request\OrderStatusRequest;
Expand Down Expand Up @@ -201,11 +200,11 @@ public function getPayLoad()
/**
* Process the exchange request.
*
* @param Config|null $config
* @param Config |null $config
* @return PayOrder
* @throws Exception
*/
public function process(PayConfig $config = null): PayOrder
public function process(Config $config = null): PayOrder
{
$payload = $this->getPayload();

Expand Down