Ejemplo n.º 1
0
function fn_rus_kupivkredit_pre_add_to_cart(&$product_data, &$cart, &$auth, &$update)
{
    if (Registry::ifGet('addons.rus_kupivkredit.status', 'D') == 'A' && Registry::get('runtime.action') == 'kvk_activate') {
        $payment_methods = fn_get_payment_methods($auth);
        foreach ($payment_methods as $p => $data) {
            if (!empty($data['processor']) && stristr($data['processor'], 'Kupivkredit')) {
                $cart['payment_id'] = $data['payment_id'];
            }
        }
    }
}
Ejemplo n.º 2
0
function fn_prepare_checkout_payment_methods(&$cart, &$auth)
{
    static $payment_methods;
    //Get payment methods
    if (empty($payment_methods)) {
        $payment_methods = fn_get_payment_methods($auth);
    }
    // Check if payment method has surcharge rates
    foreach ($payment_methods as $k => $v) {
        $payment_methods[$k]['surcharge_value'] = 0;
        if (floatval($v['a_surcharge'])) {
            $payment_methods[$k]['surcharge_value'] += $v['a_surcharge'];
        }
        if (floatval($v['p_surcharge']) && !empty($cart['total'])) {
            $payment_methods[$k]['surcharge_value'] += fn_format_price($cart['total'] * $v['p_surcharge'] / 100);
        }
    }
    fn_set_hook('prepare_checkout_payment_methods', $cart, $auth, $payment_methods);
    return $payment_methods;
}
 $cart['calculate_shipping'] = true;
 // calculate cart - get products with options, full shipping rates info and promotions
 list($cart_products, $product_groups) = fn_calculate_cart_content($cart, $customer_auth);
 Registry::get('view')->assign('product_groups', $product_groups);
 if (fn_allowed_for('MULTIVENDOR') && !empty($cart['order_id'])) {
     $order_info = fn_get_order_info($cart['order_id']);
     if (isset($order_info['company_id'])) {
         Registry::get('view')->assign('order_company_id', $order_info['company_id']);
     }
 }
 fn_gather_additional_products_data($cart_products, array('get_icon' => false, 'get_detailed' => false, 'get_options' => true, 'get_discounts' => false));
 Registry::get('view')->assign('cart_products', $cart_products);
 //
 //Get payment methods
 //
 $payment_methods = fn_get_payment_methods($customer_auth);
 // Check if payment method has surcharge rates
 foreach ($payment_methods as $k => $v) {
     if (!isset($cart['payment_id'])) {
         $cart['payment_id'] = $v['payment_id'];
     }
     $payment_methods[$k]['surcharge_value'] = 0;
     if (floatval($v['a_surcharge'])) {
         $payment_methods[$k]['surcharge_value'] += $v['a_surcharge'];
     }
     if (floatval($v['p_surcharge'])) {
         $payment_methods[$k]['surcharge_value'] += fn_format_price($cart['total'] * $v['p_surcharge'] / 100);
     }
 }
 fn_update_payment_surcharge($cart, $auth);
 if (!empty($cart['payment_surcharge'])) {
Ejemplo n.º 4
0
function fn_prepare_checkout_payment_methods(&$cart, &$auth, $lang_code = CART_LANGUAGE)
{
    static $payment_methods, $payment_groups;
    //Get payment methods
    if (empty($payment_methods)) {
        $payment_methods = fn_get_payment_methods($auth);
    }
    // Check if payment method has surcharge rates
    foreach ($payment_methods as $k => $v) {
        if ($payment_methods[$k]['processor_type'] == 'C') {
            continue;
        }
        $payment_methods[$k]['surcharge_value'] = 0;
        if (floatval($v['a_surcharge'])) {
            $payment_methods[$k]['surcharge_value'] += $v['a_surcharge'];
        }
        if (floatval($v['p_surcharge']) && !empty($cart['total'])) {
            $payment_methods[$k]['surcharge_value'] += fn_format_price($cart['total'] * $v['p_surcharge'] / 100);
        }
        $payment_methods[$k]['image'] = fn_get_image_pairs($v['payment_id'], 'payment', 'M', true, true, $lang_code);
        $payment_groups[$v['payment_category']][$k] = $payment_methods[$k];
    }
    if (!empty($payment_groups)) {
        ksort($payment_groups);
    }
    fn_set_hook('prepare_checkout_payment_methods', $cart, $auth, $payment_groups);
    return $payment_groups;
}
Ejemplo n.º 5
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_payment_methods($auth);
    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);
    }
}
Ejemplo n.º 6
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);
    }
}