Skip to content

Commit

Permalink
Add transaction ID to the authorized payment order
Browse files Browse the repository at this point in the history
  • Loading branch information
inpsyde-maticluznar committed Nov 2, 2023
1 parent a364a7e commit 1ba66bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/MerchantCapture/MerchantCaptureModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(
Expand Down

0 comments on commit 1ba66bc

Please sign in to comment.