Commerce payment state 'capture_completed' renamed to 'completed'.

Created on 12 January 2023, over 1 year ago
Updated 12 January 2024, 9 months ago

Hello,

I was trying to figure out why the order balance wasn't updating after successful payment. See image.

I can see there are a lot of issues relating to callbacks etc but I found this issue elsewhere:

https://www.drupal.org/project/commerce_mollie/issues/2976482 β†’

I could only find one instance of capture_completed in the code and that was at line 573 in WorldpayRedirect.php

if ($order instanceof OrderInterface && $request->request->get('transStatus') === 'Y') {
      $payment = $this->createPayment($request->request->all(), $order);
      $payment->state = 'capture_completed';
      $payment->save();

      $logLevel = 'info';
      $logMessage = 'OK Payment callback received from WorldPay for order %order_id with status code %transID';
      $logContext = [
        '%order_id' => $order->id(),
        '%transID' => $request->request->get('transId'),
      ];
      $this->logger->log($logLevel, $logMessage, $logContext);

      $build += [
        '#theme' => 'commerce_worldpay_success',
        '#transaction_id' => $request->request->get('transId'),
        '#order_id' => $order->id(),
        '#return_url' => $this->buildReturnUrl($order),
        '#cache' => ['max-age' => 0],
      ];
    }

Problem/Motivation

The commerce payment state 'capture_completed' was renamed to 'completed'. This was done in https://www.drupal.org/project/commerce/releases/8.x-2.0-rc1 β†’ with issue #2883704: Update the payment data model for RC1 .

Expected behaviour:
Payment has status 'completed' with label 'Completed'.

Real behaviour:
Payment has status 'capture_completed' with label 'capture_completed'.

I'm not sure if this will make a difference but it looks to me the likely culprit for my issue. I'm waiting on an order to go through as I can't test locally.

πŸ› Bug report
Status

Fixed

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom milton_segretti

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

Merge Requests

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