Payment methods are not saved on drupal side in case webhook was fired before return page was loaded.

Created on 9 January 2023, almost 2 years ago
Updated 1 May 2023, over 1 year ago

If the webhook is triggered too early, the status validation in the PaymentCheckoutController cannot be the same. This way, the onReturn() in the wallee module is never called and the payment method is not saved.

// commerce/modules/payment/src/Controller/PaymentCheckoutController.php
// Makes redirect if id's not equal
$this->validateStepId($step_id, $order);

//Never called, so the payment method can't save
$payment_gateway_plugin->onReturn($order, $request);

As fast workaround, i added a delay before the transaction webhook is called:
// commerce_wallee/src/Controller/WebhookController.php

  private function updateTransaction($paymentGatewayStorage, $data) {
    sleep(20);
    \Drupal::service('commerce_wallee.payment_sdk')->webhookTransaction($paymentGatewayStorage, $data);
  }
🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇭Switzerland ruvus Chur

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024