PAYONE-GmbH /
magento-2
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
||
| 5 | * it under the terms of the GNU Lesser General Public License as published by |
||
| 6 | * the Free Software Foundation, either version 3 of the License, or |
||
| 7 | * (at your option) any later version. |
||
| 8 | * |
||
| 9 | * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 12 | * GNU Lesser General Public License for more details. |
||
| 13 | * |
||
| 14 | * You should have received a copy of the GNU Lesser General Public License |
||
| 15 | * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
||
| 16 | * |
||
| 17 | * PHP version 5 |
||
| 18 | * |
||
| 19 | * @category Payone |
||
| 20 | * @package Payone_Magento2_Plugin |
||
| 21 | * @author FATCHIP GmbH <[email protected]> |
||
| 22 | * @copyright 2003 - 2016 Payone GmbH |
||
| 23 | * @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
||
| 24 | * @link http://www.payone.de |
||
| 25 | */ |
||
| 26 | |||
| 27 | namespace Payone\Core\Setup; |
||
| 28 | |||
| 29 | use Magento\Framework\Setup\ModuleContextInterface; |
||
|
0 ignored issues
–
show
|
|||
| 30 | use Magento\Framework\Setup\ModuleDataSetupInterface; |
||
| 31 | use Magento\Sales\Setup\SalesSetupFactory; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Class for adding columns to the order grid table |
||
| 35 | */ |
||
| 36 | class InstallData implements \Magento\Framework\Setup\InstallDataInterface |
||
| 37 | { |
||
| 38 | /** |
||
| 39 | * Sales setup factory |
||
| 40 | * |
||
| 41 | * @var SalesSetupFactory |
||
| 42 | */ |
||
| 43 | protected $salesSetupFactory; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Constructor |
||
| 47 | * |
||
| 48 | * @param SalesSetupFactory $salesSetupFactory |
||
| 49 | */ |
||
| 50 | public function __construct(SalesSetupFactory $salesSetupFactory) |
||
| 51 | { |
||
| 52 | $this->salesSetupFactory = $salesSetupFactory; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Constructor |
||
| 57 | * |
||
| 58 | * @param ModuleDataSetupInterface $setup |
||
| 59 | * @param ModuleContextInterface $context |
||
| 60 | * @return void |
||
| 61 | */ |
||
| 62 | public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) |
||
| 63 | { |
||
| 64 | $setup->startSetup(); |
||
| 65 | $salesInstaller = $this->salesSetupFactory->create(['resourceName' => 'sales_setup', 'setup' => $setup]); |
||
| 66 | $salesInstaller->addAttribute( |
||
| 67 | 'order', |
||
| 68 | 'payone_txid', |
||
| 69 | ['type' => 'varchar', 'length' => 64, 'default' => '', 'grid' => true] |
||
| 70 | ); |
||
| 71 | $salesInstaller->addAttribute( |
||
| 72 | 'order', |
||
| 73 | 'payone_refnr', |
||
| 74 | ['type' => 'varchar', 'length' => 32, 'default' => '', 'grid' => true] |
||
| 75 | ); |
||
| 76 | $salesInstaller->addAttribute( |
||
| 77 | 'order', |
||
| 78 | 'payone_transaction_status', |
||
| 79 | ['type' => 'varchar', 'length' => 32, 'default' => '', 'grid' => true] |
||
| 80 | ); |
||
| 81 | $salesInstaller->addAttribute( |
||
| 82 | 'order', |
||
| 83 | 'payone_authmode', |
||
| 84 | ['type' => 'varchar', 'length' => 32, 'default' => '', 'grid' => true] |
||
| 85 | ); |
||
| 86 | $salesInstaller->addAttribute( |
||
| 87 | 'order', |
||
| 88 | 'payone_mode', |
||
| 89 | ['type' => 'varchar', 'length' => 8, 'default' => ''] |
||
| 90 | ); |
||
| 91 | $salesInstaller->addAttribute( |
||
| 92 | 'order', |
||
| 93 | 'payone_mandate_id', |
||
| 94 | ['type' => 'varchar', 'length' => 64, 'default' => ''] |
||
| 95 | ); |
||
| 96 | |||
| 97 | $this->preconfigureGermanPaymentTitles($setup); |
||
| 98 | |||
| 99 | $setup->endSetup(); |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Add German payment title for stores with German locale |
||
| 104 | * |
||
| 105 | * @param ModuleDataSetupInterface $setup |
||
| 106 | * @return void |
||
| 107 | */ |
||
| 108 | protected function preconfigureGermanPaymentTitles(ModuleDataSetupInterface $setup) |
||
| 109 | { |
||
| 110 | $select = $setup->getConnection() |
||
| 111 | ->select() |
||
| 112 | ->from($setup->getTable('core_config_data'), ['scope', 'scope_id']) |
||
| 113 | ->where('path = "general/locale/code"') |
||
| 114 | ->where('value LIKE "de_%"') |
||
| 115 | ->order(['scope_id', 'scope']); |
||
| 116 | $result = $setup->getConnection()->fetchAssoc($select); |
||
| 117 | |||
| 118 | foreach ($result as $item) { |
||
| 119 | $this->addGermanPaymentTitles($setup, $item['scope'], $item['scope_id']); |
||
| 120 | } |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * Inserts new config rows with German payment titles in core_config_data table |
||
| 125 | * |
||
| 126 | * @param ModuleDataSetupInterface $setup |
||
| 127 | * @param string $scope |
||
| 128 | * @param string $scopeId |
||
| 129 | * @return void |
||
| 130 | */ |
||
| 131 | protected function addGermanPaymentTitles(ModuleDataSetupInterface $setup, $scope, $scopeId) |
||
| 132 | { |
||
| 133 | $translations = [ |
||
| 134 | 'payone_cash_on_delivery' => 'PAYONE Nachnahme', |
||
| 135 | 'payone_creditcard' => 'PAYONE Kreditkarte', |
||
| 136 | 'payone_debit' => 'PAYONE Lastschrift', |
||
| 137 | 'payone_advance_payment' => 'PAYONE Vorkasse', |
||
| 138 | 'payone_invoice' => 'PAYONE Rechnung', |
||
| 139 | 'payone_safe_invoice' => 'PAYONE Gesicherter Rechnungskauf', |
||
| 140 | 'payone_bnpl_invoice' => 'PAYONE Gesicherter Rechnungskauf', |
||
| 141 | 'payone_bnpl_debit' => 'PAYONE Gesicherte Lastschrift', |
||
| 142 | 'payone_bnpl_installment' => 'PAYONE Gesicherter Ratenkauf', |
||
| 143 | ]; |
||
| 144 | |||
| 145 | foreach ($translations as $paymentId => $translation) { |
||
| 146 | $setup->getConnection()->insert( |
||
| 147 | $setup->getTable('core_config_data'), |
||
| 148 | [ |
||
| 149 | 'scope' => $scope, |
||
| 150 | 'scope_id' => $scopeId, |
||
| 151 | 'path' => 'payment/'.$paymentId.'/title', |
||
| 152 | 'value' => $translation, |
||
| 153 | ] |
||
| 154 | ); |
||
| 155 | } |
||
| 156 | } |
||
| 157 | } |
||
| 158 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths