/** * Check a payment express IPN call does not throw any errors * At this stage nothing it supposed to happen so it's a pretty blunt test * but at least it should be e-notice free * The browser interaction will update Paypal express payments * The ipn code redirects POSTs to paypal pro & GETs to paypal std but the * documentation (https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/ipnguide.pdf) * implies only POSTS are sent server to server. * So, it's likely Paypal Std IPNs aren't working. * However, for Paypal Pro users payment express transactions can't work as they don't hold the component * which is required for them to be handled by either the Pro or Express class * * So, the point of this test is simply to ensure it fails in a known way & with a better message than * previously & that refactorings don't mess with that * * Obviously if the behaviour is fixed then the test should be updated! */ public function testIPNPaymentExpressNoError() { $this->setupRecurringPaymentProcessorTransaction(); $paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalExpressTransactionIPN()); try { $paypalIPN->main(); } catch (CRM_Core_Exception $e) { $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $this->_contributionID)); // no change $this->assertEquals(2, $contribution['contribution_status_id']); $this->assertEquals('Paypal IPNS not handled other than recurring_payments', $e->getMessage()); return; } $this->fail('The Paypal Express IPN should have caused an exception'); }
/** * Process incoming notification. * * This is only supported for paypal pro at the moment & no specific plans to add this path to core * for paypal standard as the goal must be to separate the 2. * * We don't need to handle paypal standard using this path as there has never been any historic support * for paypal standard to call civicrm/payment/ipn as a path. */ public static function handlePaymentNotification() { $paypalIPN = new CRM_Core_Payment_PayPalProIPN($_REQUEST); $paypalIPN->main(); }
/** * Process incoming notification. */ public static function handlePaymentNotification() { $params = array_merge($_GET, $_REQUEST); $q = explode('/', CRM_Utils_Array::value('q', $params, '')); $lastParam = array_pop($q); if (is_numeric($lastParam)) { $params['processor_id'] = $lastParam; } if (civicrm_api3('PaymentProcessor', 'getvalue', array('id' => $params['processor_id'], 'return' => 'class_name')) == 'Payment_PayPalImpl') { $paypalIPN = new CRM_Core_Payment_PayPalIPN($params); } else { $paypalIPN = new CRM_Core_Payment_PayPalProIPN($params); } $paypalIPN->main(); }