Payment not created when using test mode

Created on 22 July 2024, 5 months ago
Updated 23 July 2024, 5 months ago

Problem/Motivation

When using test mode \Drupal\commerce_dps\PaymentExpress\CommercePxPay\capturePayment never gets called. As such, the transaction completes but the Commerce Order doesn't have a payment attached.

The reason: PxPay authentication fails because Drupal\commerce_dps\PaymentExpress\CommercePxPay doesn't call $this->gateway->setTestMode(TRUE); before calling $this->gateway->completePurchase();

e.g. \Drupal\commerce_dps\PluginForm\OffSiteRedirect\buildConfigurationForm does this (at line 53-55)

Steps to reproduce

Place an order using pxPay payment gateway in test mode using test CC. Order will be placed with empty payment.

Proposed resolution

if ($this->pxPayService->getConfiguration('mode') === 'test') {
 $this->gateway->setTestMode(TRUE);
}

Remaining tasks

I'm not sure whether we can do this in one place, or if we need to do this before every call to $this->gateway->completePurchase() i.e.
\Drupal\commerce_dps\PaymentExpress\CommercePxPay::onNotify
\Drupal\commerce_dps\PaymentExpress\CommercePxPay::onCancel
\Drupal\commerce_dps\PaymentExpress\CommercePxPay::onReturn

If anyone has suggestions? In the meantime I'll roll a patch / create merge request...

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇳🇿New Zealand djroshi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024