Esempio n. 1
0
function fn_paypal_get_checkout_payment_buttons(&$cart, &$cart_products, &$auth, &$checkout_buttons, &$checkout_payments, &$payment_id)
{
    $processor_data = fn_get_processor_data($payment_id);
    if (!empty($processor_data) && empty($checkout_buttons[$payment_id]) && Registry::get('runtime.mode') == 'cart') {
        $checkout_buttons[$payment_id] = '
            <form name="pp_express" action="' . fn_payment_url('current', 'paypal_express.php') . '" method="post">
            <input name="payment_id" value="' . $payment_id . '" type="hidden" />
            <input src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-small.png" type="image" />
            <input name="mode" value="express" type="hidden" />
            </form>';
    }
}
Esempio n. 2
0
function fn_paypal_set_bml_checkout($payment_id, $order_id = 0, $order_info = array(), $cart = array(), $area = AREA)
{
    $processor_data = fn_get_payment_method_data($payment_id);
    if (!empty($order_id)) {
        $return_url = fn_url("payment_notification.notify?payment=paypal_bml&order_id={$order_id}", $area, 'current');
        $cancel_url = fn_url("payment_notification.cancel?payment=paypal_bml&order_id={$order_id}", $area, 'current');
    } else {
        $return_url = fn_payment_url('current', "paypal_bml.php?mode=express_return&payment_id={$payment_id}");
        $cancel_url = fn_url("checkout.cart", $area, 'current');
    }
    $request = array('PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE', 'PAYMENTREQUEST_0_SOLUTIONTYPE' => 'SOLE', 'PAYMENTREQUEST_0_CURRENCYCODE' => $processor_data['processor_params']['currency'], 'LOCALECODE' => CART_LANGUAGE, 'RETURNURL' => $return_url, 'CANCELURL' => $cancel_url, 'METHOD' => 'SetExpressCheckout', 'LANDINGPAGE' => 'Billing', 'UserSelectedFundingSource' => 'BML');
    fn_paypal_build_request($processor_data, $request, $post_url, $cert_file);
    $order_details = !empty($order_info) ? fn_paypal_build_details($order_info, $processor_data, false) : fn_paypal_build_details($cart, $processor_data);
    $request = array_merge($request, $order_details);
    return fn_paypal_request($request, $post_url, $cert_file);
}
Esempio n. 3
0
    }
    $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') {
    $pp_response['order_status'] = 'P';
    if (!empty($response['TxAuthNo'])) {
        $pp_response['reason_text'] = 'AuthNo: ' . @$response['TxAuthNo'];
    }
    if (!empty($response['SecurityKey'])) {
        $pp_response['reason_text'] = 'SecurityKey: ' . $response['SecurityKey'];
    } else {
        $pp_response['reason_text'] = '';
    }
} else {
    $pp_response['order_status'] = 'F';
Esempio n. 4
0
 if (!defined('BOOTSTRAP')) {
     die('Access denied');
 }
 // This file is a SAMPLE showing redirect to Payments Page from PHP.
 //Inlcude PxAccess Objects
 include Registry::get('config.dir.payments') . 'dps_files/pxaccess.inc';
 $PxAccess_Url = "https://sec.paymentexpress.com/pxpay/pxpay.aspx";
 $PxAccess_Userid = $processor_data["processor_params"]["user_id"];
 //Change to your user ID
 $PxAccess_Key = $processor_data["processor_params"]["key"];
 //Your DES Key from DPS
 $Mac_Key = $processor_data["processor_params"]["mac_key"];
 //Your MAC key from DPS
 $pxaccess = new PxAccess($PxAccess_Url, $PxAccess_Userid, $PxAccess_Key, $Mac_Key);
 $request = new PxPayRequest();
 $script_url = fn_payment_url('current', 'dps_access.php');
 $_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
 Tygh::$app['session']['dps_access']['order_id'] = $order_id;
 //Set up PxPayRequest Object
 $request->setAmountInput($order_info['total']);
 $request->setTxnData1("");
 // whatever you want to appear
 $request->setTxnData2("");
 // whatever you want to appear
 $request->setTxnData3("");
 // whatever you want to appear
 $request->setTxnType("Purchase");
 $request->setInputCurrency($processor_data["processor_params"]["currency"]);
 $request->setMerchantReference($_order_id);
 // fill this with your order number
 $request->setEmailAddress($order_info['email']);
function fn_paypal_set_express_checkout($payment_id, $order_id = 0, $order_info = array(), $cart = array(), $area = AREA)
{
    $processor_data = fn_get_payment_method_data($payment_id);
    if (!empty($order_id)) {
        $return_url = fn_url("payment_notification.notify?payment=paypal_express&order_id={$order_id}", $area, 'current');
        $cancel_url = fn_url("payment_notification.cancel?payment=paypal_express&order_id={$order_id}", $area, 'current');
    } else {
        $return_url = fn_payment_url('current', "paypal_express.php?mode=express_return&payment_id={$payment_id}");
        $cancel_url = fn_url("checkout.cart", $area, 'current');
    }
    $request = array('PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE', 'PAYMENTREQUEST_0_CURRENCYCODE' => $processor_data['processor_params']['currency'], 'LOCALECODE' => CART_LANGUAGE, 'RETURNURL' => $return_url, 'CANCELURL' => $cancel_url, 'METHOD' => 'SetExpressCheckout', 'SOLUTIONTYPE' => 'Sole');
    if (isset($_SESSION['paypal_token'])) {
        $request['IDENTITYACCESSTOKEN'] = $_SESSION['paypal_token'];
    }
    $paypal_settings = fn_get_paypal_settings();
    if (!empty($paypal_settings) && !empty($paypal_settings['main_pair']['detailed'])) {
        $request['LOGOIMG'] = !empty($paypal_settings['main_pair']['detailed']['http_image_path']) ? $paypal_settings['main_pair']['detailed']['http_image_path'] : $paypal_settings['main_pair']['detailed']['image_path'];
        $exploded_logo = explode('?', $request['LOGOIMG']);
        $request['LOGOIMG'] = $exploded_logo[0];
    }
    fn_paypal_build_request($processor_data, $request, $post_url, $cert_file);
    $order_details = !empty($order_info) ? fn_paypal_build_details($order_info, $processor_data, false) : fn_paypal_build_details($cart, $processor_data);
    $request = array_merge($request, $order_details);
    if (!empty($order_info)) {
        //We need to minus taxes when it based on unit price because product subtotal already include this tax.
        if (Registry::get('settings.General.tax_calculation') == 'unit_price') {
            $sum_taxes = fn_paypal_sum_taxes($order_info);
            $request['PAYMENTREQUEST_0_ITEMAMT'] -= $sum_taxes['P'];
            $request['PAYMENTREQUEST_0_SHIPPINGAMT'] -= $sum_taxes['S'];
        }
    }
    $result = fn_paypal_request($request, $post_url, $cert_file);
    return $result;
}
Esempio n. 6
0
                $pp_response['order_status'] = 'P';
                $pp_response['reason_text'] = $_REQUEST['msg'];
                $pp_response['transaction_id'] = $_REQUEST['TxnGUID'];
                $pp_response['card_number'] = $_REQUEST['mPAN'];
                $pp_response['card'] = $_REQUEST['type'];
                $pp_response['cardholder_name'] = $_REQUEST['name'];
                $pp_response['expiry_month'] = substr($_REQUEST['exp'], 0, 2);
                $pp_response['expiry_year'] = substr($_REQUEST['exp'], -2);
            } elseif (!empty($_REQUEST['error'])) {
                $pp_response['order_status'] = 'F';
                $pp_response['reason_text'] = !empty($_REQUEST['msg']) ? $_REQUEST['msg'] : __('error');
            } else {
                $pp_response['order_status'] = 'N';
                $pp_response['reason_text'] = __('transaction_cancelled');
            }
            if (fn_check_payment_script('cresecure.php', $order_id)) {
                fn_finish_payment($order_id, $pp_response);
                fn_order_placement_routines('route', $order_id);
            }
        }
    } else {
        if ($processor_data['processor_params']['test'] == 'live') {
            $post_address = "https://safe.cresecure.net/securepayments/a1/cc_collection.php";
        } else {
            $post_address = "https://sandbox-cresecure.net/securepayments/a1/cc_collection.php";
        }
        $post_data = array('CRESecureID' => $processor_data['processor_params']['cresecureid'], 'total_amt' => sprintf('%.2f', $order_info['total']), 'return_url' => fn_url("payment_notification.return?payment=cresecure&order_id={$order_id}", AREA, 'https'), 'content_template_url' => fn_payment_url('https', "cresecure.php?order_id={$order_id}&display_full_path=Y"), 'b_country' => db_get_field('SELECT a.code_A3 FROM ?:countries as a WHERE a.code = ?s', $order_info['b_country']), 's_country' => db_get_field('SELECT a.code_A3 FROM ?:countries as a WHERE a.code = ?s', $order_info['s_country']), 'customer_address' => $order_info['b_address'] . (!empty($order_info['b_address_2']) ? ' ' . $order_info['b_address_2'] : ''), 'delivery_address' => $order_info['s_address'] . (!empty($order_info['s_address_2']) ? ' ' . $order_info['s_address_2'] : ''), 'customer_phone' => !empty($order_info['b_phone']) ? $order_info['b_phone'] : '', 'delivery_phone' => !empty($order_info['s_phone']) ? $order_info['s_phone'] : '', 'allowed_types' => !empty($processor_data['processor_params']['allowed_types']) ? join('|', $processor_data['processor_params']['allowed_types']) : 'Visa|MasterCard', 'sess_id' => Tygh::$app['session']->getID(), 'sess_name' => Tygh::$app['session']->getName(), 'order_id' => $order_info['order_id'], 'currency' => $processor_data['processor_params']['currency'], 'CRESecureAPIToken' => $processor_data['processor_params']['cresecureapitoken'], 'customer_id' => $order_info['user_id'], 'customer_company' => $order_info['company'], 'customer_firstname' => $order_info['b_firstname'], 'customer_lastname' => $order_info['b_lastname'], 'customer_email' => $order_info['email'], 'customer_city' => $order_info['b_city'], 'customer_state' => $order_info['b_state'], 'customer_postal_code' => $order_info['b_zipcode'], 'customer_country' => $order_info['b_country'], 'delivery_firstname' => $order_info['s_firstname'], 'delivery_lastname' => $order_info['s_lastname'], 'delivery_city' => $order_info['s_city'], 'delivery_state' => $order_info['s_state'], 'delivery_postal_code' => $order_info['s_zipcode'], 'ip_address' => $_SERVER['REMOTE_ADDR']);
        fn_create_payment_form($post_address, $post_data, 'CRE secure', false);
    }
    exit;
}
Esempio n. 7
0
        } else {
            $pp_response["order_status"] = 'F';
            $pp_response["reason_text"] = "Response code: ";
            if (!empty($processor_error[$_REQUEST['erreur']])) {
                $pp_response["reason_text"] .= $processor_error[$_REQUEST['erreur']];
            } elseif (strstr($_REQUEST['erreur'], '001') == true) {
                $pp_response["reason_text"] .= $processor_error["001xx"];
            } else {
                $pp_response["reason_text"] .= $_REQUEST['erreur'];
            }
        }
        $pp_response['transaction_id'] = $_REQUEST['transac'];
        if (fn_check_payment_script('paybox.php', $order_id)) {
            fn_finish_payment($order_id, $pp_response);
        }
        exit;
    }
} else {
    $paybox_script = fn_payment_url('http', 'paybox_files/modulev2.cgi');
    $pbx_devise = $processor_data['processor_params']['currency'];
    $r_url = fn_url("payment_notification.process?payment=paybox&order_id={$order_id}&sl=" . CART_LANGUAGE, AREA, 'current');
    $pbx_annule = $r_url;
    $pbx_effectue = $r_url;
    $pbx_refuse = $r_url;
    $pbx_retour = "montant:M;ref:R;numauto:A;transac:T;erreur:E;maref:R;";
    $pbx_total = $order_info['total'] * 100;
    $pbx_cmd = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
    $post_data = array('PBX_MODE' => '1', 'PBX_SITE' => $processor_data['processor_params']['site_num'], 'PBX_RANG' => $processor_data['processor_params']['rank_num'], 'PBX_IDENTIFIANT' => $processor_data['processor_params']['identifier'], 'PBX_TOTAL' => $pbx_total, 'PBX_DEVISE' => $pbx_devise, 'PBX_CMD' => $pbx_cmd, 'PBX_PORTEUR' => $order_info['email'], 'PBX_RETOUR' => $pbx_retour, 'PBX_LANGUE' => $processor_data['processor_params']['language'], 'PBX_EFFECTUE' => $pbx_effectue, 'PBX_REFUSE' => $pbx_refuse, 'PBX_ANNULE' => $pbx_annule, 'PBX_BOUTPI' => 'nul', 'PBX_RUF1' => 'POST', 'PBX_TXT' => '<b>Proceeding to Payment Page ...</b>');
    fn_create_payment_form($paybox_script, $post_data, 'PayBox');
    exit;
}
Esempio n. 8
0
            fn_finish_payment($order_id, $pp_response, false);
        } else {
            // Set open status until callback from chronopay service is recieved
            if (fn_check_payment_script('chronopay_form.php', $order_id)) {
                if (isset($order_info['payment_info']['awaiting_callback']) && $order_info['payment_info']['awaiting_callback'] == true) {
                    fn_change_order_status($order_id, 'O', $order_info['status'], false);
                }
            }
        }
        fn_order_placement_routines('route', $order_id);
    }
} else {
    if (!defined('BOOTSTRAP')) {
        die('Access denied');
    }
    $post_url = fn_payment_url('current', 'chronopay_form.php');
    $return_url = fn_url("payment_notification.notify?payment=chronopay_form&order_id={$order_id}", AREA, 'current');
    $country = db_get_field("SELECT code_A3 FROM ?:countries WHERE code = ?s", $order_info['b_country']);
    $product_name = "";
    // Products
    if (!empty($order_info['products'])) {
        foreach ($order_info['products'] as $v) {
            $product_name = $product_name . str_replace(', ', ' ', $v['product']) . ",<br>\n  ";
        }
    }
    // Certificates
    if (!empty($order_info['gift_certificates'])) {
        foreach ($order_info['gift_certificates'] as $v) {
            $product_name = $product_name . str_replace(', ', ' ', $v['gift_cert_code']) . ",<br>\n  ";
        }
    }
Esempio n. 9
0
} elseif (defined('PAYMENT_NOTIFICATION')) {
    if ($mode == 'notify') {
        $order_info = fn_get_order_info($_REQUEST['order_id']);
        if ($order_info['status'] == 'O') {
            $pp_response['order_status'] = 'F';
            fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
        }
        fn_order_placement_routines('route', $_REQUEST['order_id']);
    }
} else {
    if (!defined('BOOTSTRAP')) {
        die('Access denied');
    }
    $return_url_s = fn_url("payment_notification.notify?payment=nochex&order_id={$order_id}", AREA, 'current');
    $return_url_c = fn_url("payment_notification.notify?payment=nochex&order_id={$order_id}", AREA, 'current');
    $responder_url = fn_payment_url('current', "nochex.php");
    $_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
    echo <<<EOT
<form method="post" action="https://secure.nochex.com/" name="process">
<input type="hidden" name="merchant_id" value="{$processor_data['processor_params']['merchantid']}" />
<input type="hidden" name="amount" value="{$order_info['total']}" />
<input type="hidden" name="status" value="test" />
<input type="hidden" name="description" value="{$processor_data['processor_params']['payment_description']}" />
<input type="hidden" name="order_id" value="{$_order_id}" />
<input type="hidden" name="success_url" value="{$return_url_s}" />
<input type="hidden" name="cancel_url" value="{$return_url_c}" />
<input type="hidden" name="callback_url" value="{$responder_url}" />

<input type="hidden" name="billing_fullname" value="{$order_info['b_firstname']} {$order_info['b_lastname']}" />
<input type="hidden" name="billing_address" value="{$order_info['b_address']} {$order_info['b_address_2']} {$order_info['b_city']} {$order_info['b_state']}" />
<input type="hidden" name="billing_postcode" value="{$order_info['b_zipcode']}" />
        $order_id = !empty($_REQUEST['order_id']) ? $_REQUEST['order_id'] : 0;
        $token = !empty($_REQUEST['token']) ? $_REQUEST['token'] : 0;
        $payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $order_id);
        $processor_data = fn_get_payment_method_data($payment_id);
        $processor_data['processor_script'] = 'paypal_express.php';
        $order_info = fn_get_order_info($order_id);
        fn_paypal_complete_checkout($token, $processor_data, $order_info);
    }
}
$mode = !empty($mode) ? $mode : (!empty($_REQUEST['mode']) ? $_REQUEST['mode'] : '');
if (!empty($_payment_id) && (!empty($_SESSION['cart']['products']) || !empty($_SESSION['cart']['gift_certificates'])) && Registry::get('runtime.mode') == 'cart') {
    $checkout_buttons[$_payment_id] = '
        <html>
        <body>
        <br/>
        <form name="pp_express" action="' . fn_payment_url('current', 'paypal_express.php') . '" method="post">
            <input name="payment_id" value="' . $_payment_id . '" type="hidden" />
            <input src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" type="image" />
            <input name="mode" value="express" type="hidden" />
        </form>
        </body>
        </html>';
} elseif ($mode == 'express_return') {
    $token = $_REQUEST['token'];
    $payment_id = $_REQUEST['payment_id'];
    $processor_data = fn_get_payment_method_data($payment_id);
    $paypal_checkout_details = fn_paypal_get_express_checkout_details($processor_data, $token);
    if (fn_paypal_ack_success($paypal_checkout_details)) {
        fn_paypal_user_login($paypal_checkout_details);
        $paypal_express_details = array('token' => $token, 'payment_id' => $payment_id);
        $_SESSION['pp_express_details'] = $paypal_express_details;
Esempio n. 11
0
    if (!empty($_REQUEST['RefNo']) && !empty($_REQUEST['Auth'])) {
        require './init_payment.php';
        $order_id = strpos($_REQUEST['RefNo'], '_') ? substr($_REQUEST['RefNo'], 0, strpos($_REQUEST['RefNo'], '_')) : $_REQUEST['RefNo'];
        if ($_REQUEST['Auth'] != "Declined") {
            $pp_response['order_status'] = 'P';
            $pp_response["reason_text"] = "AuthCode: " . $_REQUEST['Auth'];
        } else {
            $pp_response['order_status'] = 'F';
            $pp_response["reason_text"] = $_REQUEST['Auth'] . ": " . $_REQUEST['Notes'];
        }
        if (!empty($_REQUEST['TransID'])) {
            $pp_response["transaction_id"] = $_REQUEST['TransID'];
        }
        if (!empty($_REQUEST['AVSCode'])) {
            $pp_response["descr_avs"] = empty($avserr[$_REQUEST['AVSCode']]) ? "AVS Code: " . $_REQUEST['AVSCode'] : $avserr[$_REQUEST['AVSCode']];
        }
        if (fn_check_payment_script('pri_form.php', $order_id)) {
            fn_finish_payment($order_id, $pp_response, false);
        }
        fn_order_placement_routines('route', $order_id);
    } else {
        die('Access denied');
    }
} else {
    $_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
    $return_url = fn_payment_url('current', 'pri_form.php');
    $submit_url = 'https://webservices.primerchants.com/billing/TransactionCentral/EnterTransaction.asp';
    $post_data = array('MerchantID' => $processor_data['processor_params']['merchant_id'], 'RegKey' => $processor_data['processor_params']['key'], 'Amount' => $order_info['total'], 'AVSADDR' => $order_info['b_address'], 'AVSZIP' => $order_info['b_zipcode'], 'REFID' => $_order_id, 'RURL' => $return_url, 'TransType' => 'CC');
    fn_create_payment_form($submit_url, $post_data, 'PRI server');
    exit;
}
Esempio n. 12
0
         if ($tax['price_includes_tax'] == 'Y') {
             continue;
         }
         $post[] = "<freeform_purchase>";
         $post[] = "<line_number>" . ++$i . "</line_number>";
         $post[] = "<description>" . htmlspecialchars($tax['description']) . "</description>";
         $post[] = "<price_including_vat>" . fn_format_price($tax['tax_subtotal']) . "</price_including_vat>";
         $post[] = "<vat_percentage>0</vat_percentage>";
         $post[] = "<quantity>1</quantity>";
         $post[] = "</freeform_purchase>";
     }
 }
 $post[] = "</purchase_list>";
 $post[] = "</purchase>";
 //Processing control
 $url = fn_payment_url('current', "pay_read.php?order_id={$order_id}");
 $post[] = "<processing_control>";
 $post[] = "<success_redirect_url>" . $url . "</success_redirect_url>";
 $post[] = "<authorize_notification_url>" . $url . "</authorize_notification_url>";
 $post[] = "<settle_notification_url>" . $url . "</settle_notification_url>";
 $post[] = "<redirect_back_to_shop_url>" . $url . "</redirect_back_to_shop_url>";
 $post[] = "</processing_control>";
 // Database overrides
 $post[] = "<database_overrides>";
 $post[] = "<accepted_payment_methods>";
 $post[] = "<payment_method>card</payment_method>";
 $post[] = "</accepted_payment_methods>";
 // Debug mode
 $post[] = "<debug_mode>silent</debug_mode>";
 // Test mode
 $post[] = "<test_mode>" . $processor_data["processor_params"]["test"] . "</test_mode>";
    }
    $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}");
    echo <<<EOT
    <form action="{$response['ACSURL']}" method="post" name="process">
        <input type="hidden" name="PaReq" value="{$response['PAReq']}"/>
        <input type="hidden" name="TermUrl" value="{$term_url}"/>
        <input type="hidden" name="MD" value="{$response['MD']}"/>
        <NOSCRIPT>
        <center><p>Please click button below to Authenticate your card</p><input type="submit" value="Authenticate"/></p></center>
        </NOSCRIPT>
        </form>
EOT;
    $msg = __('text_cc_processor_connection', array('[processor]' => '3D Secure server'));
    echo <<<EOT
        <p><div align=center>{$msg}</div></p>
    </form>
    <script type="text/javascript">
Esempio n. 14
0
                if ($_REQUEST['PreviousStatusCode']) {
                    $error = 'true';
                    $error_message .= 'Duplaicated order\\n';
                }
                if (!$error) {
                    echo 'StatusCode=0';
                } else {
                    echo 'StatusCode=' . $status_code . '&Message=' . $_REQUEST['Message'];
                }
            } else {
                echo 'StatusCode=' . $status_code . '&Message=' . $_REQUEST['Message'];
            }
        }
    }
} else {
    $post = array('Amount' => $order_info['total'] * 100, 'CurrencyCode' => $processor_data['processor_params']['currency'], 'OrderID' => $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id, 'TransactionType' => $processor_data['processor_params']['transaction_type'], 'TransactionDateTime' => date('Y-m-d H:i:s O'), 'CallbackURL' => fn_payment_url('current', 'cardsave_hosted.php'), 'OrderDescription' => '', 'CustomerName' => fn_crds_generate_name($order_info['b_firstname'] . ' ' . $order_info['b_lastname']), 'Address1' => fn_crds_generate_name($order_info['b_address']), 'Address2' => fn_crds_generate_name($order_info['b_address_2']), 'Address3' => '', 'Address4' => '', 'City' => fn_crds_generate_name($order_info['b_city']), 'State' => fn_crds_generate_name($order_info['b_state_descr']), 'PostCode' => fn_crds_generate_name($order_info['b_zipcode']), 'CountryCode' => db_get_field('SELECT code_N3 FROM ?:countries WHERE code=?s', $order_info['b_country']), 'CV2Mandatory' => $processor_data['processor_params']['cv2_mandatory'], 'Address1Mandatory' => $processor_data['processor_params']['address_mandatory'], 'CityMandatory' => $processor_data['processor_params']['city_mandatory'], 'PostCodeMandatory' => $processor_data['processor_params']['postcode_mandatory'], 'StateMandatory' => $processor_data['processor_params']['state_mandatory'], 'CountryMandatory' => $processor_data['processor_params']['country_mandatory'], 'ResultDeliveryMethod' => 'SERVER', 'ServerResultURL' => fn_url("payment_notification.process?payment=cardsave_hosted&order_id={$order_id}&fake=true", AREA, 'current'), 'PaymentFormDisplaysResult' => 'false', 'ServerResultURLCookieVariables' => '', 'ServerResultURLFormVariables' => '', 'ServerResultURLQueryStringVariables' => '');
    $str = 'PreSharedKey=' . $processor_data['processor_params']['access_code'] . '&MerchantID=' . $processor_data['processor_params']['merchant_id'] . '&Password=' . $processor_data['processor_params']['password'];
    $post_data = array();
    foreach ($post as $k => $v) {
        $post_data[$k] = $v;
        $str .= "&{$k}={$v}";
    }
    $post_data['HashDigest'] = sha1($str);
    $post_data['MerchantID'] = $processor_data['processor_params']['merchant_id'];
    $submit_url = 'https://mms.cardsaveonlinepayments.com/Pages/PublicPages/PaymentForm.aspx';
    fn_create_payment_form($submit_url, $post_data, 'CardSave server', false);
}
function fn_crds_generate_name($str)
{
    $literals = "/[^a-z0-9-\\.]/";
    $convert_letters = fn_get_schema('literal_converter', 'schema');