public function configure() { if (null !== ($response = $this->checkAuth(array(AdminResources::MODULE), array('BitpayPayments'), AccessManager::UPDATE))) { return $response; } $conf = new BitpayPaymentsConfig(); $one_is_done = 0; $tab = ""; $form = new \BitpayPayments\Form\ConfigureBitpayPayments($this->getRequest()); try { $vform = $this->validateForm($form); $conf->setApiKey($vform->get('apiKey')->getData())->getPairingKey($vform->get('pairingKey')->getData())->write(); $one_is_done = 1; $tab = "configure_account"; } catch (\Exception $e) { } $form = new \BitpayPayments\Form\ConfigureSandboxBitpayPayments($this->getRequest()); try { $vform = $this->validateForm($form); $tab = "configure_sandbox"; $conf->setApiKeySandbox($vform->get('apiKey')->getData())->setPairingKeySandbox($vform->get('pairingKey')->getData())->setSandbox($vform->get('sandbox')->getData() ? "true" : ""); $conf->write(); } catch (\Exception $e) { } //Redirect to module configuration page $this->redirectToRoute("admin.module.configure", array(), array('module_code' => BitpayPayments::getModCode(true), 'current_tab' => $tab, '_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction')); }
/** * @return int */ public static function getModCode($flag = false) { $obj = new BitpayPayments(); $mod_code = $obj->getCode(); if ($flag) { return $mod_code; } $search = ModuleQuery::create()->findOneByCode($mod_code); return $search->getId(); }