From 1ba66bcd14ef06739d2ddb5d17f2d0aa46f383fb Mon Sep 17 00:00:00 2001 From: inpsyde-maticluznar Date: Thu, 2 Nov 2023 12:57:43 +0100 Subject: [PATCH] Add transaction ID to the authorized payment order --- src/MerchantCapture/MerchantCaptureModule.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MerchantCapture/MerchantCaptureModule.php b/src/MerchantCapture/MerchantCaptureModule.php index 9232061c..fa26227e 100644 --- a/src/MerchantCapture/MerchantCaptureModule.php +++ b/src/MerchantCapture/MerchantCaptureModule.php @@ -133,7 +133,9 @@ public function run(ContainerInterface $container): bool } add_action( - $pluginId . '_after_webhook_action', + /** + * @throws \WC_Data_Exception + */ $pluginId . '_after_webhook_action', static function (Payment $payment, WC_Order $order) use ($container) { if ($payment->isAuthorized()) { if (!$payment->getAmountCaptured() == 0.0) { @@ -144,6 +146,7 @@ static function (Payment $payment, WC_Order $order) use ($container) { self::ORDER_PAYMENT_STATUS_META_KEY, ManualCaptureStatus::STATUS_AUTHORIZED ); + $order->set_transaction_id($payment->id); $order->save(); } elseif ($payment->isPaid() && ($container->get('merchant.manual_capture.is_waiting'))($order)) { $order->update_meta_data(