-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
45 changed files
with
1,406 additions
and
933 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
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,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rvvup\Payments\Block\Order; | ||
|
||
use Magento\Checkout\Model\Session; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Registry; | ||
use Magento\Framework\View\Element\Template\Context as TemplateContext; | ||
use Magento\Payment\Helper\Data as PaymentHelper; | ||
use Magento\Sales\Model\Order; | ||
use Magento\Sales\Model\Order\Address\Renderer as AddressRenderer; | ||
|
||
class Info extends \Magento\Sales\Block\Order\Info | ||
{ | ||
/** @var Order */ | ||
private $order; | ||
|
||
/** @var Session */ | ||
private $session; | ||
|
||
/** | ||
* @param TemplateContext $context | ||
* @param Registry $registry | ||
* @param PaymentHelper $paymentHelper | ||
* @param AddressRenderer $addressRenderer | ||
* @param Session $session | ||
* @param Order $order | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
TemplateContext $context, | ||
Registry $registry, | ||
PaymentHelper $paymentHelper, | ||
AddressRenderer $addressRenderer, | ||
Session $session, | ||
Order $order, | ||
array $data = [] | ||
) { | ||
$this->session = $session; | ||
$this->order = $order; | ||
parent::__construct($context, $registry, $paymentHelper, $addressRenderer, $data); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* @return void | ||
* @throws LocalizedException | ||
*/ | ||
protected function _prepareLayout(): void | ||
{ | ||
$orderId = $this->getOrder()->getRealOrderId(); | ||
$payment = $this->getOrder()->getPayment(); | ||
if (!$orderId) { | ||
$orderId = $this->session->getLastRealOrderId(); | ||
} | ||
if (!$payment) { | ||
$order = $this->order->loadByIncrementId($orderId); | ||
$payment = $order->getPayment(); | ||
} | ||
$this->pageConfig->getTitle()->set(__('Order # %1', $orderId)); | ||
$infoBlock = $this->paymentHelper->getInfoBlock($payment, $this->getLayout()); | ||
$this->setChild('payment_info', $infoBlock); | ||
} | ||
} |
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,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rvvup\Payments\Block\Order; | ||
|
||
use Klarna\Core\Api\OrderRepositoryInterface; | ||
use Magento\Checkout\Model\Session; | ||
use Magento\Framework\App\Http\Context; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Registry; | ||
use Magento\Payment\Helper\Data; | ||
use Magento\Sales\Model\Order; | ||
|
||
class View extends \Magento\Sales\Block\Order\View | ||
{ | ||
/** @var Session */ | ||
private $session; | ||
|
||
/** @var Order */ | ||
private $order; | ||
|
||
/** | ||
* @param \Magento\Framework\View\Element\Template\Context $context | ||
* @param Registry $registry | ||
* @param Context $httpContext | ||
* @param Data $paymentHelper | ||
* @param Session $session | ||
* @param Order $order | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\View\Element\Template\Context $context, | ||
Registry $registry, | ||
Context $httpContext, | ||
Data $paymentHelper, | ||
Session $session, | ||
Order $order, | ||
array $data = [] | ||
) { | ||
$this->session = $session; | ||
$this->order = $order; | ||
parent::__construct($context, $registry, $httpContext, $paymentHelper, $data); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* @return void | ||
* @throws LocalizedException | ||
*/ | ||
protected function _prepareLayout(): void | ||
{ | ||
$orderId = $this->getOrder()->getRealOrderId(); | ||
$payment = $this->getOrder()->getPayment(); | ||
if (!$orderId) { | ||
$orderId = $this->session->getLastRealOrderId(); | ||
} | ||
if (!$payment) { | ||
$order = $this->order->loadByIncrementId($orderId); | ||
$payment = $order->getPayment(); | ||
} | ||
$this->pageConfig->getTitle()->set(__('Order # %1', $orderId)); | ||
$infoBlock = $this->_paymentHelper->getInfoBlock($payment, $this->getLayout()); | ||
$this->setChild('payment_info', $infoBlock); | ||
} | ||
} |
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
Oops, something went wrong.