[guadec-web] https changed to http IPN



commit 9db2484d15e2d5337c8053cbd36b8a74f5cfd106
Author: Saumya Dwivedi <saumya zero gmail com>
Date:   Tue Jul 8 10:00:38 2014 +0530

    https changed to http IPN

 guadec/confirm-payment.php |    2 +-
 guadec/ipn.php             |   41 +++++++++++++++++++++--------------------
 2 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/guadec/confirm-payment.php b/guadec/confirm-payment.php
index 3450e4f..58ef716 100644
--- a/guadec/confirm-payment.php
+++ b/guadec/confirm-payment.php
@@ -197,7 +197,7 @@ if (!empty($_POST)) {
                            <input type="hidden" name="custom" value="<?php echo $registerInfo; ?>">
 
                                <!-- <Address of notification url. Can not be localhost      -->
-                           <input type="hidden" name="notify_url" 
value="https://www.guadec.org/wp-content/themes/guadec/ipn.php";>
+                           <input type="hidden" name="notify_url" 
value="http://www.guadec.org/wp-content/themes/guadec/ipn.php";>
 
                            <!-- Redirect to thank you after cancelled payment -->
                            <input type="hidden" name="cancel_return" 
value="https://www.guadec.org/cancel-registration/";>
diff --git a/guadec/ipn.php b/guadec/ipn.php
index e583f3d..c4fae47 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -19,6 +19,9 @@ $listener = new IpnListener();
 // tell the IPN listener to use the PayPal test sandbox
 $listener->use_sandbox = true;
 
+// update database variable
+global $wpdb;
+
 // try to process the IPN POST
 try {
     $listener->requirePostMethod();
@@ -45,7 +48,7 @@ if ($verified) {
     while(($i < 9) && ($csplit[$i] != null)){
     $dsplit =  explode('=',$csplit[$i]);
     $ckey = $dsplit[0];
-    $cvalue = ($dsplit[1] =='')?'0': $dsplit[1];
+    $cvalue = ($dsplit[1] == null)?'0': $dsplit[1];
     $cvar[$ckey] = $cvalue;
     error_log("dsjnfsdjnfdjsjbsf\n");   
     error_log($cvar[$ckey]);
@@ -59,6 +62,7 @@ if ($verified) {
     // 1. Make sure the payment status is "Completed" 
     if ($_POST['payment_status'] != 'Completed') { 
         $errmsg .= "'Payment status' does not match: ";
+        $errmsg .= $_POST['payment_status']."\n";
         $errmsg .= $_POST['receiver_email']."\n";
         // simply ignore any IPN that is not completed
         exit(0); 
@@ -90,36 +94,33 @@ if ($verified) {
         $body = "IPN failed fraud checks: \n$errmsg\n\n";
         $body .= $listener->getTextReport();
 
-    $body .= "Registration Payment Successful-with fraud warning";
-    //append with the real payment details
-        $body .= $_POST['custom'];
+        $body .= "Registration Payment Successful-with fraud warning ";
+        //append with the real payment details
+        $body .= $cvar['name'];
         error_log($body);
         mail($_POST['receiver_email'], 'IPN Fraud Warning', $body, $headers);
-
         mail($_POST['payer_email'], 'IPN Fraud Warning', $body, $headers);
         
     } else {
 
-        // $reg_email = $cvar['email'];
-        // $table_name = $wpdb->prefix .'guadec2014_registration';
+        $reg_email = $cvar['email'];
+        $table_name = $wpdb->prefix .'guadec2014_registration';
         
-        // $wpdb->update(
-        // $table_name,
-        // array(
-        //     'payment' => 'Completed'
-        //     ),
-        // array(
-        //     'email' => $reg_email
-        //     ) 
-        // );
-       
+        $wpdb->update(
+        $table_name,
+        array(
+            'payment' => 'Completed'
+            ),
+        array(
+            'email' => $reg_email
+            ) 
+        );
+        $body .= "Registration Payment Successful for ";
+        $body .= $cvar['name'];
         $body .= $listener->getTextReport();
-    $body .= "Registration Payment Successful for ";
-        $body .= $_POST['custom'];
         error_log($body);
         mail($_POST['receiver_email'], 'Registration Successful', $body, $headers);
         mail($_POST['payer_email'], 'Registration Successful', $body, $headers);
-    
     }
 } 
 else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]