[guadec-web] Changes to IPN: trial 3
- From: Saumya Dwivedi <saumyad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web] Changes to IPN: trial 3
- Date: Mon, 7 Jul 2014 11:21:58 +0000 (UTC)
commit 9e8c6ec1d0bb446846ac9dc5813fb7f92c4e0010
Author: Saumya Dwivedi <saumya zero gmail com>
Date: Mon Jul 7 16:51:36 2014 +0530
Changes to IPN: trial 3
guadec/ipn.php | 77 +++++++++++++++++++++++++++----------------------------
1 files changed, 38 insertions(+), 39 deletions(-)
---
diff --git a/guadec/ipn.php b/guadec/ipn.php
index 3876906..74e252b 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -19,9 +19,6 @@ $listener = new IpnListener();
// tell the IPN listener to use the PayPal test sandbox
$listener->use_sandbox = true;
-//variable to update the database
-global $wpdb;
-
// try to process the IPN POST
try {
$listener->requirePostMethod();
@@ -34,31 +31,32 @@ try {
// TODO: Handle IPN Response here
if ($verified) {
- // TODO: Implement additional fraud checks and MySQL storage
+ // : Implement additional fraud checks and MySQL storage
$errmsg = ''; // stores errors from fraud checks
- $customInfo = $_POST['custom']; // access custom information
+
+ $customInfo = $_POST['custom']; // access custom information
$csplit = explode('&',$customInfo);
$cvar = array(); $i = 0;
- $headers = "From: GUADEC 2014 Registration Script <membership-committee gnome org>\n";
while(($i < 9) && ($csplit[$i] != null)){
- $dsplit = explode('=',$csplit[$i]);
- $ckey = $dsplit[0];
- $cvalue = ($dsplit[1] =='')?'0': $dsplit[1];
- $cvar[$ckey] = $cvalue;
- error_log("dsjnfsdjnfdjsjbsf\n");
- error_log($cvar[$ckey]);
- error_log($ckey);
-// error_log($cvalue);
-// error_log($csplit[$i]);
- $i = $i + 1;
- }
-
+ $dsplit = explode('=',$csplit[$i]);
+ $ckey = $dsplit[0];
+ $cvalue = ($dsplit[1] =='')?'0': $dsplit[1];
+ $cvar[$ckey] = $cvalue;
+ error_log("dsjnfsdjnfdjsjbsf\n");
+ error_log($cvar[$ckey]);
+ error_log($ckey);
+// error_log($cvalue);
+// error_log($csplit[$i]);
+ $i = $i + 1;
+ }
+ $headers = "From: GUADEC 2014 Registration Script <membership-committee gnome org>\n";
+
// 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);
}
@@ -89,34 +87,35 @@ if ($verified) {
$body = "IPN failed fraud checks: \n$errmsg\n\n";
$body .= $listener->getTextReport();
- $body .= "Registration Payment--Detected Fraud--To be verified\n";
- $body .= "If not verified, payment is refunded in full amounts to the account of the holder\n";
- //append with the real payment details
+ $body .= "Registration Payment Successful-with fraud warning";
+ //append with the real payment details
$body .= $_POST['custom'];
error_log($body);
- mail($_POST['receiver_email'], 'IPN Fraud Warning', $body);
- mail($_POST['payer_email'], 'GUADEC 2014 Registration-Payment to be verified', $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 .= $listener->getTextReport();
- $body .= "Registration Payment Successful for ";
+ $body .= "Registration Payment Successful for ";
$body .= $_POST['custom'];
error_log($body);
- mail($_POST['receiver_email'], 'GUADEC 2014 Registration Successful', $body, $headers);
- mail($_POST['payer_email'], 'GUADEC 2014 Registration Successful', $body, $headers);
+ mail($_POST['receiver_email'], 'Registration Successful', $body, $headers);
+ mail($_POST['payer_email'], 'Registration Successful', $body, $headers);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]