Skip to content

Commit

Permalink
invalid form key problem - solved
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetselim committed Nov 20, 2019
1 parent 9e039c9 commit 19e2938
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
38 changes: 16 additions & 22 deletions Controller/Response/IyzicoCheckoutForm.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
<?php
/**
* iyzico Payment Gateway For Magento 2
* Copyright (C) 2018 iyzico
*
* This file is part of Iyzico/Iyzipay.
*
* Iyzico/Iyzipay is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Iyzico\Iyzipay\Controller\Response;

Expand All @@ -27,10 +8,13 @@
use Iyzico\Iyzipay\Controller\IyzicoBase\IyzicoRequest;
use Magento\Checkout\Model\Type\Onepage;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\Request\InvalidRequestException;

class IyzicoCheckoutForm extends \Magento\Framework\App\Action\Action
class IyzicoCheckoutForm extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
{

protected $_context;
protected $_pageFactory;
protected $_jsonEncoder;
Expand All @@ -50,6 +34,16 @@ class IyzicoCheckoutForm extends \Magento\Framework\App\Action\Action
protected $_storeManager;
protected $_helper;

public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
{
return null;
}

public function validateForCsrf(RequestInterface $request): ?bool
{
return true;
}

public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Json\EncoderInterface $encoder,
Expand Down Expand Up @@ -91,7 +85,7 @@ public function __construct(
}

public function execute()
{
{

$postData = $this->getRequest()->getPostValue();
$resultRedirect = $this->_resultRedirect->create(ResultFactory::TYPE_REDIRECT);
Expand Down
Empty file modified LICENSE
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions Observer/DataAssignObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ public function execute(Observer $observer)
$order->setSubTotalInclTax($iyzicoSubTotal);
$order->setGrandTotal($iyzicoGrandTotal);
$order->setBaseGrandTotal($iyzicoGrandTotal);
$order->setState('processing');
$order->setStatus('processing');

$payment = $order->getPayment();
$payment->setAmountOrdered($iyzicoGrandTotal);
Expand All @@ -122,6 +120,9 @@ public function execute(Observer $observer)

}

$order->setState('processing');
$order->setStatus('processing');

$historyComment = __('Payment Success').$paymentId;
$order->addStatusHistoryComment($historyComment);
}
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.

0 comments on commit 19e2938

Please sign in to comment.