-
-
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
Refactor entityParams in Order.Create API so it is easier to understand/modify #18306
Refactor entityParams in Order.Create API so it is easier to understand/modify #18306
Conversation
(Standard links)
|
@mattwire I did the same refactor myself and came out with a slightly different outcome (mostly switching on $item['entity_table'] since we know what the entity is from the table & reducing the IFs on $entityParams). However, the only thing of significance / that couldn't equally well be done in a future round is that I think
is wrong - as that would take us out of both the switch AND the line item iteration loop - meaning that a contribution line item would block a later membership item being created. I guess we want to check that scenario is tested before making this change |
hmm - it might be OK - actually - perhaps - just looking at the test config we have
it's unclear whether more than one line could be in line item I guess what would make it clearer would be something like
|
Hmmm no the second break is definitely out of
|
Just adding needs test because we want to ensure that case were the line items is an array with a contribution line as the first line is covered |
10b40ef
to
6573357
Compare
@eileenmcnaughton This now has a test which should improve the test coverage for the Order API - thanks @jitendrapurohit |
6573357
to
07e6da1
Compare
@mattwire @jitendrapurohit thanks for the test - it doesn't actually cover the problem in this PR - but I have updated it so that it passes without this PR (locking in correct behaviour) but fails with this PR #18785 As I suspected the in my comments earlier - the |
Thank you for the update @eileenmcnaughton 👍 |
unit test for #18306 - order create api test for contribution
07e6da1
to
bd94f95
Compare
bd94f95
to
33f7914
Compare
@eileenmcnaughton I've updated the PR and tests are now passing |
yep that works |
Overview
Partial from #18096 - this is a refactor only.
Before
More compact, less easy to understand/modify code.
After
Less compact, clearer code. Allows for easier changes for individual entities (eg. adding participant statuses per #18096).
Technical Details
Comments
@eileenmcnaughton Could you review/merge? I'll rebase #18096 after