Skip to content
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

CRM-21134 fix enotices in payment processor code assignment. #10935

Merged
merged 1 commit into from
Sep 19, 2017

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Sep 1, 2017

Overview

This is a code tidy up that prevents enotices in obscure circumstances

Before

Direct debit (or credit card fields) show appropriately on the Confirm page

After

No visible change.

Technical Details

This is generally a code tidy up to push out the principles we have been implementing (ie.
the idea that the processors define their fields. The code can cause e-notices in extensions as is
because it is prescriptive about fields.

I removed the ANDing in the tpl because actually we are not looking to match numbers like 2
2 is the number we have hard-coded for direct debits (we should be using an option group but that
is another story

Comments

The enotices occur when the payment processor does not neatly fit into credit card or debit card assumptions. For purposes of review I don't believe these need to be replicated.


if ($assignCCInfo) {
$paymentFields = $this->_paymentProcessor['object']->getPaymentFormFields();
foreach ($paymentFields as $index => $paymentField) {
if (!isset($this->_params[$paymentField])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot really review as this block is vastly different from the one it replaces and there are no comments.

{ts}Direct Debit Information{/ts}
{else}
{ts}Credit Card Information{/ts}
{if $paymentFieldsetLabel}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sure the paymentFieldsetLabel includes the label 'Direct Debit Information' or 'Direct Debit Information'.

{/if}
</div>
{if $paymentProcessor.payment_type & 2}
{if $paymentProcessor.payment_type == 2}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, agreed, the & operator couldn't be more confusing ...

This is generally a code tidy up to push out the principles we have been implementing (ie.
the idea that the processors define their fields. The code can cause e-notices in extensions as is
because it is prescriptive about fields.

I removed the ANDing in the tpl because actually we are not looking to match numbers like 2
2 is the number we have hard-coded for direct debits (we should be using an option group but that
is another story
@eileenmcnaughton
Copy link
Contributor Author

I've improved the comments on the getPaymentFormFields function & declared the object that calls it using inline var declaration so anyone working with the code in an IDE can easily see what is being retrieved.

@monishdeb are you able to look at this one - I know what you want me to look at.....

@monishdeb
Copy link
Member

As per code point of view, the patch looks good. Tested the impact on online contribution w/ desired payment processor and ensured that this patch is clean to merge and doesn't cause any unintended regression or side-effect.

@monishdeb monishdeb merged commit 9f810f4 into civicrm:master Sep 19, 2017
@eileenmcnaughton
Copy link
Contributor Author

thanks @monishdeb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants