-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Switch recordAdditionalPayment fully over to api #14408
Conversation
(Standard links)
|
Looks like 2 receipts are being sent now
One is coming from completetransaction I think we need a is_send_receipt = 0 to go through to payment.create & from there to confirmcontribution from this form |
26395ed
to
24274d4
Compare
failure are on dedupe - ie
I can't replicate locally running all CRM & I can't see how it relates - but I also think it is consistent |
test this please |
fc57b43
to
429e92e
Compare
test this please |
@eileenmcnaughton needs a rebase |
429e92e
to
258627d
Compare
test this please |
1 similar comment
test this please |
this seems to make sense to me @monishdeb ? |
@seamuslee001 tests were a total wash until the null Array work - yay for fixing that! |
@eileenmcnaughton Looks like we need a rebase after #14589 |
258627d
to
2bc4be6
Compare
@kcristiano rebased |
@eileenmcnaughton I am trying to determine the best way to do To start I did a back end contribution using a price set. The price set had multiple financial types. Recording was correct. I edited and cancelled a line item. Looked good. I went to record the refund and the error I'll rebuild master and start testing, but wanted your thoughts on the testing methodology. Edit: I rebuilt master. Without patch Refunds work with the patch refunds fail. |
86ea359
to
4bff0ea
Compare
@kcristiano so we DO have a swag of tests in
Ideally we WOULD go through a full suite of tests but we do also have some unit test support and testing 'everything' might be unachievable I have updated this PR with what I think will fix the refunds issue |
Thanks @eileenmcnaughton PR applied. Made contributions, partially paid and then fully paid. Works perfectly. Added Contribution with multiple financial Types, partially paid, then fully paid. Payments are prorated against Accts Receivable as that is the only way - This is expected. Once fully paid Income is correct, as are cash and AR. Then did a refund of one line item. Refund works. Credited the proper Financial Type for Income. When repeating for events after doing partial payments a Credit card payment inserts itelf
The last record is the false Credit Card Payment method |
@kcristiano thanks - I will try to replicate that in a unit test |
@kcristiano although you are commenting on this PR I assume you are using the 3 prs together? |
@eileenmcnaughton I had not included #14763 But let me do that and retest. I did not realize that this was dependent on that PR,I though only the reverse. |
Ok Tested with all 3 (#14589 is merged) Still getting issue with a credit card line being inserted
|
@kcristiano they are all independent of each other to some extent - but you can't see the impact of them from additional payment form without the combo deal |
@kcristiano I should also note that 'success' / mergeable for this PR is 'not worse' - ie it's a refactoring PR that changes the code path. It is the other PR that is expected to improve behaviour. This PR will simplify code and greatly improve test coverage |
4bff0ea
to
14deae4
Compare
OK I think this is what you are describing - I'm now a little unsure about the best order to proceed with things. I've encountered a specific issue with the financial items - namely what should happen when the payment exceeds the line items total. This can happen when This means that the line item total is less than the contribution total There are 2 options
The former is locked in & tested in UpdatePaymentTest whereas the tests @monishdeb wrote for dev/core#310 assume the latter is the case One for @JoeMurray @monishdeb @pradpnayak to have thoughts on... |
14deae4
to
fd657ed
Compare
@kcristiano I realise that this pr #14673 was the one I thought might have a fix. I tested and it does fix the bug you identified I think #14673 is a pretty safe one to merge as it does not affect many existing code paths whereas this does consolidate paths. It would be good if @monishdeb and / or @pradpnayak could check that one as I think we could get it merged & simplify things while we discuss my issue above. In the meantime I've pulled it into this PR |
This actually incorporates #14673 so to progress we need @pradpnayak or @monishdeb to review this PR (combining the 2) or just that PR & we can merge this PR after |
@eileenmcnaughton can you let me know what I can to move these PRs along? If I should do mre I have this PR, #14763 and #14892 as a group - is that correct? |
@kcristiano yes this one needs someone who gets the code to take a look - I know you have done some testing & we have some tests too - I was hoping @monishdeb or @pradpnayak would have time (@JoeMurray ) but we seem to be struggling on availablility. The other issue stalling us is clarification of which of the 2 methods currently in use in different places for recording overage we should use (#14408 (comment) is about this). Since we have tests locking in each of the 2 variants (proportionally assigning overages & not assigning overages) it's a blocker to consolidation until we can confirm which is right - I need @JoeMurray to agree here |
Use payment.create api from recordAdditionalPayment form as part of general consolidation
fd657ed
to
bd98168
Compare
@kcristiano so with the other PR merged I think this could be merged if your testing reveals no regressions - it still does not fix the allocation issue and I need @JoeMurray to answer the question above (#14408 (comment)) to deal with that. As an aside I found out @pradpnayak no longer gets github pings for some reason - perhaps that affects Joe too? |
So let me try to articulate some objectives: When the sum of payments exceeds the line items total, then the result should be that there is a full allocation for each of the line items for the amount that they are worth, and the overage is not allocated. I think that when JMA and @lcdservices implemented the overpayment support we likely missed handling of UpdatePaymentTest, or perhaps it was added later. |
@monishdeb please spend up to 3h on reviewing / QA r-run for this set of linked PRs tomorrow. |
In any case where there is an overpayment (due to extra payment, overpayment, reduction of line item total below what has been paid, edit of payment amount, ), then I believe core is supposed to from a bookkeeping perspective have the money end up in the right bank accounts (or other asset accounts), and leave the excess revenue as a negative amount for Accounts Receivable. Refunds either in core or extensions and / or Credit Notes, and applying credit notes to outstanding amounts by that contact or another (via extension) work on this excess to bring it back to zero. @lcdservices may want to correct me, but I think that is how things are supposed to work. |
I agree with @JoeMurray |
@JoeMurray @lcdservices I went back to the unit test for UpdatePaymentTest and annotated the behaviour it is locking in - #15143 I read from your comments above that the goal is to allocate the payments to the line items. However, looking at the test I see it starts off by creating a partially paid contribution & then allocating the Accounts receivable amount, rather than the paid amount, to the line items. I had previously understood the goal to be to determine which items (or what proportion of them) are actually PAID for rather than intended to be paid for. I'm pretty sure something is wrong with the final resulting data documented over at #15143 but I'm a little unsure what since it's hard to see what 'right' would look like from the resulting data. |
As per PR description, it indicates that it doesn't fix the misallocation of line-items (which is handled in a separate PR #14763) but it actually focuses on improving the workflow about handling the additional payment eventually to Payment.create API from BAO function I am happy to merge this PR after code review and r-run. |
woot - this was a big code consolidation to get to this point but we now have less (I want to say only one but I'm not sure) ways of processing an additional payment |
Let's see what fails first
Overview
Code consolidation on payment handling
Before
Disparate code paths
After
Consolidated code paths
Technical Details
The payment code was originally tightly coupled with the additional payment form. Later a payment.create api was split off but the form was never changed to use it & they grew up separately. Fortunately both have pretty good testing by now
Comments