Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Info Class Reference
Inheritance diagram for Info:
AbstractExtensibleModel InfoInterface AbstractModel CustomAttributesDataInterface DataObject ExtensibleDataInterface Payment

Public Member Functions

 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getData ($key='', $index=null)
 
 getMethodInstance ()
 
 encrypt ($data)
 
 decrypt ($data)
 
 setAdditionalInformation ($key, $value=null)
 
 getAdditionalInformation ($key=null)
 
 unsAdditionalInformation ($key=null)
 
 hasAdditionalInformation ($key=null)
 
- Public Member Functions inherited from AbstractExtensibleModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getCustomAttributes ()
 
 getCustomAttribute ($attributeCode)
 
 setCustomAttributes (array $attributes)
 
 setCustomAttribute ($attributeCode, $attributeValue)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 setId ($value)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Protected Member Functions

 _initAdditionalInformation ()
 
- Protected Member Functions inherited from AbstractExtensibleModel
 filterCustomAttributes ($data)
 
 initializeCustomAttributes ()
 
 convertCustomAttributeValues (array &$customAttributes)
 
 getCustomAttributesCodes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
 _getExtensionAttributes ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_additionalInformation = []
 
 $_paymentData
 
 $_encryptor
 
- Protected Attributes inherited from AbstractExtensibleModel
 $extensionAttributesFactory
 
 $extensionAttributes
 
 $customAttributeFactory
 
 $customAttributesCodes = null
 
 $customAttributesChanged = false
 
- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Payment information model

@api

Since
100.0.2

Definition at line 16 of file Info.php.

Constructor & Destructor Documentation

◆ __construct()

Parameters
\Magento\Framework\Model\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\Api\ExtensionAttributesFactory$extensionFactory
\Magento\Framework\Api\AttributeValueFactory$customAttributeFactory

Definition at line 48 of file Info.php.

58  {
59  $this->_paymentData = $paymentData;
60  $this->_encryptor = $encryptor;
61  parent::__construct(
62  $context,
63  $registry,
64  $extensionFactory,
66  $resource,
67  $resourceCollection,
68  $data
69  );
70  }
$resource
Definition: bulk.php:12

Member Function Documentation

◆ _initAdditionalInformation()

_initAdditionalInformation ( )
protected

Initialize _additionalInformation with $this->_data['additional_information'] if empty

Returns
void

Definition at line 222 of file Info.php.

223  {
224  $additionalInfo = $this->_getData('additional_information');
225  if (empty($this->_additionalInformation) && $additionalInfo) {
226  $this->_additionalInformation = $additionalInfo;
227  }
228  }

◆ decrypt()

decrypt (   $data)

Decrypt data

Parameters
string$data
Returns
string

Implements InfoInterface.

Definition at line 139 of file Info.php.

140  {
141  return $this->_encryptor->decrypt($data);
142  }

◆ encrypt()

encrypt (   $data)

Encrypt data

Parameters
string$data
Returns
string

Implements InfoInterface.

Definition at line 128 of file Info.php.

129  {
130  return $this->_encryptor->encrypt($data);
131  }

◆ getAdditionalInformation()

getAdditionalInformation (   $key = null)

Getter for entire additional_information value or one of its element by key

Parameters
string$key
Returns
array|null|mixed

Implements InfoInterface.

Definition at line 174 of file Info.php.

175  {
177  if (null === $key) {
179  }
180  return isset($this->_additionalInformation[$key]) ? $this->_additionalInformation[$key] : null;
181  }

◆ getData()

getData (   $key = '',
  $index = null 
)

Retrieve data

Parameters
string$key
mixed$index
Returns
mixed

Definition at line 79 of file Info.php.

80  {
81  if ('cc_number' === $key) {
82  if (empty($this->_data['cc_number']) && !empty($this->_data['cc_number_enc'])) {
83  $this->_data['cc_number'] = $this->decrypt($this->getCcNumberEnc());
84  }
85  }
86  if ('cc_cid' === $key) {
87  if (empty($this->_data['cc_cid']) && !empty($this->_data['cc_cid_enc'])) {
88  $this->_data['cc_cid'] = $this->decrypt($this->getCcCidEnc());
89  }
90  }
91  return parent::getData($key, $index);
92  }
$index
Definition: list.phtml:44

◆ getMethodInstance()

getMethodInstance ( )

Retrieve payment method model object

Returns
\Magento\Payment\Model\MethodInterface
Exceptions

Implements InfoInterface.

Definition at line 100 of file Info.php.

101  {
102  if (!$this->hasMethodInstance()) {
103  if (!$this->getMethod()) {
104  throw new \Magento\Framework\Exception\LocalizedException(
105  __('The payment method you requested is not available.')
106  );
107  }
108 
109  try {
110  $instance = $this->_paymentData->getMethodInstance($this->getMethod());
111  } catch (\UnexpectedValueException $e) {
112  $instance = $this->_paymentData->getMethodInstance(Method\Substitution::CODE);
113  }
114 
115  $instance->setInfoInstance($this);
116  $this->setMethodInstance($instance);
117  }
118 
119  return $this->_getData('method_instance');
120  }
__()
Definition: __.php:13

◆ hasAdditionalInformation()

hasAdditionalInformation (   $key = null)

Check whether there is additional information by specified key

Parameters
mixed | null$key
Returns
bool

Implements InfoInterface.

Definition at line 208 of file Info.php.

209  {
211  return null === $key ? !empty($this->_additionalInformation) : array_key_exists(
212  $key,
213  $this->_additionalInformation
214  );
215  }

◆ setAdditionalInformation()

setAdditionalInformation (   $key,
  $value = null 
)

Additional information setter Updates data inside the 'additional_information' array or all 'additional_information' if key is data array

Parameters
string | array$key
mixed$value
Returns
$this
Exceptions

Implements InfoInterface.

Definition at line 154 of file Info.php.

155  {
156  if (is_object($value)) {
157  throw new \Magento\Framework\Exception\LocalizedException(__('The payment disallows storing objects.'));
158  }
160  if (is_array($key) && $value === null) {
161  $this->_additionalInformation = $key;
162  } else {
163  $this->_additionalInformation[$key] = $value;
164  }
165  return $this->setData('additional_information', $this->_additionalInformation);
166  }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16

◆ unsAdditionalInformation()

unsAdditionalInformation (   $key = null)

Unsetter for entire additional_information value or one of its element by key

Parameters
string$key
Returns
$this

Implements InfoInterface.

Definition at line 189 of file Info.php.

190  {
191  if ($key && isset($this->_additionalInformation[$key])) {
192  unset($this->_additionalInformation[$key]);
193  return $this->setData('additional_information', $this->_additionalInformation);
194  } elseif (null === $key) {
195  $this->_additionalInformation = [];
196  return $this->unsetData('additional_information');
197  }
198 
199  return $this;
200  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

Field Documentation

◆ $_additionalInformation

$_additionalInformation = []
protected

Definition at line 23 of file Info.php.

◆ $_encryptor

$_encryptor
protected

Definition at line 35 of file Info.php.

◆ $_paymentData

$_paymentData
protected

Definition at line 30 of file Info.php.


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