Getting a Contribution via API 3 does not return "tax_amount" and "financial_type_id"
Overview
When getting a Contribution via API 3, the result does not contain "tax_amount" or "financial_type_id".
Reproduction steps
Query for a Contribution:
$result = civicrm_api3('Contribution', 'get', [
'sequential' => 1,
'id' => 103,
]);
Current behaviour
The result of the query above is something like:
{
"is_error": 0,
"version": 3,
"count": 1,
"id": 103,
"values": [
{
"contact_id": "210",
"contribution_id": "103",
"currency": "USD",
"contribution_recur_id": "",
"contribution_status_id": "1",
"contribution_campaign_id": "2",
"payment_instrument_id": "4",
"receive_date": "2021-10-08 15:51:23",
"non_deductible_amount": "0.00",
"total_amount": "109.69",
"fee_amount": "0.00",
"net_amount": "109.69",
"trxn_id": "Order - 2247",
"invoice_id": "2247_woocommerce",
"invoice_number": "INV_103",
"contribution_cancel_date": "",
"cancel_reason": "",
"receipt_date": "2021-10-08 14:53:00",
"thankyou_date": "",
"contribution_source": "Shop",
"amount_level": "",
"is_test": "0",
"is_pay_later": "1",
"contribution_check_number": "",
"civicrm_value_donor_information_3_id": "6",
"contribution_recur_status": "Completed",
"payment_instrument": "Check",
"contribution_status": "Completed",
"check_number": "",
"instrument_id": "4",
"cancel_date": "",
"id": "103"
}
]
}
Expected behaviour
I would expect "tax_amount" and "financial_type_id" to be present in the set of Contribution data.
It is, of course, possible to retrieve the "tax_amount" and/or "financial_type_id" by specifying them as the returned params - for example:
$result = civicrm_api3('Contribution', 'get', [
'sequential' => 1,
'return' => ["financial_type_id", "tax_amount"],
'id' => 103,
]);
Returns:
{
"is_error": 0,
"version": 3,
"count": 1,
"id": 103,
"values": [
{
"contact_id": "210",
"contribution_id": "103",
"financial_type_id": "4",
"tax_amount": "9.69",
"id": "103",
"contribution_type_id": "4"
}
]
}
But this means an extra query is required to construct the full set of data for a Contribution.
Environment information
Issue exists CiviCRM 5.42.0, though it's probably always been like this.