From e6c08cc19d0e0c9222119e6da704412dbd768d16 Mon Sep 17 00:00:00 2001 From: guzzilar Date: Thu, 24 Sep 2015 17:12:18 +0700 Subject: [PATCH] Fix the process to re-check charge is completed in callback method of WooCommerce --- omise-wc-gateway.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/omise-wc-gateway.php b/omise-wc-gateway.php index 494a7496..516a1b63 100644 --- a/omise-wc-gateway.php +++ b/omise-wc-gateway.php @@ -356,6 +356,14 @@ public function omise_3ds_handler() WC()->cart->empty_cart(); header("Location: ".$confirmed_url); + die(); + } else { + if ($result->failure_code && $result->failure_message) { + $order->add_order_note('Charge was not completed, '.$result->failure_message); + wp_die($result->failure_message, "Charge was not completed", array( 'response' => 500 )); + } else { + wp_die("Charge still in progress", "Charge still in progress", array( 'response' => 500 )); + } } wp_die( "Access denied", "Access Denied", array( 'response' => 401 ) );