예제 #1
0
     $sql = "select user_id FROM orders where order_id='" . $invoice_id . "'";
     $result = mysql_query($sql) or pp_mail_error(mysql_error() . $sql);
     $row = mysql_fetch_array($result);
     complete_order($row['user_id'], $invoice_id);
     debit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, 'PayPal');
     break;
 case "Denied":
     // denied by merchant
     break;
 case "Failed":
     // only happens when payment is from customers' bank account
     //insert_transaction ($employer_id, $payment_status, $pending_reason, $reason_code, $payment_date, $txn_id, $parent_txn_id, $txn_type, $payment_type, $mc_gross, $mc_currency, $item_name, $item_number, $invoice_id);
     break;
 case "Pending":
     $sql = "select user_id FROM orders where order_id='" . $invoice_id . "'";
     $result = mysql_query($sql) or pp_mail_error(mysql_error() . $sql);
     $row = mysql_fetch_array($result);
     pend_order($row['user_id'], $invoice_id);
     // pending_reason : 'address', 'echeck', 'intl', 'multi_currency', 'unilateral', 'upgrade', 'verify', 'other'
     break;
 case "Refunded":
     // reason_code : 'buyer_complaint', 'chargeback', 'guarantee', 'refund', 'other'
     cancel_order($invoice_id);
     credit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, 'PayPal');
     break;
 case "Reversed":
     // reason_code : 'buyer_complaint', 'chargeback', 'guarantee', 'refund', 'other'
     cancel_order($invoice_id);
     credit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, 'PayPal');
     break;
 default:
예제 #2
0
     JB_pp_mail_error($entry_line);
 } else {
     if (PAYPAL_USE_CURL != 'YES') {
         fputs($fp, $header . $req);
         // post to paypal
     }
     while (!feof($fp)) {
         $res = fgets($fp, 1024);
         if (strcmp($res, "VERIFIED") == 0 || strpos($result, 'VERIFIED') !== false) {
             pp_log_entry("IPN - Notification verfified!\n");
             $VERIFIED = 1;
             // check that receiver_email is your Primary PayPal email
             // check that receiver_email is your Primary PayPal email
             if (strcmp(strtolower(PAYPAL_EMAIL), strtolower($business)) != 0) {
                 if (strcmp(strtolower(PAYPAL_EMAIL), strtolower($receiver_email)) != 0) {
                     pp_mail_error("Possible fraud. Error with receiver_email. " . strtolower(PAYPAL_EMAIL) . " != " . strtolower($receiver_email) . "\n");
                     pp_log_entry("IPN - Possible fraud. Error with receiver_email. " . strtolower(PAYPAL_EMAIL) . " != " . strtolower($receiver_email));
                     $VERIFIED = false;
                 }
             }
             // check so that transactrion id cannot be reused
             $sql = "SELECT * FROM jb_txn WHERE txn_id='" . jb_escape_sql($txn_id) . "' AND origin='PayPal' ";
             $result = JB_mysql_query($sql) or die(mysql_error());
             if (mysql_num_rows($result) > 0) {
                 pp_log_entry("transaction already processed " . $txn_id);
                 die;
             }
             $entry_line = "verified: {$res}";
             pp_log_entry("IPN - " . $entry_line);
         } elseif (strcmp($res, "INVALID") == 0) {
             pp_log_entry('INVALID');