* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7801 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_CAN_LOAD_FILES_')) exit; class MoneyBookers extends PaymentModule { const LEFT_COLUMN = 0; const RIGHT_COLUMN = 1; const DISABLE = -1; public function __construct() { $this->name = 'moneybookers'; $this->tab = 'payments_gateways'; $this->version = '1.5'; parent::__construct(); $this->page = basename(__FILE__, '.php'); $this->displayName = $this->l('Moneybookers'); $this->description = $this->l('Accepts payments by Moneybookers.'); $this->confirmUninstall = $this->l('Are you sure you want to delete your details ?'); if (Configuration::get('MB_PAY_TO_EMAIL') == 'testmerchant@moneybookers.com') $this->warning = $this->l('You are currently using the default Moneybookers e-mail address, please use your own e-mail address.'); /* MoneyBookers payment methods */ $this->_internationalPaymentMethods = array( 0 => array('file' => 'amex', 'name' => 'American Express', 'code' => 'AMX'), 1 => array('file' => 'diners', 'name' => 'Diners', 'code' => 'DIN'), 2 => array('file' => 'jcb', 'name' => 'JCB', 'code' => 'JCB'), 3 => array('file' => 'maestro', 'name' => 'Maestro', 'code' => 'MAE'), 4 => array('file' => 'mastercard', 'name' => 'Mastercard', 'code' => 'MSC'), 5 => array('file' => 'visa', 'name' => 'Visa', 'code' => 'VSA'), 6 => array('file' => 'visadebit', 'name' => 'Visa Debit', 'code' => 'VSD'), 7 => array('file' => 'ewallet', 'name' => 'Moneybookers eWallet', 'code' => 'WLT')); $this->_localPaymentMethods = array( 0 => array('file' => '4b', 'name' => '4B', 'code' => 'MSC'), 1 => array('file' => 'cartasi', 'name' => 'Cartasi', 'code' => 'CSI'), 2 => array('file' => 'cartebleue', 'name' => 'Carte bleue', 'code' => 'GCB'), 3 => array('file' => 'dankort', 'name' => 'Dankort' , 'code' => 'DNK'), 4 => array('file' => 'ec', 'name' => 'EC', 'code' => 'ELV'), 5 => array('file' => 'enets', 'name' => 'eNets', 'code' => 'ENT'), 6 => array('file' => 'epay', 'name' => 'ePay', 'code' => 'EPY'), 7 => array('file' => 'eps', 'name' => 'EPS', 'code' => 'NPY'), 8 => array('file' => 'euro6000', 'name' => 'Euro 6000', 'code' => 'MSC'), 9 => array('file' => 'giropay', 'name' => 'Giropay', 'code' => 'GIR'), 10 => array('file' => 'ideal', 'name' => 'iDeal', 'code' => 'IDL'), 11 => array('file' => 'instantbanktransfer', 'name' => 'Instant Bank Transfer', 'code' => 'PWY'), 12 => array('file' => 'laser', 'name' => 'Laser', 'code' => 'LSR'), 13 => array('file' => 'nordea', 'name' => 'Nordea', 'code' => 'EBT,SO2'), 14 => array('file' => 'p24', 'name' => 'P24', 'code' => ''), 15 => array('file' => 'pekao', 'name' => 'Pekao', 'code' => 'PWY18'), 16 => array('file' => 'poli', 'name' => 'Poli', 'code' => 'PLI'), 17 => array('file' => 'postepay', 'name' => 'PostePay', 'code' => 'PSP'), 18 => array('file' => 'sofort', 'name' => 'Sofort', 'code' => 'SFT'), 19 => array('file' => 'solo', 'name' => 'Solo', 'code' => 'SLO'), 20 => array('file' => 'unionpay', 'name' => 'UnionPay', 'code' => ''), 21 => array('file' => 'visaelectron', 'name' => 'Visa Electron', 'code' => 'VSE')); /* MoneyBookers countries (for iso 3 letters compatibility) */ $this->_country = array('AF' => 'AFG', 'AL' => 'ALB', 'DZ' => 'DZA', 'AS' => 'ASM', 'AD' => 'AND', 'AO' => 'AGO', 'AI' => 'AIA', 'AQ' => 'ATA', 'AG' => 'ATG', 'AR' => 'ARG', 'AM' => 'ARM', 'AW' => 'ABW', 'AU' => 'AUS', 'AT' => 'AUT', 'AZ' => 'AZE', 'BS' => 'BHS', 'BH' => 'BHR', 'BD' => 'BGD', 'BB' => 'BRB', 'BY' => 'BLR', 'BE' => 'BEL', 'BZ' => 'BLZ', 'BJ' => 'BEN', 'BM' => 'BMU', 'BT' => 'BTN', 'BO' => 'BOL', 'BA' => 'BIH', 'BW' => 'BWA', 'BV' => 'BVT', 'BR' => 'BRA', 'IO' => 'IOT', 'BN' => 'BRN', 'BG' => 'BGR', 'BF' => 'BFA', 'BI' => 'BDI', 'KH' => 'KHM', 'CM' => 'CMR', 'CA' => 'CAN', 'CV' => 'CPV', 'KY' => 'CYM', 'CF' => 'CAF', 'TD' => 'TCD', 'CL' => 'CHL', 'CN' => 'CHN', 'CX' => 'CXR', 'CC' => 'CCK', 'CO' => 'COL', 'KM' => 'COM', 'CG' => 'COG', 'CK' => 'COK', 'CR' => 'CRI', 'CI' => 'CIV', 'HR' => 'HRV', 'CU' => 'CUB', 'CY' => 'CYP', 'CZ' => 'CZE', 'DK' => 'DNK', 'DJ' => 'DJI', 'DM' => 'DMA', 'DO' => 'DOM', 'TP' => 'TMP', 'EC' => 'ECU', 'EG' => 'EGY', 'SV' => 'SLV', 'GQ' => 'GNQ', 'ER' => 'ERI', 'EE' => 'EST', 'ET' => 'ETH', 'FK' => 'FLK', 'FO' => 'FRO', 'FJ' => 'FJI', 'FI' => 'FIN', 'FR' => 'FRA', 'FX' => 'FXX', 'GF' => 'GUF', 'PF' => 'PYF', 'TF' => 'ATF', 'GA' => 'GAB', 'GM' => 'GMB', 'GE' => 'GEO', 'DE' => 'DEU', 'GH' => 'GHA', 'GI' => 'GIB', 'GR' => 'GRC', 'GL' => 'GRL', 'GD' => 'GRD', 'GP' => 'GLP', 'GU' => 'GUM', 'GT' => 'GTM', 'GN' => 'GIN', 'GW' => 'GNB', 'GY' => 'GUY', 'HT' => 'HTI', 'HM' => 'HMD', 'HN' => 'HND', 'HK' => 'HKG', 'HU' => 'HUN', 'IS' => 'ISL', 'IN' => 'IND', 'ID' => 'IDN', 'IR' => 'IRN', 'IQ' => 'IRQ', 'IE' => 'IRL', 'IL' => 'ISR', 'IT' => 'ITA', 'JM' => 'JAM', 'JP' => 'JPN', 'JO' => 'JOR', 'KZ' => 'KAZ', 'KE' => 'KEN', 'KI' => 'KIR', 'KP' => 'PRK', 'KR' => 'KOR', 'KW' => 'KWT', 'KG' => 'KGZ', 'LA' => 'LAO', 'LV' => 'LVA', 'LB' => 'LBN', 'LS' => 'LSO', 'LR' => 'LBR', 'LY' => 'LBY', 'LI' => 'LIE', 'LT' => 'LTU', 'LU' => 'LUX', 'MO' => 'MAC', 'MK' => 'MKD', 'MG' => 'MDG', 'MW' => 'MWI', 'MY' => 'MYS', 'MV' => 'MDV', 'ML' => 'MLI', 'MT' => 'MLT', 'MH' => 'MHL', 'MQ' => 'MTQ', 'MR' => 'MRT', 'MU' => 'MUS', 'YT' => 'MYT', 'MX' => 'MEX', 'FM' => 'FSM', 'MD' => 'MDA', 'MC' => 'MCO', 'MN' => 'MNG', 'MS' => 'MSR', 'MA' => 'MAR', 'MZ' => 'MOZ', 'MM' => 'MMR', 'NA' => 'NAM', 'NR' => 'NRU', 'NP' => 'NPL', 'NL' => 'NLD', 'AN' => 'ANT', 'NC' => 'NCL', 'NZ' => 'NZL', 'NI' => 'NIC', 'NE' => 'NER', 'NG' => 'NGA', 'NU' => 'NIU', 'NF' => 'NFK', 'MP' => 'MNP', 'NO' => 'NOR', 'OM' => 'OMN', 'PK' => 'PAK', 'PW' => 'PLW', 'PA' => 'PAN', 'PG' => 'PNG', 'PY' => 'PRY', 'PE' => 'PER', 'PH' => 'PHL', 'PN' => 'PCN', 'PL' => 'POL', 'PT' => 'PRT', 'PR' => 'PRI', 'QA' => 'QAT', 'RE' => 'REU', 'RO' => 'ROM', 'RU' => 'RUS', 'RW' => 'RWA', 'KN' => 'KNA', 'LC' => 'LCA', 'VC' => 'VCT', 'WS' => 'WSM', 'SM' => 'SMR', 'ST' => 'STP', 'SA' => 'SAU', 'SN' => 'SEN', 'SC' => 'SYC', 'SL' => 'SLE', 'SG' => 'SGP', 'SK' => 'SVK', 'SI' => 'SVN', 'SB' => 'SLB', 'SO' => 'SOM', 'ZA' => 'ZAF', 'GS' => 'SGS', 'ES' => 'ESP', 'LK' => 'LKA', 'SH' => 'SHN', 'PM' => 'SPM', 'SD' => 'SDN', 'SR' => 'SUR', 'SJ' => 'SJM', 'SZ' => 'SWZ', 'SE' => 'SWE', 'CH' => 'CHE', 'SY' => 'SYR', 'TW' => 'TWN', 'TJ' => 'TJK', 'TZ' => 'TZA', 'TH' => 'THA', 'TG' => 'TGO', 'TK' => 'TKL', 'TO' => 'TON', 'TT' => 'TTO', 'TN' => 'TUN', 'TR' => 'TUR', 'TM' => 'TKM', 'TC' => 'TCA', 'TV' => 'TUV', 'UG' => 'UGA', 'UA' => 'UKR', 'AE' => 'ARE', 'GB' => 'GBR', 'US' => 'USA', 'UM' => 'UMI', 'UY' => 'URY', 'UZ' => 'UZB', 'VU' => 'VUT', 'VA' => 'VAT', 'VE' => 'VEN', 'VN' => 'VNM', 'VG' => 'VGB', 'VI' => 'VIR', 'WF' => 'WLF', 'EH' => 'ESH', 'YE' => 'YEM', 'YU' => 'YUG', 'ZR' => 'ZAR', 'ZM' => 'ZMB', 'ZW' => 'ZWE'); } public function install() { if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn')) return false; Configuration::updateValue('MB_HIDE_LOGIN', 1); Configuration::updateValue('MB_PAY_TO_EMAIL', Configuration::get('PS_SHOP_EMAIL')); Configuration::updateValue('MB_CANCEL_URL', (Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__); Configuration::updateValue('MB_ID_LOGO', 1); Configuration::updateValue('MB_ID_LOGO_WALLET', 1); Configuration::updateValue('MB_PARAMETERS', 0); Configuration::updateValue('MB_DISPLAY_MODE', 1); return true; } public function uninstall() { if (!parent::uninstall()) return false; /* Clean configuration table */ Configuration::deleteByName('MB_PAY_TO_EMAIL'); Configuration::deleteByName('MB_CANCEL_URL'); Configuration::deleteByName('MB_HIDE_LOGIN'); Configuration::deleteByName('MB_SECRET_WORD'); Configuration::deleteByName('MB_ID_LOGO'); Configuration::deleteByName('MB_ID_LOGO_WALLET'); Configuration::deleteByName('MB_PARAMETERS'); Configuration::deleteByName('MB_DISPLAY_MODE'); return true; } /* ** Fetch a distant content trying to use all the available function ** if one of theme doesn't exist of failed */ private function _fetchWebContent($url, $timeout = 5, $contextOptions = array()) { $context = NULL; $defaultContextOptions = array( 'http' => array( 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'max_redirects' => 10, 'timeout' => $timeout, 'header' => array( 'Accept-language: en', 'Cookie: foo=bar'))); if (is_callable('curl_init') && ($ch = curl_init())) { curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $content = curl_exec($ch); curl_close($ch); } else { // Check availability of the context options if (!is_array($contextOptions) || !count($contextOptions)) $contextOptions = $defaultContextOptions; // Create a stream context $context = stream_context_create($contextOptions); if (($fp = @fopen($url, $mode, false, $context))) { $content = fgets($fp, 4096); fclose($fp); } else if (!($content = @file_get_contents($url, false, $context))) if (($fp = @fsockopen($url, 80, $errnom, $errstr, $timeout))) { preg_match('@^(?:http://)?([^/]+)@i', $url, $matches); $host = $matches[1]; $out = "GET / HTTP/1.1\r\n"; $out .= "Host: ".$host."\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $fetched = ''; while (!feof($fp)) $fetched .= fgets($fp, 1024); if (strlen($fetched)) $content = $fetched; fclose($fp); } } if (!$content) throw new Exception($this->l('Unable to fetch content')); return $content; } public function getContent() { global $cookie; $errors = array(); $output = '

Moneybookers


'; /* Validate account */ if (isset($_POST['SubmitValidation'])) if (isset($_POST['mb_email_to_validate']) && !empty($_POST['mb_email_to_validate'])) { try { $url = 'http://moneybookers.prestashop.com/email_check.php?email='.$_POST['mb_email_to_validate'].'&url=http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__; $content = $this->_fetchWebContent($url); $response = trim(strtolower($content)); if (!strstr('ok', $response)) $errors[] = $this->l('Account validation failed, please check your e-mail.'); else { Configuration::updateValue('MB_PAY_TO_EMAIL', $_POST['mb_email_to_validate']); Configuration::updateValue('MB_PARAMETERS', 1); $output .= ' '; } } catch(Exception $e) { $errors[] = $this->l('Unable to contact activation server, please try again later.'); } } else $errors[] = $this->l('E-mail field is required'); /* Validate secret word */ if (isset($_POST['SubmitSecret'])) { if (isset($_POST['mb_sw_to_validate']) AND !empty($_POST['mb_sw_to_validate'])) { try { $url = 'http://moneybookers.prestashop.com/email_check.php?email='.Configuration::get('MB_PAY_TO_EMAIL').'&url=http://' .$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'&sw=1&secret_word='.md5($_POST['mb_sw_to_validate']); $content = $this->_fetchWebContent($url); $response = trim(strtolower($content)); if (strstr('velocity_check_exceeded', $response)) $errors[] = $this->l('Secret word validation failed, exceeded max tries (3 per hour)'); elseif (!strstr('ok', $response)) $errors[] = $this->l('Secret word validation failed, please check your secret word.'); else { Configuration::updateValue('MB_SECRET_WORD', $_POST['mb_sw_to_validate']); Configuration::updateValue('MB_PARAMETERS_2', 1); $output .= ' '; } } catch(Exception $e) { $errors[] = $this->l('Unable to contact activation server, please try again later.'); } } else $errors[] = $this->l('Secret word field is required'); } /* Update configuration variables */ if (isset($_POST['submitMoneyBookers'])) { if (!isset($_POST['mb_hide_login'])) $_POST['mb_hide_login'] = 0; Configuration::updateValue('MB_CANCEL_URL', $_POST['mb_cancel_url']); Configuration::updateValue('MB_HIDE_LOGIN', (int)($_POST['mb_hide_login'])); $local = ''; $inter = ''; foreach ($_POST AS $key => $value) { if (strstr($key, 'mb_local_')) { preg_match('/mb_local_([0-9]+)/', $key, $matches); if (isset($matches[1])) $local .= $matches[1].'|'; } elseif (strstr($key, 'mb_inter_')) { preg_match('/mb_inter_([0-9]+)/', $key, $matches); if (isset($matches[1])) $inter .= $matches[1].'|'; } } $local = rtrim($local, '|'); $inter = rtrim($inter, '|'); Configuration::updateValue('MB_LOCAL_METHODS', $local); Configuration::updateValue('MB_INTER_METHODS', $inter); Configuration::updateValue('MB_DISPLAY_MODE', (int)($_POST['mb_display_mode'])); } if (Tools::getValue('submitSettings')) { foreach(array('leftColumn', 'rightColumn') as $hookName) if ($this->isRegisteredInHook($hookName)) $this->unregisterHook(Hook::get($hookName)); if (Tools::getValue('logo_position') == self::LEFT_COLUMN) $this->registerHook('leftColumn'); else if (Tools::getValue('logo_position') == self::RIGHT_COLUMN) $this->registerHook('rightColumn'); } /* Display errors */ if (sizeof($errors)) { $output .= ''; } $lang = new Language((int)($cookie->id_lang)); $iso_img = $lang->iso_code; if ($lang->iso_code != 'fr' AND $lang->iso_code != 'en') $iso_img = 'en'; $manual_links = array( 'en' => 'http://moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_en.pdf', 'es' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_es.pdf', 'fr' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_fr.pdf'); $iso_manual = $lang->iso_code; if (!array_key_exists($lang->iso_code, $manual_links)) $iso_manual = 'en'; $blockPositionList = array( self::DISABLE => $this->l('Disable'), self::LEFT_COLUMN => $this->l('Left Column'), self::RIGHT_COLUMN => $this->l('Right Column')); $currentLogoBlockPosition = ($this->isRegisteredInHook('leftColumn')) ? self::LEFT_COLUMN : (($this->isRegisteredInHook('rightColumn')) ? self::RIGHT_COLUMN : -1); /* Display settings form */ $output .= ' '.$this->l('About Moneybookers').'

'. $this->l('Take advantage of the special fees offered by Moneybookers to PrestaShop merchants !').'

'. $this->l('Moneybookers, controlled by Skrill Holdings, is one of the biggest online payment systems in Europe, and proposes more than 100 payment options and 41 currencies in more than 200 countries and territories. More than 80,000 merchants already use this solution among which eBay.com, Skype and Thomas Cook.').'

'. $this->l('With more than 17 million users and more than 15,000 new accounts created per day, Moneybookers also offers one of the biggest electronic wallet in the world. Your customers can also pay by using their e-mail and password thanks to the e-Wallet solution.').'

'. $this->l('Moneybookers changes its name and becomes Skrill!').'

'.$this->l('Settings').'
'.$this->l('Select the logo position').' :

'.$this->l('Change your logo position in the Front Office. Works with').' '.$this->l(' Live edit.').'

'.$this->l('Open Account').' '.$this->l('Start by opening a').' '.$this->l('free account').' '.$this->l('with Moneybookers:').'

PrestaShop & Moneybookers

'.$this->l('Then click here:').'


'.$this->l('Thanks to the PrestaShop/Moneybookers partnership,').' '.$this->l('you will get a preferential commission rate!').'



PrestaShop'.$this->l('Online payment solution by Moneybookers').'
'.$this->l('Monthly volume for payments made via Moneybookers').'Quick Checkout Moneybookers ***Moneybookers eWallet **
€ 0 - € 1,0002.9% + 0.19€0.9% + 0.19€
€ 1,000.01 - € 10,0001.8% + 0.19€
€ 10,000.01 - € 50,0001.6% + 0.19€
€ 50,000.01 - € 100,0001.4% + 0.19€
€ 100,0001.2% + 0.19€
'.$this->l('For merchants over €100,000 fees can be negotiated.').' Contact: ecommerce@moneybookers.com

** '.$this->l('Moneybookers eWallet').'
*** '.$this->l('Quick Checkout Moneybookers').'

'; return $output; } private function _displayLogoBlock($position) { $imgPath = 'http://www.prestashop.com/images/logo_partners/logo-skrill.png'; if (!@file_get_contents($imgPath)) $imgPath = __PS_BASE_URI__.'modules/moneybookers/logo-skrill.png'; return '
'; } public function hookRightColumn($params) { return $this->_displayLogoBlock(self::RIGHT_COLUMN); } public function hookLeftColumn($params) { return $this->_displayLogoBlock(self::LEFT_COLUMN); } public function hookPayment($params) { global $smarty, $cookie; if (!Configuration::get('MB_PARAMETERS') OR !Configuration::get('MB_PARAMETERS_2') OR (Configuration::get('MB_LOCAL_METHODS') == '' AND Configuration::get('MB_INTER_METHODS') == '')) return; $flag = false; $allowedCurrencies = $this->getCurrency((int)$params['cart']->id_currency); foreach ($allowedCurrencies AS $allowedCurrency) if ($allowedCurrency['id_currency'] == $params['cart']->id_currency) { $flag = true; break; } if (!$flag) { /* Uncomment the line below if you'd like to display an error message, rather than not showing the Moneybookers module */ // return $this->display(__FILE__, 'moneybookers-currency-error.tpl'); } else { $localMethods = Configuration::get('MB_LOCAL_METHODS'); $interMethods = Configuration::get('MB_INTER_METHODS'); $smarty->assign(array( 'display_mode' => (int)(Configuration::get('MB_DISPLAY_MODE')), 'local' => $localMethods ? explode('|', $localMethods) : array(), 'inter' => $interMethods ? explode('|', $interMethods) : array(), 'local_logos' => $this->_localPaymentMethods, 'inter_logos' => $this->_internationalPaymentMethods)); /* Load objects */ $address = new Address((int)($params['cart']->id_address_delivery)); $countryObj = new Country((int)($address->id_country), Configuration::get('PS_LANG_DEFAULT')); $customer = new Customer((int)($params['cart']->id_customer)); $currency = new Currency((int)($params['cart']->id_currency)); $lang = new Language((int)($cookie->id_lang)); $mbParams = array(); /* About the merchant */ $mbParams['pay_to_email'] = Configuration::get('MB_PAY_TO_EMAIL'); $mbParams['recipient_description'] = Configuration::get('PS_SHOP_NAME'); $mbParams['hide_login'] = (int)(Configuration::get('MB_HIDE_LOGIN')); $mbParams['id_logo'] = (int)(Configuration::get('MB_ID_LOGO')); $mbParams['return_url'] = (Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'order-confirmation.php?id_cart='.(int)($params['cart']->id).'&id_module='.(int)($this->id).'&key='.$customer->secure_key; $mbParams['cancel_url'] = Configuration::get('MB_CANCEL_URL'); /* About the customer */ $mbParams['pay_from_email'] = $customer->email; $mbParams['firstname'] = $address->firstname; $mbParams['lastname'] = $address->lastname; $mbParams['address'] = $address->address1; $mbParams['address2'] = $address->address2; $mbParams['phone_number'] = !empty($address->phone_mobile) ? $address->phone_mobile : $address->phone; $mbParams['postal_code'] = $address->postcode; $mbParams['city'] = $address->city; $mbParams['country'] = isset($this->_country[strtoupper($countryObj->iso_code)]) ? $this->_country[strtoupper($countryObj->iso_code)] : ''; $mbParams['language'] = strtoupper($lang->iso_code); $mbParams['date_of_birth'] = substr($customer->birthday, 5, 2).substr($customer->birthday, 8, 2).substr($customer->birthday, 0, 4); /* About the cart */ $mbParams['transaction_id'] = (int)($params['cart']->id).'_'.date('YmdHis').'_'.$params['cart']->secure_key; $mbParams['currency'] = $currency->iso_code; $mbParams['amount'] = number_format($params['cart']->getOrderTotal(), 2, '.', ''); /* URLs */ $mbParams['status_url'] = (Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/'.$this->name.'/validation.php'; /* Assign settings to Smarty template */ $smarty->assign($mbParams); /* Display the MoneyBookers iframe */ return $this->display(__FILE__, 'moneybookers.tpl'); } } public function hookPaymentReturn($params) { if (!$this->active) return ; global $smarty; switch($params['objOrder']->getCurrentState()) { case _PS_OS_PAYMENT_: case _PS_OS_OUTOFSTOCK_: $smarty->assign('status', 'ok'); break; case _PS_OS_BANKWIRE_: $smarty->assign('status', 'pending'); break; case _PS_OS_ERROR_: default: $smarty->assign('status', 'failed'); break; } return $this->display(__FILE__, 'confirmation.tpl'); } }