This issue stems from a need to bypass the Square payment pane to account for 100% discounts (or for any other time a cart would be processing a $0 balance order). As a solution, I implemented the fix outlined in #3 and #5 here:
https://www.drupal.org/project/commerce_userpoints/issues/1844236
So, I added this Condition to the Square Payment method:
---
Data comparison
Parameter: Data to compare: [commerce-order:commerce..., Operator: is greater than, Data value: 0
---
Resulting in the successful removal of the pane (with it being replaced by, "Payment is not required to complete your order.") - along with the following errors:
--
Notice: Undefined index: payment_methods in commerce_square_form_alter() (line 465 of .../sites/all/modules/commerce_square/commerce_square.module).
Warning: Invalid argument supplied for foreach() in commerce_square_form_alter() (line 465 of .../sites/all/modules/commerce_square/commerce_square.module).
--
I found this thread on the same topic that seems to indicate that this isn't a bug in Commerce but rather a module that doesn't implement the terminal properly in the submit function and validation function.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2942214-3.patch | 720 bytes | mglaman |
Comments
Comment #2
chris matthews commentedI also implemented the fix outlined in #3 and #5 here, but I'm still getting the following warning:
Warning: Invalid argument supplied for foreach() in commerce_square_form_alter() (line 465 of .../sites/all/modules/commerce_square/commerce_square.module).
Is there a fix for this by chance?
Comment #3
mglamanThis verifies the sub array keys exist and that we have an array.
Comment #4
daletrexelAt mglaman's request, I've tested the patch by applying it on a local copy of my D7 Commerce Kickstart site, and the JS for the Square Payment fields still loads. It sounds like that's the main concern needing testing, so I believe this can be marked RTBC.
Comment #5
daletrexelComment #6
mglaman@DaleTrexel thanks for testing! Committing this.