-
-
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
Support chaining Payment.create from Order api #15548
Conversation
(Standard links)
|
70ac08e
to
992ef01
Compare
api/v3/Order.php
Outdated
@@ -92,8 +92,9 @@ function civicrm_api3_order_create($params) { | |||
$entityIds = []; | |||
$contributionStatus = CRM_Utils_Array::value('contribution_status_id', $params); | |||
if ($contributionStatus !== 'Pending' && 'Pending' !== CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contributionStatus)) { | |||
CRM_Core_Error::deprecatedFunctionWarning('Creating a Order with a status other than pending is deprecated. Currently empty defaults to "Completed" so as a transition not passing in "Pending" is deprecated'); | |||
CRM_Core_Error::deprecatedFunctionWarning("Creating a Order with a status other than pending is deprecated. Currently empty defaults to 'Completed' so as a transition not passing in 'Pending' is deprecated. You can chained payment creation like - civicrm_api3('Order', 'create', ['blah' => 'blah', 'contribution_status_id' => 'Pending', 'api.Payment.create => ['total_amount' => 5]]"); |
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.
Grammar: "You can chained payment creation like -" Maybe "You can chain payment creation - for example:"
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.
thanks - fixed
992ef01
to
b6ffb8f
Compare
test this please |
b6ffb8f
to
e2887a3
Compare
test this please |
1 similar comment
test this please |
@seamuslee001 @monishdeb @mattwire is one of you good to merge this - I can fix the Extended Reports tests once merged |
This looks fine to me, backed up by a unit test and makes sense |
Thanks @seamuslee001 |
Overview
Now that we have deprecated creating an order without passing the status of 'Pending' I'm having to switch over some tested code. I quickly realised that supporting chaining would be really helpful here.
This PR creates the tests and code to make this work
Before
Above call fails
After
Above call passes & is tested
Technical Details
@JoeMurray @mattwire @artfulrobot @aydun
Comments
Note the impact of the deprecation is to show notices - this causes tested code to start failing if it hits the deprecation - this is a good thing.
@seamuslee001 I'll fix the extended reports tests once this is merged