// processor id & the handleNotification function (which should call the completetransaction api & by-pass this
// entirely). The only thing the IPN class should really do is extract data from the request, validate it
// & call completetransaction or call fail? (which may not exist yet).
+ Civi::log()->warning('Unreliable method used for AuthNet IPN - this will cause problems if you have more than one instance');
$paymentProcessorTypeID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType',
'AuthNet', 'id', 'name'
);
if (!$this->validateData($input, $ids, $objects, TRUE, $paymentProcessorID)) {
return FALSE;
}
+ if (!empty($ids['paymentProcessor']) && $objects['contributionRecur']->payment_processor_id != $ids['paymentProcessor']) {
+ Civi::log()->warning('Payment Processor does not match the recurring processor id.', array('civi.tag' => 'deprecated'));
+ }
if ($component == 'contribute' && $ids['contributionRecur']) {
// check if first contribution is completed, else complete first contribution
$this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($contribution['values'][1]['receive_date'])));
}
+ /**
+ * Test payment processor is correctly assigned for the IPN payment.
+ */
+ public function testIPNPaymentRecurSuccessMultiAuthNetProcessor() {
+ //Create and set up recur payment using second instance of AuthNet Processor.
+ $this->_paymentProcessorID2 = $this->paymentProcessorAuthorizeNetCreate(array('name' => 'Authorize2', 'is_test' => 0));
+ $this->setupRecurringPaymentProcessorTransaction(array('payment_processor_id' => $this->_paymentProcessorID2));
+
+ //Call IPN with processor id.
+ $IPN = new CRM_Core_Payment_AuthorizeNetIPN($this->getRecurTransaction(array('processor_id' => $this->_paymentProcessorID2)));
+ $IPN->main();
+ $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $this->_contributionID));
+ $this->assertEquals(1, $contribution['contribution_status_id']);
+ $this->assertEquals('6511143069', $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']);
+ }
+
/**
* Test IPN response updates contribution_recur & contribution for first & second contribution
*/