-
Notifications
You must be signed in to change notification settings - Fork 32
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 #100 from paynl/feature/PLUG-1781
PLUG-1781 - Feature request deeplink trx ID
- Loading branch information
Showing
6 changed files
with
100 additions
and
0 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,62 @@ | ||
<?php | ||
|
||
namespace Paynl\Payment\Block\Adminhtml\Order\View; | ||
|
||
use Magento\Backend\Block\Template; | ||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Sales\Model\OrderRepository; | ||
use Paynl\Payment\Helper\PayHelper; | ||
|
||
class View extends Template | ||
{ | ||
public const PAY_TRANSACTION_URL = 'https://my.pay.nl/transactions/info/'; | ||
private $orderRepository; | ||
|
||
|
||
/** | ||
* @param Context $context | ||
* @param OrderRepository $orderRepository | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
OrderRepository $orderRepository | ||
) { | ||
parent::__construct($context); | ||
$this->orderRepository = $orderRepository; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPayUrl() | ||
{ | ||
return self::PAY_TRANSACTION_URL . $this->getId(); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getOrder() | ||
{ | ||
$params = $this->getRequest()->getParams(); | ||
$orderId = isset($params['order_id']) ? $params['order_id'] : null; | ||
|
||
try { | ||
$order = $this->orderRepository->get($orderId); | ||
$getPayment = $order->getPayment(); | ||
} catch (\Exception $e) { | ||
payHelper::logCritical($e, $params); | ||
} | ||
|
||
return $getPayment; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getId() | ||
{ | ||
$additionalInformation = $this->getOrder()->getAdditionalInformation(); | ||
return $additionalInformation['transactionId'] ?? ''; | ||
} | ||
} |
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,10 @@ | ||
<?xml version="1.0"?> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" | ||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<body> | ||
<referenceBlock name="order_additional_info"> | ||
<block class="Paynl\Payment\Block\Adminhtml\Order\View\View" name="custom_view" | ||
template="order/view/view.phtml"/> | ||
</referenceBlock> | ||
</body> | ||
</page> |
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,13 @@ | ||
<?php | ||
// @codingStandardsIgnoreFile | ||
/** | ||
* @var $block Paynl\Payment\Block\Adminhtml\Order\View\View | ||
*/ | ||
?> | ||
<div class="admin__page-section-item pay-orderinformation"> | ||
<div class="admin__page-section-item-content"> | ||
<?= /* @noEscape */ | ||
__("Pay. Transaction-ID: ") ?><a href="<?php echo $block->getPayUrl() ?>" | ||
target="_blank"><?php echo $block->getId() ?><span class="pay-link-icon">⬈</span></a> | ||
</div> | ||
</div> |
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