*/ session_start(); require_once '../civicrm.config.php'; /* Cache the real UF, override it with the SOAP environment */ $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; 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<p>"; break; }
/** * Test IPN response updates contribution_recur & contribution for first & second contribution. */ public function testIPNPaymentMembershipRecurSuccess() { $this->setupMembershipRecurringPaymentProcessorTransaction(); $this->callAPISuccessGetSingle('membership_payment', array()); $paypalIPN = new CRM_Core_Payment_PayPalIPN($this->getPaypalRecurTransaction()); $paypalIPN->main(); $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $this->_contributionID)); $membershipEndDate = $this->callAPISuccessGetValue('membership', array('return' => 'end_date')); $this->assertEquals(1, $contribution['contribution_status_id']); $this->assertEquals('8XA571746W2698126', $contribution['trxn_id']); // source gets set by processor $this->assertTrue(substr($contribution['contribution_source'], 0, 20) == "Online Contribution:"); $contributionRecur = $this->callAPISuccess('contribution_recur', 'getsingle', array('id' => $this->_contributionRecurID)); $this->assertEquals(5, $contributionRecur['contribution_status_id']); $paypalIPN = new CRM_Core_Payment_PaypalIPN($this->getPaypalRecurSubsequentTransaction()); $paypalIPN->main(); $this->assertEquals(strtotime('+ 1 year', strtotime($membershipEndDate)), strtotime($this->callAPISuccessGetValue('membership', array('return' => 'end_date')))); $contribution = $this->callAPISuccess('contribution', 'get', array('contribution_recur_id' => $this->_contributionRecurID, 'sequential' => 1)); $this->assertEquals(2, $contribution['count']); $this->assertEquals('secondone', $contribution['values'][1]['trxn_id']); $this->callAPISuccessGetCount('line_item', array('entity_id' => $this->ids['membership'], 'entity_table' => 'civicrm_membership'), 2); $this->callAPISuccessGetSingle('line_item', array('contribution_id' => $contribution['values'][1]['id'], 'entity_table' => 'civicrm_membership')); $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'])); }
| License and the CiviCRM Licensing Exception along | | with this program; if not, contact CiviCRM LLC | | at info[AT]civicrm[DOT]org. If you have questions about the | | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ /** * @package CRM * @copyright CiviCRM LLC (c) 2004-2013 * $Id$ */ session_start(); require_once '../civicrm.config.php'; /* Cache the real UF, override it with the SOAP environment */ $config = CRM_Core_Config::singleton(); if (empty($_GET)) { $paypalIPN = new CRM_Core_Payment_PayPalProIPN($_REQUEST); } else { $paypalIPN = new CRM_Core_Payment_PayPalIPN(); // @todo upgrade standard per Pro } try { $paypalIPN->main(); } catch (CRM_Core_Exception $e) { CRM_Core_Error::debug_log_message($e->getMessage()); CRM_Core_Error::debug_var('error data', $e->getErrorData(), TRUE, TRUE); CRM_Core_Error::debug_var('REQUEST', $_REQUEST, TRUE, TRUE); //@todo give better info to logged in user - ie dev echo "The transaction has failed. Please review the log for more detail"; }