Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
CcConfig Class Reference

Public Member Functions

 __construct (PaymentConfig $paymentConfig, Repository $assetRepo, RequestInterface $request, UrlInterface $urlBuilder, LoggerInterface $logger)
 
 getSsStartYears ()
 
 getCcAvailableTypes ()
 
 getCcMonths ()
 
 getCcYears ()
 
 hasVerification ()
 
 hasSsCardType ()
 
 getCvvImageUrl ()
 
 getViewFileUrl ($fileId, array $params=[])
 
 createAsset ($fileId, array $params=[])
 

Protected Attributes

 $config
 
 $assetRepo
 
 $request
 
 $urlBuilder
 
 $logger
 

Detailed Description

Credit card configuration model

@api

Since
100.0.2

Definition at line 21 of file CcConfig.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( PaymentConfig  $paymentConfig,
Repository  $assetRepo,
RequestInterface  $request,
UrlInterface  $urlBuilder,
LoggerInterface  $logger 
)
Parameters
PaymentConfig$paymentConfig
Repository$assetRepo
RequestInterface$request
UrlInterface$urlBuilder
LoggerInterface$logger

Definition at line 55 of file CcConfig.php.

61  {
62  $this->config = $paymentConfig;
63  $this->assetRepo = $assetRepo;
64  $this->request = $request;
65  $this->urlBuilder = $urlBuilder;
66  $this->logger = $logger;
67  }

Member Function Documentation

◆ createAsset()

createAsset (   $fileId,
array  $params = [] 
)

Create a file asset that's subject of fallback system

Parameters
string$fileId
array$params
Returns
\Magento\Framework\View\Asset\File

Definition at line 173 of file CcConfig.php.

174  {
175  $params = array_merge(['_secure' => $this->request->isSecure()], $params);
176  return $this->assetRepo->createAsset($fileId, $params);
177  }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18

◆ getCcAvailableTypes()

getCcAvailableTypes ( )

Retrieve available credit card types

Returns
array

Definition at line 92 of file CcConfig.php.

93  {
94  return $this->config->getCcTypes();
95  }

◆ getCcMonths()

getCcMonths ( )

Retrieve credit card expire months

Returns
array

Definition at line 102 of file CcConfig.php.

103  {
104  return $this->config->getMonths();
105  }

◆ getCcYears()

getCcYears ( )

Retrieve credit card expire years

Returns
array

Definition at line 112 of file CcConfig.php.

113  {
114  return $this->config->getYears();
115  }

◆ getCvvImageUrl()

getCvvImageUrl ( )

Retrieve CVV tooltip image url

Returns
string

Definition at line 143 of file CcConfig.php.

144  {
145  return $this->getViewFileUrl('Magento_Checkout::cvv.png');
146  }
getViewFileUrl($fileId, array $params=[])
Definition: CcConfig.php:155

◆ getSsStartYears()

getSsStartYears ( )

Solo/switch card start years

Returns
array
Deprecated:
100.1.0 unused

Definition at line 75 of file CcConfig.php.

76  {
77  $years = [];
78  $first = date("Y");
79 
80  for ($index = 5; $index >= 0; $index--) {
81  $year = $first - $index;
82  $years[$year] = $year;
83  }
84  return $years;
85  }
$index
Definition: list.phtml:44

◆ getViewFileUrl()

getViewFileUrl (   $fileId,
array  $params = [] 
)

Retrieve url of a view file

Parameters
string$fileId
array$params
Returns
string

Definition at line 155 of file CcConfig.php.

156  {
157  try {
158  $params = array_merge(['_secure' => $this->request->isSecure()], $params);
159  return $this->assetRepo->getUrlWithParams($fileId, $params);
160  } catch (LocalizedException $e) {
161  $this->logger->critical($e);
162  return $this->urlBuilder->getUrl('', ['_direct' => 'core/index/notFound']);
163  }
164  }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18

◆ hasSsCardType()

hasSsCardType ( )

Whether switch/solo card type available

Returns
bool
Deprecated:
100.1.0 unused

Definition at line 133 of file CcConfig.php.

134  {
135  return false;
136  }

◆ hasVerification()

hasVerification ( )

Retrieve has verification configuration

Returns
bool

Definition at line 122 of file CcConfig.php.

123  {
124  return true;
125  }

Field Documentation

◆ $assetRepo

$assetRepo
protected

Definition at line 31 of file CcConfig.php.

◆ $config

$config
protected

Definition at line 26 of file CcConfig.php.

◆ $logger

$logger
protected

Definition at line 46 of file CcConfig.php.

◆ $request

$request
protected

Definition at line 36 of file CcConfig.php.

◆ $urlBuilder

$urlBuilder
protected

Definition at line 41 of file CcConfig.php.


The documentation for this class was generated from the following file: