Permalink
Browse files

Merge branch 'MDL-61741-33-paypal' of git://github.com/mudrd8mz/moodl…

…e into MOODLE_33_STABLE
  • Loading branch information...
dmonllao committed Apr 16, 2018
2 parents 933afbd + 49f57eb commit 1ff3c3a64c17720d51fd965e84b31c96587c0034
Showing with 13 additions and 7 deletions.
  1. +13 −7 enrol/paypal/ipn.php
@@ -103,7 +103,7 @@
$plugin = enrol_get_plugin('paypal');
/// Open a connection back to PayPal to validate the data
$paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com';
$paypaladdr = empty($CFG->usepaypalsandbox) ? 'ipnpb.paypal.com' : 'ipnpb.sandbox.paypal.com';
$c = new curl();
$options = array(
'returntransfer' => true,
@@ -180,19 +180,25 @@
// At this point we only proceed with a status of completed or pending with a reason of echeck
if ($existing = $DB->get_record("enrol_paypal", array("txn_id"=>$data->txn_id))) { // Make sure this transaction doesn't exist already
// Make sure this transaction doesn't exist already.
if ($existing = $DB->get_record("enrol_paypal", array("txn_id" => $data->txn_id), "*", IGNORE_MULTIPLE)) {
\enrol_paypal\util::message_paypal_error_to_admin("Transaction $data->txn_id is being repeated!", $data);
die;
}
// Check that the receiver email is the one we want it to be.
if (isset($data->business)) {
$recipient = $data->business;
} else if (isset($data->receiver_email)) {
$recipient = $data->receiver_email;
} else {
$recipient = 'empty';
}
if (core_text::strtolower($data->business) !== core_text::strtolower($plugin->get_config('paypalbusiness'))) { // Check that the email is the one we want it to be
\enrol_paypal\util::message_paypal_error_to_admin("Business email is {$data->business} (not ".
if (core_text::strtolower($recipient) !== core_text::strtolower($plugin->get_config('paypalbusiness'))) {
\enrol_paypal\util::message_paypal_error_to_admin("Business email is {$recipient} (not ".
$plugin->get_config('paypalbusiness').")", $data);
die;
}
if (!$user = $DB->get_record('user', array('id'=>$data->userid))) { // Check that user exists

0 comments on commit 1ff3c3a

Please sign in to comment.