Skip to content

Commit

Permalink
Merge pull request #100 from paynl/feature/PLUG-1781
Browse files Browse the repository at this point in the history
PLUG-1781 - Feature request deeplink trx ID
  • Loading branch information
woutse authored May 2, 2023
2 parents 0d2136e + fb30327 commit 95f6f35
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 0 deletions.
62 changes: 62 additions & 0 deletions Block/Adminhtml/Order/View/View.php
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'] ?? '';
}
}
1 change: 1 addition & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"Check version","Check version"
"You are up to date with the latest version","You are up to date with the latest version"
"There is a new version available (","There is a new version available ("
"Pay. Transaction-ID: ","Pay. Transaction-ID: "
"PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal.","PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal."
"Select whether you want to use the PAY. thank you page when transaction is pending.","Select whether you want to use the PAY. thank you page when transaction is pending."
"Automatically void authorisation-transactions when cancelling an order.","Automatically void authorisation-transactions when cancelling an order."
1 change: 1 addition & 0 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
"Check version","Check versie"
"You are up to date with the latest version","U bent up to date met de laatste versie"
"There is a new version available (","Er is een nieuwe versie beschikbaar ("
"Pay. Transaction-ID: ","Pay. Transactie-ID: "
"PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal.","PAY. - Deze betaling is gemarkeerd als mogelijk frauduleus. Controleer deze transactie in het Pay. portaal."
"Select whether you want to use the PAY. thank you page when transaction is pending.","Selecteer of u gebruik wilt maken van de PAY. bedankpagina wanneer de transactie in behandeling is."
"Automatically void authorisation-transactions when cancelling an order.","Authorize-transacties automatisch vrijgeven bij het annuleren van een bestelling."
10 changes: 10 additions & 0 deletions view/adminhtml/layout/sales_order_view.xml
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>
13 changes: 13 additions & 0 deletions view/adminhtml/templates/order/view/view.phtml
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">&#11016;</span></a>
</div>
</div>
13 changes: 13 additions & 0 deletions view/adminhtml/web/css/configtab.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,17 @@

#paynl_version_check_button {
padding: 1px 8px
}

.pay-orderinformation {
width: calc((100%) * .5 - 30px);
margin: -40px 0px 20px 0px;
}

.pay-link-icon {
color: black;
margin-left: 2px;
font-size: 17px;
text-decoration: none;
display: inline-block;
}

0 comments on commit 95f6f35

Please sign in to comment.