Skip to content

Commit

Permalink
Merge pull request #441 from omise/release-v5.8.1
Browse files Browse the repository at this point in the history
Release v5.8.1
  • Loading branch information
aashishgurung authored Mar 7, 2024
2 parents f7aaa0a + a27a7fc commit 52380a4
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions includes/gateway/abstract-omise-payment-base-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
),
];
Expand Down
11 changes: 5 additions & 6 deletions includes/gateway/traits/charge-request-builder-trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
];

Expand All @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions omise-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,7 +22,7 @@ class Omise
*
* @var string
*/
public $version = '5.8.0';
public $version = '5.8.1';

/**
* The Omise Instance.
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 52380a4

Please sign in to comment.