interim commit, some features not complete, while I work on something else for a...
authorgreg gay <ggay@ocad.ca>
Wed, 13 Jun 2007 15:16:35 +0000 (15:16 -0000)
committergreg gay <ggay@ocad.ca>
Wed, 13 Jun 2007 15:16:35 +0000 (15:16 -0000)
mods/ecomm/include/payments.lib.php
mods/ecomm/index.php
mods/ecomm/index_admin.php
mods/ecomm/module.sql
mods/ecomm/readme
mods/ecomm/response_ipn.php
mods/ecomm/response_paypal_user.php [new file with mode: 0644]

index 8a53290..c16f4e6 100644 (file)
@@ -26,8 +26,8 @@ function paypal_print_form($payment_id, $amount, $course_id) {
                        <input type="hidden" name="page_style" value="Primary">
                        <input type="hidden" name="notify_url" value="http://greg-pc.atrc.utoronto.ca/atutorsvn/docs/mods/ecomm/response_ipn.php">
                        <input type="hidden" name="no_shipping" value="0">
-                       <input type="hidden" name="return" value="<?php echo AT_BASE_HREF; ?>mods/ecomm/response_ipn.php?pid=<?php echo $payment_id; ?>">
-                       <input type="hidden" name="cancel_return" value="<?php echo AT_BASE_HREF; ?>mods/ecomm/response_ipn.php">
+                       <input type="hidden" name="return" value="<?php echo AT_BASE_HREF; ?>mods/ecomm/response_paypal_user.php?pid=<?php echo $payment_id; ?>">
+                       <input type="hidden" name="cancel_return" value="<?php echo AT_BASE_HREF; ?>mods/ecomm/response_paypal_user.php">
                        <input type="hidden" name="no_note" value="1">
                        <input type="hidden" name="currency_code" value="<?php echo $_config['ec_currency']; ?>">
                        <input type="hidden" name="lc" value="CA">
@@ -41,15 +41,28 @@ function paypal_print_form($payment_id, $amount, $course_id) {
 }
 
 function paypal_authenticate_user_response() {
-       global $_config, $msg;
+       global $_config, $msg, $db;
+
+//don't do anything
+
+
+/*
        if($_config['ec_gateway'] == 'PayPal'){ 
-               if (isset($_GET['pid'], $_GET['amt'], $_GET['tx'], $_GET['sig'])) {
+               $sql = "SELECT amount from ".TABLE_PREFIX."payments WHERE payment_id = '$_GET[pid]' ";
+               $result = mysql_query($sql, $db);
+               $this_amount = mysql_result($result,0);
+//print_r($_GET);
+//exit;
+
+               //if ($_GET['amt'] == $this_amount && $_POST['']) {
+               if ($_GET['amt'] == $this_amount) {
                                approve_payment($_GET['pid'], $_GET['tx']);
                                $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
                }else{
                                $msg->addError('EC_PAYMENT_FAILED');
                }
        }
+*/
 }
 function mirapay_print_form($payment_id, $amount, $course_id) {
        global $_config;
index fe2ab4d..33f35a4 100644 (file)
@@ -85,5 +85,5 @@ if (mysql_num_rows($result)) { ?>
        $msg->printInfos('EC_NO_PAID_COURSES');\r
 }\r
 \r
-\r
+//debug($_POST);\r
  require (AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
index e209766..599ad50 100644 (file)
@@ -16,6 +16,10 @@ if (isset($_POST['cancel'])) {
        $_POST['ec_contact_address']   = trim($_POST['ec_contact_address']);\r
        $_POST['ec_allow_instructors'] = intval($_POST['ec_allow_instructors']);\r
        $_POST['ec_email_admin']       = intval($_POST['ec_email_admin']);\r
+       $_POST['ec_email_admin']       = intval($_POST['ec_email_admin']);\r
+       $_POST['ec_log_file']       = $addslashes($_POST['ec_log_file']);\r
+       $_POST['ec_store_log']       = intval($_POST['ec_store_log']);\r
+\r
 \r
        if (!$_POST['ec_uri']){\r
                $msg->addError('EC_URL_EMPTY');\r
@@ -66,6 +70,12 @@ if (isset($_POST['cancel'])) {
                $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('ec_email_admin', '{$_POST['ec_email_admin']}')";\r
                mysql_query($sql, $db);\r
 \r
+               $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('ec_store_log', '{$_POST['ec_store_log']}')";\r
+               mysql_query($sql, $db);\r
+\r
+               $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('ec_log_file', '{$_POST['ec_log_file']}')";\r
+               mysql_query($sql, $db);\r
+\r
                $_POST['ec_contact_email'] = $addslashes($_POST['ec_contact_email']);\r
                $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('ec_contact_email', '$_POST[ec_contact_email]')";\r
                mysql_query($sql, $db);\r
@@ -154,6 +164,16 @@ require (AT_INCLUDE_PATH.'header.inc.php');
 \r
                        <input type="radio" name="ec_email_admin" value="0" id="email0" <?php if (!$_config['ec_email_admin']){ echo 'checked="checked"'; } ?>/><label for="email0"><?php echo _AT('disable'); ?></label>\r
                </div>\r
+               <div class="row">\r
+                       <?php echo _AT('ec_store_log'); ?><br/>\r
+                       <input type="radio" name="ec_store_log" value="1" id="ipn1" <?php if ($_config['ec_store_log']){ echo 'checked="checked"'; } ?>/><label for="ipn1"><?php echo _AT('enable'); ?></label>\r
+\r
+                       <input type="radio" name="ec_store_log" value="0" id="ipn0" <?php if (!$_config['ec_store_log']){ echo 'checked="checked"'; } ?>/><label for="ipn0"><?php echo _AT('disable'); ?></label>\r
+               </div> \r
+               <div class="row">\r
+                       <label for="ec_log_file"><?php echo _AT('ec_log_file'); ?></label><br/>\r
+                       <input type="text" name="ec_log_file" value="<?php echo htmlspecialchars($_config['ec_log_file']); ?>" id="ec_log_file" size="60"/>\r
+               </div>\r
                <div class="row buttons">\r
                        <input type="submit" name="submit" value="<?php echo _AT('save'); ?>"  class="button" accesskey="s" />\r
                        <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>"  class="button" />\r
index b2fc0e3..d92e973 100644 (file)
@@ -106,6 +106,8 @@ INSERT INTO `language_text` VALUES ('en', '_module','ec_set_date','Set Dates',NO
 INSERT INTO `language_text` VALUES ('en', '_module','ec_invoice','Invoice',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','ec_print_invoice','Print_invoice',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','ec_paybypaypal','Pay by PayPal',NOW(),'');\r
+INSERT INTO `language_text` VALUES ('en', '_module','ec_store_log','Keep transaction log ',NOW(),'');\r
+INSERT INTO `language_text` VALUES ('en', '_module','ec_log_file','Full path to writable transaction log file. (required if log is enable, create writable  file manually if necessary) ',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','ec_export_data','Export Data Displayed Below',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','ec_date_picker','Select a date range to display. (e.g. 2007-2-6)',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','ec_contact_email','EMail notification of payments to: (if different from the ATutor contact email, set in System Preferences)',NOW(),'');\r
index 8be2c73..cfdb324 100644 (file)
@@ -55,6 +55,14 @@ https://www.sandbox.paypal.com/cgi-bin/webscr
 See details on setting up a sandbox for testing the modules at:
 https://www.paypal.com/en_US/ebook/PP_Sandbox_UserGuide/wwhelp/wwhimpl/js/html/wwhelp.htm
 
+PayPal IPN Setup
+For security purpose Instant Payment Notification (IPN) must be setup with your PayPal merchant account. You will be asked to provide a URL to the IPN notification verification script, included with the EComm module. While logged into your PayPal account, slect the Profile tab, then choose "Instant Payment Notification Preferences". Turn "ON" the service, and provide the URL. The URL should also include the password you entered when setting up the module Settings in ATutor. The URL would look something like this:
+
+
+http://www.mysite.com/ATutor/mods/ecomm/response_ipn.php?secret=payment01
+
+
+
 --------------------
 Installation & Setup
 1. Unpack the downloaded module into the ATutor mods directory. This will create an ecomm/ directory which contains all the module files.
index 4dc2027..462b386 100644 (file)
@@ -1,18 +1,20 @@
 <?php
-//$_user_location      = 'public';
-//define('AT_INCLUDE_PATH', '../../include/');
-//require(AT_INCLUDE_PATH.'vitals.inc.php');
-//require('include/payments.lib.php');
 
+$_user_location        = 'public';
+define('AT_INCLUDE_PATH', '../../include/');
+require(AT_INCLUDE_PATH.'vitals.inc.php');
+require('include/payments.lib.php');
 
+//file_put_contents('/tmp/ipn.txt', print_r($_POST, TRUE));
 
+//fwrite(AT_CONTENT_DIR'/tmp/ipn.txt', print_r($_POST, TRUE));
 
 // read the post from PayPal system and add 'cmd'
 $req = 'cmd=_notify-validate';
 
 foreach ($_POST as $key => $value) {
 $value = urlencode(stripslashes($value));
-$req .= "&$key=$value";
+$req .= "&$key=$value"."test";
 }
 
 // post back to PayPal system to validate
@@ -21,260 +23,71 @@ $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
 $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
 $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
 
-
-
 if (!$fp) {
 // HTTP ERROR
 } else {
-fputs ($fp, $header . $req);
-while (!feof($fp)) {
-$res = fgets ($fp, 1024);
-if (strcmp ($res, "VERIFIED") == 0) {
-// check the payment_status is Completed
-// check that txn_id has not been previously processed
-// check that receiver_email is your Primary PayPal email
-// check that payment_amount/payment_currency are correct
-// process payment
-
-
-// echo the response
-echo "The response from IPN was: <b>" .$res ."</b><br><br>";
-
-//loop through the $_POST array and print all vars to the screen.
-
-foreach($_POST as $key => $value){
-
-        echo $key." = ". $value."<br>";
-
-
-
-}
-
-
-}
-else if (strcmp ($res, "INVALID") == 0) {
-// log for manual investigation
-
-// echo the response
-echo "The response from IPN was: <b>" .$res ."</b>";
-
-  }
-
+       fputs ($fp, $header . $req);
+       while (!feof($fp)) {
+               $res = fgets ($fp, 1024);
+       
+               if (strcmp ($res, "VERIFIED") == 0) {
+               // check that the payment_status = Completed
+               if($_POST['receiver_email'] == "Completed"){
+                       $error[] = 'AT_ERROR_EC_PAYMENT_FAILED';
+               }
+
+
+               // check that txn_id has not been previously processed
+               $sql = "SELECT transaction_id from ".TABLE_PREFIX."payments WHERE payment_id = '$_POST[item_number]' ";
+               $result = mysql_query($sql, $db);
+               $this_transaction = mysql_result($result,0);
+               if($this_transaction != ''){
+                               $error[] = 'AT_ERROR_EC_PAYMENT_FAILED';
+               }
+               // check that receiver_email is your Primary PayPal email
+               if($_config['ec_vendor_id'] != $_POST['receiver_email']){
+                       $error[] = 'AT_ERROR_EC_PAYMENT_FAILED';
+               }
+               // check that payment amount are correct
+               $sql = "SELECT amount from ".TABLE_PREFIX."payments WHERE payment_id = '$_POST[item_number]' ";
+               $result = mysql_query($sql, $db);
+               $this_amount = mysql_result($result,0);
+               if($this_amount != $_POST['mc_gross']){
+                               $error[] = 'AT_ERROR_EC_PAYMENT_FAILED';
+               }
+
+               // check that payment_currency are correct
+               if($_config['ec_currency'] != $_POST['mc_currency']){
+                               $error[] = 'AT_ERROR_EC_PAYMENT_FAILED';
+               }
+               // process payment
+
+               if(!$error){
+                       approve_payment($_POST['item_number'], $_POST['txn_id']);
+                       if($_config['ec_store_log']){
+                               $fpn = fopen($_config['ec_log_file'], "a+");
+                               $results = print_r($_POST, TRUE);
+                               $results .= "Successful Transaction \n".$results;
+                               fwrite($fpn, $results);
+                       }
+               }else{
+                       $msg->addError($error);
+               }
+       
+               fclose ($fp);
+
+               } else if (strcmp ($res, "INVALID") == 0) {
+                               // log for manual investigation
+                       $msg->addError($error);
+                       if($_config['ec_store_log']){
+                               $fpn = fopen($_config['ec_log_file'], "a+");
+                               $results = print_r($_POST, TRUE);
+                               $results .= "Failed Transaction \n".$results;
+                               fwrite($fpn, $results);
+                       }
+               }
+       }
 }
-fclose ($fp);
-}
-
-
-
-
-/////////////////////////////////////////////////
-/////////////Begin Script below to write to DB./////////////////
-/////////////////////////////////////////////////
-/*
-// read the post from PayPal system and add 'cmd'
-$req = 'cmd=_notify-validate';
-foreach ($_POST as $key => $value) {
-$value = urlencode(stripslashes($value));
-$req .= "&$key=$value";
-}
-// post back to PayPal system to validate
-$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
-$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
-$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
-$fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
-
-
-// assign posted variables to local variables
-$item_name = $_POST['item_name'];
-$business = $_POST['business'];
-$item_number = $_POST['item_number'];
-$payment_status = $_POST['payment_status'];
-$mc_gross = $_POST['mc_gross'];
-$payment_currency = $_POST['mc_currency'];
-$txn_id = $_POST['txn_id'];
-$receiver_email = $_POST['receiver_email'];
-$receiver_id = $_POST['receiver_id'];
-$quantity = $_POST['quantity'];
-$num_cart_items = $_POST['num_cart_items'];
-$payment_date = $_POST['payment_date'];
-$first_name = $_POST['first_name'];
-$last_name = $_POST['last_name'];
-$payment_type = $_POST['payment_type'];
-$payment_status = $_POST['payment_status'];
-$payment_gross = $_POST['payment_gross'];
-$payment_fee = $_POST['payment_fee'];
-$settle_amount = $_POST['settle_amount'];
-$memo = $_POST['memo'];
-$payer_email = $_POST['payer_email'];
-$txn_type = $_POST['txn_type'];
-$payer_status = $_POST['payer_status'];
-$address_street = $_POST['address_street'];
-$address_city = $_POST['address_city'];
-$address_state = $_POST['address_state'];
-$address_zip = $_POST['address_zip'];
-$address_country = $_POST['address_country'];
-$address_status = $_POST['address_status'];
-$item_number = $_POST['item_number'];
-$tax = $_POST['tax'];
-$option_name1 = $_POST['option_name1'];
-$option_selection1 = $_POST['option_selection1'];
-$option_name2 = $_POST['option_name2'];
-$option_selection2 = $_POST['option_selection2'];
-$for_auction = $_POST['for_auction'];
-$invoice = $_POST['invoice'];
-$custom = $_POST['custom'];
-$notify_version = $_POST['notify_version'];
-$verify_sign = $_POST['verify_sign'];
-$payer_business_name = $_POST['payer_business_name'];
-$payer_id =$_POST['payer_id'];
-$mc_currency = $_POST['mc_currency'];
-$mc_fee = $_POST['mc_fee'];
-$exchange_rate = $_POST['exchange_rate'];
-$settle_currency  = $_POST['settle_currency'];
-$parent_txn_id  = $_POST['parent_txn_id'];
-
-// subscription specific vars
-
-$subscr_id = $_POST['subscr_id'];
-$subscr_date = $_POST['subscr_date'];
-$subscr_effective  = $_POST['subscr_effective'];
-$period1 = $_POST['period1'];
-$period2 = $_POST['period2'];
-$period3 = $_POST['period3'];
-$amount1 = $_POST['amount1'];
-$amount2 = $_POST['amount2'];
-$amount3 = $_POST['amount3'];
-$mc_amount1 = $_POST['mc_amount1'];
-$mc_amount2 = $_POST['mc_amount2'];
-$mc_amount3 = $_POST['mcamount3'];
-$recurring = $_POST['recurring'];
-$reattempt = $_POST['reattempt'];
-$retry_at = $_POST['retry_at'];
-$recur_times = $_POST['recur_times'];
-$username = $_POST['username'];
-$password = $_POST['password'];
-
-//auction specific vars
-
-$for_auction = $_POST['for_auction'];
-$auction_closing_date  = $_POST['auction_closing_date'];
-$auction_multi_item  = $_POST['auction_multi_item'];
-$auction_buyer_id  = $_POST['auction_buyer_id'];
-
-
-
-//DB connect creds and email 
-$notify_email =  "g.gay@utoronto.ca";         //email address to which debug emails are sent to
-$DB_Server = "greg-pc.atrc.utoronto.ca"; //your MySQL Server
-$DB_Username = "root"; //your MySQL User Name
-$DB_Password = "dip99qui"; //your MySQL Password
-$DB_DBName = "atutorsvn"; //your MySQL Database Name
-
-
-if (!$fp) {
-// HTTP ERROR
-} else {
-fputs ($fp, $header . $req);
-while (!feof($fp)) {
-$res = fgets ($fp, 1024);
-if (strcmp ($res, "VERIFIED") == 0) {
-
-
-
-//create MySQL connection
-$Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password)
-or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno());
-
-
-//select database
-$Db = @mysql_select_db($DB_DBName, $Connect)
-or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno());
-
-
-$fecha = date("m")."/".date("d")."/".date("Y");
-$fecha = date("Y").date("m").date("d");
-
-//check if transaction ID has been processed before
-$checkquery = "select txnid from paypal_payment_info where txnid='".$txn_id."'";
-$sihay = mysql_query($checkquery) or die("Duplicate txn id check query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
-$nm = mysql_num_rows($sihay);
-if ($nm == 0){
-
-//execute query
-
-
-
-    if ($txn_type == "cart"){
-    $strQuery = "insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')";
-
-     $result = mysql_query($strQuery) or die("Cart - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
-     for ($i = 1; $i <= $num_cart_items; $i++) {
-         $itemname = "item_name".$i;
-         $itemnumber = "item_number".$i;
-         $on0 = "option_name1_".$i;
-         $os0 = "option_selection1_".$i;
-         $on1 = "option_name2_".$i;
-         $os1 = "option_selection2_".$i;
-         $quantity = "quantity".$i;
-
-         $struery = "insert into paypal_cart_info(txnid,itemnumber,itemname,os0,on0,os1,on1,quantity,invoice,custom) values ('".$txn_id."','".$_POST[$itemnumber]."','".$_POST[$itemname]."','".$_POST[$on0]."','".$_POST[$os0]."','".$_POST[$on1]."','".$_POST[$os1]."','".$_POST[$quantity]."','".$invoice."','".$custom."')";
-         $result = mysql_query($struery) or die("Cart - paypal_cart_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
-
-     }
-    }
-
-
-
-    else{
-     $strQuery = "insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')";
-     $result = mysql_query("insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')") or die("Default - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
-    }
-
-
-    // send an email in any case
- echo "Verified";
-     mail($notify_email, "VERIFIED IPN", "$res\n $req\n $strQuery\n $struery\n  $strQuery2");
-}
-else {
-// send an email
-mail($notify_email, "VERIFIED DUPLICATED TRANSACTION", "$res\n $req \n $strQuery\n $struery\n  $strQuery2");
-}
-
-    //subscription handling branch
-    if ( $txn_type == "subscr_signup"  ||  $txn_type == "subscr_payment"  ) {
-
-      // insert subscriber payment info into paypal_payment_info table
-      $strQuery = "insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')";
-      $result = mysql_query($strQuery) or die("Subscription - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
-
-
-         // insert subscriber info into paypal_subscription_info table
-        $strQuery2 = "insert into paypal_subscription_info(subscr_id , sub_event, subscr_date ,subscr_effective,period1,period2, period3, amount1 ,amount2 ,amount3,  mc_amount1,  mc_amount2,  mc_amount3, recurring, reattempt,retry_at, recur_times, username ,password, payment_txn_id, subscriber_emailaddress, datecreation) values ('".$subscr_id."', '".$txn_type."','".$subscr_date."','".$subscr_effective."','".$period1."','".$period2."','".$period3."','".$amount1."','".$amount2."','".$amount3."','".$mc_amount1."','".$$mc_amount2."','".$$mc_amount3."','".$recurring."','".$reattempt."','".$retry_at."','".$recur_times."','".$username."','".$password."', '".$txn_id."','".$payer_email."','".$fecha."')";
-        $result = mysql_query($strQuery2) or die("Subscription - paypal_subscription_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
-
-
-             mail($notify_email, "VERIFIED IPN", "$res\n $req\n $strQuery\n $struery\n  $strQuery2");
-
-    }
-}
-
-// if the IPN POST was 'INVALID'...do this
-
-
-else if (strcmp ($res, "INVALID") == 0) {
-// log for manual investigation
-
-mail($notify_email, "INVALID IPN", "$res\n $req");
-}
-}
-fclose ($fp);
-}
-
-*/
-//paypal_authenticate_user_response();
-//header('Location: index.php');
-//exit;
-
-
+exit;
 
 ?>
\ No newline at end of file
diff --git a/mods/ecomm/response_paypal_user.php b/mods/ecomm/response_paypal_user.php
new file mode 100644 (file)
index 0000000..9788ee1
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+$_user_location        = 'users';
+define('AT_INCLUDE_PATH', '../../include/');
+require(AT_INCLUDE_PATH.'vitals.inc.php');
+require('include/payments.lib.php');
+
+//print_r($_GET);
+//exit;
+
+if($_GET['st'] == "Completed"){
+       $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+
+}else {
+       $msg->addError('EC_PAYMENT_FAILED');
+}
+
+paypal_authenticate_user_response();
+
+header('Location: index.php');
+exit;
+?>
\ No newline at end of file