// CRM-17718 allow for possibility of changed financial type ID having been set prior to calling this.
$lineItem['financial_type_id'] = $financial_type_id;
}
- if ($lineItem['line_total'] != $total_amount) {
+ $taxAmountMatches = FALSE;
+ if ((!empty($lineItem['tax_amount']) && ($lineItem['line_total'] + $lineItem['tax_amount']) == $total_amount)) {
+ $taxAmountMatches = TRUE;
+ }
+ if ($lineItem['line_total'] != $total_amount && !$taxAmountMatches) {
// We are dealing with a changed amount! Per CRM-16397 we can work out what to do with these
// if there is only one line item, and the UI should prevent this situation for those with more than one.
$lineItem['line_total'] = $total_amount;
//Assert if first payment and repeated payment has the same contribution amount.
$this->assertEquals($payments[0]['total_amount'], $payments[1]['total_amount']);
$this->callAPISuccessGetCount('Contribution', [], 2);
+
+ //Assert line item records.
+ $lineItems = $this->callAPISuccess('LineItem', 'get', ['sequential' => 1])['values'];
+ foreach ($lineItems as $lineItem) {
+ $this->assertEquals($lineItem['unit_price'], $this->_params['total_amount']);
+ $this->assertEquals($lineItem['line_total'], $this->_params['total_amount']);
+ }
+ $this->callAPISuccessGetCount('Contribution', [], 2);
}
public function testGetCurrencyOptions() {