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

Issue#3108529 : Fix Pay later option for CiviCRM versions >= 5.21.0 #289

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

omarabuhussein
Copy link
Contributor

Before

The contribution will not be created when using the pay later payment method on CiviCRM versions >= 5.21.0 .

The issue is reported here : https://www.drupal.org/project/webform_civicrm/issues/3108529

After

Using the pay later option is working fine and the contribution is created normally.

Technical Notes

The issue was interoducded 3 months ago after this PR get merged to CiviCRM core :

civicrm/civicrm-core#15697

one of the changes in the above PR updates CRM_Core_Payment::getPaymentInstrumentID() method to return 0 instead of null when no payment method is found for the specified payment processor, but CiviCRM API treat 0 values differently from null values , it will ignore null values where it will try to set values that equal 0 into the database (which is normal given that 0 represents a value where null represents the absence of any value), and given that there is a foreign key constraint on the payment method/instrument field on the contribution table, CiviCRM will fail to create the contribution.

I solved the issue here by skipping the code that tries to get payment method Id if the payment processor Id is not set (and hence that the pay later option Id = 0 so it will always will skip this part) .

@KarinG
Copy link
Collaborator

KarinG commented Jan 30, 2020

Awesome 👍 Thank you Omar. I could not reproduce this issue on live client sites. Makes sense now.

@omarabuhussein omarabuhussein deleted the issue-3108529 branch January 30, 2020 08:40
@lalgwebdev
Copy link

Just to confirm the comment left on Issue https://www.drupal.org/project/webform_civicrm/issues/3108529 this change does fix my problem.

@KarinG
Copy link
Collaborator

KarinG commented Jan 31, 2020

Thank you for confirming that @lalgwebdev 👍

omarabuhussein added a commit to compucorp/webform_civicrm that referenced this pull request Jul 7, 2020
omarabuhussein added a commit to compucorp/webform_civicrm that referenced this pull request Jul 8, 2020
jitendrapurohit pushed a commit to jitendrapurohit/webform_civicrm that referenced this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants