Commit c766dabd authored by mattwire's avatar mattwire
Browse files

Fix Mjwpayment.get_contribution

parent 80ba0e7a
......@@ -75,7 +75,7 @@ function _civicrm_api3_mjwpayment_get_contribution_spec(&$params) {
* Input parameters.
*
* @return array
* Array of contributions, if error an array with an error id and error message
* Array of contribution, if error an array with an error id and error message
*/
function civicrm_api3_mjwpayment_get_contribution($params) {
$payments = civicrm_api3('Mjwpayment', 'get_payment', $params);
......@@ -105,9 +105,14 @@ function civicrm_api3_mjwpayment_get_contribution($params) {
if (isset($contributionParams['trxn_id'])) {
$contributionParams['trxn_id'] = ['IN' => $contributionParams['trxn_id']];
}
$contribution = civicrm_api3('Contribution', 'getsingle', $contributionParams);
$contribution = civicrm_api3('Contribution', 'get', $contributionParams)['values'];
$contribution = reset($contribution);
}
return civicrm_api3_create_success([$contribution['id'] => $contribution], $params, 'Mjwpayment', 'get_contribution');
$result = [];
if ($contribution) {
$result = [$contribution['id'] => $contribution];
}
return civicrm_api3_create_success($result, $params, 'Mjwpayment', 'get_contribution');
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment