From dc8bf2661dc8a11d72c1ae3923bd14d78ee3197b Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 3 Oct 2014 22:28:21 +0200 Subject: [PATCH] Added debug mode for paypal payments --- .../files/lib/action/PaypalCallbackAction.class.php | 10 ++++++++-- .../payment/method/PaypalPaymentMethod.class.php | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) 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 ' -- 2.20.1