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

  1. Complete a payment using Paystack.
  2. 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.

Command icon 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

chike created an issue. See original summary.

chike’s picture

Status: Active » Needs review

i-trokhanenko’s picture

Status: Needs review » Fixed

Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.