/** * {@inheritdoc} */ public function getConfig() { $configured_methods = $this->_configuredMethodFactory->create(); $config = []; foreach ($this->methodCodes as $code) { if ($this->methods[$code]->isAvailable()) { $config['payment'][$code]['settings'] = $this->methods[$code]->getFrontConfigArray(); } } $config['payment'][Smart2Pay::METHOD_CODE]['images_url'] = $this->getViewFileUrl('Smart2Pay_GlobalPay::images'); $config['payment'][Smart2Pay::METHOD_CODE]['methods'] = $configured_methods->getAllConfiguredMethodsPerCountryCode(); return $config; }
/** * @param bool|array $params * * @return array */ public function getAllConfiguredMethods($params = false) { if (empty($params) or !is_array($params)) { $params = array(); } return $this->_configuredMethodsFactory->create()->getAllConfiguredMethods($params); }
/** * {@inheritdoc} * * {@inheritdoc}. This specific method will not invalidate config cache as we don't use config caching (we save in separate table) * * @return $this */ public function afterSave() { if (!is_array($this->_methods_to_save)) { return $this; } $configured_methods_obj = $this->_configuredMethodsFactory->create(); if (($save_result = $configured_methods_obj->saveConfiguredMethods($this->_methods_to_save)) !== true) { if (!is_array($save_result)) { $error_msg = __('Error saving methods to database. Please try again.'); } else { $error_msg = implode('<br/>', $save_result); } throw new \Magento\Framework\Exception\LocalizedException($error_msg); } return $this; }