|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * NOTICE OF LICENSE |
| 4 | + * |
| 5 | + * This source file is subject to the MIT License |
| 6 | + * It is available through the world-wide-web at this URL: |
| 7 | + * https://tldrlegal.com/license/mit-license |
| 8 | + * If you are unable to obtain it through the world-wide-web, please send an email |
| 9 | + * to support@buckaroo.nl so we can send you a copy immediately. |
| 10 | + * |
| 11 | + * DISCLAIMER |
| 12 | + * |
| 13 | + * Do not edit or add to this file if you wish to upgrade this module to newer |
| 14 | + * versions in the future. If you wish to customize this module for your |
| 15 | + * needs please contact support@buckaroo.nl for more information. |
| 16 | + * |
| 17 | + * @copyright Copyright (c) Buckaroo B.V. |
| 18 | + * @license https://tldrlegal.com/license/mit-license |
| 19 | + */ |
| 20 | + |
| 21 | +namespace Buckaroo\Magento2\Model\ConfigProvider\Method; |
| 22 | + |
| 23 | +class Blik extends AbstractConfigProvider |
| 24 | +{ |
| 25 | + const XPATH_BLIK_PAYMENT_FEE = 'payment/buckaroo_magento2_blik/payment_fee'; |
| 26 | + const XPATH_BLIK_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_blik/payment_fee_label'; |
| 27 | + const XPATH_BLIK_ACTIVE = 'payment/buckaroo_magento2_blik/active'; |
| 28 | + const XPATH_BLIK_SUBTEXT = 'payment/buckaroo_magento2_blik/subtext'; |
| 29 | + const XPATH_BLIK_SUBTEXT_STYLE = 'payment/buckaroo_magento2_blik/subtext_style'; |
| 30 | + const XPATH_BLIK_SUBTEXT_COLOR = 'payment/buckaroo_magento2_blik/subtext_color'; |
| 31 | + const XPATH_BLIK_ACTIVE_STATUS = 'payment/buckaroo_magento2_blik/active_status'; |
| 32 | + const XPATH_BLIK_ORDER_STATUS_SUCCESS = 'payment/buckaroo_magento2_blik/order_status_success'; |
| 33 | + const XPATH_BLIK_ORDER_STATUS_FAILED = 'payment/buckaroo_magento2_blik/order_status_failed'; |
| 34 | + const XPATH_BLIK_AVAILABLE_IN_BACKEND = 'payment/buckaroo_magento2_blik/available_in_backend'; |
| 35 | + |
| 36 | + const XPATH_ALLOWED_CURRENCIES = 'payment/buckaroo_magento2_blik/allowed_currencies'; |
| 37 | + |
| 38 | + const XPATH_ALLOW_SPECIFIC = 'payment/buckaroo_magento2_blik/allowspecific'; |
| 39 | + const XPATH_SPECIFIC_COUNTRY = 'payment/buckaroo_magento2_blik/specificcountry'; |
| 40 | + const XPATH_SPECIFIC_CUSTOMER_GROUP = 'payment/buckaroo_magento2_blik/specificcustomergroup'; |
| 41 | + |
| 42 | + /** |
| 43 | + * @var array |
| 44 | + */ |
| 45 | + protected $allowedCurrencies = [ |
| 46 | + 'PLN' |
| 47 | + ]; |
| 48 | + /** |
| 49 | + * @return array|void |
| 50 | + */ |
| 51 | + public function getConfig() |
| 52 | + { |
| 53 | + $paymentFeeLabel = $this->getBuckarooPaymentFeeLabel( |
| 54 | + \Buckaroo\Magento2\Model\Method\Blik::PAYMENT_METHOD_CODE |
| 55 | + ); |
| 56 | + |
| 57 | + return [ |
| 58 | + 'payment' => [ |
| 59 | + 'buckaroo' => [ |
| 60 | + 'blik' => [ |
| 61 | + 'paymentFeeLabel' => $paymentFeeLabel, |
| 62 | + 'subtext' => $this->getSubtext(), |
| 63 | + 'subtext_style' => $this->getSubtextStyle(), |
| 64 | + 'subtext_color' => $this->getSubtextColor(), |
| 65 | + 'allowedCurrencies' => $this->getAllowedCurrencies(), |
| 66 | + ], |
| 67 | + ], |
| 68 | + ], |
| 69 | + ]; |
| 70 | + } |
| 71 | + |
| 72 | + /** |
| 73 | + * @param null|int $storeId |
| 74 | + * |
| 75 | + * @return float |
| 76 | + */ |
| 77 | + public function getPaymentFee($storeId = null) |
| 78 | + { |
| 79 | + $paymentFee = $this->scopeConfig->getValue( |
| 80 | + self::XPATH_BLIK_PAYMENT_FEE, |
| 81 | + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, |
| 82 | + $storeId |
| 83 | + ); |
| 84 | + |
| 85 | + return $paymentFee ? $paymentFee : false; |
| 86 | + } |
| 87 | +} |
0 commit comments