From: Eileen Date: Mon, 29 Jul 2013 02:17:45 +0000 (-0400) Subject: CRM-12108 minor improvement - simplify ipn.php by putting logic in the X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d5346e1bf20b523c025a03c4d84d22867efe39eb;p=civicrm-core.git CRM-12108 minor improvement - simplify ipn.php by putting logic in the relevant classes (no logic behind the split) --- diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index dba831909e..b4a55472bf 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -262,12 +262,13 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { $this->completeTransaction($input, $ids, $objects, $transaction, $recur); } - function main($component = 'contribute') { + function main() { // CRM_Core_Error::debug_var( 'GET' , $_GET , true, true ); // CRM_Core_Error::debug_var( 'POST', $_POST, true, true ); $objects = $ids = $input = array(); + $component = CRM_Utils_Array::value('module', $_GET); $input['component'] = $component; // get the contribution and contact ids from the GET params diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index e6dce7a694..0bab2a4a92 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -279,13 +279,12 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { $this->completeTransaction($input, $ids, $objects, $transaction, $recur); } - function main($component = 'contribute') { + function main() { CRM_Core_Error::debug_var('GET', $_GET, TRUE, TRUE); CRM_Core_Error::debug_var('POST', $_POST, TRUE, TRUE); - $objects = $ids = $input = array(); - $input['component'] = $component; + $input['component'] = self::getValue('m'); // get the contribution and contact ids from the GET params $ids['contact'] = self::getValue('c', TRUE); diff --git a/extern/ipn.php b/extern/ipn.php index 9a09ed3582..4aa7f0e174 100644 --- a/extern/ipn.php +++ b/extern/ipn.php @@ -40,32 +40,11 @@ require_once '../civicrm.config.php'; $config = CRM_Core_Config::singleton(); if (empty($_GET)) { - $rpInvoiceArray = array(); - $rpInvoiceArray = explode('&', $_POST['rp_invoice_id']); - foreach ($rpInvoiceArray as $rpInvoiceValue) { - $rpValueArray = explode('=', $rpInvoiceValue); - if ($rpValueArray[0] == 'm') { - $value = $rpValueArray[1]; - } - } $paypalIPN = new CRM_Core_Payment_PayPalProIPN(); } else { - $value = CRM_Utils_Array::value('module', $_GET); $paypalIPN = new CRM_Core_Payment_PayPalIPN(); } -switch ($value) { - case 'contribute': - $paypalIPN->main('contribute'); - break; +$paypalIPN->main(); - case 'event': - $paypalIPN->main('event'); - break; - - default: - CRM_Core_Error::debug_log_message("Could not get module name from request url"); - echo "Could not get module name from request url

"; - break; -}