AbstractInfo.php 2.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<?php
/**
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * Adyen Payment module (https://www.adyen.com/)
 *
 * Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
 * See LICENSE.txt for license details.
 *
 * Author: Adyen <magento@adyen.com>
 */

namespace Adyen\Payment\Block\Info;

use Magento\Framework\View\Element\Template;

class AbstractInfo extends \Magento\Payment\Block\Info
{

    /**
     * @var \Adyen\Payment\Helper\Data
     */
    protected $_adyenHelper;
35 36 37 38 39

    /**
     * @var \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory
     */
    protected $_adyenOrderPaymentCollectionFactory;
40
    
41
    /**
42
     * AbstractInfo constructor.
43
     *
44
     * @param \Adyen\Payment\Helper\Data $adyenHelper
45
     * @param \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
46 47 48 49 50
     * @param Template\Context $context
     * @param array $data
     */
    public function __construct(
        \Adyen\Payment\Helper\Data $adyenHelper,
51
        \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory,
52 53 54 55 56 57
        Template\Context $context,
        array $data = []
    )
    {
        parent::__construct($context, $data);
        $this->_adyenHelper = $adyenHelper;
58
        $this->_adyenOrderPaymentCollectionFactory = $adyenOrderPaymentCollectionFactory;
59 60
    }

61 62 63 64
    /**
     * @return mixed
     * @throws \Magento\Framework\Exception\LocalizedException
     */
65 66
    public function getAdyenPspReference()
    {
67
        return $this->getInfo()->getAdyenPspReference();
68 69
    }

70 71 72 73
    /**
     * @return mixed
     * @throws \Magento\Framework\Exception\LocalizedException
     */
74 75
    public function isDemoMode()
    {
76
        $storeId = $this->getInfo()->getOrder()->getStoreId();
77 78 79
        return $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
    }
}