|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * NOTICE OF LICENSE |
| 5 | + * |
| 6 | + * This source file is subject to the MIT License |
| 7 | + * It is available through the world-wide-web at this URL: |
| 8 | + * https://tldrlegal.com/license/mit-license |
| 9 | + * If you are unable to obtain it through the world-wide-web, please send an email |
| 10 | + * to [email protected] so we can send you a copy immediately. |
| 11 | + * |
| 12 | + * DISCLAIMER |
| 13 | + * |
| 14 | + * Do not edit or add to this file if you wish to upgrade this module to newer |
| 15 | + * versions in the future. If you wish to customize this module for your |
| 16 | + * needs please contact [email protected] for more information. |
| 17 | + * |
| 18 | + * @copyright Copyright (c) Buckaroo B.V. |
| 19 | + * @license https://tldrlegal.com/license/mit-license |
| 20 | + */ |
| 21 | + |
| 22 | +namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config; |
| 23 | + |
| 24 | +use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig; |
| 25 | + |
| 26 | +class Applepay extends AbstractConfig |
| 27 | +{ |
| 28 | + /** |
| 29 | + * @inheritDoc |
| 30 | + */ |
| 31 | + public function getConfig() |
| 32 | + { |
| 33 | + return [ |
| 34 | + [ |
| 35 | + "key" => "storeName", |
| 36 | + "value" => $this->getConfigValue('storeName') |
| 37 | + ], |
| 38 | + [ |
| 39 | + "key" => "currency", |
| 40 | + "value" => $this->getConfigValue('currency') |
| 41 | + ], |
| 42 | + [ |
| 43 | + "key" => "cultureCode", |
| 44 | + "value" => $this->getConfigValue('cultureCode') |
| 45 | + ], |
| 46 | + [ |
| 47 | + "key" => "country", |
| 48 | + "value" => $this->getConfigValue('country') |
| 49 | + ], |
| 50 | + [ |
| 51 | + "key" => "guid", |
| 52 | + "value" => $this->getConfigValue('guid') |
| 53 | + ], |
| 54 | + [ |
| 55 | + "key" => "buttonStyle", |
| 56 | + "value" => $this->getConfigValue('buttonStyle') |
| 57 | + ], |
| 58 | + [ |
| 59 | + "key" => "dontAskBillingInfoInCheckout", |
| 60 | + "value" => $this->getConfigValue('dontAskBillingInfoInCheckout') |
| 61 | + ], |
| 62 | + [ |
| 63 | + "key" => "availableButtons", |
| 64 | + "value" => $this->getAvailableButtons() |
| 65 | + ] |
| 66 | + |
| 67 | + ]; |
| 68 | + } |
| 69 | + |
| 70 | + protected function getConfigValue($key) |
| 71 | + { |
| 72 | + return $this->configProvider->getConfig()['payment']['buckaroo']['applepay'][$key]; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Get list of available buttons |
| 77 | + * |
| 78 | + * @return string |
| 79 | + */ |
| 80 | + protected function getAvailableButtons() |
| 81 | + { |
| 82 | + $result = ''; |
| 83 | + $availableButtons = $this->getConfigValue('availableButtons'); |
| 84 | + if (is_countable($availableButtons) && count($availableButtons)) { |
| 85 | + $result = implode(",", $availableButtons); |
| 86 | + } |
| 87 | + |
| 88 | + return $result; |
| 89 | + } |
| 90 | +} |
0 commit comments