Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 4.3.4
-
Fix Version/s: 4.7
-
Component/s: Accounting Integration, CiviContribute
-
Labels:None
-
Documentation Required?:None
Description
After using the Contribution Create API ( with skipLineItem = 1 ) and the LineItem create API to create a new contribution, I end up with an unbalanced transaction listed in the Bookkeeping Transaction report. (Financial Account Debit is listed as "Payment Processor Account" but Financial Account Credit is empty.)
I also noticed that there is no records for this contribution in the table "civicrm_financial_item"
The PHP code that I used to call the API is below:
$source_tmp = 'test of API payment';
$skipLineItem_parm = "1";
$new_contrib_params = array( 'version' => 3,
'sequential' => 1,
'financial_type_id' => 10,
'contact_id' => 12724,
'skipLineItem' => $skipLineItem_parm,
'payment_instrument_id' => 1,
'total_amount' => 53.00 ,
'trxn_id' => '' ,
'contribution_recur_id' => '' ,
'currency' => 'USD' ,
'contribution_campaign_id' => '1',
'source' => $source_tmp ,
'contribution_status_id' => 1,
'receive_date' => '20130616' ) ;
//$new_contrib_params['total_amount'] = $gateway_amount;
$new_contrib_result = civicrm_api('Contribution', 'create', $new_contrib_params ) ;
if($new_contrib_result['is_error'] <> 0 )
else{
print "<br>Created test contribution via API<br>";
print_r($new_contrib_result);
$new_contrib_id = $new_contrib_result['id'];
// create line items:
$params = array(
'version' => 3,
'sequential' => 1,
'entity_table' => 'civicrm_contribution',
'entity_id' => $new_contrib_id ,
//'price_field_id' => $original_line_item['price_field_id'],
//'label' => $original_line_item['label'],
'qty' => "53",
'unit_price' => "1",
'line_total' => "53",
'financial_type_id' => '10',
);
//print "<br><br>New line item:<br> ";
//print_r( $params ) ;
$li_result = civicrm_api('LineItem', 'create', $params);
if($li_result['is_error'] <> 0 )
else
{ print "<br>Called line item API: <br>"; // print_r( $li_result); }}
Attachments
Issue Links
- is supplemented by
-
CRM-13067 Update BAO / API to clearly support membership payments following on from CiviAccounts. Reduce form layer duplication of api layer smarts on this
- Done/Fixed