123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Paypal\Block\Payflow\Link;
- /**
- * Payflow link iframe block
- *
- * @api
- * @since 100.0.2
- */
- class Iframe extends \Magento\Paypal\Block\Iframe
- {
- /**
- * Payment data
- *
- * @var \Magento\Payment\Helper\Data
- */
- protected $_paymentData = null;
- /**
- * @param \Magento\Framework\View\Element\Template\Context $context
- * @param \Magento\Sales\Model\OrderFactory $orderFactory
- * @param \Magento\Checkout\Model\Session $checkoutSession
- * @param \Magento\Paypal\Helper\Hss $hssHelper
- * @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
- * @param \Magento\Framework\Module\Dir\Reader $reader
- * @param \Magento\Payment\Helper\Data $paymentData
- * @param array $data
- */
- public function __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,
- \Magento\Payment\Helper\Data $paymentData,
- array $data = []
- ) {
- $this->_paymentData = $paymentData;
- parent::__construct($context, $orderFactory, $checkoutSession, $hssHelper, $readFactory, $reader, $data);
- }
- /**
- * Set payment method code
- *
- * @return void
- */
- protected function _construct()
- {
- parent::_construct();
- $this->_paymentMethodCode = \Magento\Paypal\Model\Config::METHOD_PAYFLOWLINK;
- }
- /**
- * Get frame action URL
- *
- * @return string
- */
- public function getFrameActionUrl()
- {
- return $this->getUrl('paypal/payflow/form', ['_secure' => true]);
- }
- /**
- * Get secure token
- *
- * @return string
- */
- public function getSecureToken()
- {
- return $this->_getOrder()->getPayment()->getAdditionalInformation('secure_token');
- }
- /**
- * Get secure token ID
- *
- * @return string
- */
- public function getSecureTokenId()
- {
- return $this->_getOrder()->getPayment()->getAdditionalInformation('secure_token_id');
- }
- /**
- * Get payflow transaction URL
- *
- * @return string
- */
- public function getTransactionUrl()
- {
- $cgiUrl = 'cgi_url';
- if ($this->isTestMode()) {
- $cgiUrl = 'cgi_url_test_mode';
- }
- return $this->_paymentData->getMethodInstance($this->_paymentMethodCode)->getConfigData($cgiUrl);
- }
- /**
- * Check sandbox mode
- *
- * @return bool
- */
- public function isTestMode()
- {
- $mode = $this->_paymentData->getMethodInstance($this->_paymentMethodCode)->getConfigData('sandbox_flag');
- return (bool)$mode;
- }
- }
|