85 \
Magento\Sales\Model\OrderFactory $orderFactory,
86 \
Magento\Checkout\Model\Session $checkoutSession,
87 \
Magento\Paypal\Helper\Hss $hssHelper,
92 $this->_hssHelper = $hssHelper;
93 $this->_orderFactory = $orderFactory;
94 $this->_checkoutSession = $checkoutSession;
95 $this->_isScopePrivate =
true;
98 parent::__construct($context,
$data);
108 parent::_construct();
109 $paymentCode = $this->
_getCheckout()->getQuote()->getPayment()->getMethod();
110 if (in_array($paymentCode, $this->_hssHelper->getHssMethods())) {
111 $this->_paymentMethodCode = $paymentCode;
112 $templatePath = str_replace(
'_',
'', $paymentCode);
113 $templateFile =
"Magento_Paypal::{$templatePath}/iframe.phtml";
114 $directory = $this->readFactory->create($this->reader->getModuleDir(
'',
'Magento_Paypal'));
115 $file = $this->resolver->getTemplateFileName($templateFile, [
'module' =>
'Magento_Paypal']);
119 $this->
setTemplate(
'Magento_Paypal::hss/iframe.phtml');
132 if (!$this->_block) {
133 $this->_block = $this->
getLayout()->createBlock(
134 'Magento\\Paypal\\Block\\' . str_replace(
137 ucwords(str_replace(
'_',
' ', $this->_paymentMethodCode))
140 if (!$this->_block instanceof \
Magento\Paypal\Block\
Iframe) {
141 throw new \Magento\Framework\Exception\LocalizedException(
__(
'Invalid block type'));
155 if (!$this->_order) {
156 $incrementId = $this->
_getCheckout()->getLastRealOrderId();
157 $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
181 $this->_paymentMethodCode
183 $this->_shouldRender =
true;
186 if ($this->getGotoSection() || $this->getGotoSuccessPage()) {
187 $this->_shouldRender =
true;
190 return parent::_beforeToHtml();
201 $this->
setTemplate(
'Magento_Paypal::hss/js.phtml');
202 return parent::_toHtml();
204 if (!$this->_shouldRender) {
207 return parent::_toHtml();
218 if (
$quote->getPayment()->getMethod() == $this->_paymentMethodCode &&
221 $this->
getRequest()->getActionName() ==
'savePayment' 236 return $this->
_getBlock()->getFrameActionUrl();
246 return $this->
_getBlock()->getSecureToken();
256 return $this->
_getBlock()->getSecureTokenId();
266 return $this->
_getBlock()->getTransactionUrl();
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Paypal\Helper\Hss $hssHelper, \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory, \Magento\Framework\Module\Dir\Reader $reader, array $data=[])