We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

AdyenSepaConfigProvider.php 2.94 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
<?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>
 */

24
namespace Adyen\Payment\Model\Ui;
25 26 27 28 29 30 31

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper;

class AdyenSepaConfigProvider implements ConfigProviderInterface
{

32 33
    const CODE = 'adyen_sepa';

34
    /**
35
     * @var PaymentHelper
36
     */
37
    protected $_paymentHelper;
38 39

    /**
40
     * @var \Adyen\Payment\Helper\Data
41
     */
42
    protected $_adyenHelper;
43 44

    /**
45 46 47
     * Request object
     *
     * @var \Magento\Framework\App\RequestInterface
48
     */
49
    protected $_request;
50 51

    /**
52
     * @var \Magento\Framework\UrlInterface
53
     */
54
    protected $_urlBuilder;
55 56 57

    /**
     * AdyenSepaConfigProvider constructor.
58 59
     *
     * @param PaymentHelper $paymentHelper
rikterbeek's avatar
#40  
rikterbeek committed
60
     * @param \Adyen\Payment\Helper\Data $adyenHelper
61 62
     * @param \Magento\Framework\App\RequestInterface $request
     * @param \Magento\Framework\UrlInterface $urlBuilder
63 64 65
     */
    public function __construct(
        PaymentHelper $paymentHelper,
66 67 68
        \Adyen\Payment\Helper\Data $adyenHelper,
        \Magento\Framework\App\RequestInterface $request,
        \Magento\Framework\UrlInterface $urlBuilder
69 70
    ) {
        $this->_paymentHelper = $paymentHelper;
rikterbeek's avatar
#40  
rikterbeek committed
71
        $this->_adyenHelper = $adyenHelper;
72 73
        $this->_request = $request;
        $this->_urlBuilder = $urlBuilder;
74 75
    }

76 77 78
    /**
     * @return array
     */
79 80
    public function getConfig()
    {
81 82

        // set to active
83 84
        $config = [
            'payment' => [
85 86 87 88
                self::CODE => [
                    'isActive' => true,
                    'redirectUrl' => $this->_urlBuilder->getUrl(
                        'checkout/onepage/success/', ['_secure' => $this->_getRequest()->isSecure()])
89 90 91
                ]
            ]
        ];
92 93 94

        $config['payment']['adyenSepa']['countries'] = $this->_adyenHelper->getSepaCountries();

95 96
        return $config;
    }
97 98 99 100 101 102 103 104 105 106

    /**
     * Retrieve request object
     *
     * @return \Magento\Framework\App\RequestInterface
     */
    protected function _getRequest()
    {
        return $this->_request;
    }
107
}