diff --git a/CHANGELOG.md b/CHANGELOG.md index 3817c622..94de67ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## [v5.8.1 _(Mar 7, 2024)_](https://github.com/omise/omise-woocommerce/releases/tag/v5.8.1) +- Revert "Use WC order number metadata". (PR [#440](https://github.com/omise/omise-woocommerce/pull/440)) + ## [v5.8.0 _(Mar 5, 2024)_](https://github.com/omise/omise-woocommerce/releases/tag/v5.8.0) - Add WeChat Pay. (PR [#434](https://github.com/omise/omise-woocommerce/pull/434)) - Use WC order number metadata. (PR [#435](https://github.com/omise/omise-woocommerce/pull/435)) diff --git a/README.md b/README.md index b97d7882..f9b01531 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ Opn Payments provides a set of APIs that help merchants of any size accept payme **Omise WooCommerce** is our official plugin providing support for processing payments on WooCommerce through Opn Payments. +## Security Warning + +**Please do NOT use Omise WooCommerce plugin versions less than 4.8, as they are outdated and have security vulnerabilities.** + + + ## Usage See our [official docs](https://docs.opn.ooo/woocommerce-plugin) for details on installation and configuration. diff --git a/includes/gateway/abstract-omise-payment-base-card.php b/includes/gateway/abstract-omise-payment-base-card.php index d61402a4..2707d17d 100644 --- a/includes/gateway/abstract-omise-payment-base-card.php +++ b/includes/gateway/abstract-omise-payment-base-card.php @@ -62,14 +62,13 @@ private function getOmiseCustomerId($user) { private function prepareChargeData($order_id, $order, $omise_customer_id, $card_id, $token) { $currency = $order->get_currency(); - $order_number = $order->get_order_number(); $data = [ 'amount' => Omise_Money::to_subunit($order->get_total(), $currency), 'currency' => $currency, - 'description' => 'WooCommerce Order id ' . $order_number, + 'description' => 'WooCommerce Order id ' . $order_id, 'return_uri' => $this->get_redirect_url('omise_callback', $order_id, $order), 'metadata' => $this->get_metadata( - $order_number, + $order_id, [ 'secure_form_enabled' => $this->getSecureFormState()] ), ]; diff --git a/includes/gateway/traits/charge-request-builder-trait.php b/includes/gateway/traits/charge-request-builder-trait.php index bdc04476..3ddd1e11 100644 --- a/includes/gateway/traits/charge-request-builder-trait.php +++ b/includes/gateway/traits/charge-request-builder-trait.php @@ -10,14 +10,13 @@ public function build_charge_request( ) { $currency = $order->get_currency(); - $order_number = $order->get_order_number(); - $description = 'WooCommerce Order id ' . $order_number; + $description = 'WooCommerce Order id ' . $order_id; $request = [ 'amount' => Omise_Money::to_subunit($order->get_total(), $currency), 'currency' => $currency, 'description' => $description, - 'metadata' => $this->get_metadata($order_number), + 'metadata' => $this->get_metadata($order_id), 'source' => [ 'type' => $source_type ] ]; @@ -41,13 +40,13 @@ public function build_charge_request( } /** - * @param string $order_number + * @param string $order_id * @param array $additionalData */ - public function get_metadata($order_number, $additionalData = []) + public function get_metadata($order_id, $additionalData = []) { // override order_id as a reference for webhook handlers. - $orderId = [ 'order_id' => $order_number ]; + $orderId = [ 'order_id' => $order_id ]; return array_merge($orderId, $additionalData); } diff --git a/omise-woocommerce.php b/omise-woocommerce.php index d97c1d9d..a02e9bbb 100644 --- a/omise-woocommerce.php +++ b/omise-woocommerce.php @@ -4,7 +4,7 @@ * Plugin Name: Opn Payments * Plugin URI: https://www.omise.co/woocommerce * Description: Opn Payments is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Opn Payments Payment Gateway's payment methods to WooCommerce. - * Version: 5.8.0 + * Version: 5.8.1 * Author: Opn Payments and contributors * Author URI: https://github.com/omise/omise-woocommerce/graphs/contributors * Text Domain: omise @@ -22,7 +22,7 @@ class Omise * * @var string */ - public $version = '5.8.0'; + public $version = '5.8.1'; /** * The Omise Instance. diff --git a/readme.txt b/readme.txt index 1de7f2b1..80593977 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: Opn Payments Tags: opn payments, payment, payment gateway, woocommerce plugin, omise, opn, installment, internet banking, alipay, paynow, truemoney, woocommerce payment Requires at least: 4.3.1 Tested up to: 6.4.2 -Stable tag: 5.8.0 +Stable tag: 5.8.1 License: MIT License URI: https://opensource.org/licenses/MIT @@ -34,6 +34,10 @@ From there: == Changelog == += 5.8.1 = + +- Revert "Use WC order number metadata". (PR [#440](https://github.com/omise/omise-woocommerce/pull/440)) + = 5.8.0 = - Add WeChat Pay. (PR [#434](https://github.com/omise/omise-woocommerce/pull/434)) diff --git a/tests/unit/includes/gateway/abstract-omise-payment-base-card-test.php b/tests/unit/includes/gateway/abstract-omise-payment-base-card-test.php index 3a70ebdf..cff4a717 100644 --- a/tests/unit/includes/gateway/abstract-omise-payment-base-card-test.php +++ b/tests/unit/includes/gateway/abstract-omise-payment-base-card-test.php @@ -62,8 +62,6 @@ public function getOrderMock($expectedAmount, $expectedCurrency) ->andReturn($expectedAmount); // in units $orderMock->shouldReceive('add_meta_data') ->andReturn(['order_id' => 'order_123']); - $orderMock->shouldReceive('get_order_number') - ->andReturn(1234); $orderMock->shouldReceive('get_user') ->andReturn((object)[ 'ID' => 'user_123', diff --git a/tests/unit/includes/gateway/traits/charge-request-builder-test.php b/tests/unit/includes/gateway/traits/charge-request-builder-test.php index 3366dcea..3ffe5cc4 100644 --- a/tests/unit/includes/gateway/traits/charge-request-builder-test.php +++ b/tests/unit/includes/gateway/traits/charge-request-builder-test.php @@ -34,8 +34,6 @@ public function getOrderMock($expectedAmount, $expectedCurrency) $orderMock->shouldReceive('get_total') ->andReturn($expectedAmount); // in units $orderMock->shouldReceive('add_meta_data'); - $orderMock->shouldReceive('get_order_number') - ->andReturn(1234); return $orderMock; }