name = 'webmoney'; $this->tab = 'Payment'; $this->version = '0.4'; $this->currencies = true; $this->currencies_mode = 'checkbox'; $config = Configuration::getMultiple(array('WEBMONEY_PURSE_R', 'WEBMONEY_PURSE_Z', 'WEBMONEY_PURSE_E', 'WEBMONEY_KEY')); if (isset($config['WEBMONEY_PURSE_R'])) $this->purse_r = $config['WEBMONEY_PURSE_R']; if (isset($config['WEBMONEY_PURSE_Z'])) $this->purse_z = $config['WEBMONEY_PURSE_Z']; if (isset($config['WEBMONEY_PURSE_E'])) $this->purse_e = $config['WEBMONEY_PURSE_E']; if (isset($config['WEBMONEY_PURSE_U'])) $this->purse_e = $config['WEBMONEY_PURSE_U']; if (isset($config['WEBMONEY_KEY'])) $this->ikey = $config['WEBMONEY_KEY']; parent::__construct(); $this->displayName = $this->l('WebMoney'); $this->description = $this->l('Accepts payments by WebMoney'); $this->confirmUninstall = $this->l('Are you sure you want to delete your details ?'); if (!isset($this->purse_r) OR !isset($this->purse_z) OR !isset($this->purse_e)) $this->warning = $this->l('Add any purse'); if (!isset($this->ikey)) $this->warning = $this->l('Add secret key'); } public function install() { if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn')) return false; return true; } public function uninstall() { if (!Configuration::deleteByName('WEBMONEY_PURSE_R') OR !Configuration::deleteByName('WEBMONEY_PURSE_Z') OR !Configuration::deleteByName('WEBMONEY_PURSE_E') OR !Configuration::deleteByName('WEBMONEY_PURSE_U') OR !Configuration::deleteByName('WEBMONEY_KEY') OR !parent::uninstall()) return false; return true; } private function _postValidation() { if (isset($_POST['submitWebmoney'])) { if (empty($_POST['purse_r']) && empty($_POST['purse_z']) && empty($_POST['purse_e'])) $this->_postErrors[] = $this->l('Add any purse'); if (empty($_POST['ikey'])) $this->_postErrors[] = $this->l('Add secret key'); } } private function _postProcess() { if (isset($_POST['submitWebmoney'])) { Configuration::updateValue('WEBMONEY_PURSE_R', $_POST['purse_r']); Configuration::updateValue('WEBMONEY_PURSE_Z', $_POST['purse_z']); Configuration::updateValue('WEBMONEY_PURSE_E', $_POST['purse_e']); Configuration::updateValue('WEBMONEY_PURSE_U', $_POST['purse_u']); Configuration::updateValue('WEBMONEY_KEY', $_POST['ikey']); } $this->_html .= '