From: Marcel Werk Date: Fri, 3 Oct 2014 20:28:21 +0000 (+0200) Subject: Added debug mode for paypal payments X-Git-Tag: 2.1.0_Alpha_1~283 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc8bf2661dc8a11d72c1ae3923bd14d78ee3197b;p=GitHub%2FWoltLab%2FWCF.git Added debug mode for paypal payments --- diff --git a/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php b/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php index 747be579d0..d5af4a4a3e 100644 --- a/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php +++ b/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php @@ -29,13 +29,19 @@ class PaypalCallbackAction extends AbstractAction { // post back to paypal to validate $content = ''; try { - $request = new HTTPRequest('http://www.paypal.com', array(), array_merge(array('cmd' => '_notify-validate'), $_POST)); + $url = 'https://www.paypal.com/cgi-bin/webscr'; + if (!empty($_POST['test_ipn'])) { + // IPN simulator notification + $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; + } + + $request = new HTTPRequest($url, array(), array_merge(array('cmd' => '_notify-validate'), $_POST)); $request->execute(); $reply = $request->getReply(); $content = $reply['body']; } catch (SystemException $e) { - throw new SystemException('connection to paypal.com failed'); + throw new SystemException('connection to paypal.com failed: ' . $e->getMessage()); } if (strstr($content, "VERIFIED") === false) { diff --git a/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php b/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php index bf2b11b227..487582a3ad 100644 --- a/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php +++ b/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php @@ -61,7 +61,7 @@ class PaypalPaymentMethod extends AbstractPaymentMethod { public function getPurchaseButton($cost, $currency, $name, $token, $returnURL, $cancelReturnURL, $isRecurring = false, $subscriptionLength = 0, $subscriptionLengthUnit = '') { if ($isRecurring) { // subscribe button - return '
+ return ' @@ -85,7 +85,7 @@ class PaypalPaymentMethod extends AbstractPaymentMethod {
'; } else { - return '
+ return '