コード例 #1
0
{
    // $url_for_redirect = fn_url ( "orders" );
    // $url_for_redirect =  "../../../orders";
    $url_for_redirect = "../../../index.php?dispatch=orders.search";
    return $url_for_redirect;
}
// Load System
pn_load_system();
// Load PayNow
pn_load_paynow();
// Redirect URL for users using EFT/Retail payments to notify them the order's pending
$url_for_redirect = pn_get_redirect_url();
pnlog(__FILE__ . " POST: " . print_r($_REQUEST, true));
$pn_callback = $mode == 'notify' || isset($_POST['TransactionAccepted']) && $_POST['TransactionAccepted'] == true;
// CC notification or EFT or none?
if (isset($_POST) && !empty($_POST)) {
    // This is the notification coming in!
    // Act as an IPN request and forward request to Credit Card method.
    // Logic is exactly the same
    pn_do_transaction(pn_order_id_from_ref($_POST['Reference']));
    die;
} else {
    // Probably calling the "redirect" URL
    pnlog(__FILE__ . ' Probably calling the "redirect" URL');
    if ($url_for_redirect) {
        header("Location: {$url_for_redirect}");
    } else {
        die("No 'redirect' URL set.");
    }
}
die(PN_ERR_BAD_ACCESS);
コード例 #2
0
}
define('PN_DEBUG', (bool) $processor_data['processor_params']['debug']);
pnlog("Including sagepaynow.php from app/payments/sagepaynow");
pnlog("Processor params: " . print_r($processor_data['processor_params'], true));
$sagepaynow_service_key = $processor_data['processor_params']['service_key'];
// Return (callback) from the Sage Pay Now website
// Scroll the bottom to see form submit code
if (defined('PAYMENT_NOTIFICATION')) {
    // CC callback will have &order_id={ID} set
    // A notification for retail/EFT will have it set as Reference
    $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id'] : null;
    if (!$order_id) {
        $order_id = isset($_POST['Reference']) ? pn_order_id_from_ref($_POST['Reference']) : null;
    }
    if ($mode == 'notify' && $order_id !== null) {
        pn_do_transaction($order_id);
    } elseif ($mode == 'return') {
        pnlog("Mode == return");
        if (fn_check_payment_script('sagepaynow.php', $_REQUEST['order_id'])) {
            $order_info = fn_get_order_info($_REQUEST['order_id'], true);
            if ($order_info['status'] == STATUS_INCOMPLETED_ORDER) {
                fn_change_order_status($_REQUEST['order_id'], 'O', '', false);
            }
            if (fn_allowed_for('MULTIVENDOR')) {
                if ($order_info['status'] == STATUS_PARENT_ORDER) {
                    $child_orders = db_get_hash_single_array("SELECT order_id, status FROM ?:orders WHERE parent_order_id = ?i", array('order_id', 'status'), $_REQUEST['order_id']);
                    foreach ($child_orders as $order_id => $order_status) {
                        if ($order_status == STATUS_INCOMPLETED_ORDER) {
                            fn_change_order_status($order_id, 'O', '', false);
                        }
                    }