Plugin Directory

Changeset 3331857


Ignore:
Timestamp:
07/22/2025 05:05:19 AM (9 months ago)
Author:
omise
Message:

Update to version 6.2.2 from GitHub

Location:
omise
Files:
4 added
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • omise/tags/6.2.2/CHANGELOG.md

    r3312403 r3331857  
    11# CHANGELOG
     2
     3## [v6.2.2 _(Jul 22, 2025)_](https://github.com/omise/omise-woocommerce/releases/tag/v6.2.2)
     4
     5- Add authentication to Paynow status endpoint. (PR: [#530](https://github.com/omise/omise-woocommerce/issues/530))
    26
    37## [v6.2.1 _(Jun 16, 2025)_](https://github.com/omise/omise-woocommerce/releases/tag/v6.2.1)
  • omise/tags/6.2.2/assets/css/omise-css.css

    r3182037 r3331857  
    122122.omise-paynow-payment-status .green-check {
    123123    background: url('../images/green-check.svg') no-repeat;
    124     height: 150px;
    125     width: 116px;
    126     margin: auto;
     124    background-size: contain;
     125    background-position: center;
     126    height: 50px;
     127    margin: 10px auto;
    127128}
    128129
  • omise/tags/6.2.2/includes/class-omise-rest-webhooks-controller.php

    r3083045 r3331857  
    11<?php
    2 defined( 'ABSPATH' ) or die( 'No direct script access allowed.' );
     2defined( 'ABSPATH' ) || die( 'No direct script access allowed.' );
    33
    44if ( class_exists( 'Omise_Rest_Webhooks_Controller' ) ) {
     
    2222     * @var string
    2323     */
    24     const PAYNOW_CHARGE_STATUS_ENDPOINT = 'paynow-payment-status';
     24    const ENDPOINT_ORDER_STATUS = 'order-status';
    2525
    2626    /**
     
    4545        register_rest_route(
    4646            self::ENDPOINT_NAMESPACE,
    47             '/' . self::PAYNOW_CHARGE_STATUS_ENDPOINT,
     47            '/' . self::ENDPOINT_ORDER_STATUS,
    4848            array(
    4949                'methods' => WP_REST_Server::READABLE,
    50                 'callback' => array( $this, 'callback_paynow_payment_status' ),
    51                 'permission_callback' => self::RETURN_TRUE
     50                'callback' => array( $this, 'callback_get_order_status' ),
     51                'permission_callback' => self::RETURN_TRUE,
    5252            )
    5353        );
     
    8181     * @return WP_Error|WP_REST_Response
    8282     */
    83     public function callback_paynow_payment_status($request) {
    84         $order_id = $request->get_param('order_id');
    85         $data['status'] =  false;
    86         if(isset( $order_id )) {
    87             $order = new WC_Order( $order_id );
    88             if(isset($order)) {
    89                 $data['status'] =  $order->get_status();
    90             }
     83    public function callback_get_order_status( $request ) {
     84        $nonce = $request->get_param( '_nonce' );
     85        $order_key = $request->get_param( 'key' );
     86
     87        if ( ! wp_verify_nonce( $nonce, 'get_order_status_' . $order_key ) ) {
     88            return new WP_Error( 'omise_rest_invalid_nonce', __( 'Invalid nonce.', 'omise' ), [ 'status' => 403 ] );
    9189        }
    92         return rest_ensure_response( $data );
     90
     91        $order_id = wc_get_order_id_by_order_key( $order_key );
     92        $order = wc_get_order( $order_id );
     93
     94        if ( ! $order ) {
     95            return new WP_Error( 'omise_rest_order_not_found', __( 'Order not found.', 'omise' ), [ 'status' => 404 ] );
     96        }
     97
     98        return rest_ensure_response( [ 'status' => $order->get_status() ] );
    9399    }
    94100}
  • omise/tags/6.2.2/includes/gateway/abstract-omise-payment-offline.php

    r3308831 r3331857  
    1313
    1414    protected $enabled_processing_notification = true;
     15
     16    public function __construct()
     17    {
     18        parent::__construct();
     19    }
    1520
    1621    /**
  • omise/tags/6.2.2/includes/gateway/class-omise-payment-paynow.php

    r3256918 r3331857  
    9595
    9696        if ( 'view' === $context ) : ?>
     97            <?php
     98                $order_key = $order->get_order_key();
     99                $get_order_status_url = add_query_arg(
     100                    [
     101                        'key' => $order_key,
     102                        '_nonce' => wp_create_nonce( 'get_order_status_' . $order_key ),
     103                        '_wpnonce' => wp_create_nonce('wp_rest'),
     104                    ],
     105                    get_rest_url( null, 'omise/order-status')
     106                );
     107            ?>
    97108            <div class="omise omise-paynow-details" <?php echo 'email' === $context ? 'style="margin-bottom: 4em; text-align:center;"' : ''; ?>>
    98109                <div class="omise omise-paynow-logo"></div>
     
    117128            </div>
    118129            <script type="text/javascript">
    119                 var xhr_param_name          = "?order_id="+"<?php echo $this->order->get_id() ?>";
    120                     refresh_status_url      = "<?php echo get_rest_url( null, 'omise/paynow-payment-status' ); ?>"+xhr_param_name;
    121                     class_payment_pending   = document.getElementsByClassName("pending");
    122                     class_payment_completed = document.getElementsByClassName("completed");
    123                     class_payment_timeout   = document.getElementsByClassName("timeout");
    124                     class_qr_image          = document.querySelector(".omise.omise-paynow-qrcode > img");
     130                <!--
     131                var classPaymentPending   = document.getElementsByClassName("pending");
     132                var classPaymentCompleted = document.getElementsByClassName("completed");
     133                var classPaymentTimeout   = document.getElementsByClassName("timeout");
     134                var classQrImage          = document.querySelector(".omise.omise-paynow-qrcode > img");
    125135
    126                 var refresh_payment_status = function(intervalIterator) {
     136                var refreshPaymentStatus = function(intervalIterator) {
    127137                    var xmlhttp = new XMLHttpRequest();
    128138                    xmlhttp.addEventListener("load", function() {
    129139                        if (this.status == 200) {
    130140                            var chargeState = JSON.parse(this.responseText);
    131                             if(chargeState.status == "processing") {
    132                                 class_qr_image.style.display = "none";
    133                                 class_payment_pending[0].style.display = "none";
    134                                 class_payment_completed[0].style.display = "block";
     141                            if (chargeState.status == "processing") {
     142                                classQrImage.style.display = "none";
     143                                classPaymentPending[0].style.display = "none";
     144                                classPaymentCompleted[0].style.display = "block";
    135145                                clearInterval(intervalIterator);
    136146                            }
     147                        } else if (this.status == 403) {
     148                            clearInterval(intervalIterator);
    137149                        }
    138150                    });
    139                     xmlhttp.open("GET", refresh_status_url, true);
     151                    xmlhttp.open('GET', '<?php echo $get_order_status_url ?>', true);
    140152                    xmlhttp.send();
    141153                },
     
    152164                        }
    153165                        if((timer % 5) == 0 && timer >= 5) {
    154                             refresh_payment_status(intervalIterator);
     166                            refreshPaymentStatus(intervalIterator);
    155167                        }
    156168                        if(timer == 0) {
    157                             class_payment_pending[0].style.display = "none";
    158                             class_payment_timeout[0].style.display = "block";
    159                             class_qr_image.style.display = "none";
     169                            classPaymentPending[0].style.display = "none";
     170                            classPaymentTimeout[0].style.display = "block";
     171                            classQrImage.style.display = "none";
    160172                            clearInterval(intervalIterator);
    161173                        }
     
    168180                    intervalTime(duration, display);
    169181                };
     182            //-->
    170183            </script>
    171184        <?php elseif ( 'email' === $context && !$order->has_status('failed')) : ?>
  • omise/tags/6.2.2/omise-woocommerce.php

    r3312403 r3331857  
    55 * Plugin URI:  https://www.omise.co/woocommerce
    66 * Description: Omise Payments is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Omise Payment Gateway's payment methods to WooCommerce.
    7  * Version:     6.2.1
     7 * Version:     6.2.2
    88 * Author:      Omise and contributors
    99 * Author URI:  https://github.com/omise/omise-woocommerce/graphs/contributors
     
    2424     * @var string
    2525     */
    26     public $version = '6.2.1';
     26    public $version = '6.2.2';
    2727
    2828    /**
  • omise/tags/6.2.2/phpcs.xml

    r3312403 r3331857  
    1919    <exclude name="Squiz.Commenting.FileComment.Missing" />
    2020    <exclude name="Squiz.Commenting.FunctionComment.Missing" />
     21    <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
    2122    <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
     23    <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
    2224    <exclude name="Squiz.Commenting.VariableComment.Missing" />
    2325
     
    3638    </properties>
    3739  </rule>
     40
     41  <rule ref="WordPress.Security.ValidatedSanitizedInput.InputNotSanitized">
     42    <type>warning</type>
     43  </rule>
     44  <rule ref="WordPress.Security.ValidatedSanitizedInput.MissingUnslash">
     45    <type>warning</type>
     46  </rule>
    3847</ruleset>
  • omise/tags/6.2.2/readme.txt

    r3312403 r3331857  
    44Requires at least: 4.3.1
    55Tested up to: 6.8.1
    6 Stable tag: 6.2.1
     6Stable tag: 6.2.2
    77License: MIT
    88License URI: https://opensource.org/licenses/MIT
     
    3434
    3535== Changelog ==
     36
     37= 6.2.2 =
     38
     39- Add authentication to Paynow status endpoint. (PR: [#530](https://github.com/omise/omise-woocommerce/issues/530))
    3640
    3741= 6.2.1 =
  • omise/tags/6.2.2/tests/unit/includes/gateway/bootstrap-test-setup.php

    r3312403 r3331857  
    1616        return self::$is_available;
    1717    }
     18}
     19
     20/**
     21 * Temporary mock for WP_* class
     22 * In the future, we should move to use WP_UnitTestCase
     23 */
     24class WP_Error
     25{
     26    public function __construct(
     27        public $code = '',
     28        public $message = '',
     29        public $data = ''
     30    ) {
     31    }
     32}
     33class WP_REST_Server_Stub
     34{
     35    const EDITABLE = 'POST';
     36    const READABLE = 'GET';
    1837}
    1938
     
    119138        $omiseSettingMock = Mockery::mock('alias:Omise_Setting');
    120139
    121         $omiseSettingMock->shouldReceive('instance')->andReturn($omiseSettingMock);
    122         $omiseSettingMock->shouldReceive('public_key')->andReturn($pkey);
    123         $omiseSettingMock->shouldReceive('secret_key')->andReturn($skey);
     140        $omiseSettingMock->allows([
     141            'instance' => $omiseSettingMock,
     142            'public_key' => $pkey,
     143            'secret_key' => $skey,
     144        ]);
     145        $omiseSettingMock->shouldReceive('get_settings')->andReturn([])->byDefault();
    124146
    125147        return $omiseSettingMock;
  • omise/tags/6.2.2/tests/unit/includes/gateway/class-omise-payment-test.php

    r3308831 r3331857  
    204204  }
    205205
    206   protected function mockOmiseSetting($pkey, $skey)
    207   {
    208     $omiseSettingMock = parent::mockOmiseSetting($pkey, $skey);
    209     $omiseSettingMock->shouldReceive('get_settings')->andReturn([])->byDefault();
    210 
    211     return $omiseSettingMock;
    212   }
    213 
    214206  private function omisePaymentImpl($sourceType)
    215207  {
  • omise/trunk/CHANGELOG.md

    r3312403 r3331857  
    11# CHANGELOG
     2
     3## [v6.2.2 _(Jul 22, 2025)_](https://github.com/omise/omise-woocommerce/releases/tag/v6.2.2)
     4
     5- Add authentication to Paynow status endpoint. (PR: [#530](https://github.com/omise/omise-woocommerce/issues/530))
    26
    37## [v6.2.1 _(Jun 16, 2025)_](https://github.com/omise/omise-woocommerce/releases/tag/v6.2.1)
  • omise/trunk/assets/css/omise-css.css

    r3182037 r3331857  
    122122.omise-paynow-payment-status .green-check {
    123123    background: url('../images/green-check.svg') no-repeat;
    124     height: 150px;
    125     width: 116px;
    126     margin: auto;
     124    background-size: contain;
     125    background-position: center;
     126    height: 50px;
     127    margin: 10px auto;
    127128}
    128129
  • omise/trunk/includes/class-omise-rest-webhooks-controller.php

    r3083045 r3331857  
    11<?php
    2 defined( 'ABSPATH' ) or die( 'No direct script access allowed.' );
     2defined( 'ABSPATH' ) || die( 'No direct script access allowed.' );
    33
    44if ( class_exists( 'Omise_Rest_Webhooks_Controller' ) ) {
     
    2222     * @var string
    2323     */
    24     const PAYNOW_CHARGE_STATUS_ENDPOINT = 'paynow-payment-status';
     24    const ENDPOINT_ORDER_STATUS = 'order-status';
    2525
    2626    /**
     
    4545        register_rest_route(
    4646            self::ENDPOINT_NAMESPACE,
    47             '/' . self::PAYNOW_CHARGE_STATUS_ENDPOINT,
     47            '/' . self::ENDPOINT_ORDER_STATUS,
    4848            array(
    4949                'methods' => WP_REST_Server::READABLE,
    50                 'callback' => array( $this, 'callback_paynow_payment_status' ),
    51                 'permission_callback' => self::RETURN_TRUE
     50                'callback' => array( $this, 'callback_get_order_status' ),
     51                'permission_callback' => self::RETURN_TRUE,
    5252            )
    5353        );
     
    8181     * @return WP_Error|WP_REST_Response
    8282     */
    83     public function callback_paynow_payment_status($request) {
    84         $order_id = $request->get_param('order_id');
    85         $data['status'] =  false;
    86         if(isset( $order_id )) {
    87             $order = new WC_Order( $order_id );
    88             if(isset($order)) {
    89                 $data['status'] =  $order->get_status();
    90             }
     83    public function callback_get_order_status( $request ) {
     84        $nonce = $request->get_param( '_nonce' );
     85        $order_key = $request->get_param( 'key' );
     86
     87        if ( ! wp_verify_nonce( $nonce, 'get_order_status_' . $order_key ) ) {
     88            return new WP_Error( 'omise_rest_invalid_nonce', __( 'Invalid nonce.', 'omise' ), [ 'status' => 403 ] );
    9189        }
    92         return rest_ensure_response( $data );
     90
     91        $order_id = wc_get_order_id_by_order_key( $order_key );
     92        $order = wc_get_order( $order_id );
     93
     94        if ( ! $order ) {
     95            return new WP_Error( 'omise_rest_order_not_found', __( 'Order not found.', 'omise' ), [ 'status' => 404 ] );
     96        }
     97
     98        return rest_ensure_response( [ 'status' => $order->get_status() ] );
    9399    }
    94100}
  • omise/trunk/includes/gateway/abstract-omise-payment-offline.php

    r3308831 r3331857  
    1313
    1414    protected $enabled_processing_notification = true;
     15
     16    public function __construct()
     17    {
     18        parent::__construct();
     19    }
    1520
    1621    /**
  • omise/trunk/includes/gateway/class-omise-payment-paynow.php

    r3256918 r3331857  
    9595
    9696        if ( 'view' === $context ) : ?>
     97            <?php
     98                $order_key = $order->get_order_key();
     99                $get_order_status_url = add_query_arg(
     100                    [
     101                        'key' => $order_key,
     102                        '_nonce' => wp_create_nonce( 'get_order_status_' . $order_key ),
     103                        '_wpnonce' => wp_create_nonce('wp_rest'),
     104                    ],
     105                    get_rest_url( null, 'omise/order-status')
     106                );
     107            ?>
    97108            <div class="omise omise-paynow-details" <?php echo 'email' === $context ? 'style="margin-bottom: 4em; text-align:center;"' : ''; ?>>
    98109                <div class="omise omise-paynow-logo"></div>
     
    117128            </div>
    118129            <script type="text/javascript">
    119                 var xhr_param_name          = "?order_id="+"<?php echo $this->order->get_id() ?>";
    120                     refresh_status_url      = "<?php echo get_rest_url( null, 'omise/paynow-payment-status' ); ?>"+xhr_param_name;
    121                     class_payment_pending   = document.getElementsByClassName("pending");
    122                     class_payment_completed = document.getElementsByClassName("completed");
    123                     class_payment_timeout   = document.getElementsByClassName("timeout");
    124                     class_qr_image          = document.querySelector(".omise.omise-paynow-qrcode > img");
     130                <!--
     131                var classPaymentPending   = document.getElementsByClassName("pending");
     132                var classPaymentCompleted = document.getElementsByClassName("completed");
     133                var classPaymentTimeout   = document.getElementsByClassName("timeout");
     134                var classQrImage          = document.querySelector(".omise.omise-paynow-qrcode > img");
    125135
    126                 var refresh_payment_status = function(intervalIterator) {
     136                var refreshPaymentStatus = function(intervalIterator) {
    127137                    var xmlhttp = new XMLHttpRequest();
    128138                    xmlhttp.addEventListener("load", function() {
    129139                        if (this.status == 200) {
    130140                            var chargeState = JSON.parse(this.responseText);
    131                             if(chargeState.status == "processing") {
    132                                 class_qr_image.style.display = "none";
    133                                 class_payment_pending[0].style.display = "none";
    134                                 class_payment_completed[0].style.display = "block";
     141                            if (chargeState.status == "processing") {
     142                                classQrImage.style.display = "none";
     143                                classPaymentPending[0].style.display = "none";
     144                                classPaymentCompleted[0].style.display = "block";
    135145                                clearInterval(intervalIterator);
    136146                            }
     147                        } else if (this.status == 403) {
     148                            clearInterval(intervalIterator);
    137149                        }
    138150                    });
    139                     xmlhttp.open("GET", refresh_status_url, true);
     151                    xmlhttp.open('GET', '<?php echo $get_order_status_url ?>', true);
    140152                    xmlhttp.send();
    141153                },
     
    152164                        }
    153165                        if((timer % 5) == 0 && timer >= 5) {
    154                             refresh_payment_status(intervalIterator);
     166                            refreshPaymentStatus(intervalIterator);
    155167                        }
    156168                        if(timer == 0) {
    157                             class_payment_pending[0].style.display = "none";
    158                             class_payment_timeout[0].style.display = "block";
    159                             class_qr_image.style.display = "none";
     169                            classPaymentPending[0].style.display = "none";
     170                            classPaymentTimeout[0].style.display = "block";
     171                            classQrImage.style.display = "none";
    160172                            clearInterval(intervalIterator);
    161173                        }
     
    168180                    intervalTime(duration, display);
    169181                };
     182            //-->
    170183            </script>
    171184        <?php elseif ( 'email' === $context && !$order->has_status('failed')) : ?>
  • omise/trunk/omise-woocommerce.php

    r3312403 r3331857  
    55 * Plugin URI:  https://www.omise.co/woocommerce
    66 * Description: Omise Payments is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Omise Payment Gateway's payment methods to WooCommerce.
    7  * Version:     6.2.1
     7 * Version:     6.2.2
    88 * Author:      Omise and contributors
    99 * Author URI:  https://github.com/omise/omise-woocommerce/graphs/contributors
     
    2424     * @var string
    2525     */
    26     public $version = '6.2.1';
     26    public $version = '6.2.2';
    2727
    2828    /**
  • omise/trunk/phpcs.xml

    r3312403 r3331857  
    1919    <exclude name="Squiz.Commenting.FileComment.Missing" />
    2020    <exclude name="Squiz.Commenting.FunctionComment.Missing" />
     21    <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
    2122    <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
     23    <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
    2224    <exclude name="Squiz.Commenting.VariableComment.Missing" />
    2325
     
    3638    </properties>
    3739  </rule>
     40
     41  <rule ref="WordPress.Security.ValidatedSanitizedInput.InputNotSanitized">
     42    <type>warning</type>
     43  </rule>
     44  <rule ref="WordPress.Security.ValidatedSanitizedInput.MissingUnslash">
     45    <type>warning</type>
     46  </rule>
    3847</ruleset>
  • omise/trunk/readme.txt

    r3312403 r3331857  
    44Requires at least: 4.3.1
    55Tested up to: 6.8.1
    6 Stable tag: 6.2.1
     6Stable tag: 6.2.2
    77License: MIT
    88License URI: https://opensource.org/licenses/MIT
     
    3434
    3535== Changelog ==
     36
     37= 6.2.2 =
     38
     39- Add authentication to Paynow status endpoint. (PR: [#530](https://github.com/omise/omise-woocommerce/issues/530))
    3640
    3741= 6.2.1 =
  • omise/trunk/tests/unit/includes/gateway/bootstrap-test-setup.php

    r3312403 r3331857  
    1616        return self::$is_available;
    1717    }
     18}
     19
     20/**
     21 * Temporary mock for WP_* class
     22 * In the future, we should move to use WP_UnitTestCase
     23 */
     24class WP_Error
     25{
     26    public function __construct(
     27        public $code = '',
     28        public $message = '',
     29        public $data = ''
     30    ) {
     31    }
     32}
     33class WP_REST_Server_Stub
     34{
     35    const EDITABLE = 'POST';
     36    const READABLE = 'GET';
    1837}
    1938
     
    119138        $omiseSettingMock = Mockery::mock('alias:Omise_Setting');
    120139
    121         $omiseSettingMock->shouldReceive('instance')->andReturn($omiseSettingMock);
    122         $omiseSettingMock->shouldReceive('public_key')->andReturn($pkey);
    123         $omiseSettingMock->shouldReceive('secret_key')->andReturn($skey);
     140        $omiseSettingMock->allows([
     141            'instance' => $omiseSettingMock,
     142            'public_key' => $pkey,
     143            'secret_key' => $skey,
     144        ]);
     145        $omiseSettingMock->shouldReceive('get_settings')->andReturn([])->byDefault();
    124146
    125147        return $omiseSettingMock;
  • omise/trunk/tests/unit/includes/gateway/class-omise-payment-test.php

    r3308831 r3331857  
    204204  }
    205205
    206   protected function mockOmiseSetting($pkey, $skey)
    207   {
    208     $omiseSettingMock = parent::mockOmiseSetting($pkey, $skey);
    209     $omiseSettingMock->shouldReceive('get_settings')->andReturn([])->byDefault();
    210 
    211     return $omiseSettingMock;
    212   }
    213 
    214206  private function omisePaymentImpl($sourceType)
    215207  {
Note: See TracChangeset for help on using the changeset viewer.