Skip to content

Commit

Permalink
Merge pull request #501 from omise/release-v6.0.5
Browse files Browse the repository at this point in the history
Release v6.0.5
  • Loading branch information
Narum11 authored Jan 15, 2025
2 parents 6ea2ca5 + 197e62b commit 5bd4044
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## [v6.0.5 _(Jan 15, 2024)_](https://github.com/omise/omise-woocommerce/releases/tag/v6.0.5)
- Fix the issue of TrueMoney wallet not showing in payment options. (PR: [#500](https://github.com/omise/omise-woocommerce/pull/500))

## [v6.0.4 _(Jan 13, 2024)_](https://github.com/omise/omise-woocommerce/releases/tag/v6.0.4)
- Fix the issue of missing TrueMoney payment methods. (PR: [#496](https://github.com/omise/omise-woocommerce/pull/496))

Expand Down
12 changes: 12 additions & 0 deletions includes/class-omise-capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ public static function isFromCheckoutPage()
if (strpos($wp->request, $endpoint) === $len - strlen($endpoint)) {
return true;
}
} else {
$request_uri = $_SERVER['REQUEST_URI'];
$home_url = home_url();

$request_uri = strtok($request_uri, '?');
$home_url_path = rtrim(parse_url($home_url, PHP_URL_PATH), '/');
$path = trim(str_replace($home_url_path, '', $request_uri), '/');

$len = strlen($path);
if (strpos($path, $endpoint) === $len - strlen($endpoint)) {
return true;
}
}

if (isset($wp->query_vars['rest_route'])) {
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: 6.0.4
* Version: 6.0.5
* Author: Opn Payments and contributors
* Author URI: https://github.com/omise/omise-woocommerce/graphs/contributors
* Text Domain: omise
Expand All @@ -23,7 +23,7 @@ class Omise
*
* @var string
*/
public $version = '6.0.4';
public $version = '6.0.5';

/**
* 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.6.2
Stable tag: 6.0.4
Stable tag: 6.0.5
License: MIT
License URI: https://opensource.org/licenses/MIT

Expand Down Expand Up @@ -34,6 +34,10 @@ From there:

== Changelog ==

= 6.0.5 =

- Fix the issue of TrueMoney wallet not showing in payment options. (PR: [#500](https://github.com/omise/omise-woocommerce/pull/500))

= 6.0.4 =

- Fix the issue of missing TrueMoney payment methods. (PR: [#496](https://github.com/omise/omise-woocommerce/pull/496))
Expand Down
23 changes: 16 additions & 7 deletions tests/unit/includes/class-omise-capabilities-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,21 @@ public function truemoney_source_provider()
* @dataProvider ajax_call_to_store_api_provider
* @covers Omise_Capabilities
*/
public function test_ajax_call_to_store_api_calls_omise_capability_api($request, $query_vars, $expected)
public function test_ajax_call_to_store_api_calls_omise_capability_api($request, $query_vars, $server_request_uri, $expected)
{
if ($request || $query_vars) {
if ($request || $query_vars || $server_request_uri) {
$wp = new stdClass();
$wp->request = $request;
$wp->query_vars = $query_vars;
$GLOBALS['wp'] = $wp;
}
Brain\Monkey\Functions\expect('home_url')
->andReturn('/');

$_SERVER['REQUEST_URI'] = '/';
if ($server_request_uri) {
$_SERVER['REQUEST_URI'] = $server_request_uri;
}

$capabilities = new Omise_Capabilities;
$result = $capabilities::isFromCheckoutPage();
Expand All @@ -131,11 +138,13 @@ public function test_ajax_call_to_store_api_calls_omise_capability_api($request,
public function ajax_call_to_store_api_provider()
{
return [
[null, null, false], // empty to test empty wp
['wp-json/wc/store/v1/batch', [], true],
['wp-json/wc/store/v1/batch', ['rest_route' => '/wc/store/v1/batch'], true],
['', ['rest_route' => '/wc/store/v1/batch'], true],
['', '', false]
[null, null, null, false], // empty to test empty wp
['wp-json/wc/store/v1/batch', [], null, true],
['wp-json/wc/store/v1/batch', ['rest_route' => '/wc/store/v1/batch'], null, true],
['', ['rest_route' => '/wc/store/v1/batch'], null, true],
['', '', '/other/checkout', true],
['', '', '/checkout/other', false],
['', '', '/checkout?ewe=323', true],
];
}
}
Expand Down

0 comments on commit 5bd4044

Please sign in to comment.