CaptureMode.php 1.67 KB
Newer Older
1 2
<?php
/**
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * 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>
22 23 24 25 26 27 28
 */

namespace Adyen\Payment\Model\Config\Source;

class CaptureMode implements \Magento\Framework\Option\ArrayInterface
{

29 30 31
    /**
     * @var \Adyen\Payment\Helper\Data
     */
32 33 34 35
    protected $_adyenHelper;


    /**
36
     * CaptureMode constructor.
37
     *
38
     * @param \Adyen\Payment\Helper\Data $adyenHelper
39 40 41
     */
    public function __construct(
        \Adyen\Payment\Helper\Data $adyenHelper
42
    ) {
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        $this->_adyenHelper = $adyenHelper;
    }

    /**
     * @return array
     */
    public function toOptionArray()
    {
        $recurringTypes = $this->_adyenHelper->getCaptureModes();

        foreach ($recurringTypes as $code => $label) {
            $options[] = ['value' => $code, 'label' => $label];
        }
        return $options;
    }
}