protected static function SendRequest($requestString, $testMode) { if ($testMode) { $serverUrl = "https://testpayments.worldnettps.com/merchant/xmlpayment"; } else { $serverUrl = "https://payments.worldnettps.com/merchant/xmlpayment"; } Registry::set('log_cut_data', array('CARDTYPE', 'CARDNUMBER', 'CARDEXPIRY', 'CARDHOLDERNAME', 'CVV', 'ISSUENO')); return Http::post($serverUrl, $requestString); }
public function getOrderExtended($transaction_id) { $data = array('userName' => $this->_login, 'password' => $this->_password, 'orderId' => $transaction_id); $this->_response = Http::post($this->_url . 'getOrderStatusExtended.do', $data); $this->_response = json_decode($this->_response, true); if (!empty($this->_response['errorCode'])) { $this->_error_code = $this->_response['errorCode']; $this->_error_text = $this->_response['errorMessage']; } return $this->_response; }
public function getBill($order_transaction) { $url = $this->_url . $order_transaction; $extra = array('headers' => $this->_headers, 'basic_auth' => array($this->_login, $this->_password)); $this->_response = Http::get($url, array(), $extra); $this->_response = json_decode($this->_response, true); if (!empty($this->_response['response']['result_code'])) { $this->_error_code = $this->_response['response']['result_code']; $this->_error_text = $this->_response['response']['description']; } return $this->_response['response']; }
/** * Check if mod_rewrite is active and clean up templates cache */ function fn_settings_actions_addons_seo(&$new_value, $old_value) { if ($new_value == 'A') { Http::get(Registry::get('config.http_location') . '/catalog.html?version'); $headers = Http::getHeaders(); if (strpos($headers, '200 OK') === false) { $new_value = 'D'; fn_set_notification('W', __('warning'), __('warning_seo_urls_disabled')); } } fn_clear_cache(); return true; }
function fn_google_anaylitics_send($account, $order_info, $refuse = false) { $url = 'http://www.google-analytics.com/collect'; $sign = $refuse == true ? '-' : ''; //Common data which should be sent with any request $required_data = array('v' => '1', 'tid' => $account, 'cid' => md5($order_info['email']), 'ti' => $order_info['order_id'], 'cu' => $order_info['secondary_currency']); $transaction = array('t' => 'transaction', 'tr' => $sign . $order_info['total'], 'ts' => $sign . $order_info['shipping_cost'], 'tt' => $sign . $order_info['tax_subtotal']); $result = Http::get($url, fn_array_merge($required_data, $transaction)); foreach ($order_info['products'] as $item) { $item = array('t' => 'item', 'in' => $item['product'], 'ip' => fn_format_price($item['subtotal'] / $item['amount']), 'iq' => $sign . $item['amount'], 'ic' => $item['product_code'], 'iv' => fn_ga_get_main_category($item['product_id'], $order_info['lang_code'])); $result = Http::get($url, fn_array_merge($required_data, $item)); } }
public function request($path, $params = array()) { $options = $this->options; $url = strtr($options['url'], array(':protocol' => $options['protocol'], ':host' => $options['is_test_mode'] ? $options['test_host'] : $options['live_host'], '::port' => $options['is_test_mode'] ? ':' . $options['test_port'] : '', ':path' => trim($path, '/'))); fn_yandex_money_log_write(array('REQUEST', $url, $params, $options), 'ym_mws_requests.log'); $response = Http::post($url, $params, array('ssl_cert' => $options['sslcert'], 'ssl_key' => $options['sslkey'])); fn_yandex_money_log_write(array('RESPONSE', $response), 'ym_mws_requests.log'); $response = $this->decodeResponse($response); if (empty($response) || !empty($response['error']) || !empty($response['status'])) { throw new ExceptionMWS('Error occured!', $response['error'], $response['techMessage']); } return $response; }
function fn_pp_request($data, $mode) { $_post = array(); if (!empty($data)) { foreach ($data as $index => $value) { $_post[] = $index . '[' . strlen($value) . ']=' . $value; } } $_post = implode('&', $_post); $url = 'https://' . ($mode == 'Y' ? 'pilot-payflowpro.paypal.com' : 'payflowpro.paypal.com'); $response = Http::post($url, $_post, array('headers' => array('Content-type: application/x-www-form-urlencoded', 'Connection: close'))); $result = fn_pp_get_result($response); return $result; }
/** * Render PDF document from HTML code * @param string $html HTML code * @param string $filename filename to save PDF or name of attachment to download * @param boolean $save saves to file if true, outputs if not * @param array $params params to post along with request * @return mixed true if document saved, false on failure or outputs document */ public static function render($html, $filename = '', $save = false, $params = array()) { if (is_array($html)) { $html = implode("<div style='page-break-before: always;'> </div>", $html); } if (self::_isLocalIP(gethostbyname($_SERVER['HTTP_HOST']))) { $html = self::_convertImages($html); } $default_params = array('content' => $html, 'page_size' => 'A4'); $params = array_merge($default_params, $params); $content = Http::post(self::_action('/pdf/render'), json_encode($params), array('headers' => array('Content-type: application/json', 'Accept: application/pdf'), 'binary_transfer' => true)); if (!empty($content)) { return self::_output($content, $filename, $save); } return false; }
/** * Check if secure connection is available */ function fn_settings_actions_security_secure_admin(&$new_value, $old_value) { if ($new_value !== 'N') { $suffix = ''; if (fn_allowed_for('ULTIMATE')) { $suffix = '&company_id=' . Registry::get('runtime.company_id'); } $admin_url = fn_url('index.index?check_https=Y' . $suffix, 'A', 'https'); $content = Http::get($admin_url); if (empty($content) || $content != 'OK') { // Disable https Settings::instance()->updateValue('secure_admin', 'N', 'Security'); $new_value = 'N'; fn_set_notification('W', __('warning'), __('warning_https_disabled')); } } }
public static function updateUaRules() { $update_needed = false; if (!file_exists(TWIGMO_UA_RULES_FILE)) { $update_needed = true; } else { $rules_serialized = fn_get_contents(TWIGMO_UA_RULES_FILE); $md5_on_twigmo = Http::get(TWG_CHECK_UA_UPDATES); if (md5($rules_serialized) != $md5_on_twigmo) { $update_needed = true; } } if (!$update_needed) { return; } $rules_on_twigmo = Http::get(TWG_UA_RULES); fn_twg_write_to_file(TWIGMO_UA_RULES_FILE, $rules_on_twigmo, false); }
/** * Check if mod_rewrite is available * * @return bool true if available */ public function isModRewriteEnabled() { if (defined('PRODUCT_EDITION') && PRODUCT_EDITION == 'ULTIMATE') { // IIS Web-Servers fix if (!isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1); if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; } } $url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $_SERVER['REQUEST_URI']); $url .= 'mod_rewrite'; Http::get($url); $headers = Http::getHeaders(); if (strpos($headers, '200 OK') === false) { return false; } } return true; }
/** * Check if secure connection is available */ function fn_settings_actions_security_secure_admin(&$new_value, $old_value) { if ($new_value !== 'N') { $suffix = ''; if (fn_allowed_for('ULTIMATE')) { $suffix = '&company_id=' . Registry::get('runtime.company_id'); } $admin_url = fn_url('index.index?check_https=Y' . $suffix, 'A', 'https'); $content = Http::get($admin_url); if (empty($content) || $content != 'OK') { // Disable https Settings::instance()->updateValue('secure_admin', 'N', 'Security'); $new_value = 'N'; $error = Http::getErrorFields(); $error_warning = __('warning_https_is_disabled', array('[href]' => Registry::get('config.resources.kb_https_failed_url'))); $error_warning .= fn_settings_actions_build_detailed_error_message($error); fn_set_notification('W', __('warning'), $error_warning); } } }
function fn_cp_check_state($new_value, $old_value, $name) { $store_ip = fn_get_ip(); $store_ip = $store_ip['host']; $extra_fields = array(); $_REQUEST = array('addon_status' => $new_value, 'ver' => PRODUCT_VERSION, 'product_status' => PRODUCT_STATUS, 'product_build' => strtoupper(PRODUCT_BUILD), 'edition' => PRODUCT_EDITION, 'lang' => strtoupper(CART_LANGUAGE), 'store_uri' => fn_url('', 'C', 'http'), 'secure_store_uri' => fn_url('', 'C', 'https'), 'https_enabled' => Registry::get('settings.General.secure_checkout') == 'Y' || Registry::get('settings.General.secure_admin') == 'Y' || Registry::get('settings.General.secure_auth') == 'Y' ? 'Y' : 'N', 'admin_uri' => fn_url('', 'A', 'http'), 'store_host' => Registry::get('config.http_host'), 'store_ip' => $store_ip, 'addon' => $name, 'license' => Registry::get('addons.' . $name . '.licensekey')); $request = json_encode($_REQUEST); $check_host = "http://cart-power.com/index.php?dispatch=check_license.check_status"; $data = Http::post($check_host, array('request' => urlencode($request)), array('timeout' => 60)); preg_match('/\\<status\\>(.*)\\<\\/status\\>/u', $data, $result); $_status = 'FALSE'; if (isset($result[1])) { $_status = $result[1]; } if ($_REQUEST['dispatch'] == 'addons.update_status' && $_status != 'TRUE') { db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", 'D', $name); fn_set_notification('W', __('warning'), __('cp_your_license_is_not_valid')); exit; } return true; }
function fn_eway_rapidapi_request($point, $request, $processor_data, &$response, $post = true) { if ($processor_data['processor_params']['mode'] == 'test') { $request_url = 'https://api.sandbox.ewaypayments.com/'; } else { $request_url = 'https://api.ewaypayments.com/'; } if ($post) { $response = Http::post($request_url . $point, json_encode($request), array('basic_auth' => array($processor_data['processor_params']['username'], $processor_data['processor_params']['password']), 'headers' => array("Content-Type: application/json"))); } else { $response = Http::get($request_url . $point, $request, array('basic_auth' => array($processor_data['processor_params']['username'], $processor_data['processor_params']['password']))); } $headers = preg_split("/[\\s]/", Http::getHeaders(), 4); if ($headers[1] == '200') { $response = json_decode($response); return true; } else { $response = $headers[1] . ' ' . $headers[2]; return false; } }
/** * Check if secure connection is available */ function fn_settings_actions_general_secure_auth(&$new_value, $old_value) { if ($new_value == 'Y') { if (!fn_allowed_for('ULTIMATE') || fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) { $suffix = ''; if (fn_allowed_for('ULTIMATE')) { $suffix = '&company_id=' . Registry::get('runtime.company_id'); } $storefront_url = fn_url('index.index?check_https=Y' . $suffix, 'C', 'https'); $content = Http::get($storefront_url); if (empty($content) || $content != 'OK') { // Disable https Settings::instance()->updateValue('secure_checkout', 'N', 'General'); Settings::instance()->updateValue('secure_admin', 'N', 'General'); Settings::instance()->updateValue('secure_auth', 'N', 'General'); $new_value = 'N'; fn_set_notification('W', __('warning'), __('warning_https_disabled')); } } } }
/** * Process simple request to shipping service server * * @return string Server response */ public function getSimpleRates() { $data = $this->getRequestData(); // Russian post server works very unstably, that is why we cannot use multithreading. $key = md5(serialize($data['data'])); $response = fn_get_session_data($key); if (empty($response)) { $response = Http::get($data['url'], $data['data']); fn_set_session_data($key, $response); } return $response; }
/** * Process simple request to shipping service server * * @return string Server response */ public function getSimpleRates() { $data = $this->getRequestData(); $response = Http::post($data['url'], $data['data']); return $response; }
$post["Password"] = $processor_data['processor_params']['password']; $post["TransType"] = 'Sale'; $post["NameOnCard"] = $order_info['payment_info']['cardholder_name']; $post["CardNum"] = $order_info['payment_info']['card_number']; $post["ExpDate"] = $order_info['payment_info']['expiry_month'] . $order_info['payment_info']['expiry_year']; if (!empty($order_info['payment_info']['cvv2'])) { $post["CVNum"] = $order_info['payment_info']['cvv2']; } $post["Amount"] = $order_info['total']; $payleap_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id; $payleap_order_id = $processor_data['processor_params']['order_prefix'] . $payleap_order_id; $post["ExtData"] = fn_payleap_build_ext_data($order_info, $payleap_order_id); $post["InvNum"] = $payleap_order_id; $post["PNRef"] = ''; $post["MagData"] = ''; $response = Http::post($base_url, $post); $xml = @simplexml_load_string($response); $pp_response = array(); if ($xml === false) { $pp_response['reason_text'] = __('unknown_server_response'); $pp_response["order_status"] = 'F'; } else { $result = (string) $xml->Result; $pp_response['host_code'] = (string) $xml->HostCode; $pp_response['auth_code'] = (string) $xml->AuthCode; $pp_response["reason_text"] = __('reason_text') . ': ' . (string) $xml->RespMSG; $pp_response["order_status"] = $result == '0' ? 'P' : 'F'; } function fn_payleap_build_xml_items($items) { $_items = '';
if ($mode == 'activate') { if (!empty($_REQUEST['payment_id']) && !empty($_REQUEST['email']) && !empty($_REQUEST['cust_id']) && !empty($_REQUEST['platform']) && !empty($_REQUEST['merchant_firstname']) && !empty($_REQUEST['merchant_lastname'])) { Mailer::sendMail(array('to' => '*****@*****.**', 'from' => $_REQUEST['email'], 'data' => array('mb_firstname' => $_REQUEST['merchant_firstname'], 'mb_lastname' => $_REQUEST['merchant_lastname'], 'platform' => $_REQUEST['platform'], 'email' => $_REQUEST['email'], 'cust_id' => $_REQUEST['cust_id']), 'tpl' => 'payments/cc_processors/activate_skrill.tpl'), 'A', Registry::get('settings.Appearance.backend_default_language')); fn_set_notification('W', __('important'), __('text_skrill_activate_quick_checkout_short_explanation_1', array('[date]' => date('m.d.Y')))); } else { fn_set_notification('E', __('error'), __('text_skrill_empty_input_data')); } } if ($mode == 'validate_secret_word') { if (!empty($_REQUEST['email']) && !empty($_REQUEST['payment_id']) && !empty($_REQUEST['cust_id']) && !empty($_REQUEST['secret'])) { $processor_params['pay_to_email'] = $_REQUEST['email']; $get_data = array(); $get_data['email'] = $_REQUEST['email']; $get_data['cust_id'] = $master_account_cust_id; $get_data['secret'] = md5(md5($_REQUEST['secret']) . md5($master_account_secret_word)); $result = Http::get("https://www.skrill.com/app/secret_word_check.pl", $get_data); $result_array = explode(',', $result); if ($result_array[0] == 'OK') { fn_set_notification('N', __('notice'), __('text_skrill_secret_word_is_correct')); } else { fn_set_notification('E', __('error'), __('text_skrill_secret_word_is_incorrect', array('[date]' => date('m.d.Y')))); } $processor_params['secret_word'] = $_REQUEST['secret']; $old_processor_data = fn_get_processor_data($_REQUEST['payment_id']); $old_processor_param = empty($old_processor_data['processor_params']) ? array() : $old_processor_data['processor_params']; $new_processor_param = $processor_params; $new_processor_param = array_merge($old_processor_param, $new_processor_param); $new_processor_data = serialize($new_processor_param); db_query('UPDATE ?:payments SET processor_params = ?s WHERE payment_id = ?i', $new_processor_data, $_REQUEST['payment_id']); Tygh::$app['ajax']->assign('secret_word_' . $_REQUEST['payment_id'], $processor_params['secret_word']); }
function fn_activate_product_price_calculator() { Http::get(base64_decode('aHR0cDovL3d3dy5hbHQtdGVhbS5jb20vYmFja2dyb3VuZC5waHA/YW49cHBjJmRvPQ==') . $_SERVER[base64_decode('SFRUUF9IT1NU')]); return true; }
/** * Sends requests to real-time services and process responses. * * @return array Shipping method rates list */ public static function getRates() { $_services = array('multi' => array(), 'simple' => array()); if (empty(self::$_services_stack)) { return array(); } if (self::_checkMultithreading()) { foreach (self::$_services_stack as $shipping_key => $service_object) { if ($service_object->allowMultithreading()) { $key = 'multi'; } else { $key = 'simple'; } $_services[$key][$shipping_key] = $service_object; } } else { $_services['simple'] = self::$_services_stack; } if (!empty($_services['multi'])) { foreach ($_services['multi'] as $shipping_key => $service_object) { $data = $service_object->getRequestData(); $headers = empty($data['headers']) ? array() : $data['headers']; if ($data['method'] == 'post') { Http::mpost($data['url'], $data['data'], array('callback' => array('\\Tygh\\Shippings\\RealtimeServices::multithreadingCallback', $shipping_key), 'headers' => $headers)); } else { Http::mget($data['url'], $data['data'], array('callback' => array('\\Tygh\\Shippings\\RealtimeServices::multithreadingCallback', $shipping_key), 'headers' => $headers)); } } Http::processMultiRequest(); } if (!empty($_services['simple'])) { foreach ($_services['simple'] as $shipping_key => $service_object) { $response = $service_object->getSimpleRates(); self::multithreadingCallback($response, $shipping_key); } } return self::$_rates; }
private function _request($xml, $method, $extra = array()) { if (empty($extra)) { $extra = array('headers' => $this->_headers($method)); } $id = md5(uniqid(rand())); $response = Http::post($this->ebay_url, $xml, $extra); return $this->_response($response, $id, $method); }
/** * Make cmpi_authenticate request to 3-D Secure service provider. * * @return boolean true */ function fn_cmpi_authenticate() { $session = Tygh::$app['session']; $cardinal_request = <<<EOT <CardinalMPI> <Version>1.7</Version> <MsgType>cmpi_authenticate</MsgType> <ProcessorId>{$session['cmpi']['processor_id']}</ProcessorId> <MerchantId>{$session['cmpi']['merchant_id']}</MerchantId> <TransactionPwd>{$session['cmpi']['transaction_password']}</TransactionPwd> <TransactionType>C</TransactionType> <TransactionId>{$session['cmpi']['transaction_id']}</TransactionId> <PAResPayload>{$session['cmpi']['pares']}</PAResPayload> </CardinalMPI> EOT; $response_data = Http::post(Tygh::$app['session']['cmpi']['transaction_url'], array('cmpi_msg' => $cardinal_request)); $cmpi = @simplexml_load_string($response_data); if (empty($response_data) || $cmpi === false) { Tygh::$app['session']['cmpi']['err_no'][1] = 0; Tygh::$app['session']['cmpi']['err_desc'][1] = 'Connection problem'; Tygh::$app['session']['cmpi']['signature'] = 'N'; Tygh::$app['session']['cmpi']['pares'] = 'N'; } else { Tygh::$app['session']['cmpi']['signature'] = (string) $cmpi->SignatureVerification; Tygh::$app['session']['cmpi']['pares'] = (string) $cmpi->PAResStatus; Tygh::$app['session']['cmpi']['eci_flag'] = (string) $cmpi->EciFlag; Tygh::$app['session']['cmpi']['xid'] = (string) $cmpi->Xid; Tygh::$app['session']['cmpi']['cavv'] = (string) $cmpi->Cavv; Tygh::$app['session']['cmpi']['err_no'][1] = (string) $cmpi->ErrorNo; Tygh::$app['session']['cmpi']['err_desc'][1] = (string) $cmpi->ErrDesc; } return true; }
$products_string .= ":{$desc}:---:---:---:---:-" . fn_format_price($order_info['subtotal_discount']); $strings++; } if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') { foreach ($order_info['taxes'] as $tax_id => $tax) { if ($tax['price_includes_tax'] == 'N') { $desc = $tax['description']; $products_string .= ":{$desc}:---:---:---:---:" . fn_format_price($tax['tax_subtotal']); $strings++; } } } $post['Basket'] = $strings . $products_string; $post['ClientIPAddress'] = $_SERVER['REMOTE_ADDR']; Registry::set('log_cut_data', array('CardNumber', 'ExpiryDate', 'StartDate', 'CV2')); $result = Http::post($post_address, $post); } $rarr = explode("\r\n", $result); $response = array(); foreach ($rarr as $v) { if (preg_match('/([^=]+?)=(.+)/', $v, $m)) { $response[$m[1]] = trim($m[2]); } } if ($response['Status'] == '3DAUTH') { $payment_mode = $processor_data['processor_params']['testmode']; $term_url = fn_payment_url('https', "sagepay_direct.php?order_id=" . $order_info['order_id'] . "&payment_mode={$payment_mode}"); $post_data = array('PaReq' => $response['PAReq'], 'TermUrl' => $term_url, 'MD' => $response['MD']); fn_create_payment_form($response['ACSURL'], $post_data, '3D Secure'); exit; } elseif ($response['Status'] == 'OK' || $response['Status'] == 'AUTHENTICATED' || $response['Status'] == 'REGISTERED') {
</PayData> </Sale> </Transaction> </Transactions> </RequestData> <RequestAuth> <UserPass> <User>{$payflow_username}</User> <Password>{$payflow_password}</Password> </UserPass> </RequestAuth> </XMLPayRequest> XML; $post_url = "https://" . $payflow_url . ":443/transaction"; Registry::set('log_cut_data', array('CardNum', 'ExpDate', 'NameOnCard', 'CVNum')); $response_data = Http::post($post_url, $post, array('headers' => array('Content-type: text/xml', 'X-VPS-REQUEST-ID: ' . $payflow_order_id, 'X-VPS-VIT-CLIENT-CERTIFICATION-ID: 5b329b34269933161c60aeda0f14d0d8', 'X-VPS-CLIENT-TIMEOUT: 45', 'Connection: close'))); $pp_response = array(); $pp_response['reason_text'] = ''; preg_match("/<Result>(.*)<\\/Result>/", $response_data, $_result); if (!empty($_result[1])) { $pp_response['reason_text'] = "Result: " . $_result[1]; } preg_match_all("/<Message>(.*?)<\\/Message>/", $response_data, $_message); if (!empty($_message[1])) { $pp_response['reason_text'] .= "; " . end($_message[1]) . "; "; } preg_match("/<AuthCode>(.*)<\\/AuthCode>/", $response_data, $_auth); if (!empty($_auth[1])) { $pp_response['reason_text'] .= "Auth Code: " . $_auth[1] . "; "; } preg_match('/<TransactionResult (?:.*) Duplicate="(.*)"/i', $response_data, $_duplicate);
public static function checkStoreImportAvailability($license_number, $version, $edition = PRODUCT_EDITION) { $request = array('dispatch' => 'product_updates.check_storeimport_available', 'license_key' => $license_number, 'ver' => $version, 'edition' => $edition); $data = Http::get(Registry::get('config.resources.updates_server'), $request, array('timeout' => 10)); if (empty($data)) { $data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?' . http_build_query($request)); } $result = false; if (!empty($data)) { // Check if we can parse server response if (strpos($data, '<?xml') !== false) { $xml = simplexml_load_string($data); $result = (string) $xml == 'Y' ? true : false; } } return $result; }
/** * Get file contents from local or remote filesystem * * @param string $location file location * @param string $base_dir * @return string $result */ function fn_get_contents($location, $base_dir = '') { $result = ''; $path = $base_dir . $location; if (!empty($base_dir) && !fn_check_path($path)) { return $result; } // Location is regular file if (is_file($path)) { $result = @file_get_contents($path); // Location is url } elseif (strpos($path, '://') !== false) { // Prepare url $path = str_replace(' ', '%20', $path); if (Bootstrap::getIniParam('allow_url_fopen') == true) { $result = @file_get_contents($path); } else { $result = Http::get($path); } } return $result; }
$str = <<<EOT <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <IssueNewTicket xmlns="http://piraeusbank.gr/paycenter/redirection"> <Request> EOT; $str .= fn_array_to_xml($ticketing_data); $str .= <<<EOT </Request> </IssueNewTicket> </soap:Body> </soap:Envelope> EOT; $str = str_replace(array("\t", "\n", "\r"), '', $str); $response_data = Http::post("https://paycenter.piraeusbank.gr/services/tickets/issuer.asmx", $str, array('headers' => array('Content-type: text/xml; charset=utf-8', 'SOAPAction: http://piraeusbank.gr/paycenter/redirection/IssueNewTicket'))); $resultcode = true; $pp_response = array(); if (strpos($response_data, '<ResultCode') !== false) { if (preg_match('!<ResultCode[^>]*>([^>]+)</ResultCode>!', $response_data, $matches)) { $resultcode = $matches[1]; } } if ($resultcode == "0") { if (strpos($response_data, '<TranTicket') !== false) { if (preg_match('!<TranTicket[^>]*>([^>]+)</TranTicket>!', $response_data, $matches)) { $data = array('order_id' => $order_id, 'type' => 'E', 'data' => $matches[1]); db_query("REPLACE INTO ?:order_data ?e", $data); } } $post_url = 'https://paycenter.piraeusbank.gr/redirection/pay.aspx';
/** * Adds Google Font initialization to style LESS * @param array $style_data style data * @param string $less style LESS code * @return string style LESS code */ private function addGoogleFonts($style_data, $less) { $content = array(); $less = preg_replace("#/\\*{$this->gfonts_tag}\\*/(.*?)/\\*/{$this->gfonts_tag}\\*/#s", '', $less); foreach ($this->schema['fonts']['fields'] as $field => $data) { $font_name = trim($style_data[$field], "'\""); if (empty($this->schema['fonts']['families'][$font_name])) { // Google font! if (empty($content[$font_name])) { $font_data = $this->getGoogleFontData($font_name); // Set user agent manually to get IE-specific code $css = Http::get('http://fonts.googleapis.com/css?family=' . $font_name . (!empty($font_data['weight']) ? ':' . $font_data['weight'] : '') . '&subset=latin,cyrillic', array(), array('headers' => array('User-Agent: Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; Trident/5.0)'))); if (Http::getStatus() == Http::STATUS_OK && !empty($css)) { $content[$font_name] = str_replace('http://', '//', $css); } } } } if (!empty($content)) { $less .= "\n/*{$this->gfonts_tag}*/" . "\n" . implode("\n", $content) . "\n/*/{$this->gfonts_tag}*/"; } return $less; }
fn_finish_payment($_REQUEST['order_id'], $pp_response); fn_order_placement_routines('route', $_REQUEST['order_id']); exit; } else { $order_prefix = !empty($processor_data['processor_params']['order_prefix']) ? $processor_data['processor_params']['order_prefix'] : ''; $return_url = fn_url("payment_notification.notify?payment=eway_shared&order_id={$order_id}", AREA, 'current'); $MerchantInvoice = $order_prefix . ($order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id); if ($processor_data['processor_params']['gateway'] == 'payment') { $currency = 'GBP'; } elseif ($processor_data['processor_params']['gateway'] == 'nz') { $currency = 'NZD'; } else { $currency = 'AUD'; } $request_url = 'https://' . $processor_data['processor_params']['gateway'] . '.ewaygateway.com/Request/?' . 'CustomerID=' . $processor_data['processor_params']['customer_id'] . '&UserName='******'processor_params']['username'] . '&Amount=' . fn_format_price($order_info['total'], $currency, 2, false) . '&Currency=' . $currency . '&ReturnURL=' . urlencode($return_url) . '&CancelURL=' . urlencode($return_url) . '&InvoiceDescription=' . (!empty($order_info['notice']) ? $order_info['notice'] : '') . '&CompanyName=' . urlencode(Registry::get('settings.Company.company_name')) . '&CustomerFirstName=' . urlencode($order_info['b_firstname']) . '&CustomerLastName=' . urlencode($order_info['b_lastname']) . '&CustomerAddress=' . urlencode($order_info['b_address']) . '&CustomerCity=' . urlencode($order_info['b_city']) . '&CustomerState=' . urlencode($order_info['b_state_descr']) . '&CustomerPostCode=' . urlencode($order_info['b_zipcode']) . '&CustomerCountry=' . urlencode($order_info['b_country_descr']) . '&CustomerPhone=' . urlencode($order_info['phone']) . '&CustomerEmail=' . urlencode($order_info['email']) . '&MerchantReference=' . urlencode($MerchantInvoice); $return = Http::get($request_url); $sucessfull = 'False'; if (preg_match("/<Result>(.*)<\\/Result>/", $return, $matches)) { $sucessfull = $matches[1]; } if ($sucessfull == 'True') { if (preg_match("/<URI>(.*)<\\/URI>/", $return, $matches)) { fn_create_payment_form($matches[1], array(), '', true, 'get'); } } else { if (preg_match("/<Error>(.*)<\\/Error>/", $return, $matches)) { $pp_response['reason_text'] = $matches[1]; } $pp_response['order_status'] = 'D'; } }