From: skodak Date: Tue, 14 Nov 2006 08:53:39 +0000 (+0000) Subject: add hooks to paypal plugin to allow testing on www.sandbox.paypal.com MDL-7528 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=48494310745cf00c9d69fac1825175d04088ff08;p=moodle.git add hooks to paypal plugin to allow testing on www.sandbox.paypal.com MDL-7528 --- 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

";