예제 #1
0
if ($mode == 'express_return') {
    $token = $_REQUEST['token'];
    $payment_id = $_REQUEST['payment_id'];
    $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);
        $_SESSION['pp_express_details'] = $paypal_express_details;
        $_SESSION['cart']['payment_id'] = $payment_id;
    } else {
        fn_paypal_get_error($paypal_checkout_details);
    }
    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";
    }
예제 #2
0
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Http;
use Tygh\Registry;
/**
 * @var array $order_info
 * @var array $processor_data
 * @var string $mode
 */
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if (defined('PAYMENT_NOTIFICATION') && !empty($_REQUEST['order_id'])) {
    $order_id = (int) $_REQUEST['order_id'];
    fn_pp_save_mode(fn_get_order_info($order_id));
    if ($mode == 'return') {
        if (fn_check_payment_script('paypal_advanced.php', $order_id)) {
            $url = fn_url("payment_notification.finish?payment=paypal_advanced&order_id={$order_id}");
            $pp_response['order_status'] = $_REQUEST['RESULT'] === '0' ? 'P' : 'F';
            $pp_response["reason_text"] = 'Reason : ' . $_REQUEST['RESULT'] . ' / ' . urldecode($_REQUEST['RESPMSG']);
            fn_finish_payment($order_id, $pp_response, false);
            Tygh::$app['view']->assign('onload', 'javascript: top.location = ' . "'{$url}'" . ';');
            Tygh::$app['view']->assign('order_action', __('text_paypal_processing_payment'));
            Tygh::$app['view']->display('views/orders/components/placing_order.tpl');
            fn_flush();
        }
    } elseif ($mode == 'cancel') {
        $pp_response['order_status'] = 'N';
        $pp_response['reason_text'] = __('text_transaction_cancelled');
        fn_finish_payment($order_id, $pp_response, false);