![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-payment/Block/Form/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Payment\Block\Form; /** * @api * @since 100.0.2 */ class Cc extends \Magento\Payment\Block\Form { /** * @var string */ protected $_template = 'Magento_Payment::form/cc.phtml'; /** * Payment config model * * @var \Magento\Payment\Model\Config */ protected $_paymentConfig; /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Payment\Model\Config $paymentConfig * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Payment\Model\Config $paymentConfig, array $data = [] ) { parent::__construct($context, $data); $this->_paymentConfig = $paymentConfig; } /** * Retrieve availables credit card types * * @return array * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ public function getCcAvailableTypes() { $types = $this->_paymentConfig->getCcTypes(); if ($method = $this->getMethod()) { $availableTypes = $method->getConfigData('cctypes'); if ($availableTypes) { $availableTypes = explode(',', $availableTypes); foreach ($types as $code => $name) { if (!in_array($code, $availableTypes)) { unset($types[$code]); } } } } return $types; } /** * Retrieve credit card expire months * * @return array */ public function getCcMonths() { $months = $this->getData('cc_months'); if ($months === null) { $months[0] = __('Month'); $months = array_merge($months, $this->_paymentConfig->getMonths()); $this->setData('cc_months', $months); } return $months; } /** * Retrieve credit card expire years * * @return array */ public function getCcYears() { $years = $this->getData('cc_years'); if ($years === null) { $years = $this->_paymentConfig->getYears(); $years = [0 => __('Year')] + $years; $this->setData('cc_years', $years); } return $years; } /** * Retrieve has verification configuration * * @return bool */ public function hasVerification() { if ($this->getMethod()) { $configData = $this->getMethod()->getConfigData('useccv'); if ($configData === null) { return true; } return (bool)$configData; } return true; } /** * Whether switch/solo card type available * * @deprecated 100.1.0 unused * @return bool */ public function hasSsCardType() { $ccTypes = $this->getMethod()->getConfigData('cctypes'); if ($ccTypes === null) { return false; } $availableTypes = explode(',', $ccTypes); $ssPresenations = array_intersect(['SS', 'SM', 'SO'], $availableTypes); if ($availableTypes && count($ssPresenations) > 0) { return true; } return false; } /** * Solo/switch card start year * * @deprecated 100.1.0 unused * @return array */ public function getSsStartYears() { $years = []; $first = date("Y"); for ($index = 5; $index >= 0; $index--) { $year = $first - $index; $years[$year] = $year; } $years = [0 => __('Year')] + $years; return $years; } /** * Render block HTML * * @return string */ protected function _toHtml() { $this->_eventManager->dispatch('payment_form_block_to_html_before', ['block' => $this]); return parent::_toHtml(); } }