-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-16188, added order api for delete action and test #7684
Conversation
* @return array | ||
*/ | ||
function civicrm_api3_order_delete($params) { | ||
$contribution = civicrm_api3('Contribution', 'get', array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note here - one way to make this shorter would be
if (!civicrm_api3('Contribution', 'getvalue', array('return' => 'is_test', 'id' => $params['id')) {
throw new ....
}
Note you can be sure $params['id'] will be set due to your aliasing - you don't need to check contribution_id.
Also - I suggest you edit the exception to say only test orders can be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had tried with
$result = civicrm_api3('Contribution', 'getvalue', array(
'sequential' => 1,
'return' => array("is_test"),
'id' => 22,
));
I was getting exception error with 'field Array unset or not existing'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I think that might be a bug in the contribution api - no accepting that as a return value
The test fails are unrelated but I think it's worth at minimum expanding the api exception message to state the reason and getting rid of the unnecessary e-notice preventions. The other comments are more in the nice-to-have. I don't see any larger concerns with this PR |
I've updated the title to [needs minor changes] to reflect my comment above - please change to [needs core team review] when you have fixed the exception (& preferably the enotice over-handling) |
---------------------------------------- * CRM-16188: Create an order API https://issues.civicrm.org/jira/browse/CRM-16188
18e4774
to
95c4e89
Compare
CRM-16188, added order api for delete action and test
https://issues.civicrm.org/jira/browse/CRM-16188