-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Xaxxis/master
Magento2 v2.2.0
- Loading branch information
Showing
23 changed files
with
134 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Midtrans\Snap\Block; | ||
use \Magento\Framework\View\Element\Template; | ||
|
||
|
||
class Close extends Template | ||
{ | ||
public function __construct(\Magento\Framework\View\Element\Template\Context $context) | ||
{ | ||
parent::__construct($context); | ||
} | ||
|
||
public function cancelOrders() | ||
{ | ||
return __('Your order has been canceled, because you close payment page. Thank you'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
<?php | ||
|
||
namespace Midtrans\Snap\Block; | ||
|
||
use \Magento\Framework\View\Element\Template; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
|
||
namespace Midtrans\Snap\Controller\Index; | ||
use Magento\Framework\App\Action\Action; | ||
use Magento\Framework\App\Action\Context; | ||
use Magento\Framework\View\Result\PageFactory; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; | ||
|
||
class Close extends Action implements HttpGetActionInterface | ||
{ | ||
protected $pageFactory; | ||
protected $request; | ||
|
||
public function __construct(Context $context, PageFactory $pageFactory) | ||
{ | ||
$this->resultPageFactory = $pageFactory; | ||
parent::__construct($context); | ||
} | ||
|
||
public function execute() | ||
{ | ||
if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { | ||
return $this->resultRedirectFactory->create()->setPath('checkout/cart'); | ||
} | ||
$resultPage = $this->resultPageFactory->create(); | ||
return $resultPage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
|
||
namespace Midtrans\Snap\Plugin; | ||
class CsrfValidatorSkip | ||
{ | ||
/** | ||
* @param \Magento\Framework\App\Request\CsrfValidator $subject | ||
* @param \Closure $proceed | ||
* @param \Magento\Framework\App\RequestInterface $request | ||
* @param \Magento\Framework\App\ActionInterface $action | ||
*/ | ||
public function aroundValidate( | ||
$subject, | ||
\Closure $proceed, | ||
$request, | ||
$action | ||
) { | ||
if ($request->getModuleName() == 'snap') { | ||
return; // Skip CSRF check | ||
} | ||
$proceed($request, $action); // Proceed Magento 2 core functionalities | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/code/Midtrans/Snap/view/frontend/layout/snap_index_close.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" | ||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<head> | ||
<title>Payment Close</title> | ||
</head> | ||
<body> | ||
<referenceBlock name="page.main.title"> | ||
<action method="setPageTitle"> | ||
<argument translate="true" name="title" xsi:type="string">Your order has been canceled!</argument> | ||
</action> | ||
</referenceBlock> | ||
<referenceContainer name="content"> | ||
<block class="Midtrans\Snap\Block\Close" name="snap_close" template="Midtrans_Snap::close.phtml"/> | ||
</referenceContainer> | ||
</body> | ||
</page> |
4 changes: 0 additions & 4 deletions
4
app/code/Midtrans/Snap/view/frontend/layout/snap_index_pending.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
/** | ||
* @var \Midtrans\Snap\Block\Close $block | ||
*/ | ||
|
||
echo $block->cancelOrders(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters