-
-
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
First recurring payment (paypal ipn) - remove redundant status set, start_date change #23081
Conversation
(Standard links)
|
@eileenmcnaughton A quick look at this PR it looks like you're updating the recur start_date every time a payment comes in - that's wrong. |
I'm nervous about any kind of side effect like this, it seems reasonable but payment processing isn't always reasonable. Even if it did try and figure out if it was the 'first' of a sequence, that concept might not match other ideas of what first means (e.g. do you count failed ones?). |
@mattwire - no - only if the recurring contribution is being changed from 'Pending' to 'In progress' |
@eileenmcnaughton - great example of what I wrote above - a recurring contribution being changed from pending to "in progress" might normally be the first one, but may not be (e.g. currently, ACH/EFT iATS contributions, though I know that's a whole other ball of wax ...). |
@adixon so how does that work - you are saying that they date it starts (a payment is first received) is different to the date it goes from 'pending' (no payments received) to 'In progress' - one or more payments received? |
test this please |
Yes, an ACH/EFT contribution is initially pending just like every other responsible contrribution. A request for the payment goes to iats and generally, if it's syntactically good enough, gets a transaction id back that really just says, "accepted for processing". In a (business) day or two, CiviCRM gets notice back from iATS (via a report that gets pulled hourly, not a callback) that it has been accepted by payers the merchant bank (or not), at which point CiviCRM/iATS extension will convert the contribution to complete or failed. https://github.com/iATSPayments/com.iatspayments.civicrm/wiki/Verification-and-the-Journal |
@adixon ok - but how does that relate to the civicrm_contribution_recur.start_date field - ie this proposal is that the start date is consistently updated to reflect when the first payment is received - ie when the first contribution is updated to completed. |
My main point is that recurring payments are a very mixed bag and making and enforcing any assumptions across the board is likely to create new unexpected problems. My answer above was trying to point out that your logic is assuming a cc type of sequence of predictable payments, but it's also a good example of a continuing confusion with recurring payments - i.e. that even amongst developers, we get confused between a recurring schedule and a contribution that is part of a recurring schedule, because we call them both recurring contributions at different times. But maybe it would help if you describe what problem this automation is intended to solve? |
@eileenmcnaughton I think this really needs a lab issue first as it's a proposal that needs discussing. This issue and related comments there by @adixon explain very well some of the reasons why |
@adixon @mattwire so the logic in core is that
Both Authorize.net and Paypal at the same time update the civicrm_contribution_recur.start_date to be the date of that first completed contribution. In the case of Paypal it actually does 3 things
I couldn't see anything in the linked gitlab that discussed start_date - it all seemed to be about the contribution record. Haven't said all that - I'm also OK with dropping this & just removing the 1 line from the paypal class & not also trying to leverage this to remove some of the obstacles to cleaning up |
I think paypal (and core authorize.net) are doing the wrong thing if they're updating start_date on the recur. It creates inconsistency and seems limited to those two processors. |
@mattwire I'm going to go with your version & rip out changing the start_date on paypal then - purely because it is the easiest :-) and I was already marginal on the benefit of updating the date in paypal because paypal recurrings happen in real time anyway |
@mattwire updated to just remove the code |
thanks @mattwire |
Follows on from civicrm#23081
Overview
First recurring payment (paypal ipn) - remove redundant status set, set start_date centrally
Before
The paypal IPN code updates the contribution status id from 'Pending' to 'In Progress' on the first payment. This is redundant as it is later done in
BAO_ContributionRecur::updateOnNewPayment
and incorrect as it is using the wrong option group (contribution vs contribution recur status options) - and the test shows it is done with these lines removedOn removing this the only 'reason' for the
$recur->save()
here is to update the start date to the current date when updating from 'Pending' to 'In Progress' - I feel like if this is worth doing it should be done in theBAO_ContributionRecur::updateOnNewPayment
such that it is consistentAfter
update to recurring removed from the PaypalIPN
Per discussion I originally wanted to centralise this but settled on removal as ... it's complicated
Technical Details
@mattwire @KarinG @adixon - I'm inclined to think it would ALSO be OK not to update the start date in paypal since it barely changes from the initial date if you disagree with always updating the civicrm_contribution_recur.start_date field when the first contribution in the series is completed
Comments