本文整理汇总了PHP中Magento\Framework\Session\SessionManagerInterface::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManagerInterface::getData方法的具体用法?PHP SessionManagerInterface::getData怎么用?PHP SessionManagerInterface::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Session\SessionManagerInterface
的用法示例。
在下文中一共展示了SessionManagerInterface::getData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeGenerateXml
/**
* Before generate Xml
*
* @param \Magento\Framework\View\LayoutInterface $subject
* @return array
*/
public function beforeGenerateXml(\Magento\Framework\View\LayoutInterface $subject)
{
if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
$this->customerGroupId = $this->customerSession->getCustomerGroupId();
$this->formKey = $this->session->getData(\Magento\Framework\Data\Form\FormKey::FORM_KEY);
}
return [];
}
示例2: testDestroy
public function testDestroy()
{
$data = array('key' => 'value');
$this->_model->setData($data);
$this->assertEquals($data, $this->_model->getData());
$this->_model->destroy();
$this->assertEquals(array(), $this->_model->getData());
}
示例3: beforeGenerateXml
/**
* Before generate Xml
*
* @param \Magento\Framework\View\LayoutInterface $subject
* @return array
*/
public function beforeGenerateXml(\Magento\Framework\View\LayoutInterface $subject)
{
if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
$this->customerGroupId = $this->customerSession->getCustomerGroupId();
$this->formKey = $this->session->getData(\Magento\Framework\Data\Form\FormKey::FORM_KEY);
}
return array();
}
示例4: _getValidationState
/**
* Return validation state model
*
* @param string $cardType
* @return \Magento\Centinel\Model\AbstractState
*/
protected function _getValidationState($cardType = null)
{
$type = $cardType ? $cardType : $this->_centinelSession->getData('card_type');
if (!$this->_validationState && $type) {
$model = $this->_stateFactory->createState($type);
if (!$model) {
return false;
}
$model->setDataStorage($this->_centinelSession);
$this->_validationState = $model;
}
return $this->_validationState;
}
示例5: getWord
/**
* Get captcha word
*
* @return string
*/
public function getWord()
{
$sessionData = $this->_session->getData($this->_getFormIdKey(self::SESSION_WORD));
return time() < $sessionData['expires'] ? $sessionData['data'] : null;
}
示例6: isPresent
/**
* @return bool
*/
public function isPresent()
{
return (bool) $this->session->getData(self::FORM_KEY);
}
示例7: _partialAuthorization
/**
* Send request with new payment to gateway during partial authorization process
*
* @param \Magento\Payment\Model\Info $payment
* @param float $amount
* @param string $requestType
* @return $this
* @throws \Magento\Payment\Model\Info\Exception
* @throws \Magento\Framework\Model\Exception
*/
protected function _partialAuthorization($payment, $amount, $requestType)
{
$payment->setAnetTransType($requestType);
/*
* Try to build checksum of first request and compare with current checksum
*/
if ($this->getConfigData('partial_authorization_checksum_checking')) {
$payment->setAmount($amount);
$firstPlacingRequest = $this->_buildRequest($payment);
$newChecksum = $this->_generateChecksum($firstPlacingRequest, $this->_partialAuthorizationChecksumDataKeys);
$previosChecksum = $this->_session->getData($this->_partialAuthorizationChecksumSessionKey);
if ($newChecksum != $previosChecksum) {
$quotePayment = $payment->getOrder()->getQuote()->getPayment();
$this->cancelPartialAuthorization($payment);
$this->_clearAssignedData($quotePayment);
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_DATA_CHANGED);
$quotePayment->setAdditionalInformation($payment->getAdditionalInformation());
throw new \Magento\Payment\Model\Info\Exception(__('The shopping cart contents and/or address has been changed.'));
}
}
$amount = $amount - $this->getCardsStorage()->getProcessedAmount();
if ($amount <= 0) {
throw new \Magento\Framework\Model\Exception(__('This is an invalid amount for partial authorization.'));
}
$payment->setAmount($amount);
$request = $this->_buildRequest($payment);
$result = $this->_postRequest($request);
$this->_processPartialAuthorizationResponse($result, $payment);
switch ($requestType) {
case self::REQUEST_TYPE_AUTH_ONLY:
$newTransactionType = \Magento\Sales\Model\Order\Payment\Transaction::TYPE_AUTH;
break;
case self::REQUEST_TYPE_AUTH_CAPTURE:
$newTransactionType = \Magento\Sales\Model\Order\Payment\Transaction::TYPE_CAPTURE;
break;
}
foreach ($this->getCardsStorage()->getCards() as $card) {
$this->_addTransaction($payment, $card->getLastTransId(), $newTransactionType, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $card->getLastTransId()), $this->_authorizenetData->getTransactionMessage($payment, $requestType, $card->getLastTransId(), $card, $card->getProcessedAmount()));
if ($requestType == self::REQUEST_TYPE_AUTH_CAPTURE) {
$card->setCapturedAmount($card->getProcessedAmount());
$this->getCardsStorage()->updateCard($card);
}
}
$this->_session->setData($this->_partialAuthorizationChecksumSessionKey, null);
return $this;
}