CRM-18107 PayPal Standard IPN fails if payment processor id != payment processor...
authorAndrew Hunt <andrew@aghstrategies.com>
Mon, 21 Mar 2016 22:20:19 +0000 (18:20 -0400)
committerAndrew Hunt <andrew@aghstrategies.com>
Mon, 21 Mar 2016 22:29:09 +0000 (18:29 -0400)
CRM/Core/Payment/PayPalIPN.php

index 371ba571a35169ba0119c9e5b9b5e2238c0a4976..89b6033897e95200417b15b3e9a6ef8179bc1e3d 100644 (file)
@@ -321,11 +321,17 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN {
       $ids['onbehalf_dupe_alert'] = self::retrieve('onBehalfDupeAlert', 'Integer', 'GET', FALSE);
     }
 
-    $paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType',
-      'PayPal_Standard', 'id', 'name'
+    $processorParams = array(
+      'user_name' => self::retrieve('receiver_email', 'String', 'POST', FALSE),
+      'payment_processor_type_id' => CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType', 'PayPal_Standard', 'id', 'name'),
+      'is_test' => empty($input['is_test']) ? 0 : 1,
     );
+    $processorInfo = array();
+    if (!CRM_Financial_BAO_PaymentProcessor::retrieve($processorParams, $processorInfo)) {
+      return FALSE;
+    }
 
-    if (!$this->validateData($input, $ids, $objects, TRUE, $paymentProcessorID)) {
+    if (!$this->validateData($input, $ids, $objects, TRUE, $processorInfo['id'])) {
       return FALSE;
     }