Пример #1
0
 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);
 }
Пример #2
0
 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;
 }
Пример #3
0
 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;
}
Пример #5
0
 /**
  * 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;'>&nbsp;</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;
 }
Пример #6
0
 public static function sendUaStat()
 {
     $access_id = TwigmoConnector::getAccessID('A');
     if (!$access_id) {
         return;
     }
     $query = db_quote('FROM ?:twigmo_ua_stat WHERE month<?s LIMIT ?i', date('Y-m-1'), 100);
     $needToSend = db_get_array('SELECT *, ?s as access_id ' . $query, $access_id);
     if (!count($needToSend)) {
         return;
     }
     $responce = Http::post(TWG_UA_RULES_STAT, array('stat' => serialize($needToSend)));
     if ($responce == 'ok') {
         db_query('DELETE ' . $query);
     }
 }
Пример #7
0
 public static function zonesPickpoint($url_zone, $data_zone, $data_url)
 {
     $_result = array();
     $response = Http::post($url_zone, json_encode($data_zone), $data_url);
     $result = json_decode($response);
     $data_result = json_decode(json_encode($result), true);
     if (isset($data_result['Error']) && $data_result['Error'] == 1 && !empty($data_result['ErrorMessage'])) {
         self::$last_error = $data_result['ErrorMessage'];
     } elseif (isset($data_result['Error']) && !empty($data_result['Error'])) {
         self::$last_error = $data_result['Error'];
     } elseif (isset($data_result['Zones'])) {
         $zone = reset($data_result['Zones']);
         $_result = array('delivery_min' => $zone['DeliveryMin'], 'delivery_max' => $zone['DeliveryMax'], 'koefficient' => $zone['Koeff'], 'zone' => $zone['Zone'], 'to_pt' => $zone['ToPT']);
     }
     return $_result;
 }
Пример #8
0
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;
    }
}
 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;
 }
Пример #10
0
 /**
  * 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;
 }
Пример #11
0
         fn_set_notification('E', __('error'), $message);
     }
 } elseif ($pdata['processor'] == 'Avangard' && $pdata['processor_params']['returns_enabled'] == 'Y' && !empty($payment_info['avangard_ticket'])) {
     $url = "https://www.avangard.ru/iacq/h2h/reverse_order";
     $dom = new DOMDocument('1.0', 'utf-8');
     $dom->formatOutput = true;
     $order = $dom->createElement('reverse_order');
     $order->appendChild($dom->createElement('ticket', $payment_info['avangard_ticket']));
     $order->appendChild($dom->createElement('shop_id', $pdata['processor_params']['shop_id']));
     $order->appendChild($dom->createElement('shop_passwd', $pdata['processor_params']['password']));
     if ($refund_data['amount'] != $order_info['total']) {
         $order->appendChild($dom->createElement('amount', $refund_data['amount'] * 100));
     }
     $dom->appendChild($order);
     $extra = array('headers' => array('Content-type: application/x-www-form-urlencoded;charset=utf-8', 'Expect:'));
     $result_xml = Http::post($url, array('xml' => $dom->saveXML()), $extra);
     $xml_data = @simplexml_load_string($result_xml);
     if (!empty($xml_data->response_message)) {
         if ($xml_data->response_code == 0) {
             fn_set_notification('N', __('notify'), $xml_data->response_message);
             $payment_info['avangard_refunded_transaction_id'] = strval($xml_data->id);
             $payment_info['avangard_refunded_time'] = date('c');
             $payment_info['avangard_refund_amount'] = $refund_data['amount'];
             if (!empty($refund_data['cause'])) {
                 $payment_info['avangard_refund_cause'] = $refund_data['cause'];
             }
             fn_update_order_payment_info($order_info['order_id'], $payment_info);
             fn_change_order_status($order_info['order_id'], $pdata['processor_params']['returned_order_status']);
         } else {
             fn_set_notification('E', __('error'), $xml_data->response_message);
         }
Пример #12
0
function fn_sdek_calculate_cost_by_shipment($order_info, $shipping_info, $shipment_info, $rec_city_code)
{
    $total = $weight = 0;
    $goods = array();
    $length = $width = $height = 20;
    $sum_rate = 0;
    $packages = array();
    $shipping_info['module'] = $shipment_info['carrier'];
    foreach ($shipment_info['products'] as $item_id => $amount) {
        $product = $order_info['products'][$item_id];
        $total += $product['subtotal'];
        $product_extra = db_get_row("SELECT shipping_params, weight FROM ?:products WHERE product_id = ?i", $product['product_id']);
        if (!empty($product_extra['weight']) && $product_extra['weight'] != 0) {
            $product_weight = $product_extra['weight'];
        } else {
            $product_weight = 0.01;
        }
        $p_ship_params = unserialize($product_extra['shipping_params']);
        $package_length = empty($p_ship_params['box_length']) ? $length : $p_ship_params['box_length'];
        $package_width = empty($p_ship_params['box_width']) ? $width : $p_ship_params['box_width'];
        $package_height = empty($p_ship_params['box_height']) ? $height : $p_ship_params['box_height'];
        $weight_ar = fn_expand_weight($product_weight);
        $weight = round($weight_ar['plain'] * Registry::get('settings.General.weight_symbol_grams') / 1000, 3);
        $good['weight'] = $weight;
        $good['length'] = $package_length;
        $good['width'] = $package_width;
        $good['height'] = $package_height;
        for ($x = 1; $x <= $amount; $x++) {
            $goods[] = $good;
        }
        foreach ($order_info['product_groups'] as $product_groups) {
            if (!empty($product_groups['products'][$item_id])) {
                $products[$item_id] = $product_groups['products'][$item_id];
                $products[$item_id] = array_merge($products[$item_id], $good);
                $products[$item_id]['amount'] = $amount;
            }
            $shipping_info['package_info'] = $product_groups['package_info'];
        }
    }
    $data_package = Shippings::groupProductsList($products, $shipping_info['package_info']['location']);
    $data_package = reset($data_package);
    $shipping_info['package_info_full'] = $data_package['package_info_full'];
    $shipping_info['package_info'] = $data_package['package_info_full'];
    $url = 'http://api.edostavka.ru/calculator/calculate_price_by_json.php';
    $r_url = 'http://lk.cdek.ru:8080/calculator/calculate_price_by_json.php';
    $post['version'] = '1.0';
    $post['dateExecute'] = date('Y-m-d');
    if (!empty($shipping_info['service_params']['dateexecute'])) {
        $timestamp = TIME + $shipping_info['service_params']['dateexecute'] * SECONDS_IN_DAY;
        $dateexecute = date('Y-m-d', $timestamp);
    } else {
        $dateexecute = date('Y-m-d');
    }
    $post['dateExecute'] = $dateexecute;
    if (!empty($shipping_settings['authlogin'])) {
        $post['authLogin'] = $shipping_info['service_params']['authlogin'];
        $post['secure'] = !empty($shipping_info['service_params']['authpassword']) ? md5($post['dateExecute'] . "&" . $shipping_info['service_params']['authpassword']) : '';
    }
    $post['authLogin'] = $shipping_info['service_params']['authlogin'];
    $post['secure'] = md5($post['dateExecute'] . "&" . $shipping_info['service_params']['authpassword']);
    $post['senderCityId'] = $shipping_info['service_params']['from_city_id'];
    $post['receiverCityId'] = $rec_city_code;
    $post['tariffId'] = $shipping_info['service_params']['tariffid'];
    $post['goods'] = $goods;
    $post = json_encode($post);
    $key = md5($post);
    $sdek_data = fn_get_session_data($key);
    $content = json_encode($post);
    if (empty($sdek_data)) {
        $response = Http::post($url, $post, array('Content-Type: application/json', 'Content-Length: ' . strlen($content)), array('timeout' => SDEK_TIMEOUT));
        if (empty($response)) {
            $response = Http::post($r_url, $post, array('Content-Type: application/json', 'Content-Length: ' . strlen($content)), array('timeout' => SDEK_TIMEOUT));
        }
        fn_set_session_data($key, $response);
    } else {
        $response = $sdek_data;
    }
    $result = json_decode($response, true);
    $sum_rate = Shippings::calculateRates(array($shipping_info));
    $sum_rate = reset($sum_rate);
    $result = $sum_rate['price'];
    return $result;
}
Пример #13
0
/**
 * 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;
}
Пример #14
0
                    </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);
Пример #15
0
 public function _addDellinCities($url_cities, $post)
 {
     $file_dir = fn_get_files_dir_path() . "dellin/";
     fn_mkdir($file_dir);
     @chmod($file_dir, 0777);
     $file_path = $file_dir . date("Y-m-d", TIME) . '_cities.csv';
     if (!file_exists($file_path)) {
         $response = Http::post($url_cities, json_encode($post), $this->url_params);
         $result = (array) json_decode($response);
         file_put_contents($file_path, file_get_contents($result['url']));
         if (!empty($result['url'])) {
             $max_line_size = 65536;
             // 64 Кб
             $data_city = array();
             $delimiter = ',';
             $encoding = fn_detect_encoding($result['url'], 'F', CART_LANGUAGE);
             if (!empty($encoding)) {
                 $result['url'] = fn_convert_encoding($encoding, 'UTF-8', $result['url'], 'F');
             } else {
                 fn_set_notification('W', __('warning'), __('text_exim_utf8_file_format'));
             }
             $f = false;
             if ($result['url'] !== false) {
                 $f = fopen($result['url'], 'rb');
             }
             if ($f) {
                 $import_schema = fgetcsv($f, $max_line_size, $delimiter);
                 $schema_size = sizeof($import_schema);
                 $skipped_lines = array();
                 $line_it = 1;
                 while (($data = fn_fgetcsv($f, $max_line_size, $delimiter)) !== false) {
                     $line_it++;
                     if (fn_is_empty($data)) {
                         continue;
                     }
                     if (sizeof($data) != $schema_size) {
                         $skipped_lines[] = $line_it;
                         continue;
                     }
                     $data = str_replace(array('\\r', '\\n', '\\t', '"'), '', $data);
                     $data_city = array_combine($import_schema, Bootstrap::stripSlashes($data));
                     if (!empty($data_city)) {
                         $dellin_city = array('number_city' => $data_city['id'], 'code_kladr' => str_replace(' ', '', $data_city['codeKLADR']), 'is_terminal' => $data_city['isTerminal']);
                         $first_pos = strpos($data_city['name'], '(');
                         $end_pos = strpos($data_city['name'], ')') - $first_pos;
                         if (!empty($first_pos)) {
                             $dellin_city['state'] = str_replace(array("(", ")"), "", substr($data_city['name'], $first_pos, $end_pos));
                             $dellin_city['city'] = str_replace(array('(' . $dellin_city['state'] . ')', '"'), "", $data_city['name']);
                         } else {
                             $dellin_city['state'] = str_replace(array('г.', 'г', 'г. ', 'г '), '', $data_city['name']);
                             $dellin_city['city'] = $data_city['name'];
                         }
                         $dellin_city['city_id'] = db_get_field("SELECT city_id FROM ?:rus_dellin_cities WHERE code_kladr = ?s", $dellin_city['code_kladr']);
                         db_query("REPLACE INTO ?:rus_dellin_cities ?e", $dellin_city);
                     }
                 }
             }
         }
     }
 }
Пример #16
0
         fn_change_order_status($_REQUEST['order_id'], $pp_response['order_status']);
     }
     exit;
 }
 if (fn_format_price($pp_mc_gross, $processor_data['processor_params']['currency']) != fn_format_price($order_info['total'], $processor_data['processor_params']['currency'])) {
     $pp_response['order_status'] = $paypal_statuses['denied'];
     $pp_response['reason_text'] = __('order_total_not_correct');
     $pp_response['transaction_id'] = @$_REQUEST['txn_id'];
 } elseif (stristr($_REQUEST['payment_status'], 'Completed')) {
     $params = $processor_data['processor_params'];
     $paypal_host = $params['mode'] == 'test' ? "www.sandbox.paypal.com" : "www.paypal.com";
     $paypal_post = $_REQUEST;
     $paypal_post[$account_type] = $processor_data['processor_params']['account'];
     $paypal_post['cmd'] = '_notify-validate';
     unset($paypal_post['dispatch']);
     $result = Http::post("https://{$paypal_host}:443/cgi-bin/webscr", $paypal_post, array('headers' => array('Connection: close')));
     if (stristr($result, 'VERIFIED')) {
         $pp_response['order_status'] = $paypal_statuses['completed'];
         $pp_response['reason_text'] = '';
         $pp_response['transaction_id'] = @$_REQUEST['txn_id'];
     } elseif (stristr($result, 'INVALID')) {
         $pp_response['order_status'] = $paypal_statuses['denied'];
         $pp_response['reason_text'] = '';
         $pp_response['transaction_id'] = @$_REQUEST['txn_id'];
     } else {
         $pp_response['order_status'] = $paypal_statuses['expired'];
         $pp_response['reason_text'] = '';
         $pp_response['transaction_id'] = @$_REQUEST['txn_id'];
     }
 } elseif (stristr($_REQUEST['payment_status'], 'Pending')) {
     $pp_response['order_status'] = $paypal_statuses['pending'];
Пример #17
0
 protected static function _httpRequest($url, $data, $method, $add_lang = true)
 {
     if ($add_lang) {
         $url .= '&sl=' . strtolower(CART_LANGUAGE);
     }
     if ($method == 'POST') {
         $result = Http::post($url, $data);
     } else {
         $result = Http::get($url, $data);
     }
     return $result;
 }
Пример #18
0
}
$post['Withroot'] = 'Y';
$post['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
if (isset($processor_data['processor_params']['use_new_sha_method']) && $processor_data['processor_params']['use_new_sha_method'] == 'Y') {
    if (!empty($processor_data['processor_params']['userid'])) {
        $userid_condition = "USERID=" . $processor_data['processor_params']['userid'] . $pp_secret;
    } else {
        $userid_condition = '';
    }
    //New SHA:  All parameters in alphabetical order
    $post['SHASign'] = sha1("AMOUNT=" . 100 * $order_info["total"] . $pp_secret . "CARDNO=" . trim($order_info['payment_info']['card_number']) . $pp_secret . "CN=" . trim($order_info['payment_info']['cardholder_name']) . $pp_secret . "CURRENCY=" . $pp_curr . $pp_secret . "CVC=" . $order_info['payment_info']['cvv2'] . $pp_secret . "ED=" . $order_info['payment_info']['expiry_month'] . '/' . $order_info['payment_info']['expiry_year'] . $pp_secret . (!empty($email) ? "EMAIL=" . $email . $pp_secret : '') . "ORDERID=" . $_order_id . $pp_secret . (!empty($owneraddress) ? "OWNERADDRESS=" . $owneraddress . $pp_secret : '') . (!empty($ownercty) ? "OWNERCTY=" . $ownercty . $pp_secret : '') . (!empty($ownertelno) ? "OWNERTELNO=" . $ownertelno . $pp_secret : '') . (!empty($ownertown) ? "OWNERTOWN=" . $ownertown . $pp_secret : '') . (!empty($ownerzip) ? "OWNERZIP=" . $ownerzip . $pp_secret : '') . "PSPID=" . $pp_merch . $pp_secret . "PSWD=" . $pp_pass . $pp_secret . "REMOTE_ADDR=" . $_SERVER['REMOTE_ADDR'] . $pp_secret . $userid_condition . "WITHROOT=Y" . $pp_secret);
} else {
    //SHA-1(OrderID + Amount + Currency + Cardno + PSPID + operation + additional string)
    $post['SHASign'] = sha1($_order_id . 100 * $order_info["total"] . $pp_curr . $order_info['payment_info']['card_number'] . $pp_merch . $pp_secret);
}
$result = Http::post($pp_url, $post);
$pp_response = array();
$response_code = '';
if (preg_match("/[^NC]STATUS=\"(.+)\"/U", $result, $m)) {
    $pp_response['reason_text'] = empty($status[$m[1]]) ? "Status code: " . $m[1] : $status[$m[1]];
    $response_code = $m[1];
}
if ($response_code == '5' || $response_code == '9') {
    if (preg_match("/PAYID=\"(.+)\"/U", $result, $m)) {
        $pp_response['transaction_id'] = $m[1];
    }
    if (preg_match("/ACCEPTANCE=\"(.+)\"/U", $result, $m)) {
        $pp_response['reason_text'] .= " (ACCEPTANCE: " . $m[1] . ')';
    }
    $pp_response["order_status"] = 'P';
} else {
Пример #19
0
 public static function deliveryTariffs($invoice, $order_info, $shipping_data)
 {
     $code_tariff = array('Калибри-документ' => 'Dox', 'Гепард-экспресс 13' => 'Gep13', 'Гепард-экспресс 18' => 'Gep18', 'Гепард-экспресс' => 'GepEx', 'Пеликан-стандарт' => 'PelSt', 'Пеликан-эконом' => 'PelEc', 'Бизон-карго' => 'BisCa', 'Бизон-авиа' => 'BisAv', 'Фрахт' => 'Freig', 'Пеликан-онлайн' => 'PelOn');
     if ($shipping_data['service_params']['insurance_type'] == "INS") {
         $amount_check = 1;
     } elseif ($shipping_data['service_params']['insurance_type'] == "VAL") {
         $amount_check = 0;
     }
     $product_type = array();
     foreach ($invoice['products'] as $product) {
         $product_type[$product['product_type']] = $product['product_type'];
         $nature = $product['product_type'];
     }
     if (count($product_type) > 1) {
         if (array_search(18, $product_type)) {
             $amount_check = 1;
             $nature = 18;
         } else {
             $nature = $shipping_data['service_params']['default_product_type'];
         }
     }
     $data_city = array();
     $data_city['city'] = !empty($order_info['s_city']) ? $order_info['s_city'] : $order_info['b_city'];
     $data_city['country'] = !empty($order_info['s_country']) ? $order_info['s_country'] : $order_info['b_country'];
     $city = self::WAGetCities($data_city);
     $weight = $invoice['weight'];
     if ($weight == 0) {
         $weight = 0.01 * $invoice['amount'];
     }
     $data = array('ToCity' => $city['City_ID'] . '|' . $city['City_owner_ID'], 'FromCity' => $shipping_data['service_params']['from_city_id'] . '|' . $shipping_data['service_params']['from_city_owner_id'], 'Weight' => $weight, 'Nature' => $nature, 'Amount' => $invoice['cost'], 'AmountCheck' => $amount_check, 'SMS' => $shipping_data['service_params']['sms_to_shipper'], 'SMS_Recv' => $shipping_data['service_params']['sms_to_receiver'], 'PlatType' => $shipping_data['service_params']['plat_type'], 'DuesOrder' => $shipping_data['service_params']['dues_order'], 'ToBeCalledFor' => $shipping_data['service_params']['to_be_called_for'], 'ByHand' => $shipping_data['service_params']['by_hand'], 'icd' => $shipping_data['service_params']['idc'], 'SID' => self::$sid);
     $_result = array();
     $response = Http::post('http://www.cpcr.ru/cgi-bin/postxml.pl?TARIFFCOMPUTE_2', $data);
     $xml = simplexml_load_string($response);
     if (isset($xml->Error)) {
         fn_set_notification('E', __('notice'), __('shippings.spsr.error_tariff'));
     } elseif (isset($xml->Tariff)) {
         foreach ($xml->Tariff as $shipment) {
             if ($shipment->Total_Dost == 'Error') {
                 fn_set_notification('E', __('notice'), (string) $shipment->TariffType);
             } else {
                 $tariff_name = str_replace("Услуги по доставке ", "", (string) $shipment->TariffType);
                 $tariff_name = str_replace('"', "", $tariff_name);
                 $_result[$code_tariff[$tariff_name]] = array('Code' => $code_tariff[$tariff_name], 'TariffType' => $tariff_name, 'Total_Dost' => (string) $shipment->Total_Dost, 'Total_DopUsl' => (string) $shipment->Total_DopUsl, 'Insurance' => (string) $shipment->id, 'worth' => (string) $shipment->Insurance, 'DP' => (string) $shipment->DP);
             }
         }
     }
     return $_result;
 }
Пример #20
0
 public static function deliveryTariffs($invoice, $order_info, $shipping_data)
 {
     $code_tariff = fn_get_schema('spsr', 'tariffs', 'php', true);
     if ($shipping_data['service_params']['insurance_type'] == "INS") {
         $amount_check = 1;
     } elseif ($shipping_data['service_params']['insurance_type'] == "VAL") {
         $amount_check = 0;
     }
     $product_type = array();
     foreach ($invoice['products'] as $product) {
         $product_type[$product['product_type']] = $product['product_type'];
         $nature = $product['product_type'];
     }
     if (count($product_type) >= 1) {
         if (array_search(18, $product_type)) {
             $amount_check = 1;
             $nature = 18;
         } else {
             $nature = $shipping_data['service_params']['default_product_type'];
         }
     }
     $data_city = array();
     $data_city['city'] = !empty($order_info['s_city']) ? $order_info['s_city'] : $order_info['b_city'];
     $data_city['country'] = !empty($order_info['s_country']) ? $order_info['s_country'] : $order_info['b_country'];
     $city = self::WAGetCities($data_city);
     $weight = round($invoice['weight'] * Registry::get('settings.General.weight_symbol_grams') / 1000, 3);
     if ($weight == 0) {
         $weight = 0.01 * $invoice['amount'];
     }
     $data = array('ToCity' => $city['City_ID'] . '|' . $city['City_owner_ID'], 'FromCity' => $shipping_data['service_params']['from_city_id'] . '|' . $shipping_data['service_params']['from_city_owner_id'], 'Weight' => $weight, 'Nature' => $nature, 'Amount' => $invoice['cost'], 'AmountCheck' => $amount_check, 'SMS' => $shipping_data['service_params']['sms_to_shipper'], 'SMS_Recv' => $shipping_data['service_params']['sms_to_receiver'], 'PlatType' => $shipping_data['service_params']['plat_type'], 'DuesOrder' => $shipping_data['service_params']['dues_order'], 'ToBeCalledFor' => $shipping_data['service_params']['to_be_called_for'], 'ByHand' => $shipping_data['service_params']['by_hand'], 'icd' => $shipping_data['service_params']['idc'], 'SID' => self::$sid);
     $_result = array();
     $response = Http::post('http://www.cpcr.ru/cgi-bin/postxml.pl?TARIFFCOMPUTE_2', $data);
     $xml = @simplexml_load_string($response);
     if (isset($xml->Error)) {
         fn_set_notification('E', __('notice'), __('shippings.spsr.error_tariff'));
     } elseif (isset($xml->Tariff)) {
         foreach ($xml->Tariff as $shipment) {
             if ($shipment->Total_Dost == 'Error') {
                 fn_set_notification('E', __('notice'), (string) $shipment->TariffType);
             } else {
                 $tariff_name = str_replace(METHOD_SPSR, "", (string) $shipment->TariffType);
                 $tariff_name = str_replace('"', "", $tariff_name);
                 $_result[$code_tariff[$tariff_name]] = array('Code' => $code_tariff[$tariff_name], 'TariffType' => $tariff_name, 'Total_Dost' => (string) $shipment->Total_Dost, 'Total_DopUsl' => (string) $shipment->Total_DopUsl, 'Insurance' => (string) $shipment->id, 'worth' => (string) $shipment->Insurance, 'DP' => (string) $shipment->DP);
             }
         }
     }
     return $_result;
 }
Пример #21
0
    $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';
Пример #22
0
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Http;
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'login') {
        $redirect_url = '';
        if (!empty($_REQUEST['token'])) {
            $auth =& $auth;
            $_request = array();
            $_request['apiKey'] = Registry::get('addons.janrain.apikey');
            $_request['token'] = $_REQUEST['token'];
            $_result = Http::post('https://rpxnow.com/api/v2/auth_info', $_request);
            $data = json_decode($_result, true);
            if (isset($data['stat']) && $data['stat'] == 'ok') {
                $user_data = array();
                $condition = db_quote(" AND janrain_identifier = ?s", md5($data['profile']['identifier']));
                if (fn_allowed_for('ULTIMATE')) {
                    if (Registry::get('settings.Stores.share_users') == 'N' && AREA != 'A') {
                        $condition .= fn_get_company_condition('?:users.company_id');
                    }
                }
                $user_data = db_get_row("SELECT user_id, password FROM ?:users WHERE 1 {$condition}");
                if (empty($user_data['user_id'])) {
                    Registry::get('settings.Checkout.address_position') == 'billing_first' ? $address_zone = 'b' : ($address_zone = 's');
                    $user_data = array();
                    $user_data['janrain_identifier'] = md5($data['profile']['identifier']);
                    $user_data['email'] = !empty($data['profile']['verifiedEmail']) ? $data['profile']['verifiedEmail'] : (!empty($data['profile']['email']) ? $data['profile']['email'] : $data['profile']['displayName'] . '@' . $data['profile']['preferredUsername'] . '.com');
Пример #23
0
        $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') {
Пример #24
0
        if ($order_status == STATUS_INCOMPLETED_ORDER) {
            $pp_response = array();
            $pp_response['order_status'] = 'F';
            $pp_response['reason_text'] = __('merchant_response_was_not_received');
            $pp_response['transaction_id'] = '';
            fn_finish_payment($order_id, $pp_response);
        }
        fn_order_placement_routines('route', $order_id, false);
    } elseif ($mode == 'cancel') {
        $pp_response['order_status'] = 'N';
        $pp_response['reason_text'] = __('text_transaction_cancelled');
        fn_finish_payment($order_id, $pp_response, false);
        fn_order_placement_routines('route', $order_id);
    }
} else {
    $total = fn_rus_pay_format_price($order_info['total'], $processor_data['processor_params']['currency']);
    if ($processor_data['processor_params']['commission'] == 'admin') {
        $url = 'https://auth.robokassa.ru/Merchant/WebService/Service.asmx/CalcOutSumm';
        $data = array('MerchantLogin' => $processor_data['processor_params']['merchantid'], 'IncCurrLabel' => $processor_data['processor_params']['payment_method'], 'IncSum' => $total);
        $total_xml = Http::post($url, $data);
        $xml = @simplexml_load_string($total_xml);
        if (isset($xml->Result->Code) && $xml->Result->Code == 0) {
            $total = $xml->OutSum;
        }
    }
    $crc = md5($processor_data['processor_params']['merchantid'] . ':' . $total . ':' . $order_id . ':' . $processor_data['processor_params']['password1']);
    $url = $processor_data['processor_params']['mode'] == 'live' ? 'https://merchant.roboxchange.com/Index.aspx' : 'http://test.robokassa.ru/Index.aspx';
    $post_data = array('MrchLogin' => $processor_data['processor_params']['merchantid'], 'OutSum' => $total, 'InvId' => $order_id, 'Desc' => $processor_data['processor_params']['details'], 'SignatureValue' => $crc, 'Culture' => CART_LANGUAGE, 'IncCurrLabel' => $processor_data['processor_params']['payment_method']);
    fn_create_payment_form($url, $post_data, 'Robokassa server');
}
exit;
Пример #25
0
 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);
 }
Пример #26
0
 /**
  * Process simple request to shipping service server
  *
  * @return string Server response
  */
 public function getSimpleRates()
 {
     $data = $this->getRequestData();
     $response = Http::post($data['url'], $data['data'], array('headers' => 'Content-type: text/xml'));
     return $response;
 }
Пример #27
0
$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 = '';
Пример #28
0
function fn_paypal_request($request, $post_url, $cert_file)
{
    $extra = array('headers' => array('Connection: close'), 'ssl_cert' => $cert_file);
    $response = Http::post($post_url, $request, $extra);
    if (!empty($response)) {
        parse_str($response, $result);
    } else {
        $result['ERROR'] = Http::getError();
    }
    return $result;
}
Пример #29
0
    /**
     * @param string $pares PaRes value returned from ACS
     *
     * @return string Response body
     */
    protected function send3DSecureVerifySignatureRequest($pares)
    {
        // 3DS Verifysig request doesnt need card number to be sent
        $sha1_hash = sha1(sha1($this->request_data['TIMESTAMP'] . '.' . $this->request_data['MERCHANT_ID'] . '.' . $this->request_data['ORDER_ID'] . '.' . $this->request_data['AMOUNT'] . '.' . $this->request_data['CURRENCY'] . '.') . '.' . $this->processor_data['processor_params']['secret_word']);
        $request = <<<REQUEST
<request timestamp="{$this->request_data['TIMESTAMP']}" type="3ds-verifysig">
    <merchantid>{$this->request_data['MERCHANT_ID']}</merchantid>
    <account>{$this->request_data['ACCOUNT']}</account>
    <orderid>{$this->request_data['ORDER_ID']}</orderid>
    <amount currency="{$this->request_data['CURRENCY']}">{$this->request_data['AMOUNT']}</amount>
    <pares>{$pares}</pares>
    <sha1hash>{$sha1_hash}</sha1hash>
</request>
REQUEST;
        Registry::set('log_cut_data', array('card', 'sha1hash'));
        $response_data = Http::post(self::REALEX_REMOTE_3DSECURE_URL, $request, array('headers' => array('Content-type: text/xml', 'Connection: close')));
        return $response_data;
    }
Пример #30
0
function fn_se_send_request($url_part, $private_key, $data)
{
    if (empty($private_key)) {
        return;
    }
    $params = array('private_key' => $private_key) + $data;
    Registry::set('log_cut', true);
    $result = Http::post(SE_SERVICE_URL . $url_part, $params, array('timeout' => SE_REQUEST_TIMEOUT));
    $response = fn_se_parse_response($result, false);
    fn_se_set_simple_setting('last_request', TIME);
    return $response;
}