Exemplo n.º 1
0
function wpc_handle_paypal_ipn()
{
    $debug_log = "ipn_handle_debug.log";
    // Debug log file name
    $ipn_handler_instance = new paypal_ipn_handler();
    $debug_enabled = false;
    $debug = get_option('wp_shopping_cart_enable_debug');
    if ($debug) {
        $debug_enabled = true;
    }
    if ($debug_enabled) {
        echo 'Debug is enabled. Check the ' . $debug_log . ' file for debug output.';
        $ipn_handler_instance->ipn_log = true;
        //$ipn_handler_instance->ipn_log_file = realpath(dirname(__FILE__)).'/'.$debug_log;
    }
    $sandbox = get_option('wp_shopping_cart_enable_sandbox');
    if ($sandbox) {
        $ipn_handler_instance->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
        $ipn_handler_instance->sandbox_mode = true;
    }
    $ipn_handler_instance->debug_log('Paypal Class Initiated by ' . $_SERVER['REMOTE_ADDR'], true);
    // Validate the IPN
    if ($ipn_handler_instance->validate_ipn()) {
        $ipn_handler_instance->debug_log('Creating product Information to send.', true);
        if (!$ipn_handler_instance->validate_and_dispatch_product()) {
            $ipn_handler_instance->debug_log('IPN product validation failed.', false);
        }
    }
    $ipn_handler_instance->debug_log('Paypal class finished.', true, true);
}
Exemplo n.º 2
0
    }
}
// Start of IPN handling (script execution)
$ipn_handler_instance = new paypal_ipn_handler();
$debug_enabled = get_option('eStore_cart_enable_debug');
if ($debug_enabled) {
    echo 'Debug is enabled. Check the ipn_handle_debug.log file for debug output.';
    $ipn_handler_instance->ipn_log = true;
    if (empty($_POST)) {
        $ipn_handler_instance->debug_log('This debug line was generated because you entered the URL of the ipn handling script in the browser.', true, true);
        exit;
    }
}
$sandbox = get_option('eStore_cart_enable_sandbox');
if ($sandbox) {
    $ipn_handler_instance->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
    $ipn_handler_instance->sandbox_mode = true;
}
$ipn_handler_instance->debug_log('Paypal Class Initiated by ' . $_SERVER['REMOTE_ADDR'] . ' eStore Version: ' . WP_ESTORE_VERSION, true);
if ($ipn_handler_instance->validate_ipn()) {
    $ipn_handler_instance->debug_log('Creating product Information to send.', true);
    if (!$ipn_handler_instance->validate_and_dispatch_product()) {
        $ipn_handler_instance->debug_log('IPN product validation failed.', false);
        $to_address = get_option('eStore_notify_email_address');
        $subject = "WP eStore - Payment Verification Failed!";
        $body = "This is a notification email from the eStore plugin letting you know that a payment verification failed." . "\n\nPlease fully read this email as it will explain everything you need to know to address any issue(s) that maybe occuring (if there are any)!" . "\n\nThe post payment verification for a payment notification failed. This could happen for one of the following reasons:" . "\n\n 1. The fund for the payment have not cleared in PayPal yet (no need to do anything as the digital product will be delivered once the fund clears)." . "\n 2. Someone maybe trying to scam a purchase! (no worries... WP eStore got your back :)" . "\n 3. You have made a mistake somewhere (please see the failure reason section below to find out more details about this)." . "\n\nThe following section has more details on why this failure occurred." . "\n\n===== Exact Reason for This Failure =====" . "\n" . "\nThe transaction failed for the following reason...\n" . $error_msg . "\n\n===== How to solve the 'Funds have not cleared' or 'Pending payment received' notification =====" . "\n" . "\nIf you have received a pending payment meaning the funds have not cleared for this payment and you don't know the reason then this link should help" . "\nhttp://www.tipsandtricks-hq.com/forum/topic/reasons-for-a-pending-paypal-payment" . "\n\n===== PayPal parameters for this transaction =====" . "\n\n" . $ipn_handler_instance->post_string;
        $from_address = get_option('eStore_download_email_address');
        eStore_send_notification_email($to_address, $subject, $body, $from_address);
    }
}
$ipn_handler_instance->debug_log('Paypal class finished.', true, true);