Skip to content

Commit

Permalink
Updates for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse committed Nov 12, 2024
1 parent 2951b7a commit a24a337
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 39 deletions.
56 changes: 21 additions & 35 deletions samples/TransactionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$config = (new Config())->setUsername($_REQUEST['username'] ?? '')->setPassword($_REQUEST['password'] ?? '');

try {
$transaction = (new TransactionStatusRequest($orderId))->setConfig($config)->start();
$payOrder = (new TransactionStatusRequest($orderId))->setConfig($config)->start();
} catch (PayException $e) {
echo '<pre>';
echo 'Technical message: ' . $e->getMessage() . PHP_EOL;
Expand All @@ -27,37 +27,23 @@
echo '<pre>';
echo 'Success, values:' . PHP_EOL.PHP_EOL;

echo 'isPending: ' . ($transaction->isPending() ? 'YES' : 'no') . PHP_EOL;
echo 'isPaid: ' . ($transaction->isPaid() ? 'YES' : 'no') . PHP_EOL;
echo 'isAuthorized: ' . ($transaction->isAuthorized() ? 'YES' : 'no') . PHP_EOL;
echo 'isCancelled: ' . ($transaction->isCancelled() ? 'YES' : 'no') . PHP_EOL;
echo 'isBeingVerified: ' . ($transaction->isBeingVerified() ? 'YES' : 'no') . PHP_EOL;
echo 'isChargeBack: ' . ($transaction->isChargeBack() ? 'YES' : 'no') . PHP_EOL;
echo 'isPartialPayment: ' . ($transaction->isPartialPayment() ? 'YES' : 'no') . PHP_EOL;
echo 'isRefunded: ' . ($transaction->isRefunded() ? 'YES' : 'no') . PHP_EOL;
echo 'isPartiallyRefunded: ' . ($transaction->isPartiallyRefunded() ? 'YES' : 'no') . PHP_EOL . PHP_EOL;

echo 'getStatusCode: ' . $transaction->getStatusCode() . PHP_EOL;
echo 'getStatusName: ' . $transaction->getStatusName() . PHP_EOL;
echo 'getId: ' . $transaction->getId() . PHP_EOL;
echo 'getOrderId: ' . $transaction->getOrderId() . PHP_EOL;
echo 'getServiceCode: ' . $transaction->getServiceCode() . PHP_EOL;
echo 'getDescription: ' . $transaction->getDescription() . PHP_EOL;
echo 'getReference: ' . $transaction->getReference() . PHP_EOL;
echo 'getIpAddress: ' . $transaction->getIpAddress() . PHP_EOL.PHP_EOL;
echo 'getAmount: ' . $transaction->getAmount() . PHP_EOL;
echo 'getCurrency: ' . $transaction->getCurrency() . PHP_EOL;

echo 'getAmountConverted: ' . $transaction->getAmountConverted() . PHP_EOL;
echo 'getAmountConvertedCurrency: ' . $transaction->getAmountConvertedCurrency() . PHP_EOL;
echo 'getAmountPaid: ' . $transaction->getAmountPaid() . PHP_EOL;
echo 'getAmountPaidCurrency: ' . $transaction->getAmountPaidCurrency() . PHP_EOL;
echo 'getAmountRefunded: ' . $transaction->getAmountRefunded() . PHP_EOL;
echo 'getAmountRefundedCurrency: ' . $transaction->getAmountRefundedCurrency() . PHP_EOL.PHP_EOL;

echo 'paymentMethod: ' . $transaction->getPaymentMethod()['id'] . PHP_EOL;
echo 'getPaymentProfileId: ' . $transaction->getPaymentProfileId() . PHP_EOL;
echo 'integration: ' . ($transaction->getIntegration()['testMode'] === true ? '1' : 0) . PHP_EOL;
echo 'expiresAt: ' . $transaction->getExpiresAt() . PHP_EOL;
echo 'createdAt: ' . $transaction->getCreatedAt() . PHP_EOL;
print_r($transaction->getPaymentData());
echo 'isPending: ' . ($payOrder->isPending() ? 'YES' : 'no') . PHP_EOL;
echo 'isPaid: ' . ($payOrder->isPaid() ? 'YES' : 'no') . PHP_EOL;
echo 'isAuthorized: ' . ($payOrder->isAuthorized() ? 'YES' : 'no') . PHP_EOL;
echo 'isCancelled: ' . ($payOrder->isCancelled() ? 'YES' : 'no') . PHP_EOL;
echo 'isBeingVerified: ' . ($payOrder->isBeingVerified() ? 'YES' : 'no') . PHP_EOL;
echo 'isChargeBack: ' . ($payOrder->isChargeBack() ? 'YES' : 'no') . PHP_EOL;
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 'getStatusCode: ' . $payOrder->getStatusCode() . PHP_EOL;
echo 'getStatusName: ' . $payOrder->getStatusName() . PHP_EOL;
echo 'getId: ' . $payOrder->getId() . PHP_EOL;
echo 'getOrderId: ' . $payOrder->getOrderId() . PHP_EOL;
echo 'getDescription: ' . $payOrder->getDescription() . PHP_EOL;
echo 'getReference: ' . $payOrder->getReference() . PHP_EOL;
echo 'getAmount: ' . $payOrder->getAmount() . PHP_EOL;
echo 'getCurrency: ' . $payOrder->getCurrency() . PHP_EOL;
echo 'integration: ' . ($payOrder->getIntegration()['testMode'] === true ? '1' : 0) . PHP_EOL;
echo 'expiresAt: ' . $payOrder->getExpiresAt() . PHP_EOL;
echo 'createdAt: ' . $payOrder->getCreatedAt() . PHP_EOL;
2 changes: 1 addition & 1 deletion src/Mapper/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getMap(): array
'DeclineTransaction' => 'Transaction',
'TokenizeTransaction' => 'Transaction',
'TransactionRefund' => 'TransactionRefundResponse',
'TransactionStatus' => 'TransactionStatusResponse',
'TransactionStatus' => 'PayOrder',
'OrderCreate' => 'PayOrder',
'OrderCapture' => 'PayOrder',
'OrderVoid' => 'PayOrder',
Expand Down
6 changes: 3 additions & 3 deletions src/Model/Request/TransactionStatusRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PayNL\Sdk\Exception\PayException;
use PayNL\Sdk\Request\RequestData;
use PayNL\Sdk\Model\Response\TransactionStatusResponse;
use PayNL\Sdk\Model\Pay\PayOrder;
use PayNL\Sdk\Request\RequestInterface;

/**
Expand Down Expand Up @@ -41,10 +41,10 @@ public function getBodyParameters(): array
}

/**
* @return TransactionStatusResponse
* @return PayOrder
* @throws PayException
*/
public function start(): TransactionStatusResponse
public function start(): PayOrder
{
# Always use rest.pay.nl for this status request
$this->config->setCore('https://rest.pay.nl');
Expand Down

0 comments on commit a24a337

Please sign in to comment.