/**
* Set contribution to failed.
+ *
* @param array $objects
* @param object $transaction
* @param array $input
+ *
* @return bool
*/
public function failed(&$objects, &$transaction, $input = array()) {
$contribution->contribution_status_id = $contributionStatuses['Failed'];
$contribution->save();
- //add lineitems for recurring payments
+ // Add line items for recurring payments.
if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) {
$this->addRecurLineItems($objects['contributionRecur']->id, $contribution);
}
}
$contribution->save();
- //add new soft credit against current $contribution and
+ // Add new soft credit against current $contribution.
if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
$this->addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
}
));
}
- ///////////////// civicrm_contribution_
-
/**
* Create an contribution_id=FALSE and financial_type_id=Donation.
*/
}
/**
- * Test create with valid payment instument.
+ * Test create with valid payment instrument.
*/
public function testCreateContributionWithPaymentInstrument() {
$params = $this->_params + array('payment_instrument' => 'EFT');
$this->assertEquals('125.00', $lineItems);
$trxnAmount = $this->_getFinancialTrxnAmount($contribution['id']);
- $fitemAmount = $this->_getFinancialItemAmount($contribution['id']);
- // Financial trxn SUM = 125 + 5 (fee)
+
+ // Financial trxn SUM = 125 + 5 (fee).
$this->assertEquals('130.00', $trxnAmount);
- $this->assertEquals('125.00', $fitemAmount);
+ $this->assertEquals('125.00', $this->_getFinancialItemAmount($contribution['id']));
}
/**
}
/**
- * To Update Contribution.
+ * Test Updating a Contribution.
+ *
* CHANGE: we require the API to do an incremental update
*/
public function testCreateUpdateContribution() {
);
$original = $this->callAPISuccess('contribution', 'get', $old_params);
- //Make sure it came back
+ // Make sure it came back.
$this->assertAPISuccess($original);
$this->assertEquals($original['id'], $contributionID);
//set up list of old params, verify
/**
* This could be merged with 4.5 function setup in api_v3_ContributionPageTest::setUpContributionPage
- * on parent class at some point (fn is not in 4.4)
+ * on parent class at some point (fn is not in 4.4).
* @param $entity
* @param array $params
*/