Skip to content

Commit

Permalink
Merge pull request #172 from paynl/feature/PLUG-3276
Browse files Browse the repository at this point in the history
PLUG-3276 - Fix for instore method
  • Loading branch information
woutse authored Mar 27, 2024
2 parents fc8a36a + 8990113 commit ea9365b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Controller/Checkout/Finish.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ public function execute()
$pinStatus = $this->handlePin($information['terminal_hash'], $order);
if (!empty($pinStatus)) {
$bSuccess = true;
} else {
$bPending = false;
}
}

Expand Down
12 changes: 8 additions & 4 deletions Model/Paymentmethod/Instore.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,20 @@ public function startTransaction(Order $order, $fromAdmin = false)

$transaction = (new PayPaymentCreate($order, $this))->create();

$instorePayment = \Paynl\Instore::payment(['transactionId' => $transaction->getTransactionId(), 'terminalId' => $terminalId]);
if ($this->getPaymentOptionId() === 1927) {
$additionalData['terminal_hash'] = $transaction->getData()['terminal']['hash'];
$url = $transaction->getRedirectUrl();
} else {
$instorePayment = \Paynl\Instore::payment(['transactionId' => $transaction->getTransactionId(), 'terminalId' => $terminalId]);
$additionalData['terminal_hash'] = $instorePayment->getHash();
$url = $instorePayment->getRedirectUrl();
}

$additionalData['transactionId'] = $transaction->getTransactionId();
$additionalData['terminal_hash'] = $instorePayment->getHash();
$additionalData['payment_option'] = $terminalId;

$order->getPayment()->setAdditionalInformation($additionalData);
$order->save();

$url = $instorePayment->getRedirectUrl();
} catch (\Exception $e) {
$this->payHelper->logCritical($e->getMessage(), [], $store);

Expand Down
2 changes: 1 addition & 1 deletion Model/Paymentmethod/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public function startTransaction(Order $order)
*/
public function getPaymentOptionId()
{
$paymentOptionId = $this->getConfigData('payment_option_id');
$paymentOptionId = (int)$this->getConfigData('payment_option_id');

if (empty($paymentOptionId)) {
$paymentOptionId = $this->getDefaultPaymentOptionId();
Expand Down

0 comments on commit ea9365b

Please sign in to comment.