From a8c9531825ddb5df557f965b590daf577a15be97 Mon Sep 17 00:00:00 2001 From: kGablo Date: Wed, 17 Jan 2024 14:47:33 +0100 Subject: [PATCH] Blik fix --- Controller/tpay/Create.php | 23 ++++++++++++----------- Model/ApiFacade/OpenApi.php | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Controller/tpay/Create.php b/Controller/tpay/Create.php index 9d2e992..4f24aad 100644 --- a/Controller/tpay/Create.php +++ b/Controller/tpay/Create.php @@ -32,12 +32,13 @@ class Create extends Action private $cache; public function __construct( - Context $context, - TpayInterface $tpayModel, - TpayService $tpayService, - Session $checkoutSession, + Context $context, + TpayInterface $tpayModel, + TpayService $tpayService, + Session $checkoutSession, CacheInterface $cache - ) { + ) + { $this->tpay = $tpayModel; $this->tpayService = $tpayService; $this->checkoutSession = $checkoutSession; @@ -69,14 +70,14 @@ public function execute(): ResponseInterface $this->handleOpenApiTrId($paymentData, $transaction); - $this->tpayService->addCommentToHistory($orderId, 'Transaction title '.$transaction['title']); + $this->tpayService->addCommentToHistory($orderId, 'Transaction title ' . $transaction['title']); $transactionUrl = $transaction['url']; if (true === $this->tpay->redirectToChannel()) { $transactionUrl = str_replace('gtitle', 'title', $transactionUrl); } - $this->tpayService->addCommentToHistory($orderId, 'Transaction link '.$transactionUrl); + $this->tpayService->addCommentToHistory($orderId, 'Transaction link ' . $transactionUrl); $paymentData['additional_information']['transaction_url'] = $transactionUrl; $payment->setData($paymentData)->save(); @@ -84,9 +85,9 @@ public function execute(): ResponseInterface if (true === $this->transaction->isOpenApiUse()) { if (isset($transaction['payments']['errors']) && count($transaction['payments']['errors']) > 0) { return $this->_redirect('magento2basic/tpay/error'); - } else { - return $this->_redirect('magento2basic/tpay/success'); } + + return $this->_redirect('magento2basic/tpay/success'); } $result = $this->blikPay($transaction['title'], $additionalPaymentInformation['blik_code']); $this->checkoutSession->unsQuoteId(); @@ -131,8 +132,8 @@ private function prepareTransaction($orderId, array $additionalPaymentInformatio $data['channel'] = null; $this->handleBlikData($data, $additionalPaymentInformation['blik_code']); } else { - $data['group'] = (int) ($additionalPaymentInformation['group'] ?? null); - $data['channel'] = (int) ($additionalPaymentInformation['channel'] ?? null); + $data['group'] = (int)($additionalPaymentInformation['group'] ?? null); + $data['channel'] = (int)($additionalPaymentInformation['channel'] ?? null); if ($this->tpay->redirectToChannel()) { $data['direct'] = 1; diff --git a/Model/ApiFacade/OpenApi.php b/Model/ApiFacade/OpenApi.php index eea6e68..fb12a15 100755 --- a/Model/ApiFacade/OpenApi.php +++ b/Model/ApiFacade/OpenApi.php @@ -85,7 +85,7 @@ private function handleDataStructure(array $data): array } if ($data['group']) { - $paymentData['pay']['groupId' ] = $data['group']; + $paymentData['pay']['groupId'] = $data['group']; } if ($data['channel']) {