Skip to content

Commit

Permalink
Merge pull request #396 from omise/release-v5.3.0
Browse files Browse the repository at this point in the history
Preparing release v5.3.0
  • Loading branch information
aashishgurung committed Aug 23, 2023
2 parents e0baea0 + b473c10 commit ad6bce7
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

### [v5.3.0 _(Aug 23, 2023)_](https://github.com/omise/omise-woocommerce/releases/tag/v5.3.0)
- Add Alipay+ on Thailand psp. (PR [#394](https://github.com/omise/omise-woocommerce/pull/394))
- Adding admin_notices action once all dependencies are loaded. (PR [#395](https://github.com/omise/omise-woocommerce/pull/395))

### [v5.2.1 _(Aug 9, 2023)_](https://github.com/omise/omise-woocommerce/releases/tag/v5.2.1)
- Fixed installment payment when admin manually pay for order. (PR [#388](https://github.com/omise/omise-woocommerce/pull/388))
- Fixed Japanese translation issue in secure form. (PR [#389](https://github.com/omise/omise-woocommerce/pull/389))
Expand Down
4 changes: 2 additions & 2 deletions includes/gateway/class-omise-payment-alipayplus.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Omise_Payment_Alipay_Hk extends Omise_Payment_Alipayplus {
public function __construct() {
$source = 'alipay_hk';
$title = 'AlipayHK';
$countries = array( 'SG' );
$countries = array( 'SG', 'TH' );
parent::__construct( $source, $title, $countries );
}
}
Expand All @@ -131,7 +131,7 @@ class Omise_Payment_Kakaopay extends Omise_Payment_Alipayplus {
public function __construct() {
$source = 'kakaopay';
$title = 'Kakao Pay';
$countries = array( 'SG' );
$countries = array( 'SG', 'TH' );
parent::__construct( $source, $title, $countries );
}
}
2 changes: 1 addition & 1 deletion includes/gateway/class-omise-payment-touch-n-go.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct() {

$this->title = $this->get_option( 'title' );
$this->description = $this->get_option( 'description' );
$this->restricted_countries = array( 'SG', 'MY' );
$this->restricted_countries = array( 'SG', 'MY', 'TH' );

add_action( 'woocommerce_api_' . $this->id . '_callback', 'Omise_Callback::execute' );
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
Expand Down
12 changes: 9 additions & 3 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.2.1
* Version: 5.3.0
* 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.2.1';
public $version = '5.3.0';

/**
* The Omise Instance.
Expand Down Expand Up @@ -51,7 +51,6 @@ public function __construct()
add_action('plugins_loaded', array($this, 'check_dependencies'));
add_action('woocommerce_init', array($this, 'init'));
do_action('omise_initiated');
add_action('admin_notices', [$this, 'embedded_form_notice']);
}

/**
Expand Down Expand Up @@ -125,6 +124,13 @@ public function init()
$this->register_ajax_actions();

prepare_omise_myaccount_panel();

// adding action after all dependencies are loaded.
if (static::$can_initiate) {
// Moving here because the class used in the function could not be found on uninstall
add_action('admin_notices', [$this, 'embedded_form_notice']);
return;
}
}

/**
Expand Down
7 changes: 6 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 wallet, woocommerce payment
Requires at least: 4.3.1
Tested up to: 6.0.2
Stable tag: 5.2.1
Stable tag: 5.3.0
License: MIT
License URI: https://opensource.org/licenses/MIT

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

== Changelog ==

= 5.3.0 =

- Add Alipay+ on Thailand psp. (PR [#394](https://github.com/omise/omise-woocommerce/pull/394))
- Adding admin_notices action once all dependencies are loaded. (PR [#395](https://github.com/omise/omise-woocommerce/pull/395))

= 5.2.1 =

- Fix installment payment when admin manually pay for order. (PR [#388](https://github.com/omise/omise-woocommerce/pull/388))
Expand Down
35 changes: 35 additions & 0 deletions tests/unit/includes/gateway/class-omise-offsite-test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use PHPunit\Framework\TestCase;
use Mockery;

abstract class Offsite_Test extends TestCase
{
public function setUp(): void
{
// Mocking the parent class
$offsite = Mockery::mock('overload:Omise_Payment_Offsite');
$offsite->shouldReceive('init_settings');
$offsite->shouldReceive('get_option');
$offsite->shouldReceive('get_provider');

// mocking WP built-in functions
if (!function_exists('wp_kses')) {
function wp_kses() {}
}

if (!function_exists('add_action')) {
function add_action() {}
}

require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-alipayplus.php';
}

/**
* close mockery after tests are done
*/
public function teardown(): void
{
Mockery::close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

require_once __DIR__ . '/class-omise-offsite-test.php';

class Omise_Payment_Alipay_Hk_Test extends Offsite_Test
{
public function setUp(): void
{
parent::setUp();
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-alipayplus.php';
}

/**
* @test
*/
public function restrictedCountriesHasRequiredCountries()
{
$obj = new Omise_Payment_Alipay_Hk();
$expectedCountries = ['SG', 'TH'];

$this->assertEqualsCanonicalizing($expectedCountries, $obj->restricted_countries);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

require_once __DIR__ . '/class-omise-offsite-test.php';

class Omise_Payment_Kakaopay_Test extends Offsite_Test
{
public function setUp(): void
{
parent::setUp();
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-alipayplus.php';
}

/**
* @test
*/
public function restrictedCountriesHasRequiredCountries()
{
$obj = new Omise_Payment_Kakaopay();
$expectedCountries = ['SG', 'TH'];

$this->assertEqualsCanonicalizing($expectedCountries, $obj->restricted_countries);
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
<?php

use PHPUnit\Framework\TestCase;
use Mockery;
require_once __DIR__ . '/class-omise-offsite-test.php';

class Omise_Payment_Installment_Test extends TestCase
class Omise_Payment_Installment_Test extends Offsite_Test
{
public function setUp(): void
{
// Mocking the parent class
$offsite = Mockery::mock('overload:Omise_Payment_Offsite');
$offsite->shouldReceive('init_settings');
$offsite->shouldReceive('get_option');

// mocking WP built-in functions
if (!function_exists('wp_kses')) {
function wp_kses() {}
}

if (!function_exists('add_action')) {
function add_action() {}
}

parent::setUp();
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-installment.php';
}

/**
* close mockery after tests are done
*/
public function teardown(): void
{
Mockery::close();
}

/**
* @test
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

require_once __DIR__ . '/class-omise-offsite-test.php';

class Omise_Payment_TouchNGo_Test extends Offsite_Test
{
public function setUp(): void
{
parent::setUp();
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-touch-n-go.php';
}

/**
* @test
*/
public function restrictedCountriesHasRequiredCountries()
{
$obj = new Omise_Payment_TouchNGo();
$expectedCountries = ['SG', 'MY', 'TH'];

$this->assertEqualsCanonicalizing($expectedCountries, $obj->restricted_countries);
}
}

0 comments on commit ad6bce7

Please sign in to comment.