{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"autodispatch","path":"autodispatch","contentType":"directory"},{"name":"bin","path":"bin","contentType":"directory"},{"name":"controllers","path":"controllers","contentType":"directory"},{"name":"images","path":"images","contentType":"directory"},{"name":"log","path":"log","contentType":"directory"},{"name":"param","path":"param","contentType":"directory"},{"name":"views","path":"views","contentType":"directory"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".htaccess","path":".htaccess","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"fr.php","path":"fr.php","contentType":"file"},{"name":"logo.gif","path":"logo.gif","contentType":"file"},{"name":"logo.png","path":"logo.png","contentType":"file"},{"name":"tggatos.php","path":"tggatos.php","contentType":"file"}],"totalCount":15}},"fileTreeProcessingTime":5.815022000000001,"foldersToFetch":[],"repo":{"id":8097127,"defaultBranch":"5.1.0","name":"prestashop-tggatos-module","ownerLogin":"TrogloGeek","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2013-02-08T16:47:01.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/3205686?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"RC_3.1.0","listCacheKey":"v0:1551020791.0","canEdit":false,"refType":"branch","currentOid":"75fcedeea28f4d4c78bf4e8c658ec2512b9ee325"},"path":"tggatos.php","currentUser":null,"blob":{"rawLines":[" '',","\t\t'cyberplus' => 'CyberPlus - Banque Populaire',","\t\t'etransactions' => 'E-Transactions - Crédit Agricole',","\t\t'elysnet' => 'ElysNet - CCF/HSBC',","\t\t'mercanet' => 'Mercanet - BNP',","\t\t'scelliusnet' => 'ScelliusNet - La Banque Postale',","\t\t'sherlocks' => 'Sherlocks - LCL',","\t\t'sogenactif' => 'Sogenactif - Société Générale',","\t\t'webaffaires' => 'WebAffaires - Crédit du Nord',","\t\t'citelis' => 'Citélis',","\t\t'smc' => 'Société Marseillaise de Crédit'","\t);","\tprivate $_demoCertificates = array(","\t\t'cyberplus' => '038862749811111',","\t\t'etransactions' => '013044876511111',","\t\t'elysnet' => '014102450311111',","\t\t'mercanet' => '082584341411111',","\t\t'scelliusnet' => '014141675911111',","\t\t'sherlocks' => '014295303911111',","\t\t'sogenactif' => '014213245611111',","\t\t'webaffaires' => '014022286611111',","\t\t'citelis' => '029800266211111',","\t\t'smc' => '011223344551111'","\t);","\t","\tprivate $_hasTransacIDAvailableCached = null;","\t","\t/**","\t * Module's constructor","\t */","\tpublic function __construct() ","\t{","\t\t$this->name = strtolower(get_class($this));","\t\t$this->author = 'TrogloGeek';","\t\t$this->tab = 'payments_gateways';","\t\t$this->need_instance = 1;","\t\t$this->version = '3.1.0';","\t\t$this->currencies_mode = 'checkbox';","\t\t$this->ps_versions_compliancy['min'] = '1.5.0.1';","\t\t$this->ps_versions_compliancy['max'] = '1.6';","\t\tparent::__construct();","\t\tif (empty($this->_path))","\t\t\t$this->_path = __PS_BASE_URI__.'modules/'.$this->name.'/';","\t\t$this->displayName = $this->l('CC Payment with SIPS/ATOS');","\t\t$this->description = $this->l('SIPS/ATOS payment module by TrogloGeek');","\t\t$this->confirmUninstall = $this->l('Uninstall this module will erase your configuration including current transaction ID, continue ?');","\t\tif ($this->context->employee instanceof Employee","\t\t\t\t&& $this->context->employee->isLoggedBack()","\t\t\t\t&& ($this->context->controller instanceof AdminModulesController)","\t\t\t\t&& !in_array($this->name, explode('|', Tools::getValue('configure', ''))))","\t\t{","\t\t\t$this->autoCheck();","\t\t}","\t}","\t","\t/**","\t * Returns internal configuration value","\t * @param string $varname name of internal configuration variable to fetch","\t * @return string","\t */","\tpublic function get($varname)","\t{","\t\t$this->initConfVars();","\t\t$value = Configuration::get(strtoupper($this->name).'_'.$varname);","\t\tif ($this->_confVarsByName[$varname]['type'] == self::T_BOOL)","\t\t\t$value = (bool)$value;","\t\treturn $value;","\t}","\t","\t/**","\t * Sets internal configuration value","\t * @param string $varname name of internal configuration variable to set","\t * @param string $value value to set","\t * @return boolean Update result","\t */","\tpublic function set($varname, $value) ","\t{","\t\t$this->initConfVars();","\t\tswitch ($this->_confVarsByName[$varname]['type'])","\t\t{","\t\t\tcase self::T_NONE:","\t\t\t\treturn false;","\t\t\tcase self::T_BOOL:","\t\t\t\t$value = intval((bool)$value);","\t\t\t\tbreak;","\t\t\tcase self::T_INT:","\t\t\t\t$value = intval($value);","\t\t\t\tbreak;","\t\t\tcase self::T_UNSIGNED_INT:","\t\t\t\t$value = max(intval($value), 0);","\t\t\t\tbreak;","\t\t\tcase self::T_ABS_POSITIVE_INT:","\t\t\t\t$value = max(intval($value), 1);","\t\t\t\tbreak;","\t\t\tcase self::T_FLOAT:","\t\t\t\tif (is_string($value))","\t\t\t\t{","\t\t\t\t\t$localeinfo = localeconv();","\t\t\t\t\t$value = preg_replace('/[.,]/', $localeinfo['decimal_point'], $value);","\t\t\t\t}","\t\t\t\t$value = floatval($value);","\t\t\t\tbreak;","\t\t\tcase self::T_UNSIGNED_FLOAT:","\t\t\t\tif (is_string($value))","\t\t\t\t{","\t\t\t\t\t$localeinfo = localeconv();","\t\t\t\t\t$value = preg_replace('/[.,]/', $localeinfo['decimal_point'], $value);","\t\t\t\t}","\t\t\t\t$value = max(floatval($value), 0.0);","\t\t\t\tbreak;","\t\t\tcase self::T_STRING:","\t\t\tcase self::T_URI:","\t\t\t\t$value = (string)$value;","\t\t\t\tbreak;","\t\t\tcase self::T_PATH:","\t\t\t\t$value = rtrim((string)$value, '/\\\\').DIRECTORY_SEPARATOR;","\t\t\t\tbreak;","\t\t\tdefault:","\t\t\t\tthrow new PrestaShopModuleException('Unknown type for confVar '.$varname);","\t\t}","\t\treturn Configuration::updateValue(strtoupper($this->name).'_'.$varname, $value);","\t}","\t","\tpublic function deleteVar($varname)","\t{","\t\tConfiguration::deleteByName(strtoupper($this->name).'_'.$varname);","\t}","\t","\tpublic function getTable($table, $addPrefix = true)","\t{","\t\treturn ($addPrefix ? _DB_PREFIX_ : '').$this->name.$table;","\t}","\t","\tpublic function install()","\t{","\t\t$result = true;","\t\ttry {","\t\t\tif (!parent::install()) {","\t\t\t\tthrow new Exception($this->l('Fatal error: parent::install(): Prestashop internal module installation procedure failed, installation can\\'t go any further.'));","\t\t\t}","\t\t} catch (Exception $e) ","\t\t{","\t\t\t$result = false;","\t\t\t$this->_errors[] = sprintf('%s(%u): %s'.PHP_EOL.'%s'.PHP_EOL.'%s', $e->getFile(), $e->getLine(), $e->getMessage(), $e->getTraceAsString(), $e->getPrevious());","\t\t}","\t\tforeach (array('displayPayment', 'displayPaymentReturn') as $hook)","\t\t\tif ($result)","\t\t\t{","\t\t\t\tif (!$this->registerHook($hook))","\t\t\t\t{","\t\t\t\t\t$result = false;","\t\t\t\t\t$this->_errors[] = sprintf($this->l('Unable to subscribe to hook %s'), $hook);","\t\t\t\t}","\t\t\t}","\t\tif ($result)","\t\t{","\t\t\t$DB = Db::getInstance(TRUE);","\t\t\ttry {","\t\t\t\tif (!$DB->execute('","\t\t\t\t\tCREATE TABLE IF NOT EXISTS `'.$this->getTable(self::TABLE_TRANSACTION_TODAY).'` (","\t\t\t\t\t\t`date`\t\t\t\tDATE\t\t\t\tNOT NULL,","\t\t\t\t\t\t`transaction_id`\tMEDIUMINT UNSIGNED\tNOT NULL\tAUTO_INCREMENT,","\t\t\t\t\t\tPRIMARY KEY (`date`,`transaction_id`)","\t\t\t\t\t)","\t\t\t\t\tENGINE=MyISAM","\t\t\t\t\t;","\t\t\t\t', false)) {","\t\t\t\t\tthrow new Exception(sprintf($this->l('Fatal error: Installation of the database table failed, error code: %u, error message: %s'), $DB->getNumberError(), $DB->getMsgError()));","\t\t\t\t}","\t\t\t}","\t\t\tcatch (Exception $e)","\t\t\t{","\t\t\t\t$result = false;","\t\t\t\t$this->_errors[] = sprintf('%s(%u): %s'.PHP_EOL.'%s'.PHP_EOL.'%s', $e->getFile(), $e->getLine(), $e->getMessage(), $e->getTraceAsString(), $e->getPrevious());","\t\t\t}","\t\t}","\t\tif ($result)","\t\t{","\t\t\t$this->setDefaults();","\t\t\t$this->updateAtosParamFiles();","\t\t}","\t\telse ","\t\t{","\t\t\tparent::uninstall();","\t\t}","\t\treturn $result;","\t}","\t","\tpublic function uninstall()","\t{","\t\tDb::getInstance(TRUE)->execute('DROP TABLE IF EXISTS `'.$this->getTable(self::TABLE_TRANSACTION_TODAY).'`', false);","\t\t$this->initConfVars();","\t\tforeach ($this->_confVarsByName as $varname)","\t\t\t$this->deleteVar($varname);","\t\treturn parent::uninstall();","\t}","\t","\t/**","\t * Check if this payment method can be used, with optionnal additionnal checks against cart","\t * @param int $mode self::MODE_* or NULL to perform only basic health checks","\t * @param Cart $cart","\t * @param bool $skipHealthChecks","\t */","\tpublic function canProcess($mode = NULL, Cart $cart = null, $skipHealthChecks = FALSE)","\t{","\t\tif (!$this->id)","\t\t\treturn false;","\t\tif (!$this->active)","\t\t\treturn false;","\t\t","\t\tswitch ($mode)","\t\t{","\t\t\tcase self::MODE_SINGLE:","\t\t\t\tif (!$this->get(self::CNF_SINGLE)) return false;","\t\t\t\tbreak;","\t\t\tcase self::MODE_2TPAYMENT:","\t\t\t\tif (!$this->get(self::CNF_2TPAYMENT)) return false;","\t\t\t\tbreak;","\t\t\tcase self::MODE_3TPAYMENT:","\t\t\t\tif (!$this->get(self::CNF_3TPAYMENT)) return false;","\t\t\t\tbreak;","\t\t\tcase NULL:","\t\t\t\tbreak;","\t\t\tdefault:","\t\t\t\tthrow new PrestaShopModuleException('Invalid Argument $mode');","\t\t}","\t\t","\t\tif (!$skipHealthChecks) {","\t\t\tif (!$this->get(self::CNF_BANK) || !array_key_exists($this->get(self::CNF_BANK), $this->_banks))","\t\t\t\treturn false;","\t\t\tif ($this->get(self::CNF_PRODUCTION) && !$this->get(self::CNF_MERCHANT_ID))","\t\t\t\treturn false;","\t\t\tif (!$this->get(self::CNF_NO_TID_GENERATION))","\t\t\t{","\t\t\t\tif ($this->get(self::CNF_MIN_TID) > $this->get(self::CNF_MAX_TID))","\t\t\t\t\treturn false;","\t\t\t\t$last_tid = Db::getInstance(TRUE)->getValue('SELECT max(transaction_id) as value FROM `'.$this->getTable(self::TABLE_TRANSACTION_TODAY).'` WHERE `date` = \\''.date('Y-m-d').'\\'', FALSE);","\t\t\t\tif (!empty($last_tid) && intval($last_tid) >= $this->get(self::CNF_MAX_TID))","\t\t\t\t\treturn false;","\t\t\t}","\t\t}","\t\t","\t\tif (!is_null($mode) && !empty($cart)) {","\t\t\tif ($cart->getOrderTotal() < $this->defaultCurrencyConvert($this->getMinAmount($mode), $cart->id_currency, self::CONVERT_FROM_DEFAULT))","\t\t\t\treturn false;","\t\t}","\t\treturn true;","\t}","\t","\t/**","\t * Hook displayPayment which displays available payment methods","\t * @param array $params Hook params","\t * @return boolean|string","\t */","\tpublic function hookDisplayPayment($params)","\t{","\t\tif (!$this->canProcess())","\t\t\treturn false;","\t\t$cart = $params['cart'];","\t\t/* @var $cart Cart */","\t\t$this->smarty->assign(array(","\t\t\t'TggAtos' => $this,","\t\t\t'tggatos_cart' => $cart","\t\t), null, true);","\t\t","\t\tif ($this->get(self::CNF_SKIP_REDIRECTION_CONTROLLER))","\t\t{","\t\t\t$transaction_id = $this->generateTransactionId();","\t\t\tif (!$transaction_id)","\t\t\t{","\t\t\t\t$this->error(__LINE__, 'No transaction_id generated', 3, null, false);","\t\t\t\treturn false;","\t\t\t}","\t\t\t$currency = Currency::getCurrencyInstance(intval($cart->id_currency));","\t\t\t$cartAmount = $cart->getOrderTotal();","\t\t\t$mergeParams = array(","\t\t\t\t'customer_id' => $this->context->customer->id,","\t\t\t\t'order_id' => $cart->id ","\t\t\t);","\t\t\tif ($this->canProcess(self::MODE_SINGLE, $cart, true))","\t\t\t{","\t\t\t\t$singleAmount = $cartAmount + $this->getPaymentFees($cartAmount, $currency, self::MODE_SINGLE);","\t\t\t\t$this->smarty->assign(array(","\t\t\t\t\t'tggatos_singleAmount' => $singleAmount,","\t\t\t\t\t'tggatos_singleForm' => $this->getPaymentRedirectionForm(","\t\t\t\t\t\t$singleAmount,","\t\t\t\t\t\t$currency,","\t\t\t\t\t\tself::MODE_SINGLE,","\t\t\t\t\t\t$mergeParams,","\t\t\t\t\t\t$transaction_id","\t\t\t\t\t)","\t\t\t\t), null, true);","\t\t\t} else {","\t\t\t\t$this->smarty->assign('tggatos_singleForm', false, true);","\t\t\t}","\t\t\tif ($this->canProcess(self::MODE_2TPAYMENT, $cart, true))","\t\t\t{","\t\t\t\t$m2tAmount = $cartAmount + $this->getPaymentFees($cartAmount, $currency, self::MODE_2TPAYMENT);","\t\t\t\t$this->smarty->assign(array(","\t\t\t\t\t'tggatos_2tAmount' => $m2tAmount,","\t\t\t\t\t'tggatos_2tForm' => $this->getPaymentRedirectionForm(","\t\t\t\t\t\t$m2tAmount,","\t\t\t\t\t\t$currency,","\t\t\t\t\t\tself::MODE_2TPAYMENT,","\t\t\t\t\t\t$mergeParams,","\t\t\t\t\t\t$transaction_id","\t\t\t\t\t)","\t\t\t\t), null, true);","\t\t\t} else {","\t\t\t\t$this->smarty->assign('tggatos_2tForm', false, true);","\t\t\t}","\t\t\tif ($this->canProcess(self::MODE_3TPAYMENT, $cart, true))","\t\t\t{","\t\t\t\t$m3tAmount = $cartAmount + $this->getPaymentFees($cartAmount, $currency, self::MODE_3TPAYMENT);","\t\t\t\t$this->smarty->assign(array(","\t\t\t\t\t'tggatos_3tAmount' => $m3tAmount,","\t\t\t\t\t'tggatos_3tForm' => $this->getPaymentRedirectionForm(","\t\t\t\t\t\t$m3tAmount,","\t\t\t\t\t\t$currency,","\t\t\t\t\t\tself::MODE_3TPAYMENT,","\t\t\t\t\t\t$mergeParams,","\t\t\t\t\t\t$transaction_id","\t\t\t\t\t)","\t\t\t\t), null, true);","\t\t\t} else {","\t\t\t\t$this->smarty->assign('tggatos_3tForm', false, true);","\t\t\t}","\t\t\treturn $this->display(__FILE__, 'direct_payment.tpl');","\t\t} else {","\t\t\t$this->smarty->assign(array(","\t\t\t\t'tggatos_modeSingleLink' => $this->context->link->getModuleLink($this->name, 'payment', array('mode' => self::MODE_SINGLE)),","\t\t\t\t'tggatos_mode2tLink' => $this->context->link->getModuleLink($this->name, 'payment', array('mode' => self::MODE_2TPAYMENT)),","\t\t\t\t'tggatos_mode3tLink' => $this->context->link->getModuleLink($this->name, 'payment', array('mode' => self::MODE_3TPAYMENT))","\t\t\t));","\t\t\treturn $this->display(__FILE__, 'payment.tpl');","\t\t}","\t}","\t","\tpublic function hookDisplayPaymentReturn($params)","\t{","\t\t$this->smarty->assign('tggatos_response', $this->getResponseFromLog(Tools::getValue('tggatos_date'), Tools::getValue('id_cart'), Tools::getValue('transaction_id')));","\t\treturn $this->display(__FILE__, 'payment_return.tpl');","\t}","\t","\t/**","\t * Generate payment redirection form by calling request binary of ATOS SIPS API","\t * @param float $amount","\t * @param Currency $currency","\t * @param int $mode self::MODE_*","\t * @param array $mergeParams","\t * @param string $transaction_id","\t * @return boolean|string","\t */","\tpublic function getPaymentRedirectionForm($amount, Currency $currency, $mode, $mergeParams = array(), $transaction_id = NULL)","\t{","\t\t$atosAmount = $amount;","\t\tif ($currency->decimals)","\t\t\t$atosAmount *= 100;","\t\t","\t\t$data = array();","\t\t$params = array(","\t\t\t'language' => $this->get(self::CNF_ISO_LANG) ? $this->get(self::CNF_ISO_LANG) : $this->context->language->iso_code,","\t\t\t'merchant_id' => $this->get(self::CNF_PRODUCTION) ? $this->get(self::CNF_MERCHANT_ID) : $this->_demoCertificates[$this->get(self::CNF_BANK)],","\t\t\t'currency_code' => $currency->iso_code_num,","\t\t\t'amount' => intval(round($atosAmount)),","\t\t\t'pathfile' => $this->get(self::CNF_PARAM_PATH).self::PATHFILE,","\t\t\t'normal_return_url' => $this->getBankReturnUri(self::RETURN_CONTEXT_USER),","\t\t\t'cancel_return_url' => $this->getBankReturnUri(self::RETURN_CONTEXT_USER),","\t\t\t'automatic_response_url' => $this->getBankReturnUri(self::RETURN_CONTEXT_SILENT)","\t\t);","\t\tif (!empty($_SERVER['REMOTE_ADDR']))","\t\t{","\t\t\t$params['customer_ip_address'] = substr($_SERVER['REMOTE_ADDR'], max(0, strlen($_SERVER['REMOTE_ADDR']) - 20), min(19, strlen($_SERVER['REMOTE_ADDR'])));","\t\t}","\t\tif (strlen($this->context->customer->email) <= 128)","\t\t\t$params['customer_email'] = $this->context->customer->email;","\t\tif (!is_null($transaction_id))","\t\t{","\t\t\t$params['transaction_id'] = $transaction_id;","\t\t} elseif (!$this->get(self::CNF_NO_TID_GENERATION)) {","\t\t\t$params['transaction_id'] = $this->generateTransactionId();","\t\t\tif (empty($params['transaction_id']))","\t\t\t{","\t\t\t\t$this->error(__LINE__, 'No transaction_id has been generated', 4);","\t\t\t\treturn false;","\t\t\t}","\t\t}","\t\tswitch ($mode)","\t\t{","\t\t\tcase self::MODE_SINGLE:","\t\t\t\t$params['payment_means'] = $this->get(self::CNF_PAYMENT_MEANS);","\t\t\t\t$params['capture_mode'] = $this->get(self::CNF_CAPTURE_MODE);","\t\t\t\t$params['capture_day'] = $this->get(self::CNF_CAPTURE_DAY);","\t\t\t\tbreak;","\t\t\tcase self::MODE_2TPAYMENT:","\t\t\t\t$params['payment_means'] = $this->get(self::CNF_2TPAYMENT_MEANS);","\t\t\t\t$params['capture_mode'] = 'PAYMENT_N';","\t\t\t\t$params['capture_day'] = $this->get(self::CNF_2TPAYMENT_DELAY);","\t\t\t\t$initialAmount = $this->defaultCurrencyConvert($this->get(self::CNF_2TPAYMENT_FP_FXD), $currency, self::CONVERT_FROM_DEFAULT) + $this->get(self::CNF_2TPAYMENT_FP_PCT) / 100 * $amount;","\t\t\t\tif ($currency->decimals)","\t\t\t\t\t$initialAmount *= 100;","\t\t\t\t$initialAmount = str_pad((string)intval(Tools::ps_round($initialAmount)), 3, '0', STR_PAD_LEFT);","\t\t\t\tarray_push($data, 'NB_PAYMENT=2', 'PERIOD='.$this->get(self::CNF_2TPAYMENT_SPACING), 'INITIAL_AMOUNT='.$initialAmount);","\t\t\t\tbreak;","\t\t\tcase self::MODE_3TPAYMENT:","\t\t\t\t$params['payment_means'] = $this->get(self::CNF_3TPAYMENT_MEANS);","\t\t\t\t$params['capture_mode'] = 'PAYMENT_N';","\t\t\t\t$params['capture_day'] = $this->get(self::CNF_3TPAYMENT_DELAY);","\t\t\t\t$initialAmount = $this->defaultCurrencyConvert($this->get(self::CNF_3TPAYMENT_FP_FXD), $currency, self::CONVERT_FROM_DEFAULT) + $this->get(self::CNF_3TPAYMENT_FP_PCT) / 100 * $amount;","\t\t\t\tif ($currency->decimals)","\t\t\t\t\t$initialAmount *= 100;","\t\t\t\t$initialAmount = str_pad((string)intval(Tools::ps_round($initialAmount)), 3, '0', STR_PAD_LEFT);","\t\t\t\tarray_push($data, 'NB_PAYMENT=3', 'PERIOD='.$this->get(self::CNF_3TPAYMENT_SPACING), 'INITIAL_AMOUNT='.$initialAmount);","\t\t\t\tbreak;","\t\t}","\t\tif ($this->get(self::CNF_FORCE_RETURN))","\t\t\tarray_push($data, 'NO_RESPONSE_PAGE');","\t\t$this->initConfVars();","\t\tforeach ($this->_confVarsByName as $name => $varconf)","\t\t\tif (!empty($varconf['autofeed']) && !empty($varconf['atos']))","\t\t\t\t$params[$varconf['atos']] = $this->get($name);","\t\tif (isset($mergeParams['data']))","\t\t{","\t\t\tif (is_null($mergeParams['data']))","\t\t\t{","\t\t\t\t$data = array();","\t\t\t} else {","\t\t\t\t$mergeData = is_array($mergeParams['data']) ? $mergeParams['data'] : explode(';', $mergeParams['data']);","\t\t\t\t$data = array_merge($data, $mergeData);","\t\t\t\tunset($mergeData);","\t\t\t}","\t\t}","\t\t$params['data'] = implode(';', $data);","\t\t$params = array_merge($params,$mergeParams);","\t\tif (!isset($params['receipt_complement']))","\t\t{","\t\t\t//This parameter is generated only if not overriden as we don't want to waste processing resources","\t\t\t// passing this parameter with value boolean FALSE will forbid template to be called","\t\t\t// and receipt_complement to be populated in ATOS SIPS API request call","\t\t\t$this->smarty->assign(array(","\t\t\t\t'TggAtos' => $this,","\t\t\t\t'tggatos_cart' => $this->context->cart,","\t\t\t\t'tggatos_params' => $params,","\t\t\t\t'tggatos_mode' => $mode,","\t\t\t\t'tggatos_fromCharset' => 'UTF-8',","\t\t\t\t'tggatos_toCharset' => 'ISO-8859-1//TRANSLIT'","\t\t\t), null, true);","\t\t\t$params['receipt_complement'] = trim($this->display(__FILE__, 'param_receipt_complement.tpl'));","\t\t\t//Charsets can be overriden by in-template assignation with scope=\"parent\"","\t\t\t$fromCharset = $this->smarty->getTemplateVars('tggatos_fromCharset');","\t\t\t$toCharset = $this->smarty->getTemplateVars('tggatos_toCharset');","\t\t\t$this->smarty->clearAssign('tggatos_fromCharset');","\t\t\t$this->smarty->clearAssign('tggatos_toCharset');","\t\t\tif (!empty($params['receipt_complement'])) {","\t\t\t\t$params['receipt_complement'] = iconv($fromCharset, $toCharset, $params['receipt_complement']);","\t\t\t\tif ($params['receipt_complement'] === FALSE) ","\t\t\t\t{","\t\t\t\t\t$this->error(__LINE__, sprintf('Iconv failed to convert encoding of receipt_complement from %s to %s', $fromCharset, $toCharset), 3);","\t\t\t\t\tunset($params['receipt_complement']);","\t\t\t\t} else {","\t\t\t\t\t$rawReceipt = $params['receipt_complement'];","\t\t\t\t\t$params['receipt_complement'] = '';","\t\t\t\t\t//Now we convert all non ASCII 128 character to an HTML entity as ATOS SIPS API is really old","\t\t\t\t\t// and seems to have problem with these characters. It's a waste of character, but it was my better idea","\t\t\t\t\t// to deal with it","\t\t\t\t\tfor ($c = 0; $c < strlen($rawReceipt); $c++)","\t\t\t\t\t\tif (ord($rawReceipt[$c]) <= 128)","\t\t\t\t\t\t\t$params['receipt_complement'] .= $rawReceipt[$c];","\t\t\t\t\t\telse","\t\t\t\t\t\t\t$params['receipt_complement'] .= ''.ord($rawReceipt[$c]).';';","\t\t\t\t\tif (strlen($params['receipt_complement']) > self::RECEIPT_COMPLEMENT_MAXLENGTH) {","\t\t\t\t\t\t$this->error(__LINE__, sprintf('Receipt complement is too long: %u characters long, %u characters max.', strlen($params['receipt_complement']), self::RECEIPT_COMPLEMENT_MAXLENGTH), 3, $params['receipt_complement']);","\t\t\t\t\t\tunset($params['receipt_complement']);","\t\t\t\t\t}","\t\t\t\t}","\t\t\t} else {","\t\t\t\tunset($params['receipt_complement']);","\t\t\t}","\t\t}","\t\t$params['amount'] = str_pad((string)$params['amount'], 3, '0', STR_PAD_LEFT);","\t\t$call = $this->rawCall(self::BIN_REQUEST, $this->paramsToArgs($params));","\t\tif ($call->exit_code != 0)","\t\t{","\t\t\t$this->error(__LINE__, sprintf('Error when calling request ATOS binary, exit code was: '.$call->exit_code), 4, $call);","\t\t\treturn false;","\t\t}","\t\t$result = new TggAtosModuleRequestOutputParser($call);","\t\tif (!$result->success)","\t\t{","\t\t\t$this->error(__LINE__, 'Atos invocation returned an error: '.$call->command, 4, $result);","\t\t\treturn false;","\t\t}","\t\treturn ($this->get(self::CNF_DEBUG_MODE) && !empty($result->error)) ? $result->error : $result->form;","\t}","\t","\t/**","\t * Uncypher bank response using ATOS SIPS response binary","\t * @param string $message","\t * @return boolean|TggAtosModuleResponseObject","\t */","\tpublic function uncypherResponse($message, $responseType)","\t{","\t\t$params = array(","\t\t\t'pathfile' => $this->get(self::CNF_PARAM_PATH).self::PATHFILE,","\t\t\t'message' => $message","\t\t);","\t\t$call = $this->rawCall(self::BIN_RESPONSE, $this->paramsToArgs($params));","\t\tif ($call->exit_code != 0)","\t\t{","\t\t\t$this->error(__LINE__, sprintf('Error when calling response ATOS binary, exit code was: %u', $call->exit_code), 4, $call);","\t\t\treturn false;","\t\t}","\t\t$result = new TggAtosModuleResponseOutputParser($call, $message, $responseType, $this);","\t\tif (!$result->success)","\t\t{","\t\t\t$this->error(__LINE__, 'Failure to uncypher bank response '.$message, 4, $result);","\t\t\treturn false;","\t\t}","\t\treturn $result->response;","\t}","\t","\t/**","\t * @param TggAtosModuleResponseObject $response","\t * @return Order","\t */","\t","\tpublic function processResponse(TggAtosModuleResponseObject $response)","\t{","\t\tif (is_null($response))","\t\t\tthrow new InvalidArgumentException('$response must be not null');","\t\t$this->logResponse($response);","\t\t$this->context->cart = new Cart(intval($response->order_id));","\t\tif (!Validate::isLoadedObject($this->context->cart))","\t\t\tthrow new PrestaShopModuleException('Payment cart cannot be loaded');","\t\tif (is_null($this->context->link))","\t\t\t$this->context->link = new Link();","\t\tif ($this->context->cart->orderExists())","\t\t{","\t\t\treturn new Order(Order::getOrderByCartId($this->context->cart->id));","\t\t} else {","\t\t\t$this->context->currency = Currency::getCurrencyInstance(Currency::getIdByIsoCodeNum($response->currency_code));","\t\t\tif (!Validate::isLoadedObject($this->context->currency))","\t\t\t\tthrow new PrestaShopModuleException('Payment currency cannot be loaded');","\t\t\tif ($response->capture_mode == 'PAYMENT_N')","\t\t\t{","\t\t\t\tswitch ($response->getDataVar('NB_PAYMENT'))","\t\t\t\t{","\t\t\t\t\tcase 2:","\t\t\t\t\t\t$mode = self::MODE_2TPAYMENT;","\t\t\t\t\tcase 3:","\t\t\t\t\t\t$mode = self::MODE_3TPAYMENT;","\t\t\t\t}","\t\t\t} else {","\t\t\t\t$mode = self::MODE_SINGLE;","\t\t\t}","\t\t\tswitch ($response->response_code)","\t\t\t{","\t\t\t\tcase '00':","\t\t\t\t\tswitch ($mode)","\t\t\t\t\t{","\t\t\t\t\t\tcase self::MODE_SINGLE:","\t\t\t\t\t\t\t$orderState = $this->get(self::CNF_OS_PAYMENT_SUCCESS);","\t\t\t\t\t\t\tbreak;","\t\t\t\t\t\tcase self::MODE_2TPAYMENT:","\t\t\t\t\t\t\t$orderState = $this->get(self::CNF_2TPAYMENT_OS);","\t\t\t\t\t\t\tbreak;","\t\t\t\t\t\tcase self::MODE_3TPAYMENT:","\t\t\t\t\t\t\t$orderState = $this->get(self::CNF_3TPAYMENT_OS);","\t\t\t\t\t\t\tbreak;","\t\t\t\t\t}","\t\t\t\t\tbreak;","\t\t\t\tcase '17':","\t\t\t\t\t$orderState = $this->get(self::CNF_OS_PAYMENT_CANCELLED);","\t\t\t\t\tbreak;","\t\t\t\tdefault:","\t\t\t\t\t$orderState = $this->get(self::CNF_OS_PAYMENT_FAILED);","\t\t\t\t\tbreak;","\t\t\t}","\t\t\tif (!$orderState)","\t\t\t\treturn NULL;","\t\t\t$amount = $response->amount;","\t\t\tif ($this->context->currency->decimals)","\t\t\t\t$amount /= 100;","\t\t\t$extraVars = array();","\t\t\t$orderLog = $this->get(self::CNF_ORDER_MESSAGE) ? array() : null;","\t\t\tforeach (TggAtosModuleResponseObject::$fields as $field)","\t\t\t{","\t\t\t\t$extraVars['tggatos_'.$field] = $response->{$field};","\t\t\t\tif (is_array($orderLog)) $orderLog[] = $field.': '.$response->{$field};","\t\t\t}","\t\t\t$extraVars['transaction_id'] = $response->{$this->get(self::CNF_OP_FIELD_TID)};","\t\t\t$this->validateOrder(","\t\t\t\t$this->context->cart->id,","\t\t\t\t$orderState,","\t\t\t\t$amount - $this->getPaymentFees($amount, $this->context->currency, $mode),","\t\t\t\t$this->displayName,","\t\t\t\timplode(PHP_EOL, $orderLog),","\t\t\t\t$extraVars,","\t\t\t\t$this->context->currency->id,","\t\t\t\tfalse,","\t\t\t\t$this->context->cart->secure_key","\t\t\t);","\t\t\t$order = new Order($this->currentOrder);","\t\t\t$orderPayments = OrderPayment::getByOrderReference($order->reference);","\t\t\tif (is_array($orderPayments) && count($orderPayments) == 1)","\t\t\t{","\t\t\t\t$orderPayment = array_shift($orderPayments);","\t\t\t\t/* @var $orderPayment OrderPayment */","\t\t\t\t$orderPayment->payment_method = $this->displayName;","\t\t\t\t$orderPayment->id_currency = $this->context->currency->id;","\t\t\t\t$orderPayment->conversion_rate = $this->context->currency->conversion_rate;","\t\t\t\t$orderPayment->card_brand = $response->payment_means;","\t\t\t\t$orderPayment->card_number = str_replace('.', ' #### #### ##', $response->card_number);","\t\t\t\tif ($response->capture_mode == 'PAYMENT_N')","\t\t\t\t{","\t\t\t\t\t$orderPayment->payment_method .= ' x'.$response->getDataVar('NB_PAYMENT');","\t\t\t\t}","\t\t\t\t$orderPayment->save();","\t\t\t}","\t\t\treturn $order;","\t\t}","\t}","\t","\t/**","\t * @var Currency","\t */","\tprotected $_defaultCurrency = null;","\tpublic function getDefaultCurrency()","\t{","\t\tif (is_null($this->_defaultCurrency))","\t\t\t$this->_defaultCurrency = Currency::getDefaultCurrency();","\t\treturn $this->_defaultCurrency;","\t}","\t","\t/**","\t * @param float $amount","\t * @param Currency|int $currency","\t * @param int $direction self::CONVERT_*","\t * @throws PrestaShopModuleException","\t * @return float","\t */","\tpublic function defaultCurrencyConvert($amount, $currency, $direction)","\t{","\t\tif (is_numeric($currency))","\t\t\t$currency = Currency::getCurrencyInstance(intval($currency));","\t\tif (!Validate::isLoadedObject($currency))","\t\t\tthrow new PrestaShopModuleException('Argument $currency must be a Currency object or a valid currency ID');","\t\t$amount = floatval($amount);","\t\tif ($this->getDefaultCurrency()->conversion_rate != $currency->conversion_rate)","\t\t\tswitch ($direction) ","\t\t\t{","\t\t\t\tcase self::CONVERT_TO_DEFAULT:","\t\t\t\t\t$amount *= floatval($this->getDefaultCurrency()->conversion_rate) / floatval($currency->conversion_rate);","\t\t\t\t\tbreak;","\t\t\t\tcase self::CONVERT_FROM_DEFAULT:","\t\t\t\t\t$amount /= floatval($this->getDefaultCurrency()->conversion_rate) / floatval($currency->conversion_rate);","\t\t\t\t\tbreak;","\t\t\t\tdefault:","\t\t\t\t\tthrow new PrestaShopModuleException('Invalid Argument $direction (must be self::CONVERT_*)');","\t\t\t}","\t\treturn $amount;","\t}","\t\t","\t/**","\t * @param int $mode self::MODE_*","\t * @throws PrestaShopModuleException","\t * @return float","\t */","\tpublic function getMinAmount($mode)","\t{","\t\tswitch ($mode)","\t\t{","\t\t\tcase self::MODE_SINGLE:","\t\t\t\treturn $this->get(self::CNF_MINAMOUNT);","\t\t\tcase self::MODE_2TPAYMENT:","\t\t\t\treturn $this->get(self::CNF_2TPAYMENT_MINAMOUNT);","\t\t\tcase self::MODE_3TPAYMENT:","\t\t\t\treturn $this->get(self::CNF_3TPAYMENT_MINAMOUNT);","\t\t\tdefault:","\t\t\t\tthrow new PrestaShopModuleException('Invalid Argument $mode (must be self::MODE_*)');","\t\t}","\t}","\t","\tpublic function getPaymentFees($amount, Currency $currency, $mode)","\t{","\t\t$fixed = null;","\t\t$percent = null;","\t\tswitch ($mode)","\t\t{","\t\t\tcase self::MODE_SINGLE:","\t\t\t\t$fixed = $this->get(self::CNF_PAYMENT_FEES);","\t\t\t\t$percent = $this->get(self::CNF_PAYMENT_FEES_P);","\t\t\t\tbreak;","\t\t\tcase self::MODE_2TPAYMENT:","\t\t\t\t$fixed = $this->get(self::CNF_2TPAYMENT_FEES);","\t\t\t\t$percent = $this->get(self::CNF_2TPAYMENT_FEES_P);","\t\t\t\tbreak;","\t\t\tcase self::MODE_3TPAYMENT:","\t\t\t\t$fixed = $this->get(self::CNF_3TPAYMENT_FEES);","\t\t\t\t$percent = $this->get(self::CNF_3TPAYMENT_FEES_P);","\t\t\t\tbreak;","\t\t\tdefault:","\t\t\t\tthrow new PrestaShopModuleException('Invalid Argument $mode (must be self::MODE_*)');","\t\t}","\t\treturn Tools::ps_round($this->defaultCurrencyConvert($fixed, $currency, self::CONVERT_FROM_DEFAULT) + $percent / 100 * $amount, $currency->decimals ? 2 : 0);","\t}","\t","\tpublic function getBankReturnUri($context)","\t{","\t\tswitch ($context)","\t\t{","\t\t\tcase self::RETURN_CONTEXT_USER:","\t\t\t\t$protocol = $this->get(self::CNF_RETURN_PROTOCOL_USER);","\t\t\t\t$domain = $this->get(self::CNF_RETURN_DOMAIN_USER);","\t\t\t\t$controller = $this->getPathUri().self::BANK_CONTROLLER_USER;","\t\t\t\tbreak;","\t\t\tcase self::RETURN_CONTEXT_SILENT:","\t\t\t\t$protocol = self::RETURN_PROTOCOL_HTTP;","\t\t\t\t$domain = $this->get(self::CNF_RETURN_DOMAIN_SILENT);","\t\t\t\t$controller = preg_replace('@^(https?://[^/]+)?(/.*)$@', '$2', $this->context->link->getModuleLink($this->name, 'silentresponse'));","\t\t\t\tbreak;","\t\t\tdefault:","\t\t\t\tthrow new PrestaShopModuleException('Invalid Argument $context (must be self::RETURN_CONTEXT_*)');","\t\t}","\t\tif ($protocol == self::RETURN_PROTOCOL_AUTO)","\t\t{","\t\t\t$protocol = Configuration::get('PS_SSL_ENABLED') ? self::RETURN_PROTOCOL_HTTPS : self::RETURN_PROTOCOL_HTTP;","\t\t}","\t\tif ($domain == self::RETURN_DOMAIN_AUTO)","\t\t{","\t\t\t$domain = ($protocol == self::RETURN_PROTOCOL_HTTPS) ? Tools::getShopDomainSsl(false) : Tools::getShopDomain(false);","\t\t}","\t\treturn $protocol.$domain.$controller;","\t}","\t","\t/**","\t * @return boolean|string","\t */","\tpublic function generateTransactionId()","\t{","\t\t$DB = Db::getInstance(true);","\t\t//We don't clean yesterday's records to avoid clustering problems with bad time sync arround midnight","\t\t$DB->delete($this->getTable(self::TABLE_TRANSACTION_TODAY, false), '`date` < \\''.date('Y-m-d', strtotime('-1 day')).'\\'');","\t\t$tid = $this->generateTransactionIdNoCheck($DB);","\t\tif ($tid < $this->get(self::CNF_MIN_TID))","\t\t{","\t\t\t$DB->insert($this->getTable(self::TABLE_TRANSACTION_TODAY, false), array('date' => date('Y-m-d'), 'transaction_id' => $this->get(self::CNF_MIN_TID) - 1), false, false, Db::INSERT_IGNORE);","\t\t\t$tid = $this->generateTransactionIdNoCheck($DB);","\t\t}","\t\tif ($tid > $this->get(self::CNF_MAX_TID))","\t\t\treturn false;","\t\treturn $tid;","\t}","\t","\t/**","\t * @param Db $DB","\t * @throws PrestaShopDatabaseException","\t * @return string","\t */","\tpublic function generateTransactionIdNoCheck(Db $DB)","\t{","\t\tif (!$DB->insert($this->getTable(self::TABLE_TRANSACTION_TODAY, false), array('date' => date('Y-m-d'))))","\t\t\tthrow new PrestaShopDatabaseException();","\t\treturn $DB->Insert_ID();","\t}","\t","\t/**","\t * Populate internal configuration definition","\t */","\tprotected function initConfVars()","\t{","\t\tif (!empty($this->_confVars)) return;","\t\t$comment = 0;","\t\t$this->_confVars = array(","\t\t\t'INTERNAL' => array(","\t\t\t\tself::CNF_VERSION => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_INTERNAL,","\t\t\t\t\t'default' => '0'","\t\t\t\t),","\t\t\t),","\t\t\t'BASIC' => array(","\t\t\t\tself::CNF_BANK => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Your bank'),","\t\t\t\t\t'atos' => 'merchant_id',","\t\t\t\t\t'pathfile' => 'F_DEFAULT',","\t\t\t\t\t'values' => $this->_banks,","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_PRODUCTION => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('ATOS Run mode'),","\t\t\t\t\t'atos' => 'merchant_id',","\t\t\t\t\t'values' => array(","\t\t\t\t\t\tFALSE => $this->l('Demonstration: Use your bank\\'s demo certificate'),","\t\t\t\t\t\tTRUE => $this->l('(Pre-)Production: Use your production certificate')","\t\t\t\t\t),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_MERCHANT_ID => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'template' => 'merchant_id',","\t\t\t\t\t'description' => $this->l('Select the production certificate (unused in demonstration mode)'),","\t\t\t\t\t'hint' => Tools::htmlentitiesDecodeUTF8(sprintf($this->l('Your production certificate must be uploaded to \"%s\" defined in advanced configuration, named certif.fr.xxxxxxxxxxxxxxx where xxxxxxxxxxxxxxx is your merchant ID, this file has to be read/write protected, only PHP and you should be able to read it, and only you should be able to modify it.'), $this->l('Location of ATOS configuration'))),","\t\t\t\t\t'atos' => 'merchant_id',","\t\t\t\t\t'values' => new TggAtosModuleFunctionCall('getMerchantIdList', array(TRUE)),","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_ISO_LANG => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Force a language in payment server'),","\t\t\t\t\t'hint' => $this->l('If none given, ISO code of the language used by client to browse your shop will be sent to ATOS API. See ATOS doc. for available language codes.'),","\t\t\t\t\t'atos' => 'language',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_RESPONSE_LOG_TXT => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Log bank responses in human readable format'),","\t\t\t\t\t'default' => TRUE","\t\t\t\t),","\t\t\t\tself::CNF_RESPONSE_LOG_CSV => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Log bank responses in CSV format (currently needed to display payment information on user return).'),","\t\t\t\t\t'default' => TRUE","\t\t\t\t),","\t\t\t\tself::CNF_LOG_PATH => array(","\t\t\t\t\t'type' => self::T_PATH,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Responses logs storage path'),","\t\t\t\t\t'hint' => $this->l('MUST only be accessible to you and PHP user. MUST be writable by PHP user.'),","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => $this->local_path . 'log'.DIRECTORY_SEPARATOR","\t\t\t\t),","\t\t\t\tself::CNF_ORDER_MESSAGE => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Add a summary of the transaction as order message'),","\t\t\t\t\t'hint' => $this->l('Only visible by back office users.'),","\t\t\t\t\t'default' => TRUE","\t\t\t\t),","\t\t\t\tself::CNF_CHECK_VERSION => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Check availabity of update in back office (see hint for confidentialities issues)'),","\t\t\t\t\t'hint' => $this->l('May slow a bit modules page on back office and may not work on some low cost hostings.|In exchange of this service, statistics are collected, following information will be transmitted:|- PrestaSop\\'s version|- TggAtos\\'s version|- Shop domain|- Back-office language used'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_OS_PAYMENT_CANCELLED => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Order state to apply on cancel return'),","\t\t\t\t\t'values' => TggAtosModuleFunctionCall::factory('getOrderStatesSelectArray', array($this->l('No order creation'))),","\t\t\t\t\t'default' => 0","\t\t\t\t),","\t\t\t\tself::CNF_OS_PAYMENT_FAILED => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Order state to apply on payment fail return'),","\t\t\t\t\t'values' => TggAtosModuleFunctionCall::factory('getOrderStatesSelectArray', array($this->l('No order creation'))),","\t\t\t\t\t'default' => 0","\t\t\t\t),","\t\t\t),","\t\t\t'SINGLE' => array(","\t\t\t\tself::CNF_SINGLE => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Enable single payment mode'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_PAYMENT_MEANS => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Accepted payment means'),","\t\t\t\t\t'atos' => 'payment_means',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => 'CB,3,VISA,3,MASTERCARD,3'","\t\t\t\t),","\t\t\t\tself::CNF_MINAMOUNT => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Disable this payment method when cart amount is below this value'),","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_CAPTURE_MODE => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Select capture mode to apply'),","\t\t\t\t\t'hint' => $this->l('See ATOS doc. about capture mode.'),","\t\t\t\t\t'atos' => 'capture_mode',","\t\t\t\t\t'values' => array(","\t\t\t\t\t\t'AUTHOR_CAPTURE' => 'AUTHOR_CAPTURE',","\t\t\t\t\t\t'VALIDATION' => 'VALIDATION'","\t\t\t\t\t),","\t\t\t\t\t'default' => 'AUTHOR_CAPTURE'","\t\t\t\t),","\t\t\t\tself::CNF_CAPTURE_DAY => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Select capture delay'),","\t\t\t\t\t'hint' => $this->l('See ATOS doc. about capture mode.'),","\t\t\t\t\t'atos' => 'capture_day',","\t\t\t\t\t'autofeed' => true,","\t\t\t\t\t'values' => range(0,99),","\t\t\t\t\t'default' => 0","\t\t\t\t),","\t\t\t\tself::CNF_OS_PAYMENT_SUCCESS => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Select order state to apply on a successful payment'),","\t\t\t\t\t'values' => TggAtosModuleFunctionCall::factory('getOrderStatesSelectArray'),","\t\t\t\t\t'default' => Configuration::get('PS_OS_PAYMENT')","\t\t\t\t),","\t\t\t\tself::CNF_PAYMENT_FEES => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Apply fixed payment fees'),","\t\t\t\t\t'hint' => $this->l('This value is related to the selected default currency.'),","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_PAYMENT_FEES_P => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Apply fees relative to cart amount'),","\t\t\t\t\t'hint' => $this->l('Expressed in cart amount percent. Added to fixed fees.'),","\t\t\t\t\t'field_suffix' => '%',","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t),","\t\t\t'2TIMES' => array(","\t\t\t\tself::CNF_2TPAYMENT => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Enable 2 times payments mode'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_MEANS => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Accepted payment means'),","\t\t\t\t\t'atos' => 'payment_means',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => 'CB,3,VISA,3,MASTERCARD,3'","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_MINAMOUNT => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Minimum cart amount to use 2 times payments'),","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_DELAY => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Days before first payment'),","\t\t\t\t\t'atos' => 'capture_day',","\t\t\t\t\t'values' => range(0,99),","\t\t\t\t\t'default' => 0","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_SPACING => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Days between the payments'),","\t\t\t\t\t'atos' => 'data[PERIOD]',","\t\t\t\t\t'values' => $this->_mirrorArray(range(1,30)),","\t\t\t\t\t'default' => 30","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_OS => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Order state to apply'),","\t\t\t\t\t'values' => TggAtosModuleFunctionCall::factory('getOrderStatesSelectArray'),","\t\t\t\t\t'default' => Configuration::get('PS_OS_PAYMENT')","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_FEES => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Apply fixed fees'),","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_FEES_P => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Apply fees relative to cart amount'),","\t\t\t\t\t'hint' => $this->l('Added to fixed fees.'),","\t\t\t\t\t'field_suffix' => '%',","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_FP_FXD => array(","\t\t\t\t\t'type' => self::T_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('First payment fixed amount'),","\t\t\t\t\t'atos' => 'data[INITIAL_AMOUNT]',","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_2TPAYMENT_FP_PCT => array(","\t\t\t\t\t'type' => self::T_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('First payment amount relative to cart amount'),","\t\t\t\t\t'hint' => $this->l('Added to fixed amount.'),","\t\t\t\t\t'field_suffix' => '%',","\t\t\t\t\t'atos' => 'data[INITIAL_AMOUNT]',","\t\t\t\t\t'default' => 50.0","\t\t\t\t),","\t\t\t),","\t\t\t'3TIMES' => array(","\t\t\t\tself::CNF_3TPAYMENT => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Enable 3 times payments mode'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_MEANS => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Accepted payment means'),","\t\t\t\t\t'atos' => 'payment_means',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => 'CB,3,VISA,3,MASTERCARD,3'","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_MINAMOUNT => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Minimum cart amount to use 3 times payments'),","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_DELAY => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Days before first payment'),","\t\t\t\t\t'values' => range(0,99),","\t\t\t\t\t'atos' => 'capture_day',","\t\t\t\t\t'default' => 0","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_SPACING => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Days between the payments'),","\t\t\t\t\t'values' => $this->_mirrorArray(range(1,30)),","\t\t\t\t\t'atos' => 'data[PERIOD]',","\t\t\t\t\t'default' => 30","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_OS => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Order state to apply'),","\t\t\t\t\t'values' => TggAtosModuleFunctionCall::factory('getOrderStatesSelectArray'),","\t\t\t\t\t'default' => Configuration::get('PS_OS_PAYMENT')","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_FEES => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Apply fixed fees'),","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_FEES_P => array(","\t\t\t\t\t'type' => self::T_UNSIGNED_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Apply fees relative to cart amount'),","\t\t\t\t\t'hint' => $this->l('Added to fixed fees.'),","\t\t\t\t\t'field_suffix' => '%',","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_FP_FXD => array(","\t\t\t\t\t'type' => self::T_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('First payment fixed amount'),","\t\t\t\t\t'atos' => 'data[INITIAL_AMOUNT]',","\t\t\t\t\t'default' => 0.0","\t\t\t\t),","\t\t\t\tself::CNF_3TPAYMENT_FP_PCT => array(","\t\t\t\t\t'type' => self::T_FLOAT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('First payment amount relative to cart amount'),","\t\t\t\t\t'hint' => $this->l('Added to fixed amount.'),","\t\t\t\t\t'field_suffix' => '%',","\t\t\t\t\t'atos' => 'data[INITIAL_AMOUNT]',","\t\t\t\t\t'default' => 33.4","\t\t\t\t),","\t\t\t),","\t\t\t'GRAPHIC' => array(","\t\t\t\t'comment'.($comment++) => array(","\t\t\t\t\t'type' => self::T_NONE,","\t\t\t\t\t'input' => self::T_NONE,","\t\t\t\t\t'text' => $this->l('Following options are applied to the form redirecting to bank server (the clickable card logos). See ATOS pages customisation doc.')","\t\t\t\t),","\t\t\t\tself::CNF_CARD_IMG_PATH => array(","\t\t\t\t\t'type' => self::T_URI,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Web URI of the folder containing card logos'),","\t\t\t\t\t'hint' => $this->l('Change this to use a custom card logos pack. You should put your logos in a theme sub-folder. An undocumented limitation of PATHFILE reader seems to limit this field to 78 characters.'),","\t\t\t\t\t'pathfile' => 'D_LOGO',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => $this->_path . 'images/card_logo/'","\t\t\t\t),","\t\t\t\tself::CNF_BLOCK_ORDER => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Block order'),","\t\t\t\t\t'atos' => 'block_order',","\t\t\t\t\t'parmcom' => 'BLOCK_ORDER',","\t\t\t\t\t'default' => '1,2,3,4,5,6,7,8'","\t\t\t\t),","\t\t\t\tself::CNF_BLOCK_ALIGN => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Block alignement'),","\t\t\t\t\t'atos' => 'block_align',","\t\t\t\t\t'parmcom' => 'BLOCK_ALIGN',","\t\t\t\t\t'values' => array(","\t\t\t\t\t\tself::BLOCK_ALIGN_LEFT => $this->l('Left'),","\t\t\t\t\t\tself::BLOCK_ALIGN_CENTER => $this->l('Center'),","\t\t\t\t\t\tself::BLOCK_ALIGN_RIGHT => $this->l('Right')","\t\t\t\t\t),","\t\t\t\t\t'default' => self::BLOCK_ALIGN_CENTER","\t\t\t\t),","\t\t\t\tself::CNF_HEADER_FLAG => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('Payment security comment'),","\t\t\t\t\t'atos' => 'header_flag',","\t\t\t\t\t'parmcom' => 'HEADER_FLAG',","\t\t\t\t\t'values' => array(","\t\t\t\t\t\t'yes' => $this->l('Yes'),","\t\t\t\t\t\t'no' => $this->l('No')","\t\t\t\t\t),","\t\t\t\t\t'default' => 'yes'","\t\t\t\t),","\t\t\t\tself::CNF_TARGET => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Link to bank\\'s page HTML target'),","\t\t\t\t\t'atos' => 'target',","\t\t\t\t\t'parmcom' => 'TARGET',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\t'comment'.($comment++) => array(","\t\t\t\t\t'type' => self::T_NONE,","\t\t\t\t\t'input' => self::T_NONE,","\t\t\t\t\t'text' => $this->l('Following options are applied to the pages located on bank server. See ATOS pages customisation doc.')","\t\t\t\t),","\t\t\t\tself::CNF_TEMPLATE_FILE => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Stylesheet'),","\t\t\t\t\t'atos' => 'templatefile',","\t\t\t\t\t'parmcom' => 'TEMPLATE',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_LOGO_LEFT => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Upper left logo'),","\t\t\t\t\t'atos' => 'logo_id',","\t\t\t\t\t'parmcom' => 'LOGO',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_LOGO_CENTER => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Center banner'),","\t\t\t\t\t'atos' => 'advert',","\t\t\t\t\t'parmcom' => 'ADVERT',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_LOGO_RIGHT => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Upper right logo'),","\t\t\t\t\t'atos' => 'logo_id2',","\t\t\t\t\t'parmcom' => 'LOGO2',","\t\t\t\t\t'default' => 'merchant.gif'","\t\t\t\t),","\t\t\t\tself::CNF_LOGO_SUBMIT => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Submit logo'),","\t\t\t\t\t'atos' => 'logo_id',","\t\t\t\t\t'parmcom' => 'SUBMIT_LOGO',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_LOGO_NORMAL_RETURN => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Normal return logo'),","\t\t\t\t\t'atos' => 'normal_return_logo',","\t\t\t\t\t'parmcom' => 'RETURN_LOGO',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_LOGO_CANCEL_RETURN => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Cancel return logo'),","\t\t\t\t\t'atos' => 'cancel_return_logo',","\t\t\t\t\t'parmcom' => 'CANCEL_LOGO',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_BG_IMAGE => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('HTML Background image'),","\t\t\t\t\t'atos' => 'background_id',","\t\t\t\t\t'parmcom' => 'BACKGROUND',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_BG_COLOR => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('HTML Background RGB color'),","\t\t\t\t\t'atos' => 'bgcolor',","\t\t\t\t\t'parmcom' => 'BGCOLOR',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_TXT_FONT => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('HTML Text font'),","\t\t\t\t\t'atos' => 'textfont',","\t\t\t\t\t'parmcom' => 'TEXTCOLOR',","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_TXT_COLOR => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('HTML Text RGB color'),","\t\t\t\t\t'atos' => 'textcolor',","\t\t\t\t\t'parmcom' => 'TEXTCOLOR',","\t\t\t\t\t'default' => ''","\t\t\t\t)","\t\t\t),","\t\t\t'ADVANCED' => array(","\t\t\t\tself::CNF_FORCE_RETURN => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Force user return from bank'),","\t\t\t\t\t'hint' => $this->l('Disables transaction summary on bank server, see NO_RESPONSE_PAGE data param in ATOS doc.'),","\t\t\t\t\t'atos' => 'data[NO_RESPONSE_PAGE]',","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_SKIP_REDIRECTION_CONTROLLER => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Display redirection forms on displayPayment hook (see warnings in hint)'),","\t\t\t\t\t'hint' => $this->l('WARNING: ATOS SIPS forms contain all payment parameters that will be transmitted to payment server. It means that they have to be refreshed if cart amount is updated. For exemple, using this feature in One Page Checkout mode will require some changes on your theme\\'s javascript to refresh payment selection on each cart update. It will also consume a transaction ID on each forms display (all forms generated together use the same transaction ID to avoid wasting a lot of them). You will also want to customize tggatos/views/templates/hook/direct_payment.tpl'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_NO_TID_GENERATION => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Don\\'t generate transaction ID'),","\t\t\t\t\t'hint' => $this->l('ATOS API will be called without transaction ID, meaning that it will be set to HHMMSS according to server\\'s time when calling ATOS API, which can cause a lot of problems (less transactions possible per days, possible collisions between clients, much less safe than segmenting available IDs between websites when using single certificate on multiple websites).'),","\t\t\t\t\t'atos' => 'transaction_id',","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_MIN_TID => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Minimum transaction ID to use'),","\t\t\t\t\t'hint' => Tools::htmlentitiesDecodeUTF8(sprintf($this->l('Between 1 and 999999. Unused if option \"%s\" is checked.'), $this->l('Don\\'t generate transaction ID'))),","\t\t\t\t\t'atos' => 'transaction_id',","\t\t\t\t\t'default' => 1","\t\t\t\t),","\t\t\t\tself::CNF_MAX_TID => array(","\t\t\t\t\t'type' => self::T_ABS_POSITIVE_INT,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Maximum transaction ID to use'),","\t\t\t\t\t'hint' => Tools::htmlentitiesDecodeUTF8(sprintf($this->l('Between 1 and 999999. Unused if option \"%s\" is checked.'), $this->l('Don\\'t generate transaction ID'))),","\t\t\t\t\t'atos' => 'transaction_id',","\t\t\t\t\t'default' => 999999","\t\t\t\t),","\t\t\t\tself::CNF_OP_FIELD_TID => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('ATOS Response field to use as PrestaShop\\'s transaction ID in order payment'),","\t\t\t\t\t'values' => $this->_mirrorArray(array(","\t\t\t\t\t\tself::ATOS_FIELD_TRANSACTION_ID,","\t\t\t\t\t\tself::ATOS_FIELD_PAYMENT_CERTIFICATE,","\t\t\t\t\t\tself::ATOS_FIELD_AUTHORISATION_ID","\t\t\t\t\t)),","\t\t\t\t\t'default' => self::ATOS_FIELD_TRANSACTION_ID","\t\t\t\t),","\t\t\t\tself::CNF_BINARIES_IN_PATH => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Call binaries without path'),","\t\t\t\t\t'hint' => $this->l('Check it if (and ONLY if) the location of the ATOS binaries to use is a folder of the PATH system var.'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t\tself::CNF_BIN_PATH => array(","\t\t\t\t\t'type' => self::T_PATH,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Location of ATOS binaries'),","\t\t\t\t\t'hint' => $this->l('Unused if the option above is enabled. PHP user MUST be able to CD to this dir.'),","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => $this->local_path . 'bin'.DIRECTORY_SEPARATOR","\t\t\t\t),","\t\t\t\tself::CNF_BIN_SUFFIX => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Optionnal suffix to append at the end of request and response binaries before calling them.'),","\t\t\t\t\t'default' => ''","\t\t\t\t),","\t\t\t\tself::CNF_PARAM_PATH => array(","\t\t\t\t\t'type' => self::T_PATH,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Location of ATOS configuration'),","\t\t\t\t\t'hint' => $this->l('MUST be readable (and writable to allow module to update those files) by PHP user.'),","\t\t\t\t\t'pathfile' => 'F_PARAM, F_CERTIFICATE, F_DEFAULT',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => $this->local_path . 'param'.DIRECTORY_SEPARATOR","\t\t\t\t),","\t\t\t\tself::CNF_RETURN_PROTOCOL_USER => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_SELECT,","\t\t\t\t\t'description' => $this->l('User return protocol'),","\t\t\t\t\t'hint' => $this->l('Used to generate the user return URL transmitted to ATOS API. Automatic means HTTPS will be used when, and only when, PS_SSL_ENABLED configuration is ON.'),","\t\t\t\t\t'atos' => 'normal_return_url, cancel_return_url',","\t\t\t\t\t'values' => array(","\t\t\t\t\t\tself::RETURN_PROTOCOL_AUTO => $this->l('automatic'),","\t\t\t\t\t\tself::RETURN_PROTOCOL_HTTP => self::RETURN_PROTOCOL_HTTP,","\t\t\t\t\t\tself::RETURN_PROTOCOL_HTTPS => self::RETURN_PROTOCOL_HTTPS","\t\t\t\t\t),","\t\t\t\t\t'default' => self::RETURN_PROTOCOL_AUTO","\t\t\t\t),","\t\t\t\tself::CNF_RETURN_DOMAIN_USER => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('User return front office domain'),","\t\t\t\t\t'hint' => $this->l('Used to generate the user return URL transmitted to ATOS API. Leave empty to use Prestashop\\'s Shop domain.'),","\t\t\t\t\t'atos' => 'normal_return_url, cancel_return_url',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => TggATos::RETURN_DOMAIN_AUTO","\t\t\t\t),","\t\t\t\tself::CNF_RETURN_DOMAIN_SILENT => array(","\t\t\t\t\t'type' => self::T_STRING,","\t\t\t\t\t'input' => self::IN_TEXT,","\t\t\t\t\t'description' => $this->l('Silent return front office domain'),","\t\t\t\t\t'hint' => $this->l('Used to generate the silent return URL transmitted to ATOS API. Leave empty to use Prestashop\\'s Shop domain.'),","\t\t\t\t\t'atos' => 'automatic_reponse_url',","\t\t\t\t\t'width' => '100%',","\t\t\t\t\t'default' => TggATos::RETURN_DOMAIN_AUTO","\t\t\t\t),","\t\t\t\tself::CNF_DEBUG_MODE => array(","\t\t\t\t\t'type' => self::T_BOOL,","\t\t\t\t\t'input' => self::IN_CHECKBOX,","\t\t\t\t\t'description' => $this->l('Debug mode'),","\t\t\t\t\t'pathfile' => 'DEBUG',","\t\t\t\t\t'hint' => $this->l('Prints debug outputs alongside with payment redirection form. To allow internal module exceptions to be displayed too, set _PS_MODE_DEV_ Prestashop constant to TRUE in prestashop/config/defines.inc.php.'),","\t\t\t\t\t'default' => FALSE","\t\t\t\t),","\t\t\t),","\t\t);","\t\t$this->_confVarsByName = array();","\t\tforeach ($this->_confVars as $section)","\t\t\t$this->_confVarsByName += $section;","\t}","\t","\t/**","\t * Back office module's configuration page handler","\t * @return string Html configuration GUI","\t */","\tpublic function getContent()","\t{","\t\t$this->initConfVars();","\t\t$this->context->controller->addJqueryUI(array('ui.tabs'));","\t\tforeach ($this->_confVars as $sectionName => $sectionVars)","\t\t\tif (( $sectionName != 'INTERNAL' ) && Tools::isSubmit('btnSubmit'.$sectionName))","\t\t{","\t\t\tforeach ($sectionVars as $varname => $declaration)","\t\t\t{","\t\t\t\tif ($declaration['type'] == self::T_NONE) continue;","\t\t\t\tif ($declaration['input'] == self::IN_INTERNAL) continue;","\t\t\t\tif ($declaration['input'] == self::IN_NONE) continue;","\t\t\t\t$this->set($varname, Tools::getValue('tggatos_'.$varname));","\t\t\t}","\t\t\t$this->updateAtosParamFiles();","\t\t}","\t\t$errorsIndex = $this->autoCheck();","\t\t$html = '","\t\t
' . preg_replace('/^(\\|\\+> [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}:)/m', '
$1', Tools::htmlentitiesUTF8(file_get_contents($errorLog))) . '
'.$this->l('Many options have additionnal information displayed by hovering corresponding input field with your mouse cursor.').'
","\t\t\t