diff --git a/IcepayForWoocommerce.php b/IcepayForWoocommerce.php index b85c4d2..dbef7ef 100644 --- a/IcepayForWoocommerce.php +++ b/IcepayForWoocommerce.php @@ -6,7 +6,7 @@ * Description: Accept payments on your WooCommerce store via ICEPAY. * Author: ICEPAY * Author URI: http://www.icepay.com - * Version: 1.0.8 + * Version: 1.0.9 * Copyright: Copyright © 2024 ICEPAY B.V. (https://icepay.com/) * Text Domain: icepay-for-woocommerce * Domain Path: /languages diff --git a/composer.json b/composer.json index 6eab6a9..67a912a 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "icepay/icepay-woocommerce", "description": "ICEPAY for WooCommerce", - "version": "1.0.8", + "version": "1.0.9", "type": "library", "keywords": [ "icepay", diff --git a/package-lock.json b/package-lock.json index 06153d3..5b1cfb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "icepay-for-woocommerce", - "version": "1.0.8", + "version": "1.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "icepay-for-woocommerce", - "version": "1.0.8", + "version": "1.0.9", "license": "GPLV3", "devDependencies": { "@woocommerce/dependency-extraction-webpack-plugin": "^3.0.1", diff --git a/package.json b/package.json index 926184a..91910dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "icepay-for-woocommerce", - "version": "1.0.8", + "version": "1.0.9", "description": "```bash cp .env.example .env docker compose up -d make install ```", "scripts": { "build": "wp-scripts build", diff --git a/src/Integration.php b/src/Integration.php index 4c9e6f2..5f4a522 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -11,7 +11,7 @@ class Integration { public const NAME = 'ICEPAY for WooCommerce'; public const ID = 'icepay-for-woocommerce'; - public const VERSION = '1.0.8'; + public const VERSION = '1.0.9'; public function __invoke(): void { $this->addSettings(); diff --git a/src/Order.php b/src/Order.php index face9d5..f29838d 100644 --- a/src/Order.php +++ b/src/Order.php @@ -1,29 +1,30 @@ 1, - 'meta_query' => [ - 'key' => 'icepay-payment-key', - 'value' => $key - ] - ] ); +class Order +{ + public static function FindOrderByKey(string $key): \WC_Order|null + { + $orders = wc_get_orders([ + 'limit' => 1, + 'meta_key' => 'icepay-payment-key', + 'meta_value' => $key, + 'meta_compare' => '=', + ]); - $orderId = current( $orders ) ? current( $orders )->get_id() : false; + $orderId = current($orders) ? current($orders)->get_id() : false; - if ( ! empty( $orderId ) ) { - $order = wc_get_order( $orderId ); - } + if (!empty($orderId)) { + $order = wc_get_order($orderId); + } - if ( ! empty( $order ) && $order->get_status() !== 'trash' ) { - return $order; - } + if (!empty($order) && $order->get_status() !== 'trash') { + return $order; + } - return null; - } + return null; + } }