Example #1
0
$fp = @fopen("ipn.txt",$mode);  @flock($fp, LOCK_EX); @fwrite($fp,$str); @flock($fp, LOCK_UN); @fclose($fp);
}

$postString = ''; foreach($_POST as $key => $val) $postString .= $key.' = '.$val.NEW_LINE;
if($postString != '') {
debugWriteFile($postString,"w+");
}
*/
//require_once(PAYPAL_IPN_DIR.'application_top.inc.php');
require_once DIR_WS_INCLUDES . 'application_top.inc.php';
require_once PAYPAL_IPN_DIR . 'Classes/Ipn/IPN.class.php';
require_once PAYPAL_IPN_DIR . 'Classes/Debug/Debug.class.php';
require_once PAYPAL_IPN_DIR . 'Functions/general.func.php';
paypal_include_lng(PAYPAL_IPN_DIR . 'languages/', SESSION_LANGUAGE, 'ipn.lng.php');
$debug = new PayPal_Debug(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, MODULE_PAYMENT_PAYPAL_IPN_DEBUG);
$ipn = new PayPal_IPN($_POST);
$ipn->setTestMode(MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE);
unset($_POST);
//post back to PayPal to validate
if (!$ipn->authenticate(MODULE_PAYMENT_PAYPAL_DOMAIN) && $ipn->testMode('Off')) {
    $ipn->dienice('500');
}
//Check both the receiver_email and business id fields match
if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID, MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) {
    $ipn->dienice('500');
}
if ($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) {
    //parent_txn_id is the txn_id of the original transaction
    $txn = $ipn->queryTxnID($ipn->key['parent_txn_id']);
    if (!empty($txn)) {
        $ipn->insert($txn['paypal_id']);
Example #2
0
File: ipn.php Project: Zilus/cms
    {
        if (isset($post[$key])) {
            $return = $post[$key];
        } else {
            $return = '';
        }
        return $return;
    }
    function insert_data($request)
    {
        $post = $request;
        $item_name = $this->issetCheck($post, 'item_name');
        $amount = $this->issetCheck($post, 'mc_gross');
        $currency = $this->issetCheck($post, 'mc_currency');
        $payer_email = $this->issetCheck($post, 'payer_email');
        $first_name = $this->issetCheck($post, 'first_name');
        $last_name = $this->issetCheck($post, 'last_name');
        $country = $this->issetCheck($post, 'residence_country');
        $txn_id = $this->issetCheck($post, 'txn_id');
        $txn_type = $this->issetCheck($post, 'txn_type');
        $payment_status = $this->issetCheck($post, 'payment_status');
        $payment_type = $this->issetCheck($post, 'payment_type');
        $payer_id = $this->issetCheck($post, 'payer_id');
        $create_date = date('Y-m-d H:i:s');
        $payment_date = date('Y-m-d H:i:s');
        mysql_query("INSERT INTO infotuts_transection_tbl (item_name,payer_email,first_name,last_name,amount,currency,country,txn_id,txn_type,payer_id,payment_status,payment_type,create_date,payment_date) \nVALUES ('{$item_name}','{$payer_email}','{$first_name}','{$last_name}','{$amount}','{$currency}','{$country}','{$txn_id}','{$txn_type}','{$payer_id}','{$payment_status}','{$payment_type}','{$create_date}','{$payment_date}')");
        mysqli_close($con);
    }
}
$obj = new PayPal_IPN();
$obj->ipn_response($_REQUEST);
  http://www.devosc.com

  Copyright (c) 2003 osCommerce
  Copyright (c) 2004 DevosC.com
Copyright (c) 2006 Dipl.-Ing.(TH) Winfried Kaiser (w.kaiser@fortune.de) -- Port to OL-Commerce

  Released under the GNU General Public License
*/
require_once DIR_FS_INC . 'olc_draw_form.inc.php';
require_once DIR_FS_INC . 'olc_draw_hidden_field.inc.php';
olc_draw_form('ipn', olc_catalog_href_link(FILENAME_IPN), 'POST');
olc_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_BUSINESS_ID);
olc_draw_hidden_field('receiver_email', MODULE_PAYMENT_PAYPAL_ID);
olc_draw_hidden_field('verify_sign', 'PAYPAL_SHOPPING_CART_IPN-TEST_TRANSACTION-00000000000000');
olc_draw_hidden_field('payment_date', ate("H:i:s M d, Y T"));
olc_draw_hidden_field('digestKey', PayPal_IPN::digestKey());
?>
<table border="0" cellspacing="0" cellpadding="2" class="main">
<?php 
if (MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE == 'Off') {
    ?>
  <tr>
    <td>
      <table border="0" cellspacing="0" cellpadding="0" style="padding: 4px; border:1px solid #aaaaaa; background: #ffffcc;">
        <tr>
          <td><?php 
    echo $page->image('icon_error_40x40.gif', 'Error icon');
    ?>
</td>
          <td><br class="text_spacer"></td>
          <td class="pperrorbold" style="text-align: center; width:100%;">Test Mode must be enabled!</td>