Example #1
0
    db_query("DELETE FROM {$sql_tbl['temporary_data']} WHERE expire < " . time());
}
#
# Remember visitor for a long time period
#
$remember_user = true;
#
# Time period for which user info should be stored (days)
#
$remember_user_days = 30;
#
# Redirect from alias host to main host
#
if (!defined("XCART_EXT_ENV") && $REQUEST_METHOD == 'GET' && isset($_SERVER['HTTP_HOST'])) {
    $tmp = explode(":", $_SERVER['HTTP_HOST'], 2);
    $server_http_host = $tmp[0];
    if ($server_http_host != $xcart_http_host && $server_http_host != $xcart_https_host && (!$HTTPS || !$HTTPS_RELAY)) {
        func_header_location(($HTTPS ? "https://" . $xcart_https_host : "http://" . $xcart_http_host) . $REQUEST_URI, true, 301);
    }
}
#
# Initialize character set of database. Used in func_translit function
#
$tmp = func_query_first("SHOW VARIABLES LIKE 'character_set" . (defined('X_MYSQL40_COMP_MODE') ? "_client'" : "'"));
$config['db_charset'] = $tmp['Value'];
unset($tmp);
#
# WARNING !
# Please ensure that you have no whitespaces / empty lines below this message.
# Adding a whitespace or an empty line below this line will cause a PHP error.
#
function cko_config()
{
    global $sql_tbl;
    $payment_cc_data = func_query_first("SELECT * FROM {$sql_tbl['ccprocessors']} WHERE processor='checkoutapipayment.php'");
    return $payment_cc_data;
}
<?php

define('SKIP_COOKIE_CHECK', true);
require_once './auth.php';
include './payment/includes/autoload.php';
x_load('order');
$posted_data = file_get_contents("php://input");
if (empty($posted_data)) {
    // empty request
    exit;
} else {
    $payment_cc_data = func_query_first("SELECT * FROM {$sql_tbl['ccprocessors']} WHERE processor='checkoutapipayment.php'");
    $Api = CheckoutApi_Api::getApi(array('mode' => $payment_cc_data['param01']));
    $objectCharge = $Api->chargeToObj($posted_data);
    if ($objectCharge->isValid()) {
        /*
         * Need to get track id
         */
        $order_id = $objectCharge->getTrackId();
        if ($objectCharge->getCaptured()) {
            $advinfo = 'Your payment has been successfully completed';
            func_change_order_status($order_id, 'C', $advinfo);
            // completed status?
        } elseif ($objectCharge->getRefunded()) {
            $advinfo = 'Your payment has been refunded';
            func_change_order_status($order_id, 'D', $advinfo);
            // declined status?
        } elseif (!$objectCharge->getAuthorised()) {
            $advinfo[] = 'Your order has been cancelled';
            func_change_order_status($order_id, 'D', $advinfo);
            // cancelled status?