Example #1
0
function fn_payment_dependencies_checkout_select_default_payment_method(&$cart, &$payment_methods, &$completed_steps)
{
    $available_payment_ids = array();
    foreach ($payment_methods as $group) {
        foreach ($group as $method) {
            $available_payment_ids[] = $method['payment_id'];
        }
    }
    // Change default payment if it doesn't exists
    if (floatval($cart['total']) != 0 && !in_array($cart['payment_id'], $available_payment_ids)) {
        $cart['payment_id'] = reset($available_payment_ids);
        $cart['payment_method_data'] = fn_get_payment_method_data($cart['payment_id']);
    }
}
Example #2
0
 public function index($id = 0, $params = array())
 {
     $lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
     if (!empty($id)) {
         $data = fn_get_payment_method_data($id, $lang_code);
         if (empty($data)) {
             $status = Response::STATUS_NOT_FOUND;
         } else {
             $status = Response::STATUS_OK;
         }
     } else {
         $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page'));
         $page = $this->safeGet($params, 'page', 1);
         $data = fn_get_payments($lang_code);
         if ($items_per_page) {
             $data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page);
         }
         $data = array('payments' => $data, 'params' => array('items_per_page' => $items_per_page, 'page' => $page, 'total_items' => count($data)));
         $status = Response::STATUS_OK;
     }
     return array('status' => $status, 'data' => $data);
 }
Example #3
0
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Http;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if (defined('PAYMENT_NOTIFICATION')) {
    if ($mode == 'notify') {
        $order_id = strpos($_REQUEST['MerchantReference'], '_') ? substr($_REQUEST['MerchantReference'], 0, strpos($_REQUEST['MerchantReference'], '_')) : $_REQUEST['MerchantReference'];
        $order_info = fn_get_order_info($order_id);
        $processor_data = fn_get_payment_method_data($order_info['payment_id']);
        $pp_response = array();
        $pp_response['transaction_id'] = $_REQUEST['TransactionId'];
        $pp_response['transaction_datetime'] = $_REQUEST['TransactionDateTime'];
        $pp_response['reason_text'] = $_REQUEST['ResponseDescription'];
        if ($_REQUEST['ResultCode'] == 0) {
            if ($_REQUEST['StatusFlag'] == 'Success' && in_array($_REQUEST['ResponseCode'], array('00', '08', '10', '11', '16'))) {
                $tran_ticket = db_get_field("SELECT data FROM ?:order_data WHERE type = 'E' AND order_id = ?i", $order_id);
                $cart_hashkey_str = $tran_ticket . $processor_data['processor_params']['posid'] . $processor_data['processor_params']['acquirerid'] . $_REQUEST['MerchantReference'] . $_REQUEST['ApprovalCode'] . $_REQUEST['Parameters'] . $_REQUEST['ResponseCode'] . $_REQUEST['SupportReferenceID'] . $_REQUEST['AuthStatus'] . $_REQUEST['PackageNo'] . $_REQUEST['StatusFlag'];
                $cart_hashkey = strtoupper(hash('sha256', $cart_hashkey_str));
                if ($cart_hashkey == $_REQUEST['HashKey']) {
                    $pp_response['order_status'] = 'P';
                    db_query("DELETE FROM ?:order_data WHERE type = 'E' AND order_id = ?i", $order_id);
                    if (!empty($_REQUEST['SupportReferenceID'])) {
                        $pp_response['reason_text'] .= '; SupportReferenceID: ' . $_REQUEST['SupportReferenceID'];
                    }
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;
}
Example #5
0
 public static function processPaymentCertificates($store_data)
 {
     $payment_methods = db_get_array('SELECT p.payment_id, pp.* FROM ?:payments p, ?:payment_processors pp WHERE pp.processor_id = p.processor_id AND p.processor_id != 0');
     $certificates_dir = Registry::get('config.dir.certificates');
     foreach ($payment_methods as $payment_method) {
         if (in_array($payment_method['processor_script'], array('paypal_express.php', 'paypal_pro.php', 'qbms.php'))) {
             $payment_data = fn_get_payment_method_data($payment_method['payment_id']);
             $certificate_filename = '';
             if (isset($payment_data['processor_params']['certificate_filename'])) {
                 $certificate_filename = $payment_data['processor_params']['certificate_filename'];
             } elseif (isset($payment_data['processor_params']['certificate'])) {
                 $certificate_filename = $payment_data['processor_params']['certificate'];
             }
             if ($certificate_filename) {
                 $filename = $payment_method['payment_id'] . '/' . $certificate_filename;
                 $old_certificate_file = $store_data['path'] . '/payments/certificates/' . $certificate_filename;
                 if (file_exists($old_certificate_file)) {
                     fn_mkdir($certificates_dir . $payment_method['payment_id']);
                     fn_copy($old_certificate_file, $certificates_dir . $filename);
                 } else {
                     $filename = '';
                 }
                 $payment_data['processor_params']['certificate_filename'] = $filename;
                 fn_update_payment($payment_data, $payment_method['payment_id']);
             }
         }
     }
 }
Example #6
0
/**
 * Place order handler
 *
 * @param  array $cart   Cart
 * @param  array $auth   Auth
 * @param  array $params Params
 * @return str
 */
function fn_checkout_place_order(&$cart, &$auth, $params)
{
    // Prevent unauthorized access
    if (empty($cart['user_data']['email'])) {
        return PLACE_ORDER_STATUS_DENIED;
    }
    // Prevent using disabled payment method by challenging HTTP data
    if (!empty($params['payment_id'])) {
        $cart['payment_id'] = $params['payment_id'];
    }
    if (isset($cart['payment_id'])) {
        $payment_method_data = fn_get_payment_method_data($cart['payment_id']);
        if (!empty($payment_method_data['status']) && $payment_method_data['status'] != 'A') {
            return PLACE_ORDER_STATUS_DENIED;
        }
    }
    // Remove previous failed order
    if (!empty($cart['failed_order_id']) || !empty($cart['processed_order_id'])) {
        $_order_ids = !empty($cart['failed_order_id']) ? $cart['failed_order_id'] : $cart['processed_order_id'];
        foreach ($_order_ids as $_order_id) {
            fn_delete_order($_order_id);
        }
        $cart['rewrite_order_id'] = $_order_ids;
        unset($cart['failed_order_id'], $cart['processed_order_id']);
    }
    if (!empty($params['payment_info'])) {
        $cart['payment_info'] = $params['payment_info'];
    } else {
        $cart['payment_info'] = array();
    }
    if (empty($params['payment_info']) && !empty($cart['extra_payment_info'])) {
        $cart['payment_info'] = empty($cart['payment_info']) ? array() : $cart['payment_info'];
        $cart['payment_info'] = array_merge($cart['extra_payment_info'], $cart['payment_info']);
    }
    unset($cart['payment_info']['secure_card_number']);
    if (!empty($cart['products'])) {
        foreach ($cart['products'] as $cart_id => $product) {
            $_is_edp = db_get_field("SELECT is_edp FROM ?:products WHERE product_id = ?i", $product['product_id']);
            if (fn_check_amount_in_stock($product['product_id'], $product['amount'], empty($product['product_options']) ? array() : $product['product_options'], $cart_id, $_is_edp, 0, $cart) == false) {
                fn_delete_cart_product($cart, $cart_id);
                return PLACE_ORDER_STATUS_TO_CART;
            }
            if (!fn_allowed_for('ULTIMATE:FREE')) {
                $exceptions = fn_get_product_exceptions($product['product_id'], true);
                if (!isset($product['options_type']) || !isset($product['exceptions_type'])) {
                    $product = array_merge($product, db_get_row('SELECT options_type, exceptions_type FROM ?:products WHERE product_id = ?i', $product['product_id']));
                }
                if (!fn_is_allowed_options_exceptions($exceptions, $product['product_options'], $product['options_type'], $product['exceptions_type'])) {
                    fn_set_notification('E', __('notice'), __('product_options_forbidden_combination', array('[product]' => $product['product'])));
                    fn_delete_cart_product($cart, $cart_id);
                    return PLACE_ORDER_STATUS_TO_CART;
                }
                if (!fn_is_allowed_options($product)) {
                    fn_set_notification('E', __('notice'), __('product_disabled_options', array('[product]' => $product['product'])));
                    fn_delete_cart_product($cart, $cart_id);
                    return PLACE_ORDER_STATUS_TO_CART;
                }
            }
        }
    }
    list($order_id, $process_payment) = fn_place_order($cart, $auth);
    // Clean up saved shipping rates
    unset($_SESSION['product_groups']);
    if (!empty($order_id)) {
        if (empty($params['skip_payment']) && $process_payment == true || !empty($params['skip_payment']) && empty($auth['act_as_user'])) {
            // administrator, logged in as customer can skip payment
            $payment_info = !empty($cart['payment_info']) ? $cart['payment_info'] : array();
            fn_start_payment($order_id, array(), $payment_info);
        }
        fn_order_placement_routines('route', $order_id);
        return PLACE_ORDER_STATUS_OK;
    } else {
        return PLACE_ORDER_STATUS_TO_CART;
    }
}
Example #7
0
function fn_prepare_repay_data($payment_id, $order_info, $auth)
{
    if (empty($payment_id)) {
        $payment_id = $order_info['payment_id'];
    }
    //Get payment methods
    $payment_methods = fn_get_payments(array('usergroup_ids' => $auth['usergroup_ids']));
    fn_set_hook('prepare_repay_data', $payment_id, $order_info, $auth, $payment_methods);
    if (!empty($payment_methods)) {
        // Get payment method info
        $payment_groups = fn_prepare_checkout_payment_methods($order_info, $auth);
        if (!empty($payment_id)) {
            $order_payment_id = $payment_id;
        } else {
            $first = reset($payment_methods);
            $order_payment_id = $first['payment_id'];
        }
        $payment_data = fn_get_payment_method_data($order_payment_id);
        $payment_data['surcharge_value'] = 0;
        if (floatval($payment_data['a_surcharge'])) {
            $payment_data['surcharge_value'] += $payment_data['a_surcharge'];
        }
        if (floatval($payment_data['p_surcharge'])) {
            if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor($order_info['products'])) {
                $payment_data['surcharge_value'] += fn_format_price($order_info['total']);
            } else {
                $payment_data['surcharge_value'] += fn_format_price(($order_info['total'] - $order_info['payment_surcharge']) * $payment_data['p_surcharge'] / 100);
            }
        }
        Registry::get('view')->assign('payment_methods', $payment_groups);
        Registry::get('view')->assign('order_payment_id', $order_payment_id);
        Registry::get('view')->assign('payment_method', $payment_data);
    }
}
Example #8
0
function fn_prepare_repay_data($payment_id, $order_info, $auth, &$templater)
{
    //Get payment methods
    $payment_methods = fn_get_payment_methods($auth);
    if (!empty($payment_methods)) {
        // Get payment method info
        if (!empty($payment_id)) {
            $order_payment_id = $payment_id;
        } else {
            $first = reset($payment_methods);
            $order_payment_id = $first['payment_id'];
        }
        $payment_data = fn_get_payment_method_data($order_payment_id);
        $payment_data['surcharge_value'] = 0;
        if (floatval($payment_data['a_surcharge'])) {
            $payment_data['surcharge_value'] += $payment_data['a_surcharge'];
        }
        if (floatval($payment_data['p_surcharge'])) {
            $payment_data['surcharge_value'] += fn_format_price(($order_info['total'] - $order_info['payment_surcharge']) * $payment_data['p_surcharge'] / 100);
        }
        $templater->assign('payment_methods', $payment_methods);
        $templater->assign('credit_cards', fn_get_static_data_section('C', true));
        $templater->assign('order_payment_id', $order_payment_id);
        $templater->assign('payment_method', $payment_data);
    }
}
Example #9
0
        $addons = Registry::get('addons');
        foreach ($addons as $addon_id => $addon) {
            if ($view->templateExists('addons/' . $addon_id . '/views/payments/components/cc_processors/' . $processor_template)) {
                $view->assign('processor_template', 'addons/' . $addon_id . '/views/payments/components/cc_processors/' . $processor_template);
                break;
            }
        }
    }
    $view->assign('processor_params', $processor_data['processor_params']);
    $view->assign('processor_name', $processor_data['processor']);
    $view->assign('callback', $processor_data['callback']);
    $view->assign('payment_id', $_REQUEST['payment_id']);
    // Show methods list
} elseif ($mode == 'manage') {
    $payments = fn_get_payments(DESCR_SL);
    Tygh::$app['view']->assign('usergroups', fn_get_usergroups(array('type' => 'C', 'status' => array('A', 'H')), DESCR_SL));
    Tygh::$app['view']->assign('payments', $payments);
    Tygh::$app['view']->assign('templates', fn_get_payment_templates());
    Tygh::$app['view']->assign('payment_processors', fn_get_payment_processors());
} elseif ($mode == 'update') {
    $payment = fn_get_payment_method_data($_REQUEST['payment_id'], DESCR_SL);
    $payment['icon'] = fn_get_image_pairs($payment['payment_id'], 'payment', 'M', true, true, DESCR_SL);
    Tygh::$app['view']->assign('usergroups', fn_get_usergroups(array('type' => 'C', 'status' => array('A', 'H')), DESCR_SL));
    Tygh::$app['view']->assign('payment', $payment);
    Tygh::$app['view']->assign('templates', fn_get_payment_templates($payment));
    Tygh::$app['view']->assign('payment_processors', fn_get_payment_processors());
    Tygh::$app['view']->assign('taxes', fn_get_taxes());
    if (Registry::get('runtime.company_id') && Registry::get('runtime.company_id') != $payment['company_id']) {
        Tygh::$app['view']->assign('hide_for_vendor', true);
    }
}
Example #10
0
function fn_rus_edost_calculate_cart_taxes_pre(&$cart, $cart_products, &$product_groups)
{
    if (!empty($cart['shippings_extra'])) {
        if (!empty($cart['select_office'])) {
            $select_office = $cart['select_office'];
        } elseif (!empty($_REQUEST['select_office'])) {
            $select_office = $cart['select_office'] = $_REQUEST['select_office'];
        }
        if (!empty($select_office)) {
            foreach ($product_groups as $group_key => $group) {
                if (!empty($group['chosen_shippings'])) {
                    foreach ($group['chosen_shippings'] as $shipping_key => $shipping) {
                        $shipping_id = $shipping['shipping_id'];
                        if ($shipping['module'] != 'edost') {
                            continue;
                        }
                        if (!empty($cart['shippings_extra']['data'][$group_key][$shipping_id])) {
                            $shippings_extra = $cart['shippings_extra']['data'][$group_key][$shipping_id];
                            $product_groups[$group_key]['chosen_shippings'][$shipping_key]['data'] = $shippings_extra;
                            if (!empty($select_office[$group_key][$shipping_id])) {
                                $office_id = $select_office[$group_key][$shipping_id];
                                $product_groups[$group_key]['chosen_shippings'][$shipping_key]['office_id'] = $office_id;
                                if (!empty($shippings_extra['office'][$office_id])) {
                                    $office_data = $shippings_extra['office'][$office_id];
                                    $product_groups[$group_key]['chosen_shippings'][$shipping_key]['office_data'] = $office_data;
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!empty($cart['shippings_extra']['data'])) {
            foreach ($cart['shippings_extra']['data'] as $group_key => $shippings) {
                foreach ($shippings as $shipping_id => $shipping_data) {
                    if (!empty($product_groups[$group_key]['shippings'][$shipping_id]['module'])) {
                        $module = $product_groups[$group_key]['shippings'][$shipping_id]['module'];
                        if (!empty($shipping_data) && $module == 'edost') {
                            $product_groups[$group_key]['shippings'][$shipping_id]['data'] = $shipping_data;
                        }
                    }
                }
            }
        }
        if (!empty($cart['shippings_extra']['rates'])) {
            foreach ($cart['shippings_extra']['rates'] as $group_key => $shippings) {
                foreach ($shippings as $shipping_id => $shipping) {
                    if (!empty($shipping['day']) && !empty($product_groups[$group_key]['shippings'][$shipping_id])) {
                        $product_groups[$group_key]['shippings'][$shipping_id]['delivery_time'] = $shipping['day'];
                    }
                }
            }
        }
    }
    if (!empty($cart['payment_id'])) {
        $payment_info = fn_get_payment_method_data($cart['payment_id']);
        if (strpos($payment_info['template'], 'edost_cod.tpl')) {
            $cart['shippings_extra']['sum'] = array('pricediff' => 0, 'transfer' => 0, 'total' => 0);
            foreach ($product_groups as $group_key => $group) {
                foreach ($group['shippings'] as $shipping_id => $shipping) {
                    if (!empty($cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'])) {
                        $cart['product_groups'][$group_key]['shippings'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
                        $product_groups[$group_key]['shippings'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
                    }
                    if (!empty($cart['shipping'][$shipping_id])) {
                        $cart['shipping'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
                        $cart['shipping'][$shipping_id]['rates'] = 1;
                    }
                }
                if (!empty($group['chosen_shippings'])) {
                    foreach ($group['chosen_shippings'] as $shipping_key => $shipping) {
                        $shipping_id = $shipping['shipping_id'];
                        if (!empty($cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'])) {
                            $cart['product_groups'][$group_key]['shippings'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
                            $cart['shippings_extra']['sum']['pricediff'] += $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricediff'];
                        }
                        $cart['shippings_extra']['sum']['transfer'] += $cart['shippings_extra']['rates'][$group_key][$shipping_id]['transfer'];
                        if (!empty($cart['shippings_extra']['rates'][$group_key][$shipping['shipping_id']]['pricecash'])) {
                            $product_groups[$group_key]['chosen_shippings'][$shipping_key]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping['shipping_id']]['pricecash'];
                            $cart['shipping_cost'] = $cart['shippings_extra']['rates'][$group_key][$shipping['shipping_id']]['pricecash'];
                            $cart['display_shipping_cost'] = $cart['shipping_cost'];
                        }
                    }
                    $cart['shippings_extra']['sum']['total'] = $cart['shippings_extra']['sum']['transfer'] + $cart['shippings_extra']['sum']['pricediff'];
                }
            }
        }
        $_SESSION['shipping_hash'] = fn_get_shipping_hash($cart['product_groups']);
    }
}
Example #11
0
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
// rus_build_pack dbazhenov
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if (defined('PAYMENT_NOTIFICATION')) {
    if ($mode == 'notify') {
        if (isset($_REQUEST['hash']) && isset($_REQUEST['type'])) {
            $processor_data = fn_get_processor_data_by_name('vsevcredit.php');
            $payment_data = fn_get_payment_by_processor($processor_data['processor_id']);
            $payment_data = reset($payment_data);
            $payment_params = fn_get_payment_method_data($payment_data['payment_id']);
            $secret_word = $payment_params['processor_params']['vvc_secret'];
            if ($_REQUEST['type'] == 'user') {
                if (md5($_REQUEST['user_code'] . $_REQUEST['email'] . $secret_word) === $_REQUEST['hash']) {
                    //For the anonymous checkout
                    die(0);
                }
            } elseif ($_REQUEST['type'] == 'order_status') {
                if (isset($_REQUEST['order_id']) && isset($_REQUEST['type']) && $_REQUEST['type'] != 'user') {
                    $order_id = (int) $_REQUEST['order_id'];
                    $order_info = fn_get_order_info($order_id);
                } else {
                    die('Access denied');
                }
                if (md5($_REQUEST['user_id'] . $order_id . $_REQUEST['vvc_order_id'] . $_REQUEST['vvc_status'] . $secret_word) === $_REQUEST['hash'] && $order_info['payment_info']['awaiting_callback'] == true) {
                    if ($_REQUEST['vvc_status'] == 'OK') {
function fn_associate_order_id($order_id, $transaction_id, $schema_url)
{
    $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);
    $base_url = 'https://' . ($processor_data['params']['test'] == 'N' ? 'checkout.google.com' : 'sandbox.google.com/checkout') . '/cws/v2/Merchant/' . $processor_data['params']['merchant_id'];
    $request_url = $base_url . '/request';
    $post = array();
    $post[] = "<add-merchant-order-number xmlns='" . $schema_url . "' google-order-number='" . $transaction_id . "'>";
    $post[] = "<merchant-order-number>" . $order_id . "</merchant-order-number>";
    $post[] = "</add-merchant-order-number>";
    $_id = base64_encode($processor_data['params']['merchant_id'] . ":" . $processor_data['params']['merchant_key']);
    $headers[] = "Authorization: Basic {$_id}";
    $headers[] = "Accept: application/xml ";
    list($a, $return) = fn_https_request("POST", $request_url, $post, '', '', 'application/xml', '', '', '', $headers);
    return true;
}
//
// $Id: proxypay3_validation.php 7502 2009-05-19 14:54:59Z zeke $
//
DEFINE('AREA', 'C');
DEFINE('AREA_NAME', 'customer');
require './../prepare.php';
require './../init.php';
#$Ref=88;
#$Amount=4.50;
#$Shop=500;
#$Currency=978;
$totals_100 = array('EUR', 'USD', 'GBP', 'CHF', 'NLG', 'DEM', 'FRF', 'ATS');
if (!empty($_REQUEST['Ref'])) {
    $order_id = strpos($_REQUEST['Ref'], '_') ? substr($_REQUEST['Ref'], 0, strpos($_REQUEST['Ref'], '_')) : $_REQUEST['Ref'];
    $result = db_get_row("SELECT * FROM ?:orders WHERE order_id = ?i", $order_id);
    $processor_data = fn_get_payment_method_data($result['payment_id']);
    if (!in_array($processor_data['params']['currency'], $_REQUEST['totals_100'])) {
        $total_cost = $result['total'];
    } else {
        $total_cost = $result['total'] * 100;
    }
    $amount = !empty($_REQUEST['Amount']) ? $_REQUEST['Amount'] + 0 : 0;
    // what is zero for?
    $currency = !empty($_REQUEST['Currency']) ? $_REQUEST['Currency'] + 0 : 0;
    if (0 + $result['total'] == $amount && $processor_data['params']['merchantid'] == $_REQUEST['Shop'] && 0 + $processor_data['params']['currency'] == $currency && !empty($order_id) && !empty($amount) && !empty($currency)) {
        fn_change_order_status($order_id, 'O');
        print "[OK]";
    } else {
        fn_change_order_status($order_id, 'D', '', true);
        print "[ERROR]";
    }
Example #14
0
/**
 *
 * @param int $payment_id payment ID
 * @param string $action action 
 * @return array (boolean, string) 
 */
function fn_check_processor_script($payment_id, $action, $additional_params = false)
{
    if ($additional_params) {
        if ($action == 'save' || !empty($_REQUEST['skip_payment']) && AREA == 'C') {
            return array(false, '');
        }
    }
    $payment = fn_get_payment_method_data((int) $payment_id);
    if (!empty($payment['processor_id'])) {
        $processor_data = fn_get_processor_data($payment['payment_id']);
        if (!empty($processor_data['processor_script']) && file_exists(DIR_PAYMENT_FILES . $processor_data['processor_script'])) {
            return array(true, $processor_data);
        }
    }
    return array(false, '');
}
Example #15
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);
}
Example #16
0
function fn_checkout_summary(&$cart)
{
    if (fn_cart_is_empty($cart) == true) {
        return false;
    }
    fn_set_hook('checkout_summary', $cart);
    //Get payment methods
    $payment_data = fn_get_payment_method_data($cart['payment_id']);
    Registry::get('view')->assign('payment_method', $payment_data);
    Registry::get('view')->assign('credit_cards', fn_get_static_data_section('C', true, 'credit_card'));
    // Downlodable files agreements
    $agreements = array();
    foreach ($cart['products'] as $item) {
        if ($item['is_edp'] == 'Y') {
            if ($_agreement = fn_get_edp_agreements($item['product_id'], true)) {
                $agreements[$item['product_id']] = $_agreement;
            }
        }
    }
    if (!empty($agreements)) {
        Registry::get('view')->assign('cart_agreements', $agreements);
    }
}
Example #17
0
 $shipping_hash = fn_get_shipping_hash($cart['product_groups']);
 if (!empty($_SESSION['shipping_hash']) && $_SESSION['shipping_hash'] != $shipping_hash && $completed_steps['step_three'] && $cart['shipping_required']) {
     $_SESSION['chosen_shipping'] = array();
     fn_set_notification('W', __('important'), __('text_shipping_rates_changed'));
     if ($cart['edit_step'] == 'step_four') {
         return array(CONTROLLER_STATUS_REDIRECT, 'checkout.checkout?edit_step=step_three');
     }
 }
 $_SESSION['shipping_hash'] = $shipping_hash;
 fn_gather_additional_products_data($cart_products, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => false));
 if (floatval($cart['total']) == 0) {
     $cart['payment_id'] = 0;
 }
 fn_set_hook('checkout_select_default_payment_method', $cart, $payment_methods, $completed_steps);
 if (!empty($cart['payment_id'])) {
     $payment_info = fn_get_payment_method_data($cart['payment_id']);
     Tygh::$app['view']->assign('payment_info', $payment_info);
     if (!empty($payment_info['processor_params']['iframe_mode']) && $payment_info['processor_params']['iframe_mode'] == 'Y') {
         Tygh::$app['view']->assign('iframe_mode', true);
     }
 }
 Tygh::$app['view']->assign('payment_methods', $payment_methods);
 $cart['payment_surcharge'] = 0;
 if (!empty($cart['payment_id']) && !empty($payment_info)) {
     fn_update_payment_surcharge($cart, $auth);
 }
 if (fn_allowed_for('MULTIVENDOR')) {
     Tygh::$app['view']->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($cart['products']));
 }
 Tygh::$app['view']->assign('usergroups', fn_get_usergroups(array('type' => 'C', 'status' => 'A'), CART_LANGUAGE));
 Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
    function content_55d312504e2e18_94467538($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_function_math')) {
            include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/function.math.php';
        }
        if (!is_callable('smarty_function_set_id')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php';
        }
        fn_preload_lang_vars(array('subtotal', 'ls_shipping_estimation', 'month_name_abr_', 'shipping_cost', 'including_discount', 'order_discount', 'taxes', 'included', 'payment_surcharge', 'subtotal', 'ls_shipping_estimation', 'month_name_abr_', 'shipping_cost', 'including_discount', 'order_discount', 'taxes', 'included', 'payment_surcharge'));
        if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") {
            $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null);
            ob_start();
            ?>
<ul class="ty-cart-statistic ty-statistic-list">
    <li class="ty-cart-statistic__item ty-statistic-list-subtotal">
        <span class="ty-cart-statistic__title"><?php 
            echo $_smarty_tpl->__("subtotal");
            ?>
</span>
        <span class="ty-cart-statistic__value"><?php 
            echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['display_subtotal']), 0);
            ?>
</span>
    </li>
    
    <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:checkout_totals"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "checkout:checkout_totals"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

    <li class="ty-cart-statistic__item">
                    <span class="ty-cart-statistic__title">
                        <?php 
                echo $_smarty_tpl->__("ls_shipping_estimation");
                ?>

                    </span>    
                    <span class="ty-cart-statistic__value">
                            <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['ls_shipping_estimation_day']->value, ENT_QUOTES, 'UTF-8');
                ?>
 <?php 
                echo $_smarty_tpl->__("month_name_abr_" . (string) $_smarty_tpl->tpl_vars['ls_shipping_estimation_month']->value);
                ?>
 <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['ls_shipping_estimation_year']->value, ENT_QUOTES, 'UTF-8');
                ?>
 
                    </span>
    </li>
        <?php 
                if ($_smarty_tpl->tpl_vars['cart']->value['shipping_required'] == true && ($_smarty_tpl->tpl_vars['location']->value != "cart" || $_smarty_tpl->tpl_vars['settings']->value['General']['estimate_shipping_cost'] == "Y")) {
                    ?>
        <li class="ty-cart-statistic__item ty-statistic-list-shipping-method">
        <?php 
                    if ($_smarty_tpl->tpl_vars['cart']->value['shipping']) {
                        ?>
            <span class="ty-cart-statistic__title">
                <?php 
                        $_smarty_tpl->tpl_vars["shipping"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["shipping"]->_loop = false;
                        $_smarty_tpl->tpl_vars["shipping_id"] = new Smarty_Variable();
                        $_from = $_smarty_tpl->tpl_vars['cart']->value['shipping'];
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        $_smarty_tpl->tpl_vars["shipping"]->total = $_smarty_tpl->_count($_from);
                        $_smarty_tpl->tpl_vars["shipping"]->iteration = 0;
                        foreach ($_from as $_smarty_tpl->tpl_vars["shipping"]->key => $_smarty_tpl->tpl_vars["shipping"]->value) {
                            $_smarty_tpl->tpl_vars["shipping"]->_loop = true;
                            $_smarty_tpl->tpl_vars["shipping_id"]->value = $_smarty_tpl->tpl_vars["shipping"]->key;
                            $_smarty_tpl->tpl_vars["shipping"]->iteration++;
                            $_smarty_tpl->tpl_vars["shipping"]->last = $_smarty_tpl->tpl_vars["shipping"]->iteration === $_smarty_tpl->tpl_vars["shipping"]->total;
                            $_smarty_tpl->tpl_vars['smarty']->value['foreach']["f_shipp"]['last'] = $_smarty_tpl->tpl_vars["shipping"]->last;
                            ?>
                    <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['shipping']->value['shipping'], ENT_QUOTES, 'UTF-8');
                            if (!$_smarty_tpl->getVariable('smarty')->value['foreach']['f_shipp']['last']) {
                                ?>
, <?php 
                            }
                            ?>
                <?php 
                        }
                        ?>
                <span class="ty-nowrap">(<?php 
                        echo trim(Smarty::$_smarty_vars['capture']['shipping_estimation']);
                        ?>
)</span>
            </span>
            <span class="ty-cart-statistic__value"><?php 
                        echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['display_shipping_cost']), 0);
                        ?>
</span>
        <?php 
                    } else {
                        ?>
            <span class="ty-cart-statistic__title"><?php 
                        echo $_smarty_tpl->__("shipping_cost");
                        ?>
</span>
            <span class="ty-cart-statistic__value"><?php 
                        echo Smarty::$_smarty_vars['capture']['shipping_estimation'];
                        ?>
</span>
        <?php 
                    }
                    ?>
        </li>
        <?php 
                }
                ?>
    <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "checkout:checkout_totals"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

    
    <?php 
            if (floatval($_smarty_tpl->tpl_vars['cart']->value['discount'])) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-discount">
        <span class="ty-cart-statistic__title"><?php 
                echo $_smarty_tpl->__("including_discount");
                ?>
</span>
        <span class="ty-cart-statistic__value discount-price">-<?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['discount']), 0);
                ?>
</span>
    </li>
    
    <?php 
            }
            ?>

    <?php 
            if (floatval($_smarty_tpl->tpl_vars['cart']->value['subtotal_discount'])) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-subtotal-discount">
        <span class="ty-cart-statistic__title"><?php 
                echo $_smarty_tpl->__("order_discount");
                ?>
</span>
        <span class="ty-cart-statistic__value discount-price">-<?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['subtotal_discount']), 0);
                ?>
</span>
    </li>
    <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:checkout_discount"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "checkout:checkout_discount"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "checkout:checkout_discount"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

    <?php 
            }
            ?>

    <?php 
            if ($_smarty_tpl->tpl_vars['cart']->value['taxes']) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-taxes ty-cart-statistic__group">
        <span class="ty-cart-statistic__title ty-cart-statistic_title_main"><?php 
                echo $_smarty_tpl->__("taxes");
                ?>
</span>
    </li>
    <?php 
                $_smarty_tpl->tpl_vars["tax"] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars["tax"]->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['cart']->value['taxes'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars["tax"]->key => $_smarty_tpl->tpl_vars["tax"]->value) {
                    $_smarty_tpl->tpl_vars["tax"]->_loop = true;
                    ?>
    <li class="ty-cart-statistic__item ty-statistic-list-tax">
        <span class="ty-cart-statistic__title"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['description'], ENT_QUOTES, 'UTF-8');
                    ?>
&nbsp;(<?php 
                    echo $_smarty_tpl->getSubTemplate("common/modifier.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('mod_value' => $_smarty_tpl->tpl_vars['tax']->value['rate_value'], 'mod_type' => $_smarty_tpl->tpl_vars['tax']->value['rate_type']), 0);
                    if ($_smarty_tpl->tpl_vars['tax']->value['price_includes_tax'] == "Y" && ($_smarty_tpl->tpl_vars['settings']->value['Appearance']['cart_prices_w_taxes'] != "Y" || $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] == "subtotal")) {
                        ?>
&nbsp;<?php 
                        echo $_smarty_tpl->__("included");
                    }
                    ?>
)</span>
        <span class="ty-cart-statistic__value"><?php 
                    echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['tax']->value['tax_subtotal']), 0);
                    ?>
</span>
    </li>
    <?php 
                }
                ?>
    <?php 
            }
            ?>

    <?php 
            if ($_smarty_tpl->tpl_vars['cart']->value['payment_surcharge'] && !$_smarty_tpl->tpl_vars['take_surcharge_from_vendor']->value) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-payment-surcharge" id="payment_surcharge_line">
        <?php 
                $_smarty_tpl->tpl_vars["payment_data"] = new Smarty_variable(fn_get_payment_method_data($_smarty_tpl->tpl_vars['cart']->value['payment_id']), null, 0);
                ?>
        <span class="ty-cart-statistic__title"><?php 
                echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['cart']->value['payment_surcharge_title']) === null || $tmp === '' ? $_smarty_tpl->__("payment_surcharge") : $tmp, ENT_QUOTES, 'UTF-8');
                if ($_smarty_tpl->tpl_vars['payment_data']->value['payment']) {
                    ?>
&nbsp;(<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['payment_data']->value['payment'], ENT_QUOTES, 'UTF-8');
                    ?>
)<?php 
                }
                ?>
:</span>
        <span class="ty-cart-statistic__value"><?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['payment_surcharge'], 'span_id' => "payment_surcharge_value"), 0);
                ?>
</span>
    </li>
    <?php 
                echo smarty_function_math(array('equation' => "x+y", 'x' => $_smarty_tpl->tpl_vars['cart']->value['total'], 'y' => $_smarty_tpl->tpl_vars['cart']->value['payment_surcharge'], 'assign' => "_total"), $_smarty_tpl);
                ?>

    <?php 
                $_smarty_tpl->_capture_stack[0][] = array("_total", null, null);
                ob_start();
                echo htmlspecialchars($_smarty_tpl->tpl_vars['_total']->value, ENT_QUOTES, 'UTF-8');
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
                ?>
    <?php 
            }
            ?>
</ul><?php 
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            if (trim(Smarty::$_smarty_vars['capture']['template_content'])) {
                if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") {
                    ?>
<span class="cm-template-box template-box" data-ca-te-template="views/checkout/components/checkout_totals_info.tpl" id="<?php 
                    echo smarty_function_set_id(array('name' => "views/checkout/components/checkout_totals_info.tpl"), $_smarty_tpl);
                    ?>
"><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php 
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                    ?>
<!--[/tpl_id]--></span><?php 
                } else {
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                }
            }
        } else {
            ?>
<ul class="ty-cart-statistic ty-statistic-list">
    <li class="ty-cart-statistic__item ty-statistic-list-subtotal">
        <span class="ty-cart-statistic__title"><?php 
            echo $_smarty_tpl->__("subtotal");
            ?>
</span>
        <span class="ty-cart-statistic__value"><?php 
            echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['display_subtotal']), 0);
            ?>
</span>
    </li>
    
    <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:checkout_totals"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "checkout:checkout_totals"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

    <li class="ty-cart-statistic__item">
                    <span class="ty-cart-statistic__title">
                        <?php 
                echo $_smarty_tpl->__("ls_shipping_estimation");
                ?>

                    </span>    
                    <span class="ty-cart-statistic__value">
                            <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['ls_shipping_estimation_day']->value, ENT_QUOTES, 'UTF-8');
                ?>
 <?php 
                echo $_smarty_tpl->__("month_name_abr_" . (string) $_smarty_tpl->tpl_vars['ls_shipping_estimation_month']->value);
                ?>
 <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['ls_shipping_estimation_year']->value, ENT_QUOTES, 'UTF-8');
                ?>
 
                    </span>
    </li>
        <?php 
                if ($_smarty_tpl->tpl_vars['cart']->value['shipping_required'] == true && ($_smarty_tpl->tpl_vars['location']->value != "cart" || $_smarty_tpl->tpl_vars['settings']->value['General']['estimate_shipping_cost'] == "Y")) {
                    ?>
        <li class="ty-cart-statistic__item ty-statistic-list-shipping-method">
        <?php 
                    if ($_smarty_tpl->tpl_vars['cart']->value['shipping']) {
                        ?>
            <span class="ty-cart-statistic__title">
                <?php 
                        $_smarty_tpl->tpl_vars["shipping"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["shipping"]->_loop = false;
                        $_smarty_tpl->tpl_vars["shipping_id"] = new Smarty_Variable();
                        $_from = $_smarty_tpl->tpl_vars['cart']->value['shipping'];
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        $_smarty_tpl->tpl_vars["shipping"]->total = $_smarty_tpl->_count($_from);
                        $_smarty_tpl->tpl_vars["shipping"]->iteration = 0;
                        foreach ($_from as $_smarty_tpl->tpl_vars["shipping"]->key => $_smarty_tpl->tpl_vars["shipping"]->value) {
                            $_smarty_tpl->tpl_vars["shipping"]->_loop = true;
                            $_smarty_tpl->tpl_vars["shipping_id"]->value = $_smarty_tpl->tpl_vars["shipping"]->key;
                            $_smarty_tpl->tpl_vars["shipping"]->iteration++;
                            $_smarty_tpl->tpl_vars["shipping"]->last = $_smarty_tpl->tpl_vars["shipping"]->iteration === $_smarty_tpl->tpl_vars["shipping"]->total;
                            $_smarty_tpl->tpl_vars['smarty']->value['foreach']["f_shipp"]['last'] = $_smarty_tpl->tpl_vars["shipping"]->last;
                            ?>
                    <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['shipping']->value['shipping'], ENT_QUOTES, 'UTF-8');
                            if (!$_smarty_tpl->getVariable('smarty')->value['foreach']['f_shipp']['last']) {
                                ?>
, <?php 
                            }
                            ?>
                <?php 
                        }
                        ?>
                <span class="ty-nowrap">(<?php 
                        echo trim(Smarty::$_smarty_vars['capture']['shipping_estimation']);
                        ?>
)</span>
            </span>
            <span class="ty-cart-statistic__value"><?php 
                        echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['display_shipping_cost']), 0);
                        ?>
</span>
        <?php 
                    } else {
                        ?>
            <span class="ty-cart-statistic__title"><?php 
                        echo $_smarty_tpl->__("shipping_cost");
                        ?>
</span>
            <span class="ty-cart-statistic__value"><?php 
                        echo Smarty::$_smarty_vars['capture']['shipping_estimation'];
                        ?>
</span>
        <?php 
                    }
                    ?>
        </li>
        <?php 
                }
                ?>
    <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "checkout:checkout_totals"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

    
    <?php 
            if (floatval($_smarty_tpl->tpl_vars['cart']->value['discount'])) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-discount">
        <span class="ty-cart-statistic__title"><?php 
                echo $_smarty_tpl->__("including_discount");
                ?>
</span>
        <span class="ty-cart-statistic__value discount-price">-<?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['discount']), 0);
                ?>
</span>
    </li>
    
    <?php 
            }
            ?>

    <?php 
            if (floatval($_smarty_tpl->tpl_vars['cart']->value['subtotal_discount'])) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-subtotal-discount">
        <span class="ty-cart-statistic__title"><?php 
                echo $_smarty_tpl->__("order_discount");
                ?>
</span>
        <span class="ty-cart-statistic__value discount-price">-<?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['subtotal_discount']), 0);
                ?>
</span>
    </li>
    <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "checkout:checkout_discount"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "checkout:checkout_discount"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "checkout:checkout_discount"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

    <?php 
            }
            ?>

    <?php 
            if ($_smarty_tpl->tpl_vars['cart']->value['taxes']) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-taxes ty-cart-statistic__group">
        <span class="ty-cart-statistic__title ty-cart-statistic_title_main"><?php 
                echo $_smarty_tpl->__("taxes");
                ?>
</span>
    </li>
    <?php 
                $_smarty_tpl->tpl_vars["tax"] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars["tax"]->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['cart']->value['taxes'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars["tax"]->key => $_smarty_tpl->tpl_vars["tax"]->value) {
                    $_smarty_tpl->tpl_vars["tax"]->_loop = true;
                    ?>
    <li class="ty-cart-statistic__item ty-statistic-list-tax">
        <span class="ty-cart-statistic__title"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['description'], ENT_QUOTES, 'UTF-8');
                    ?>
&nbsp;(<?php 
                    echo $_smarty_tpl->getSubTemplate("common/modifier.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('mod_value' => $_smarty_tpl->tpl_vars['tax']->value['rate_value'], 'mod_type' => $_smarty_tpl->tpl_vars['tax']->value['rate_type']), 0);
                    if ($_smarty_tpl->tpl_vars['tax']->value['price_includes_tax'] == "Y" && ($_smarty_tpl->tpl_vars['settings']->value['Appearance']['cart_prices_w_taxes'] != "Y" || $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] == "subtotal")) {
                        ?>
&nbsp;<?php 
                        echo $_smarty_tpl->__("included");
                    }
                    ?>
)</span>
        <span class="ty-cart-statistic__value"><?php 
                    echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['tax']->value['tax_subtotal']), 0);
                    ?>
</span>
    </li>
    <?php 
                }
                ?>
    <?php 
            }
            ?>

    <?php 
            if ($_smarty_tpl->tpl_vars['cart']->value['payment_surcharge'] && !$_smarty_tpl->tpl_vars['take_surcharge_from_vendor']->value) {
                ?>
    <li class="ty-cart-statistic__item ty-statistic-list-payment-surcharge" id="payment_surcharge_line">
        <?php 
                $_smarty_tpl->tpl_vars["payment_data"] = new Smarty_variable(fn_get_payment_method_data($_smarty_tpl->tpl_vars['cart']->value['payment_id']), null, 0);
                ?>
        <span class="ty-cart-statistic__title"><?php 
                echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['cart']->value['payment_surcharge_title']) === null || $tmp === '' ? $_smarty_tpl->__("payment_surcharge") : $tmp, ENT_QUOTES, 'UTF-8');
                if ($_smarty_tpl->tpl_vars['payment_data']->value['payment']) {
                    ?>
&nbsp;(<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['payment_data']->value['payment'], ENT_QUOTES, 'UTF-8');
                    ?>
)<?php 
                }
                ?>
:</span>
        <span class="ty-cart-statistic__value"><?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['cart']->value['payment_surcharge'], 'span_id' => "payment_surcharge_value"), 0);
                ?>
</span>
    </li>
    <?php 
                echo smarty_function_math(array('equation' => "x+y", 'x' => $_smarty_tpl->tpl_vars['cart']->value['total'], 'y' => $_smarty_tpl->tpl_vars['cart']->value['payment_surcharge'], 'assign' => "_total"), $_smarty_tpl);
                ?>

    <?php 
                $_smarty_tpl->_capture_stack[0][] = array("_total", null, null);
                ob_start();
                echo htmlspecialchars($_smarty_tpl->tpl_vars['_total']->value, ENT_QUOTES, 'UTF-8');
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
                ?>
    <?php 
            }
            ?>
</ul><?php 
        }
    }
Example #19
0
    db_query("REPLACE INTO ?:order_data ?e", $data);
    fn_update_order_payment_info($order_id, $pp_response);
    fn_order_placement_routines('route', $order_id);
} elseif ($message_recognizer == 'OrderCancelledNotification') {
    // Customer cancel this order on the Amazon side. We need to cancel the order in the shop
    list($amazon_sess_id, $payment_id) = explode(';', base64_decode((string) $xml->ProcessedOrder->ProcessedOrderItems->ProcessedOrderItem->CartCustomData->ClientRequestId));
    $processor_data = fn_get_payment_method_data($payment_id);
    // If we use the signed cart, validate the request
    if (!fn_amazon_validate_request($processor_data, $_POST)) {
        die('Access denied');
    }
    $transaction_id = (string) $xml->ProcessedOrder->AmazonOrderID;
    $order_id = db_get_field('SELECT order_id FROM ?:order_data WHERE type = ?s AND data = ?s', 'E', $transaction_id);
    if (!empty($order_id)) {
        fn_change_order_status($order_id, 'I');
    }
} elseif ($message_recognizer == 'OrderReadyToShipNotification') {
    // Order was processed by Amazon. We need to process the order in the shop
    list($amazon_sess_id, $payment_id) = explode(';', base64_decode((string) $xml->ProcessedOrder->ProcessedOrderItems->ProcessedOrderItem->CartCustomData->ClientRequestId));
    $processor_data = fn_get_payment_method_data($payment_id);
    // If we use the signed cart, validate the request
    if (!fn_amazon_validate_request($processor_data, $_POST)) {
        die('Access denied');
    }
    $transaction_id = (string) $xml->ProcessedOrder->AmazonOrderID;
    $order_id = db_get_field('SELECT order_id FROM ?:order_data WHERE type = ?s AND data = ?s', 'E', $transaction_id);
    if (!empty($order_id)) {
        fn_change_order_status($order_id, 'P');
    }
}
exit;
Example #20
0
 * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
 ****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($mode == 'details') {
    $order_info = fn_get_order_info($_REQUEST['order_id']);
    if (isset($order_info['payment_method']['processor_params']['sbrf_enabled']) && $order_info['payment_method']['processor_params']['sbrf_enabled'] == "Y") {
        $navigation_tabs = Registry::get('navigation.tabs');
        $navigation_tabs['payment_information'] = array('title' => __('payment_information'), 'js' => true, 'href' => 'orders.details?order_id=' . $_REQUEST['order_id'] . '&selected_section=payment_information');
        $temp_dir = Registry::get('config.dir.cache_misc') . 'tmp/';
        fn_mkdir($temp_dir);
        $path = fn_qr_generate($order_info, '|', $temp_dir);
        $url_qr_code = Registry::get('config.current_location') . '/' . fn_get_rel_dir($path);
        Tygh::$app['view']->assign('url_qr_code', $url_qr_code);
        Registry::set('navigation.tabs', $navigation_tabs);
    }
    if (isset($order_info['payment_method']['processor_params']['account_enabled']) && $order_info['payment_method']['processor_params']['account_enabled'] == "Y") {
        $navigation_tabs = Registry::get('navigation.tabs');
        $navigation_tabs['payment_information'] = array('title' => __('payment_information'), 'js' => true, 'href' => 'orders.details?order_id=' . $_REQUEST['order_id'] . '&selected_section=payment_information');
        Registry::set('navigation.tabs', $navigation_tabs);
        if (!empty($order_info['payment_id']) && !empty($order_info['payment_info'])) {
            Tygh::$app['view']->assign('account_params', $order_info['payment_info']);
        }
    }
    if (!empty($_REQUEST['payment_id'])) {
        $payment_info = fn_get_payment_method_data($_REQUEST['payment_id']);
        Tygh::$app['view']->assign('payment_info', $payment_info);
    }
}