-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
dev/financial#150: civicrm/payment/form url got empty currency argument in backoffice live CC form #18517
Conversation
(Standard links)
|
$currentCurrency | ||
); | ||
return $result; | ||
return $submittedValues['currency'] ?? $this->_values['currency'] ?? CRM_Core_Config::singleton()->defaultCurrency; |
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.
This part looks good - it's just cleanup.
@@ -95,7 +95,10 @@ | |||
|
|||
var payment_instrument_id = $('#payment_instrument_id').val(); | |||
|
|||
var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="formName=`$form.formName`¤cy=`$currency`&`$urlPathVar``$isBackOfficePathVar``$profilePathVar``$contributionPageID``$preProfileID`processor_id="}" + type; | |||
var currency = '{$currency}'; | |||
currency = currency == '' ? $('#currency').val() : currency; |
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.
This is the only bit I have concerns with - why would the currency not be set when the form loads?
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.
@mattwire actually there are two cases where the currency variable is not set in backend, these are:
-
When we open the standalone CC form for submitting new live contribution, where we are setting a NULL currency value in here Although the default currency set in the system can be used in here instead of NULL. So I am not sure if we need to do that.
-
When we are changing the currency beside the amount field https://github.com/civicrm/civicrm-core/pull/18517/files#diff-726c3dcc8c2364a0b9b8f0c0e11bcd34R122 which call the js function, and in this case the code should consider what currency value has been chosen in b/o form and when in reloads the snippet
This is not a issue on edit CC form where currency variable is set.
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.
@monishdeb can we pass currency though the url for case 2?
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.
@eileenmcnaughton yes I am passing the currency value for the 2nd case, if you look at L122 below, I am calling the buildPaymentBlock() fn on currency change and eventually at L99 we are considering the currency value and passing through the url at L144
I've raised a couple of comments for an |
test this please |
When Jenkins is happy I'll test it. |
thanks @KarinG |
$('[name=payment_processor_id]').on('change.paymentBlock', function() { | ||
buildPaymentBlock($(this).val()); | ||
$('[name=payment_processor_id], #currency').on('change.paymentBlock', function() { | ||
buildPaymentBlock($('[name=payment_processor_id]').val()); |
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.
We need to add :checked
or it will always take the first option.
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.
Tested on a site with a payment processor and pay later and the pay later option was broken.
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 @samuelsov for raising this issue and suggesting the fix. I have updated the PR with this commit b86dc53 as per which we need to consider both the w/o pay-later cases.
@monishdeb Looks like this needs a bit of work? |
4614ad1
to
b86dc53
Compare
"Submit Credit Card Contribution backoffice form" -> it's not at all obvious that this is where one would go to process an ACH EFT (i.e. a non Credit Card) transaction. |
We were thinking of a separate PR for changing the name since it really should be Submit Online Contribution or something similar, @KarinG . What do you think? |
I think you are brave :-) Changing button names is fighting talk. But yes, separate PR or issue don't mix it in with this |
I think this PR requires a new button -> "Process ACH EFT" |
@adixon - ping! |
@KarinG no - a SEPARATE PR can cover that.... |
buildPaymentBlock($(this).val()); | ||
$('[name=payment_processor_id], #currency').on('change.paymentBlock', function() { | ||
var payment_processor_id = $('[name=payment_processor_id]:checked').val() == undefined ? $('[name=payment_processor_id]').val() : $('[name=payment_processor_id]:checked').val(); | ||
buildPaymentBlock(payment_processor_id); |
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.
@monishdeb This breaks backend New Contribution forms without a payment processor (ex: Contact Record -> New Contribution, then change the currency).
Adding "if (payment_contribution_id != undefined) { .. }" fixes it, although I haven't tested extensively.
For reference, this form:
Hi @monishdeb This is awaiting changes following @mlutfy testing. |
sorry for delay I have updated the PR. |
Seems good to me, but I will let someone merge since it's not my area of expertise. Symbiotic has been using this patch in production (with the latest commit) for a few weeks and seems to be working well. |
I don't have any remaining concerns - @mattwire ? |
Overview
This affects iATS Payments ACH/EFT payment processor which renders the payment block based on currency chosen.
Here are the steps to replicate:
Issue:
Before
After
Technical Details
For more detail discussion on MM - https://chat.civicrm.org/civicrm/pl/ixxrxhxs43r4mfyjpnf6tnwnnc
https://lab.civicrm.org/dev/financial/-/issues/150
ping @KarinG @Edzelopez @eileenmcnaughton @JoeMurray