Fixes exception when not using primary PayPal email
authorSir-Will <brieftaubenman@gmail.com>
Tue, 28 Jul 2020 00:57:32 +0000 (02:57 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Jul 2020 00:57:32 +0000 (02:57 +0200)
PayPal allows adding multiple emails, if you are using one of the alternative emails instead of the primary email then WoltLab will throw the exception.
The `receiver_email` is always the primary email while `business` is the secondary in the IPN.

wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php

index f6420c30ad5d9c8eddfc0ca505420ca307bb52f4..af1330728eae9418d217c254333b73699c6ed114 100644 (file)
@@ -55,8 +55,8 @@ class PaypalCallbackAction extends AbstractAction {
                        }
                        
                        // Check that receiver_email is your Primary PayPal email
-                       if (strtolower($_POST['receiver_email']) != strtolower(PAYPAL_EMAIL_ADDRESS)) {
-                               throw new SystemException("Mismatching receiver_email '" . $_POST['receiver_email'] . "', expected '".PAYPAL_EMAIL_ADDRESS."'.");
+                       if (strtolower($_POST['receiver_email']) != strtolower(PAYPAL_EMAIL_ADDRESS) && strtolower($_POST['business']) != strtolower(PAYPAL_EMAIL_ADDRESS)) {
+                               throw new SystemException("Mismatching receiver_email and business '" . $_POST['receiver_email'] . "', expected '".PAYPAL_EMAIL_ADDRESS."'.");
                        }
                        
                        // get token