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.