Problem/Motivation
Using the latest release of Commerce Paystack I tried making a payment and after a successful payment and I got redirected back to the site, the order wasn't marked as paid, instead I got the the warning and error,
Warning: Undefined property: Drupal\commerce_paystack\Plugin\Commerce\PaymentGateway\PaystackStandard::$entityId in Drupal\commerce_paystack\Plugin\Commerce\PaymentGateway\PaystackStandard->onReturn() (line 115 of modules/contrib/commerce_paystack/src/Plugin/Commerce/PaymentGateway/PaystackStandard.php).
Error messageWe encountered an issue recording your payment. Please contact customer service to resolve the issue.
This appears to be related to how the payment gateway entity ID is referenced in the onReturn() method. Updating the code to use $order->get('payment_gateway')->entity->id() resolved the issue and orders were again marked as paid.
Steps to reproduce
- Complete a payment using Paystack.
- Observe that the order is not marked as paid and the above warning appears.
Proposed resolution
Update the payment creation code in onReturn() to use the payment gateway entity ID from the order object. This change restores expected functionality and compatibility.
I am opening a merge request for the fix.
Issue fork commerce_paystack-3539438
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
chikeComment #5
i-trokhanenkoThanks!