* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ require_once dirname(__FILE__) . '/../../bootstrap.php'; class RetailcrmSettingsController extends RetailcrmAdminPostAbstractController { protected function postHandler() { $settings = new RetailcrmSettings($this->module); return $settings->save(); } protected function getHandler() { if (null === $this->module->reference) { return [ 'success' => false, 'errorMsg' => 'Set api key & url first', ]; } $result = [ 'success' => true, ]; if (Tools::getIsset('catalog')) { $result['catalog'] = RetailcrmSettingsHelper::getIcmlFileInfo(); } if (Tools::getIsset('delivery')) { $result['delivery'] = $this->module->reference->getApiDeliveryTypes( ); // todo replace with helper function } if (Tools::getIsset('payment')) { $result['payment'] = $this->module->reference->getApiPaymentTypes( ); // todo replace with helper function } if (Tools::getIsset('status')) { $result['status'] = $this->module->reference->getApiStatusesWithGroup( ); // todo replace with helper function } return $result; } }