} fn_order_placement_routines('checkout_redirect'); } elseif ($mode == 'place_order' && !empty($_SESSION['pp_express_details'])) { fn_pp_save_mode($order_info); $token = $_SESSION['pp_express_details']['token']; fn_paypal_complete_checkout($token, $processor_data, $order_info); } elseif ($mode == 'place_order' || $mode == 'express' || $mode == 'repay') { if (!defined('BOOTSTRAP')) { require './init_payment.php'; $_SESSION['cart'] = empty($_SESSION['cart']) ? array() : $_SESSION['cart']; } $payment_id = empty($_REQUEST['payment_id']) ? $_SESSION['cart']['payment_id'] : $_REQUEST['payment_id']; if ($mode == 'express') { $result = fn_paypal_set_express_checkout($payment_id, 0, array(), $_SESSION['cart']); $useraction = 'continue'; } else { $result = fn_paypal_set_express_checkout($payment_id, $order_id, $order_info); $useraction = "commit"; } if (fn_paypal_ack_success($result) && !empty($result['TOKEN'])) { $processor_data = fn_get_payment_method_data($payment_id); fn_paypal_payment_form($processor_data, $result['TOKEN']); } else { fn_paypal_get_error($result); if ($mode == 'express') { fn_order_placement_routines('checkout.cart'); } else { fn_order_placement_routines('checkout_redirect'); } } }
$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); Tygh::$app['session']['pp_express_details'] = $paypal_express_details; Tygh::$app['session']['cart']['payment_id'] = $payment_id; } else { fn_paypal_get_error($paypal_checkout_details); } fn_order_placement_routines('checkout_redirect'); } elseif ($mode == 'express') { Tygh::$app['session']['cart'] = empty(Tygh::$app['session']['cart']) ? array() : Tygh::$app['session']['cart']; $payment_id = empty($_REQUEST['payment_id']) ? Tygh::$app['session']['cart']['payment_id'] : $_REQUEST['payment_id']; $is_in_context_order = isset($_REQUEST['in_context_order']) && isset($_REQUEST['in_context']); $result = fn_paypal_set_express_checkout($payment_id, 0, array(), Tygh::$app['session']['cart'], AREA, $is_in_context_order); $useraction = 'continue'; $processor_data = fn_get_payment_method_data($payment_id); $in_context_checkout = $processor_data['processor_params']['in_context'] == 'Y'; if (fn_paypal_ack_success($result) && !empty($result['TOKEN'])) { if ($in_context_checkout && isset($_REQUEST['in_context'])) { header('Content-type: application/json'); echo json_encode(array('token' => $result['TOKEN'])); exit; } else { fn_paypal_payment_form($processor_data, $result['TOKEN']); } } else { // create notification fn_paypal_get_error($result); if ($in_context_checkout && isset($_REQUEST['in_context'])) {