Plugin Directory

Changeset 2771968


Ignore:
Timestamp:
08/18/2022 07:48:40 AM (4 years ago)
Author:
omise
Message:

Update to version 4.23.2 from GitHub

Location:
omise
Files:
32 added
36 edited
1 copied

Legend:

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

    r2766266 r2771968  
    11# CHANGELOG
     2
     3### [v4.23.2 _(Aug 18, 2022)_](https://github.com/omise/omise-woocommerce/releases/tag/v4.23.2)
     4
     5#### 👾 Bug Fixes
     6- Handle capabilities failed. (PR [#294](https://github.com/omise/omise-woocommerce/pull/294))
    27
    38### [v4.23.1 _(Aug 4, 2022)_](https://github.com/omise/omise-woocommerce/releases/tag/v4.23.1)
  • omise/tags/4.23.2/assets/javascripts/omise-payment-form-handler.js

    r2766266 r2771968  
    2323       
    2424        $form.prepend( $ulError );
    25         $("html, body").animate({
    26              scrollTop:0
    27              },"slow");
     25        $("html, body").animate({ scrollTop:0 },"slow");
    2826    }
    2927   
     
    7169                });
    7270
    73                 let errors                  = [],
    74                     omise_card              = {},
     71                let errors = [],
     72                    omise_card = {},
    7573                    omise_card_number_field = 'number',
    76                     omise_card_fields       = {
    77                         'name'             : $( '#omise_card_name' ),
    78                         'number'           : $( '#omise_card_number' ),
     74                    omise_card_state_field = 'state',
     75                    omise_card_fields = {
     76                        'name' : $( '#omise_card_name' ),
     77                        'number' : $( '#omise_card_number' ),
    7978                        'expiration_month' : $( '#omise_card_expiration_month' ),
    80                         'expiration_year'  : $( '#omise_card_expiration_year' ),
    81                         'security_code'    : $( '#omise_card_security_code' )
     79                        'expiration_year' : $( '#omise_card_expiration_year' ),
     80                        'security_code' : $( '#omise_card_security_code' ),
     81                        'city' : $( '#billing_city' ),
     82                        'state' : $( '#billing_state' ),
     83                        'country' : $( '#billing_country' ),
     84                        'postal_code' : $( '#billing_postcode' ),
     85                        'street1' : $( '#billing_address_1' )
    8286                    };
    8387
    8488                $.each( omise_card_fields, function( index, field ) {
    85                     omise_card[ index ] = (index === omise_card_number_field) ? field.val().replace(/\s/g, '') : field.val();
     89                    if (index === omise_card_state_field) {
     90                        omise_card[ index ] = field.find(":selected").text();
     91                    } else {
     92                        omise_card[ index ] = (index === omise_card_number_field) ? field.val().replace(/\s/g, '') : field.val();
     93                    }
     94
    8695                    if ( "" === omise_card[ index ] ) {
    8796                        errors.push( omise_params[ 'required_card_' + index ] );
     
    102111                        if (statusCode == 200) {
    103112                            $.each( omise_card_fields, function( index, field ) {
    104                                 field.val( '' );
     113                                const sensitiveDataIndex = ['name', 'number', 'expiration_year', 'expiration_month', 'security_code'];
     114                                if (sensitiveDataIndex.includes(index)) {
     115                                    field.val( '' );
     116                                }
    105117                            } );
    106118                            $form.append( '<input type="hidden" class="omise_token" name="omise_token" value="' + response.id + '"/>' );
     
    110122                        };
    111123                    });
    112                 }else{
     124                } else {
    113125                    showError( omise_params.cannot_load_omisejs + '<br/>' + omise_params.check_internet_connection );
    114126                    $form.unblock();
  • omise/tags/4.23.2/includes/backends/class-omise-backend-fpx.php

    r2737840 r2771968  
    1919     */
    2020    public function get_available_banks() {
    21         $providers = $this->capabilities()->getFPXBanks();
     21        $capabilities = $this->capabilities();
     22
     23        if ( !$capabilities ){
     24            return null;
     25        }
     26
     27        $providers = $capabilities->getFPXBanks();
    2228        $first_value = reset($providers);
    2329
  • omise/tags/4.23.2/includes/backends/class-omise-backend-installment.php

    r2621135 r2771968  
    9898     */
    9999    public function get_available_providers( $currency, $purchase_amount ) {
     100        $capabilities = $this->capabilities();
     101
     102        if ( !$capabilities ){
     103            return null;
     104        }
     105
    100106        // Note: As installment payment at the moment only supports THB and MYR currency, the
    101107        //       $purchase_amount is multiplied with 100 to convert the amount into subunit (satang and sen).
    102         $providers = $this->capabilities()->getInstallmentBackends( $currency, ( $purchase_amount * 100 ) );
     108        $providers = $capabilities->getInstallmentBackends( $currency, ( $purchase_amount * 100 ) );
    103109
    104110        foreach ( $providers as &$provider ) {
  • omise/tags/4.23.2/includes/backends/class-omise-backend-mobile-banking.php

    r2720994 r2771968  
    3636     */
    3737    public function get_available_providers( $currency ) {
     38        $mobile_banking_providers = array();
     39        $capabilities = $this->capabilities();
    3840
    39         $providers = $this->capabilities()->getBackends( $currency );
     41        if ( $capabilities ){
     42            $providers = $capabilities->getBackends( $currency );
    4043
    41         $mobile_banking_providers = array();
     44            foreach ( $providers as &$provider ) {
     45                if(isset(self::$providers[ $provider->_id ])){
    4246
    43         foreach ( $providers as &$provider ) {
    44             if(isset(self::$providers[ $provider->_id ])){
     47                    $provider_detail = self::$providers[ $provider->_id ];
     48                    $provider->provider_name   = $provider_detail['title'];
     49                    $provider->provider_logo   = $provider_detail['logo'];
    4550
    46                 $provider_detail = self::$providers[ $provider->_id ];
    47                 $provider->provider_name   = $provider_detail['title'];
    48                 $provider->provider_logo   = $provider_detail['logo'];
    49 
    50                 array_push($mobile_banking_providers, $provider);
     51                    array_push($mobile_banking_providers, $provider);
     52                }
    5153            }
    5254        }
  • omise/tags/4.23.2/includes/class-omise-callback.php

    r2766266 r2771968  
    2626
    2727    public static function execute() {
     28        if(RequestHelper::isUserOriginated()) {
     29            return wp_redirect( wc_get_checkout_url() );
     30        }
     31
    2832        $order_id = isset( $_GET['order_id'] ) ? sanitize_text_field( $_GET['order_id'] ) : null;
    2933
     
    6872        $message = __(
    6973            '<strong>We cannot validate your payment result:</strong><br/>
    70              Note that your payment may have already been processed.<br/>
    71              Please contact our support team if you have any questions.',
     74            Note that your payment may have already been processed.<br/>
     75            Please contact our support team if you have any questions.',
    7276            'omise'
    7377        );
     
    109113            $message = __(
    110114                'Omise: The payment is being processed.<br/>
    111                  An amount %1$s %2$s has been authorized.',
     115                An amount %1$s %2$s has been authorized.',
    112116                'omise'
    113117            );
     
    135139        $message = __(
    136140            'Omise: The payment is being processed.<br/>
    137              Depending on the payment provider, this may take some time to process.<br/>
    138              Please do a manual \'Sync Payment Status\' action from the <strong>Order Actions</strong> panel, or check the payment status directly at the Omise Dashboard later.',
     141            Depending on the payment provider, this may take some time to process.<br/>
     142            Please do a manual \'Sync Payment Status\' action from the <strong>Order Actions</strong> panel, or check the payment status directly at the Omise Dashboard later.',
    139143            'omise'
    140144        );
     
    153157     */
    154158    protected function payment_failed() {
    155         $message         = __( "It seems we've been unable to process your payment properly:<br/>%s", 'omise' );
     159        $message = __( "It seems we've been unable to process your payment properly:<br/>%s", 'omise' );
    156160        $failure_message = Omise()->translate( $this->charge['failure_message'] ) . ' (code: ' . $this->charge['failure_code'] . ')';
    157161
  • omise/tags/4.23.2/includes/class-omise-capabilities.php

    r2766266 r2771968  
    2121    public static function retrieve() {
    2222        if ( ! self::$the_instance ) {
     23            try {
     24                $capabilities = OmiseCapabilities::retrieve();
     25            } catch(\Exception $e) {
     26                // suppressing error on the admin dashboard
     27                return null;
     28            }
     29   
    2330            self::$the_instance = new self();
    24             self::$the_instance->capabilities = OmiseCapabilities::retrieve();
     31            self::$the_instance->capabilities = $capabilities;
    2532        }
    26 
     33   
    2734        return self::$the_instance;
    2835    }
     
    6370
    6471    /**
     72     * Retrieves details of Touch n Go payment backends from capabilities.
     73     *
     74     * @return string
     75     */
     76    public function getTouchNGoBackends() {
     77        $params   = array();
     78        $params[] = $this->capabilities->backendFilter['type']('touch_n_go');
     79   
     80        return $this->capabilities->getBackends( $params );
     81    }
     82
     83    /**
    6584     * Retrieves details of fpx bank list from capabilities.
    6685     *
  • omise/tags/4.23.2/includes/class-omise-payment-factory.php

    r2766266 r2771968  
    3434        'Omise_Payment_OCBC_PAO',
    3535        'Omise_Payment_GrabPay',
    36         'Omise_Payment_GooglePay'
     36        'Omise_Payment_GooglePay',
     37        'Omise_Payment_Boost',
     38        'Omise_Payment_ShopeePay',
     39        'Omise_Payment_Maybank_QR',
     40        'Omise_Payment_DuitNow_QR',
     41        'Omise_Payment_DuitNow_OBW'
    3742    );
    3843
  • omise/tags/4.23.2/includes/gateway/class-omise-payment-alipayplus.php

    r2766266 r2771968  
    148148    }
    149149}
    150 
    151 class Omise_Payment_TouchNGo extends Omise_Payment_Alipayplus {
    152     public function __construct() {
    153         $source = 'touch_n_go';
    154         $title = 'TNG eWallet';
    155         $countries = array( 'SG' );
    156         parent::__construct( $source, $title, $countries );
    157     }
    158 }
  • omise/tags/4.23.2/includes/gateway/class-omise-payment-grabpay.php

    r2766266 r2771968  
    7777        ) );
    7878    }
     79
     80    /**
     81     * Get icons
     82     *
     83     * @see WC_Payment_Gateway::get_icon()
     84     */
     85    public function get_icon() {
     86        $icon = Omise_Image::get_image( array(
     87                'file' => 'grabpay.png',
     88                'alternate_text' => 'GrabPay',
     89        ));
     90        return apply_filters( 'woocommerce_gateway_icon', $icon, $this->id );
     91    }
    7992}
  • omise/tags/4.23.2/includes/gateway/class-omise-payment-installment.php

    r2711951 r2771968  
    7373            array(
    7474                'installment_backends' => $this->backend->get_available_providers( $currency, $cart_total ),
    75                 'is_zero_interest'     => $this->backend->capabilities()->is_zero_interest()
     75                'is_zero_interest'     => $this->backend->capabilities() ? $this->backend->capabilities()->is_zero_interest() : false
    7676            )
    7777        );
  • omise/tags/4.23.2/includes/libraries/omise-plugin/Omise.php

    r2766266 r2771968  
    44require_once dirname(__FILE__).'/helpers/wc_order.php';
    55require_once dirname(__FILE__).'/helpers/mailer.php';
     6require_once dirname(__FILE__).'/helpers/request.php';
  • omise/tags/4.23.2/languages/omise-ja.po

    r2766266 r2771968  
    357357#: templates/payment/form-konhini.php:4
    358358msgid "Name"
    359 msgstr "名前"
     359msgstr "カード名義"
    360360
    361361#: templates/payment/form-konhini.php:8
     
    377377#: includes/class-omise-callback.php:156
    378378msgid "email is in invalid format and phone_number must contain 10-11 digit characters"
    379 msgstr ""電子メールの形式が無効です。電話_番号には10-11桁の数字を入力してください"。"
     379msgstr "電子メールの形式が無効です。電話_番号には10-11桁の数字を入力してください。"
    380380
    381381#: includes/class-omise-callback.php:156
     
    462462msgid "Your payment code has been sent to your email"
    463463msgstr "お客様のメールに決済コードが送信されました。"
     464
     465#: templates/myaccount/my-card.php
     466msgid "Cards"
     467msgstr "カード"
     468
     469#: templates/myaccount/my-card.php
     470msgid "Number"
     471msgstr "カード番号"
     472
     473#: templates/myaccount/my-card.php
     474msgid "Created date"
     475msgstr "カード作成日"
     476
     477#: templates/myaccount/my-card.php
     478msgid "Action"
     479msgstr "アクション"
     480
     481#: templates/myaccount/my-card.php
     482msgid "Add new card"
     483msgstr "新しいカードを追加する"
     484
     485#: templates/myaccount/my-card.php
     486msgid "Save card"
     487msgstr "カードを保存する"
     488
     489#: templates/myaccount/my-card.php
     490msgid "Delete"
     491msgstr "削除する"
  • omise/tags/4.23.2/omise-woocommerce.php

    r2766266 r2771968  
    44 * Plugin URI:  https://www.omise.co/woocommerce
    55 * Description: Omise WooCommerce Gateway Plugin is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Omise Payment Gateway payment method to WooCommerce.
    6  * Version:     4.23.1
     6 * Version:     4.23.2
    77 * Author:      Omise and contributors
    88 * Author URI:  https://github.com/omise/omise-woocommerce/graphs/contributors
     
    2121     * @var string
    2222     */
    23     public $version = '4.23.1';
     23    public $version = '4.23.2';
    2424
    2525    /**
     
    125125        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/backends/class-omise-backend-mobile-banking.php';
    126126        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/backends/class-omise-backend-fpx.php';
     127        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/backends/class-omise-backend-touch-n-go.php';
    127128        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/classes/class-omise-charge.php';
    128129        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/classes/class-omise-card-image.php';
     
    151152        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-grabpay.php';
    152153        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-ocbc-pao.php';
     154        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-boost.php';
     155        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-duitnow-obw.php';
     156        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-duitnow-qr.php';
     157        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-maybank-qr.php';
     158        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-shopeepay.php';
     159        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-touch-n-go.php';
    153160        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment.php';
    154161        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/libraries/omise-php/lib/Omise.php';
  • omise/tags/4.23.2/readme.txt

    r2766266 r2771968  
    44Requires at least: 4.3.1
    55Tested up to: 5.9.0
    6 Stable tag: 4.23.1
     6Stable tag: 4.23.2
    77License: MIT
    88License URI: https://opensource.org/licenses/MIT
     
    3333
    3434== Changelog ==
     35
     36= 4.23.2 =
     37
     38#### 👾 Bug Fixes
     39- Handle capabilities failed. (PR [#294](https://github.com/omise/omise-woocommerce/pull/294))
    3540
    3641= 4.23.1 =
  • omise/tags/4.23.2/templates/myaccount/my-card.php

    r2766266 r2771968  
    1 <h2>Omise settings</h2>
    2 <h3>Cards</h3>
     1<h3><?php _e( 'Cards', 'omise' ); ?></h3>
    32<div id="omise_card_panel">
    43    <table>
    54        <tr>
    6             <th>Name</th>
    7             <th>Number</th>
    8             <th>Created date</th>
    9             <th>Action</th>
     5            <th><?php _e( 'Name', 'omise' ); ?></th>
     6            <th><?php _e( 'Number', 'omise' ); ?></th>
     7            <th><?php _e( 'Created date', 'omise' ); ?></th>
     8            <th><?php _e( 'Action', 'omise' ); ?></th>
    109        </tr>
    1110        <tbody>
     
    1312                <?php foreach( $viewData['existingCards']['data'] as $card ): ?>
    1413                    <?php
    15                     $nonce = wp_create_nonce( 'omise_delete_card_' . $card['id'] );
    16                     echo "<tr><td>{$card['name']}</td><td>XXXX XXXX XXXX {$card['last_digits']}</td>";
    17                     $created_date = date_i18n( get_option( 'date_format' ), strtotime($card['created']));
    18                     echo "<td>{$created_date}</td>";
    19                     echo "<td><button class='button delete_card' data-card-id='{$card['id']}' data-delete-card-nonce='{$nonce}'>Delete</button></td></tr>";
     14                        $nonce = wp_create_nonce( 'omise_delete_card_' . $card['id'] );
     15                        $created_date = date_i18n( get_option( 'date_format' ), strtotime($card['created']));
    2016                    ?>
     17                    <tr>
     18                        <td><?= $card['name'] ?></td>
     19                        <td>XXXX XXXX XXXX <?= $card['last_digits'] ?></td>
     20                        <td><?= $created_date ?></td>
     21                        <td>
     22                            <button
     23                                class='button delete_card'
     24                                data-card-id=<?= $card['id'] ?>
     25                                data-delete-card-nonce=<?= $nonce ?>
     26                            >
     27                                <?php _e( 'Delete', 'omise' ); ?>
     28                            </button>
     29                        </td>
     30                    </tr>
    2131                <?php endforeach; ?>
    2232            <?php endif; ?>
     
    2434    </table>
    2535
    26     <h4>Add new card</h4>
     36    <h4><?php _e( 'Add new card', 'omise' ); ?></h4>
    2737    <form name="omise_cc_form" id="omise_cc_form">
    2838        <?php wp_nonce_field('omise_add_card','omise_add_card_nonce'); ?>
     
    3242        </fieldset>
    3343    </form>
    34     <button id="omise_add_new_card" class="button">Save card</button>
     44    <button id="omise_add_new_card" class="button"><?php _e( 'Save card', 'omise' ); ?></button>
    3545</div>
  • omise/tags/4.23.2/templates/payment/form-fpx.php

    r2737840 r2771968  
    3333<script type="text/javascript">
    3434    var selectElem = document.getElementById("fpx-select-bank");
    35     selectElem.addEventListener('change', function(e) {
    36          selectElem.setAttribute("class", e.target.value);
    37     })
     35    if(selectElem) {
     36        selectElem.addEventListener('change', function(e) {
     37            selectElem.setAttribute("class", e.target.value);
     38        })
     39    }
    3840</script>
  • omise/trunk/CHANGELOG.md

    r2766266 r2771968  
    11# CHANGELOG
     2
     3### [v4.23.2 _(Aug 18, 2022)_](https://github.com/omise/omise-woocommerce/releases/tag/v4.23.2)
     4
     5#### 👾 Bug Fixes
     6- Handle capabilities failed. (PR [#294](https://github.com/omise/omise-woocommerce/pull/294))
    27
    38### [v4.23.1 _(Aug 4, 2022)_](https://github.com/omise/omise-woocommerce/releases/tag/v4.23.1)
  • omise/trunk/assets/javascripts/omise-payment-form-handler.js

    r2766266 r2771968  
    2323       
    2424        $form.prepend( $ulError );
    25         $("html, body").animate({
    26              scrollTop:0
    27              },"slow");
     25        $("html, body").animate({ scrollTop:0 },"slow");
    2826    }
    2927   
     
    7169                });
    7270
    73                 let errors                  = [],
    74                     omise_card              = {},
     71                let errors = [],
     72                    omise_card = {},
    7573                    omise_card_number_field = 'number',
    76                     omise_card_fields       = {
    77                         'name'             : $( '#omise_card_name' ),
    78                         'number'           : $( '#omise_card_number' ),
     74                    omise_card_state_field = 'state',
     75                    omise_card_fields = {
     76                        'name' : $( '#omise_card_name' ),
     77                        'number' : $( '#omise_card_number' ),
    7978                        'expiration_month' : $( '#omise_card_expiration_month' ),
    80                         'expiration_year'  : $( '#omise_card_expiration_year' ),
    81                         'security_code'    : $( '#omise_card_security_code' )
     79                        'expiration_year' : $( '#omise_card_expiration_year' ),
     80                        'security_code' : $( '#omise_card_security_code' ),
     81                        'city' : $( '#billing_city' ),
     82                        'state' : $( '#billing_state' ),
     83                        'country' : $( '#billing_country' ),
     84                        'postal_code' : $( '#billing_postcode' ),
     85                        'street1' : $( '#billing_address_1' )
    8286                    };
    8387
    8488                $.each( omise_card_fields, function( index, field ) {
    85                     omise_card[ index ] = (index === omise_card_number_field) ? field.val().replace(/\s/g, '') : field.val();
     89                    if (index === omise_card_state_field) {
     90                        omise_card[ index ] = field.find(":selected").text();
     91                    } else {
     92                        omise_card[ index ] = (index === omise_card_number_field) ? field.val().replace(/\s/g, '') : field.val();
     93                    }
     94
    8695                    if ( "" === omise_card[ index ] ) {
    8796                        errors.push( omise_params[ 'required_card_' + index ] );
     
    102111                        if (statusCode == 200) {
    103112                            $.each( omise_card_fields, function( index, field ) {
    104                                 field.val( '' );
     113                                const sensitiveDataIndex = ['name', 'number', 'expiration_year', 'expiration_month', 'security_code'];
     114                                if (sensitiveDataIndex.includes(index)) {
     115                                    field.val( '' );
     116                                }
    105117                            } );
    106118                            $form.append( '<input type="hidden" class="omise_token" name="omise_token" value="' + response.id + '"/>' );
     
    110122                        };
    111123                    });
    112                 }else{
     124                } else {
    113125                    showError( omise_params.cannot_load_omisejs + '<br/>' + omise_params.check_internet_connection );
    114126                    $form.unblock();
  • omise/trunk/includes/backends/class-omise-backend-fpx.php

    r2737840 r2771968  
    1919     */
    2020    public function get_available_banks() {
    21         $providers = $this->capabilities()->getFPXBanks();
     21        $capabilities = $this->capabilities();
     22
     23        if ( !$capabilities ){
     24            return null;
     25        }
     26
     27        $providers = $capabilities->getFPXBanks();
    2228        $first_value = reset($providers);
    2329
  • omise/trunk/includes/backends/class-omise-backend-installment.php

    r2621135 r2771968  
    9898     */
    9999    public function get_available_providers( $currency, $purchase_amount ) {
     100        $capabilities = $this->capabilities();
     101
     102        if ( !$capabilities ){
     103            return null;
     104        }
     105
    100106        // Note: As installment payment at the moment only supports THB and MYR currency, the
    101107        //       $purchase_amount is multiplied with 100 to convert the amount into subunit (satang and sen).
    102         $providers = $this->capabilities()->getInstallmentBackends( $currency, ( $purchase_amount * 100 ) );
     108        $providers = $capabilities->getInstallmentBackends( $currency, ( $purchase_amount * 100 ) );
    103109
    104110        foreach ( $providers as &$provider ) {
  • omise/trunk/includes/backends/class-omise-backend-mobile-banking.php

    r2720994 r2771968  
    3636     */
    3737    public function get_available_providers( $currency ) {
     38        $mobile_banking_providers = array();
     39        $capabilities = $this->capabilities();
    3840
    39         $providers = $this->capabilities()->getBackends( $currency );
     41        if ( $capabilities ){
     42            $providers = $capabilities->getBackends( $currency );
    4043
    41         $mobile_banking_providers = array();
     44            foreach ( $providers as &$provider ) {
     45                if(isset(self::$providers[ $provider->_id ])){
    4246
    43         foreach ( $providers as &$provider ) {
    44             if(isset(self::$providers[ $provider->_id ])){
     47                    $provider_detail = self::$providers[ $provider->_id ];
     48                    $provider->provider_name   = $provider_detail['title'];
     49                    $provider->provider_logo   = $provider_detail['logo'];
    4550
    46                 $provider_detail = self::$providers[ $provider->_id ];
    47                 $provider->provider_name   = $provider_detail['title'];
    48                 $provider->provider_logo   = $provider_detail['logo'];
    49 
    50                 array_push($mobile_banking_providers, $provider);
     51                    array_push($mobile_banking_providers, $provider);
     52                }
    5153            }
    5254        }
  • omise/trunk/includes/class-omise-callback.php

    r2766266 r2771968  
    2626
    2727    public static function execute() {
     28        if(RequestHelper::isUserOriginated()) {
     29            return wp_redirect( wc_get_checkout_url() );
     30        }
     31
    2832        $order_id = isset( $_GET['order_id'] ) ? sanitize_text_field( $_GET['order_id'] ) : null;
    2933
     
    6872        $message = __(
    6973            '<strong>We cannot validate your payment result:</strong><br/>
    70              Note that your payment may have already been processed.<br/>
    71              Please contact our support team if you have any questions.',
     74            Note that your payment may have already been processed.<br/>
     75            Please contact our support team if you have any questions.',
    7276            'omise'
    7377        );
     
    109113            $message = __(
    110114                'Omise: The payment is being processed.<br/>
    111                  An amount %1$s %2$s has been authorized.',
     115                An amount %1$s %2$s has been authorized.',
    112116                'omise'
    113117            );
     
    135139        $message = __(
    136140            'Omise: The payment is being processed.<br/>
    137              Depending on the payment provider, this may take some time to process.<br/>
    138              Please do a manual \'Sync Payment Status\' action from the <strong>Order Actions</strong> panel, or check the payment status directly at the Omise Dashboard later.',
     141            Depending on the payment provider, this may take some time to process.<br/>
     142            Please do a manual \'Sync Payment Status\' action from the <strong>Order Actions</strong> panel, or check the payment status directly at the Omise Dashboard later.',
    139143            'omise'
    140144        );
     
    153157     */
    154158    protected function payment_failed() {
    155         $message         = __( "It seems we've been unable to process your payment properly:<br/>%s", 'omise' );
     159        $message = __( "It seems we've been unable to process your payment properly:<br/>%s", 'omise' );
    156160        $failure_message = Omise()->translate( $this->charge['failure_message'] ) . ' (code: ' . $this->charge['failure_code'] . ')';
    157161
  • omise/trunk/includes/class-omise-capabilities.php

    r2766266 r2771968  
    2121    public static function retrieve() {
    2222        if ( ! self::$the_instance ) {
     23            try {
     24                $capabilities = OmiseCapabilities::retrieve();
     25            } catch(\Exception $e) {
     26                // suppressing error on the admin dashboard
     27                return null;
     28            }
     29   
    2330            self::$the_instance = new self();
    24             self::$the_instance->capabilities = OmiseCapabilities::retrieve();
     31            self::$the_instance->capabilities = $capabilities;
    2532        }
    26 
     33   
    2734        return self::$the_instance;
    2835    }
     
    6370
    6471    /**
     72     * Retrieves details of Touch n Go payment backends from capabilities.
     73     *
     74     * @return string
     75     */
     76    public function getTouchNGoBackends() {
     77        $params   = array();
     78        $params[] = $this->capabilities->backendFilter['type']('touch_n_go');
     79   
     80        return $this->capabilities->getBackends( $params );
     81    }
     82
     83    /**
    6584     * Retrieves details of fpx bank list from capabilities.
    6685     *
  • omise/trunk/includes/class-omise-payment-factory.php

    r2766266 r2771968  
    3434        'Omise_Payment_OCBC_PAO',
    3535        'Omise_Payment_GrabPay',
    36         'Omise_Payment_GooglePay'
     36        'Omise_Payment_GooglePay',
     37        'Omise_Payment_Boost',
     38        'Omise_Payment_ShopeePay',
     39        'Omise_Payment_Maybank_QR',
     40        'Omise_Payment_DuitNow_QR',
     41        'Omise_Payment_DuitNow_OBW'
    3742    );
    3843
  • omise/trunk/includes/gateway/class-omise-payment-alipayplus.php

    r2766266 r2771968  
    148148    }
    149149}
    150 
    151 class Omise_Payment_TouchNGo extends Omise_Payment_Alipayplus {
    152     public function __construct() {
    153         $source = 'touch_n_go';
    154         $title = 'TNG eWallet';
    155         $countries = array( 'SG' );
    156         parent::__construct( $source, $title, $countries );
    157     }
    158 }
  • omise/trunk/includes/gateway/class-omise-payment-grabpay.php

    r2766266 r2771968  
    7777        ) );
    7878    }
     79
     80    /**
     81     * Get icons
     82     *
     83     * @see WC_Payment_Gateway::get_icon()
     84     */
     85    public function get_icon() {
     86        $icon = Omise_Image::get_image( array(
     87                'file' => 'grabpay.png',
     88                'alternate_text' => 'GrabPay',
     89        ));
     90        return apply_filters( 'woocommerce_gateway_icon', $icon, $this->id );
     91    }
    7992}
  • omise/trunk/includes/gateway/class-omise-payment-installment.php

    r2711951 r2771968  
    7373            array(
    7474                'installment_backends' => $this->backend->get_available_providers( $currency, $cart_total ),
    75                 'is_zero_interest'     => $this->backend->capabilities()->is_zero_interest()
     75                'is_zero_interest'     => $this->backend->capabilities() ? $this->backend->capabilities()->is_zero_interest() : false
    7676            )
    7777        );
  • omise/trunk/includes/libraries/omise-plugin/Omise.php

    r2766266 r2771968  
    44require_once dirname(__FILE__).'/helpers/wc_order.php';
    55require_once dirname(__FILE__).'/helpers/mailer.php';
     6require_once dirname(__FILE__).'/helpers/request.php';
  • omise/trunk/languages/omise-ja.po

    r2766266 r2771968  
    357357#: templates/payment/form-konhini.php:4
    358358msgid "Name"
    359 msgstr "名前"
     359msgstr "カード名義"
    360360
    361361#: templates/payment/form-konhini.php:8
     
    377377#: includes/class-omise-callback.php:156
    378378msgid "email is in invalid format and phone_number must contain 10-11 digit characters"
    379 msgstr ""電子メールの形式が無効です。電話_番号には10-11桁の数字を入力してください"。"
     379msgstr "電子メールの形式が無効です。電話_番号には10-11桁の数字を入力してください。"
    380380
    381381#: includes/class-omise-callback.php:156
     
    462462msgid "Your payment code has been sent to your email"
    463463msgstr "お客様のメールに決済コードが送信されました。"
     464
     465#: templates/myaccount/my-card.php
     466msgid "Cards"
     467msgstr "カード"
     468
     469#: templates/myaccount/my-card.php
     470msgid "Number"
     471msgstr "カード番号"
     472
     473#: templates/myaccount/my-card.php
     474msgid "Created date"
     475msgstr "カード作成日"
     476
     477#: templates/myaccount/my-card.php
     478msgid "Action"
     479msgstr "アクション"
     480
     481#: templates/myaccount/my-card.php
     482msgid "Add new card"
     483msgstr "新しいカードを追加する"
     484
     485#: templates/myaccount/my-card.php
     486msgid "Save card"
     487msgstr "カードを保存する"
     488
     489#: templates/myaccount/my-card.php
     490msgid "Delete"
     491msgstr "削除する"
  • omise/trunk/omise-woocommerce.php

    r2766266 r2771968  
    44 * Plugin URI:  https://www.omise.co/woocommerce
    55 * Description: Omise WooCommerce Gateway Plugin is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Omise Payment Gateway payment method to WooCommerce.
    6  * Version:     4.23.1
     6 * Version:     4.23.2
    77 * Author:      Omise and contributors
    88 * Author URI:  https://github.com/omise/omise-woocommerce/graphs/contributors
     
    2121     * @var string
    2222     */
    23     public $version = '4.23.1';
     23    public $version = '4.23.2';
    2424
    2525    /**
     
    125125        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/backends/class-omise-backend-mobile-banking.php';
    126126        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/backends/class-omise-backend-fpx.php';
     127        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/backends/class-omise-backend-touch-n-go.php';
    127128        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/classes/class-omise-charge.php';
    128129        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/classes/class-omise-card-image.php';
     
    151152        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-grabpay.php';
    152153        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-ocbc-pao.php';
     154        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-boost.php';
     155        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-duitnow-obw.php';
     156        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-duitnow-qr.php';
     157        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-maybank-qr.php';
     158        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-shopeepay.php';
     159        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment-touch-n-go.php';
    153160        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/gateway/class-omise-payment.php';
    154161        require_once OMISE_WOOCOMMERCE_PLUGIN_PATH . '/includes/libraries/omise-php/lib/Omise.php';
  • omise/trunk/readme.txt

    r2766266 r2771968  
    44Requires at least: 4.3.1
    55Tested up to: 5.9.0
    6 Stable tag: 4.23.1
     6Stable tag: 4.23.2
    77License: MIT
    88License URI: https://opensource.org/licenses/MIT
     
    3333
    3434== Changelog ==
     35
     36= 4.23.2 =
     37
     38#### 👾 Bug Fixes
     39- Handle capabilities failed. (PR [#294](https://github.com/omise/omise-woocommerce/pull/294))
    3540
    3641= 4.23.1 =
  • omise/trunk/templates/myaccount/my-card.php

    r2766266 r2771968  
    1 <h2>Omise settings</h2>
    2 <h3>Cards</h3>
     1<h3><?php _e( 'Cards', 'omise' ); ?></h3>
    32<div id="omise_card_panel">
    43    <table>
    54        <tr>
    6             <th>Name</th>
    7             <th>Number</th>
    8             <th>Created date</th>
    9             <th>Action</th>
     5            <th><?php _e( 'Name', 'omise' ); ?></th>
     6            <th><?php _e( 'Number', 'omise' ); ?></th>
     7            <th><?php _e( 'Created date', 'omise' ); ?></th>
     8            <th><?php _e( 'Action', 'omise' ); ?></th>
    109        </tr>
    1110        <tbody>
     
    1312                <?php foreach( $viewData['existingCards']['data'] as $card ): ?>
    1413                    <?php
    15                     $nonce = wp_create_nonce( 'omise_delete_card_' . $card['id'] );
    16                     echo "<tr><td>{$card['name']}</td><td>XXXX XXXX XXXX {$card['last_digits']}</td>";
    17                     $created_date = date_i18n( get_option( 'date_format' ), strtotime($card['created']));
    18                     echo "<td>{$created_date}</td>";
    19                     echo "<td><button class='button delete_card' data-card-id='{$card['id']}' data-delete-card-nonce='{$nonce}'>Delete</button></td></tr>";
     14                        $nonce = wp_create_nonce( 'omise_delete_card_' . $card['id'] );
     15                        $created_date = date_i18n( get_option( 'date_format' ), strtotime($card['created']));
    2016                    ?>
     17                    <tr>
     18                        <td><?= $card['name'] ?></td>
     19                        <td>XXXX XXXX XXXX <?= $card['last_digits'] ?></td>
     20                        <td><?= $created_date ?></td>
     21                        <td>
     22                            <button
     23                                class='button delete_card'
     24                                data-card-id=<?= $card['id'] ?>
     25                                data-delete-card-nonce=<?= $nonce ?>
     26                            >
     27                                <?php _e( 'Delete', 'omise' ); ?>
     28                            </button>
     29                        </td>
     30                    </tr>
    2131                <?php endforeach; ?>
    2232            <?php endif; ?>
     
    2434    </table>
    2535
    26     <h4>Add new card</h4>
     36    <h4><?php _e( 'Add new card', 'omise' ); ?></h4>
    2737    <form name="omise_cc_form" id="omise_cc_form">
    2838        <?php wp_nonce_field('omise_add_card','omise_add_card_nonce'); ?>
     
    3242        </fieldset>
    3343    </form>
    34     <button id="omise_add_new_card" class="button">Save card</button>
     44    <button id="omise_add_new_card" class="button"><?php _e( 'Save card', 'omise' ); ?></button>
    3545</div>
  • omise/trunk/templates/payment/form-fpx.php

    r2737840 r2771968  
    3333<script type="text/javascript">
    3434    var selectElem = document.getElementById("fpx-select-bank");
    35     selectElem.addEventListener('change', function(e) {
    36          selectElem.setAttribute("class", e.target.value);
    37     })
     35    if(selectElem) {
     36        selectElem.addEventListener('change', function(e) {
     37            selectElem.setAttribute("class", e.target.value);
     38        })
     39    }
    3840</script>
Note: See TracChangeset for help on using the changeset viewer.