Skip to content
Snippets Groups Projects
Commit 95c4e89e authored by Pradeep Nayak's avatar Pradeep Nayak
Browse files

--CRM-16188, added changes suggested by Eileen

parent 5f44f698
Branches
Tags
No related merge requests found
......@@ -137,15 +137,15 @@ function civicrm_api3_order_create(&$params) {
function civicrm_api3_order_delete($params) {
$contribution = civicrm_api3('Contribution', 'get', array(
'return' => array('is_test'),
'id' => CRM_Utils_Array::value('contribution_id', $params, $params['id']),
'id' => $params['id'],
));
if ($contribution['id'] && $contribution['values'][$contribution['id']]['is_test'] == TRUE) {
$result = civicrm_api3('Contribution', 'delete', $params);
}
else {
throw new API_Exception('Could not delete Order.');
throw new API_Exception('Only test orders can be deleted.');
}
return civicrm_api3_create_success(CRM_Utils_Array::value('values', $result), $params, 'Order', 'delete');
return civicrm_api3_create_success($result['values'], $params, 'Order', 'delete');
}
/**
......
......@@ -446,7 +446,7 @@ class api_v3_OrderTest extends CiviUnitTestCase {
$this->fail("Missed expected exception");
}
catch (Exception $expected) {
$this->callAPISuccess('contribution', 'create', array(
$this->callAPISuccess('Contribution', 'create', array(
'contribution_id' => $order['id'],
'is_test' => TRUE,
));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment