[guadec-web] Made sure to mark the specific registration as complete instead of base on email



commit 48c9f48273fa2d9e390f28872f11f0648f7aaa30
Author: Patrick Uiterwijk <puiterwijk redhat com>
Date:   Fri Jul 18 16:23:12 2014 -0400

    Made sure to mark the specific registration as complete instead of base on email

 guadec/confirm-payment.php |   29 +++++++++++++++--------------
 guadec/ipn.php             |    5 +++--
 guadec/ipnlistener.php     |    4 ++--
 3 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/guadec/confirm-payment.php b/guadec/confirm-payment.php
index 43b3ac0..ccc8cd1 100644
--- a/guadec/confirm-payment.php
+++ b/guadec/confirm-payment.php
@@ -149,20 +149,6 @@ if (!empty($_POST)) {
         $headers = "From: GUADEC 2014 Registration Script <contact guadec org>\n";
             
         if ($errors == false) {
-            /* This variable not be changed: goes to a restricted field to Paypal API */
-            $registerInfo = 
-            "name=" . $name . "&".
-            "email=" . $email . "&" .
-            "time=" . date("Y-m-d H:i:s"). "&".
-            "arrive=". $arrive . "&".
-            "depart=". $depart . "&".
-            "entryfee=". $entry ."&".
-            "lunchfee=".$lamount."&".
-            "accomfee=".$aamount."&".
-            "totalfee=".$tamount
-            ;
-            $mailContent .= $registerInfo;
-            $subject = "GUADEC 2014 Registration";
             $wpdb->insert($table_name, array('timeofregistration' => date("Y-m-d H:i:s"),
                      'name' => $name,
                      'email' => $email,
@@ -183,6 +169,21 @@ if (!empty($_POST)) {
                      'country' => $country,
                      'payment' => $payment,
                      'ispublic' => $public));
+            /* This variable not be changed: goes to a restricted field to Paypal API */
+            $registerInfo = 
+            "regid=" . $wpdb->insert_id . "&" .
+            "name=" . $name . "&".
+            "email=" . $email . "&" .
+            "time=" . date("Y-m-d H:i:s"). "&".
+            "arrive=". $arrive . "&".
+            "depart=". $depart . "&".
+            "entryfee=". $entry ."&".
+            "lunchfee=".$lamount."&".
+            "accomfee=".$aamount."&".
+            "totalfee=".$tamount
+            ;
+            $mailContent .= $registerInfo;
+            $subject = "GUADEC 2014 Registration";
         }
        
 ?>
diff --git a/guadec/ipn.php b/guadec/ipn.php
index 13733e7..94209e9 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -80,13 +80,14 @@ if ($verified) {
     // }
 
     // TODO: Check for duplicate user_id
+    $reg_id = $cvar['regid'];
     $reg_email = $cvar['email'];
     if(empty($reg_email)){
         $errmsg .= "No Valid user email-address found\n";
     }        
     if (!empty($errmsg)) {
         $status = "FraudCheck";
-        $upipn = $listener->updateCompleted($reg_email,$status);
+        $upipn = $listener->updateCompleted($reg_id,$status);
         error_log($upipn);
 
        $body = "Your payment was accepted but was not as expected and your registration will need manual 
validation.";
@@ -104,7 +105,7 @@ if ($verified) {
         error_log($body); // Transcript copy in the error log
         mail('zana gnome org, pterjan gmail com', 'Guadec Payment Fraud Warning (validation needed)', $body, 
$headers);
     } else {
-        $body = $listener->updateCompleted($reg_email, 'Completed');
+        $body = $listener->updateCompleted($reg_id, 'Completed');
         $body .= "Registration Payment Successful for ";
         $body .= $cvar['name'];
         $body .= " with email ";
diff --git a/guadec/ipnlistener.php b/guadec/ipnlistener.php
index eb197ca..2d3e9bd 100755
--- a/guadec/ipnlistener.php
+++ b/guadec/ipnlistener.php
@@ -314,7 +314,7 @@ class IpnListener {
             throw new Exception("Invalid HTTP request method.");
         }
     }
-    public function updateCompleted($reg_email='dummy mail com', $status='Pending') {
+    public function updateCompleted($reg_id=0, $status='Pending') {
         global $wpdb;
         $table_name = $wpdb->prefix .'guadec2014_registrations';
         // check if the record exists: with a status to be changed
@@ -325,7 +325,7 @@ class IpnListener {
             'payment' => $status
             ),
         array(
-            'email' => $reg_email
+            'id' => $reg_id
             ) 
         );
         // if(!($up)){


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