Skip to content

Commit

Permalink
add hooks to paypal plugin to allow testing on www.sandbox.paypal.com
Browse files Browse the repository at this point in the history
…MDL-7528
  • Loading branch information
skodak committed Nov 14, 2006
1 parent 6b71712 commit 4849431
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions enrol/paypal/enrol.html
Expand Up @@ -3,8 +3,10 @@
<p><?php print_string("paymentrequired") ?></p>
<p><b><?php echo get_string("cost").": $CFG->enrol_currency $cost"; ?></b></p>
<p><?php print_string("paymentinstant") ?></p>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<?php
$paypalurl = empty($CFG->usepaypalsandbox) ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr';
?>
<form action="<?php echo $paypalurl ?>" method="post">

<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php p($CFG->enrol_paypalbusiness)?>">
Expand Down
3 changes: 2 additions & 1 deletion enrol/paypal/ipn.php
Expand Up @@ -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 "<p>Error: could not access paypal.com</p>";
Expand Down

0 comments on commit 4849431

Please sign in to comment.