Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
inpsyde-maticluznar committed Nov 2, 2023
1 parent c68b40d commit b323b67
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/MerchantCapture/MerchantCaptureModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,24 @@ public function run(ContainerInterface $container): bool
add_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) {
return;
*/ $pluginId . '_after_webhook_action',
static function (Payment $payment, WC_Order $order) use ($container) {
if ($payment->isAuthorized()) {
if (!$payment->getAmountCaptured() == 0.0) {
return;
}
$order->set_status(SharedDataDictionary::STATUS_ON_HOLD);
$order->update_meta_data(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(self::ORDER_PAYMENT_STATUS_META_KEY, ManualCaptureStatus::STATUS_CAPTURED);
$order->save();
}
$order->set_status(SharedDataDictionary::STATUS_ON_HOLD);
$order->update_meta_data(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(self::ORDER_PAYMENT_STATUS_META_KEY, ManualCaptureStatus::STATUS_CAPTURED);
$order->save();
}
}, 10, 2);
},
10,
2
);

add_action('woocommerce_order_refunded', static function (int $orderId) use ($container) {
$order = wc_get_order($orderId);
Expand Down

0 comments on commit b323b67

Please sign in to comment.