$smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
$smarty->assign('oID', $_GET['oID']);
if ($order->info['payment_method'] != '' && $order->info['payment_method'] != 'no_payment') {
    include DIR_FS_CATALOG . 'lang/' . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_method'] . '.php';
    $payment_method = constant(strtoupper('MODULE_PAYMENT_' . $order->info['payment_method'] . '_TEXT_TITLE'));
    $smarty->assign('PAYMENT_METHOD', $payment_method);
}
$smarty->assign('COMMENTS', $order->info['comments']);
$smarty->assign('DATE', xtc_date_long($order->info['date_purchased']));
$smarty->assign('order_data', $order_data);
$smarty->assign('order_total', $order_total);
require_once DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/billsafe_2.php';
//DokuMan - 2012-06-19 - move billsafe to external directory
require DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/ini.php';
//DokuMan - 2012-06-19 - move billsafe to external directory
$bs = new Billsafe_Sdk(DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/ini.php');
//DokuMan - 2012-06-19 - move billsafe to external directory
if ($_SESSION['language_charset'] == 'iso-8859-1' || $_SESSION['language_charset'] == 'iso-8859-15') {
    $bs->setUtf8Mode(false);
} else {
    $bs->setUtf8Mode(true);
}
if (MODULE_PAYMENT_BILLSAFE_2_SERVER == 'Live') {
    $bs->setMode('LIVE');
} else {
    $bs->setMode('SANDBOX');
}
$bs->setCredentials(array('merchantId' => MODULE_PAYMENT_BILLSAFE_2_MERCHANT_ID, 'merchantLicenseSandbox' => MODULE_PAYMENT_BILLSAFE_2_MERCHANT_LICENSE, 'merchantLicenseLive' => MODULE_PAYMENT_BILLSAFE_2_MERCHANT_LICENSE, 'applicationSignature' => $ini['applicationSignature'], 'applicationVersion' => $ini['applicationVersion']));
$orders_query = xtc_db_query('SELECT id, transactionid, billsafeStatus, type FROM billsafe_orders_2 WHERE orderid = "' . xtc_db_input($order_id) . '"');
$billsafe_orders = xtc_db_fetch_array($orders_query);
$paramsIns = array('transactionId' => $billsafe_orders['transactionid']);
 function after_process()
 {
     global $order, $insert_id;
     unset($_SESSION['discount_value']);
     unset($_SESSION['discount_name']);
     unset($_SESSION['voucher_value']);
     unset($_SESSION['voucher_name']);
     unset($_SESSION['coupon_value']);
     unset($_SESSION['coupon_name']);
     unset($_SESSION['lofee_value']);
     unset($_SESSION['lofee_name']);
     $token = $_GET['token'];
     if ($this->response->ack == 'OK' && $this->response->status == 'ACCEPTED') {
         if ($this->order_status) {
             xtc_db_query('UPDATE ' . TABLE_ORDERS . ' SET orders_status = "' . xtc_db_input($this->order_status) . '" WHERE orders_id = "' . xtc_db_input($insert_id) . '"');
         }
         $customer = $this->response->customer;
         xtc_db_query('INSERT INTO billsafe_orders_2 (id, orderid, transactionid, token, billsafeStatus, type, paymentStatus, date) VALUES (NULL,"' . xtc_db_input($insert_id) . '", "' . xtc_db_input($this->response->transactionId) . '", "' . $token . '", "' . xtc_db_input($this->response->status) . '", "installment", NULL, "' . date('Y-m-d H:i:s') . '")');
         $resultQuery = xtc_db_query('SELECT id FROM billsafe_orders_2 WHERE transactionId = "' . xtc_db_input($this->response->transactionId) . '"');
         $result = xtc_db_fetch_array($resultQuery);
         xtc_db_query('INSERT INTO billsafe_orders_user_2 (id, bsorders_id, gender, company, firstname, lastname, street, housenumber, postcode, city, country, dateofbirth, email, phone) VALUES (NULL, "' . xtc_db_input($result['id']) . '", "' . xtc_db_input($customer->gender) . '", "' . xtc_db_input($customer->firstname) . '", "' . xtc_db_input($customer->company) . '", "' . xtc_db_input($customer->lastname) . '", "' . xtc_db_input($customer->street) . '", "' . xtc_db_input($customer->housenumber) . '", "' . xtc_db_input($customer->postcode) . '", "' . xtc_db_input($customer->city) . '", "' . xtc_db_input($customer->country) . '", "0000-00-00", "' . xtc_db_input($customer->email) . '", "' . xtc_db_input($customer->phone) . '")');
         $bs = new Billsafe_Sdk(DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/ini.php');
         //DokuMan - 2012-06-19 - move billsafe to external directory
         if ($_SESSION['language_charset'] == 'iso-8859-1' || $_SESSION['language_charset'] == 'iso-8859-15') {
             $bs->setUtf8Mode(false);
         } else {
             $bs->setUtf8Mode(true);
         }
         if (MODULE_PAYMENT_BILLSAFE_2HP_SERVER == 'Live') {
             $bs->setMode("LIVE");
         } else {
             $bs->setMode("SANDBOX");
         }
         $bs->setCredentials(array('merchantId' => MODULE_PAYMENT_BILLSAFE_2HP_MERCHANT_ID, 'merchantLicenseSandbox' => MODULE_PAYMENT_BILLSAFE_2HP_MERCHANT_LICENSE, 'merchantLicenseLive' => MODULE_PAYMENT_BILLSAFE_2HP_MERCHANT_LICENSE, 'applicationSignature' => $this->applicationSignature, 'applicationVersion' => $this->application_version));
         $params = array('transactionId' => $this->response->transactionId);
         $response = $bs->callMethod('getArticleList', $params);
         $article = $response->articleList;
         for ($i = 0, $n = sizeof($article); $i < $n; $i++) {
             for ($ii = 0, $nn = intval($article[$i]->quantity); $ii < $nn; $ii++) {
                 $article[$i]->name = str_replace("\"", "\\\"", $article[$i]->name);
                 $article[$i]->name = str_replace("\\'", "\\\\'", $article[$i]->name);
                 xtc_db_query('INSERT INTO billsafe_orders_details_2 (ordernumber, product_id, articletype, articlenumber, articlename, articleprice, articletax, bsorders_id) values("' . xtc_db_input($insert_id) . '", "' . xtc_db_input($order->products[$i]['id']) . '", "' . xtc_db_input($article[$i]->type) . '", "' . xtc_db_input($article[$i]->number) . '", "' . xtc_db_input($article[$i]->name) . '", "' . xtc_db_input($article[$i]->grossPrice) . '", "' . xtc_db_input($article[$i]->tax) . '", "' . xtc_db_input($result['id']) . '")');
             }
         }
         $comments = MODULE_PAYMENT_BILLSAFE_2HP_STATUS_TEXT . ': ' . $this->response->status . '; ' . MODULE_PAYMENT_BILLSAFE_2HP_TRANSACTIONID . ': ' . $this->response->transactionId;
         xtc_db_query('INSERT INTO orders_status_history (orders_status_history_id, orders_id, orders_status_id, date_added, customer_notified, comments) VALUES (NULL, "' . xtc_db_input($insert_id) . '", "1", "' . date('Y-m-d H:i:s') . '", "0", "' . xtc_db_input($comments) . '")');
         $params = array('transactionId' => xtc_db_input($this->response->transactionId), 'orderNumber' => xtc_db_input($insert_id));
         $response = $bs->callMethod('setOrderNumber', $params);
         if ($response->ack == 'OK') {
         } else {
         }
     } else {
         $_SESSION['billsafe_status'] = 'declined';
         $message = $this->get_error_message($response);
         xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error_message=' . stripslashes(urlencode(html_entity_decode($message))), 'SSL'));
     }
     return false;
 }
* @license GPLv2
*/
$order_id = $_GET['oID'];
$post_url = 'billsafe_orders_2.php?oID=' . $order_id;
require 'includes/application_top.php';
$language = $_SESSION['language'];
require DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/billsafe_2.php';
require DIR_WS_CLASSES . 'order.php';
$order = new order($order_id);
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
require_once DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/billsafe_2.php';
//DokuMan - 2012-06-19 - move billsafe to external directory
require DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/ini.php';
//DokuMan - 2012-06-19 - move billsafe to external directory
$bs = new Billsafe_Sdk(DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/ini.php');
//DokuMan - 2012-06-19 - move billsafe to external directory
if ($_SESSION['language_charset'] == 'iso-8859-1' || $_SESSION['language_charset'] == 'iso-8859-15') {
    $bs->setUtf8Mode(false);
} else {
    $bs->setUtf8Mode(true);
}
if (MODULE_PAYMENT_BILLSAFE_2_SERVER == 'Live') {
    $bs->setMode('LIVE');
} else {
    $bs->setMode('SANDBOX');
}
if (MODULE_PAYMENT_BILLSAFE_2_LOG == 'True') {
    if (MODULE_PAYMENT_BILLSAFE_2_LOG_TYPE == 'Echo') {
        require_once DIR_FS_CATALOG . 'includes/external/billsafe/classes/billsafe_2/LoggerEcho.php';
        //DokuMan - 2012-06-19 - move billsafe to external directory