Awight has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311899

Change subject: Be strict about PayPal IPN postback response.
......................................................................

Be strict about PayPal IPN postback response.

Change-Id: I551ce9265c4941c11153c52f63bf0ce41ebcc932
---
M PaymentProviders/PayPal/PayPalPaymentsAPI.php
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/99/311899/1

diff --git a/PaymentProviders/PayPal/PayPalPaymentsAPI.php 
b/PaymentProviders/PayPal/PayPalPaymentsAPI.php
index ec2c6c8..f92c6c3 100644
--- a/PaymentProviders/PayPal/PayPalPaymentsAPI.php
+++ b/PaymentProviders/PayPal/PayPalPaymentsAPI.php
@@ -24,6 +24,14 @@
                curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
                curl_setopt( $ch, CURLOPT_POST, 1 );
                // TODO we can put VERIFIED in config and generalize this
-               return $this->curl( $ch, $post_fields ) === 'VERIFIED';
+               $response = $this->curl( $ch, $post_fields );
+
+               if ( $response === 'VERIFIED' ) {
+                       return true;
+               } elseif ( $response === 'INVALID' ) {
+                       return false;
+               } else {
+                       throw new \RuntimeException( "Unknown response from 
PayPal IPN PB: [{$response}]" );
+               }
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/311899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I551ce9265c4941c11153c52f63bf0ce41ebcc932
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to