-
-
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
Fix propertyBag regression on amount
#23301
Conversation
This appears to have caused a regression per https://lab.civicrm.org/dev/core/-/issues/3413 In addition I don't think we should have a 'sloppy alternative' to being called with the correct documented amount property https://docs.civicrm.org/dev/en/latest/extensions/payment-processors/create/#available-parameters
(Standard links)
|
I agree this makes good sense, since |
thanks for taking a look @artfulrobot |
Yes, makes sense. I think this was added because something somewhere was passing |
Thank you for working together on this and figuring out the issue. Appreciate that! |
@magnolia61 thanks for pinpointing the issue |
Is it too late for this to make its way to the RC as it is a regression? |
@magnolia61 it IS in the rc - which is due for release next Wed - I was on the fence about asking @totten to drop a release of 5.48 prior to then |
Oh, nice. Thats fine. High impact but kind of niche still. |
@magnolia61 yeah - with a week to go to 5.49 it is a bit borderline - if #23295 gets turned around quickly-ish then I think I will push for it to go out before next Wed |
Overview
Fixes a regression by payment processors from this line
https://github.com/civicrm/civicrm-core/pull/21583/files#diff-c8d9bcea3e41ecc2ae13f5b654fefbbe3e95a73c9066b83017af82204533f9d2R29
The expectation is that functions calling
doPayment
pass the parameters in documented herehttps://docs.civicrm.org/dev/en/latest/extensions/payment-processors/create/#available-parameters
In some cases the parameter passing has been historically inconsistent and the
PropertyBag
has been a technical solution to help with that inconsistency - e.g a form might not have passed billing address fields and the syntax when they do is a bit nasty - e.gbilling_street_address-{$billingLocationID}
so a payment processor may choose to implement the property bag to get easier access to the properties passed in.However, the documented parameters are the ones that should be prioritised for use (where the calling code sloppily passes in more than one similar property) - and in the case of
amount
theamount
field has been used by many processors for many years and we now know of at least one scenario wheretotal_amount
is actually incorrect to use.I don't think we should have a 'sloppy alternative'
to being called with the correct documented
amount property
Before
When both the contracted property
amount
and the non-required propertytotal_amount
are passed in thecast
function treatstotal_amount
as theamount
After
As per before #21583 -
amount
is used,total_amount
is ignoredTechnical details
@mattwire - this reverses just the line of the PR you merged that appears to be causing problems - the more I think about it the more I think the line should go - we definitely want functions that call
doPayment
to do so with the documented parameters. The point of the propertyBag (as I understand it) was to help out where they didn't - but not to make it so the calling code could be more loose about what it passes