From 48494310745cf00c9d69fac1825175d04088ff08 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 14 Nov 2006 08:53:39 +0000 Subject: [PATCH] add hooks to paypal plugin to allow testing on www.sandbox.paypal.com MDL-7528 --- enrol/paypal/enrol.html | 6 ++++-- enrol/paypal/ipn.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/enrol/paypal/enrol.html b/enrol/paypal/enrol.html index 8b7006079a..30a3f0b311 100644 --- a/enrol/paypal/enrol.html +++ b/enrol/paypal/enrol.html @@ -3,8 +3,10 @@

enrol_currency $cost"; ?>

- -
+usepaypalsandbox) ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr'; +?> + diff --git a/enrol/paypal/ipn.php b/enrol/paypal/ipn.php index 2f5cf4af4c..495cfeeb9c 100644 --- a/enrol/paypal/ipn.php +++ b/enrol/paypal/ipn.php @@ -61,7 +61,8 @@ $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.paypal.com', 80, $errno, $errstr, 30); + $paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com'; + $fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30); if (!$fp) { /// Could not open a socket to Paypal - FAIL echo "

Error: could not access paypal.com

"; -- 2.39.5