From 95c4e89ecd2cc50bf2b716c014c0c24b353bbcd8 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Fri, 29 Jan 2016 19:33:45 +0530 Subject: [PATCH] --CRM-16188, added changes suggested by Eileen --- api/v3/Order.php | 6 +++--- tests/phpunit/api/v3/OrderTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/v3/Order.php b/api/v3/Order.php index f531443290..36b093d2ac 100644 --- a/api/v3/Order.php +++ b/api/v3/Order.php @@ -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'); } /** diff --git a/tests/phpunit/api/v3/OrderTest.php b/tests/phpunit/api/v3/OrderTest.php index ed18a1914b..1aa5e3a6eb 100644 --- a/tests/phpunit/api/v3/OrderTest.php +++ b/tests/phpunit/api/v3/OrderTest.php @@ -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, )); -- 2.25.1