*
* @input array information from Payment processor
*
- * @param $input
+ * @param array $input
* @param array $ids
* @param array $objects
* @param bool $required
* @param int $paymentProcessorID
* @param array $error_handling
*
- * @return bool
+ * @return bool|array
*/
public function loadObjects(&$input, &$ids, &$objects, $required, $paymentProcessorID, $error_handling = NULL) {
if (empty($error_handling)) {
}
$participant = &$objects['participant'];
- //CRM-15546
+ // CRM-15546
$contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
'labelColumn' => 'name',
'flip' => 1,
/**
* Process cancelled payment outcome.
*
- * @param $objects
- * @param $transaction
+ * @param array $objects
+ * @param CRM_Core_Transaction $transaction
* @param array $input
*
* @return bool
/**
* Rollback unhandled outcomes.
*
- * @param $objects
- * @param $transaction
+ * @param array $objects
+ * @param CRM_Core_Transaction $transaction
*
* @return bool
*/
* @param array $input
* @param array $ids
* @param array $objects
- * @param $transaction
+ * @param CRM_Core_Transaction $transaction
* @param bool $recur
*/
public function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = FALSE) {
* Incoming data from Payment processor.
* @param array $ids
* Related object IDs.
- * @param $objects
+ * @param array $objects
* @param array $values
* Values related to objects that have already been loaded.
* @param bool $recur
protected $_processorId;
protected $_contributionRecurParams;
protected $_paymentProcessor;
+
+ /**
+ * Parameters to create a membership.
+ *
+ * @var array
+ */
+ protected $_membershipParams = array();
+
+ /**
+ * IPN instance.
+ *
+ * @var CRM_Core_Payment_BaseIPN
+ */
protected $IPN;
protected $_recurId;
protected $_membershipId;
protected $_membershipStatusID;
public $DBResetRequired = FALSE;
+ /**
+ * Setup function.
+ */
public function setUp() {
parent::setUp();
$this->_processorId = $this->paymentProcessorAuthorizeNetCreate(array('is_test' => 0));
$this->objects['contribution'] = $contribution;
}
+ /**
+ * Tear down after class.
+ */
public function tearDown() {
$this->quickCleanUpFinancialEntities();
CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->assertEquals('Anthony', $this->objects['contact']->first_name);
- $this->ids['contact'] = $this->_contactId = $this->individualCreate(array('first_name' => 'Donald', 'last_name' => 'Duck', 'email' => 'the-don@duckville.com'));
+ $this->ids['contact'] = $this->_contactId = $this->individualCreate(array(
+ 'first_name' => 'Donald',
+ 'last_name' => 'Duck',
+ 'email' => 'the-don@duckville.com,
+ '));
$contribution = $this->callAPISuccess('contribution', 'create', array_merge($this->_contributionParams, array('invoice_id' => 'abc')));
$this->_contributionId = $contribution['id'];
$this->_setUpMembershipObjects();
}
/**
- * Test that an error is returned if required set & no contribution page
+ * Test that an error is returned if required set & no contribution page.
*/
public function testRequiredWithoutProcessorID() {
$this->_setUpPledgeObjects();
'event_id' => $this->_eventId,
'contact_id' => $this->_contactId,
));
- //we'll create membership payment here because to make setup more re-usable
- $participantPayment = $this->callAPISuccess('participant_payment', 'create', array(
+
+ $this->callAPISuccess('participant_payment', 'create', array(
'contribution_id' => $this->_contributionId,
'participant_id' => $this->_participantId,
));
protected $_contributionRecurID;
protected $_contributionPageID;
protected $_paymentProcessorID;
+ /**
+ * IDs of entities created to support the tests.
+ *
+ * @var array
+ */
+ protected $ids = array();
+ /**
+ * Set up function.
+ */
public function setUp() {
parent::setUp();
$this->_paymentProcessorID = $this->paymentProcessorCreate(array('is_test' => 0));
$this->_contributionPageID = $contributionPage['id'];
}
+ /**
+ * Tear down function.
+ */
public function tearDown() {
$this->quickCleanUpFinancialEntities();
}
}
/**
- * Test IPN response updates contribution_recur & contribution for first & second contribution
+ * Test IPN response updates contribution_recur & contribution for first & second contribution.
*/
public function testIPNPaymentMembershipRecurSuccess() {
$this->setupMembershipRecurringPaymentProcessorTransaction();
}
/**
- * CRM-13743 test IPN edge case where the first transaction fails and the second succeeds
+ * CRM-13743 test IPN edge case where the first transaction fails and the second succeeds.
+ *
* We are checking that the created contribution has the same date as IPN says it should
* Note that only one contribution will be created (no evidence of the failed contribution is left)
* It seems likely that may change in future & this test will start failing (I point this out in the hope it
}
/**
- * Check a payment express IPN call does not throw any errors
+ * 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
}
/**
+ * Get IPN style details for an incoming recurring transaction.
*/
public function getPaypalProRecurTransaction() {
return array(
}
/**
+ * Get IPN-style details for a second incoming transaction.
+ *
* @return array
*/
public function getPaypalProRecurSubsequentTransaction() {