Skip to content

Commit

Permalink
v3.8.3 released
Browse files Browse the repository at this point in the history
- Improvement : Force update check
- Improvement : Translations Update
- Issue : Self update error at some cases
- Issue : Installment fee tax
  • Loading branch information
trgino committed Oct 31, 2023
1 parent 6f3e794 commit 78ee413
Show file tree
Hide file tree
Showing 12 changed files with 453 additions and 278 deletions.
26 changes: 26 additions & 0 deletions assets/moka-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,30 @@ jQuery(document).ready(function ($) {
});
}
}

$('.moka-woocommerce-check-update').click(function (e) {
e.preventDefault();
let _thiz = $(this);
if (!_thiz.hasClass('checking')) {
_thiz.addClass('checking');
_thiz.text(_thiz.attr('data-check'));
$.post(moka_ajax.ajax_url, {
action: 'optimisthub_ajax',
method: 'update_check'
}, function (response) {
_thiz.removeClass('checking');
_thiz.text(_thiz.attr('data-default'));
if (response.status === true) {
alert(response.message);
setTimeout(function () {
window.location.reload(true);
}, 1250);
}
}, 'json').fail(function () {
_thiz.removeClass('checking');
_thiz.text(_thiz.attr('data-default'));
alert(moka_ajax.failed);
});
}
});
});
18 changes: 12 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#### Version 3.8.3
- Improvement : Force update check
- Improvement : Translations Update
- Issue : Self update error at some cases
- Issue : Installment fee tax

#### Version 3.8.2
- Issue : Order total at pay for order state

Expand All @@ -17,11 +23,11 @@
- Issue : Secure Renegotiation

#### Version 3.7.8 Beta
- Feauture : Limit instalment.
- Feauture : Limit instalment by product
- Feauture : Remote connection test
- Feauture : Dealer informations test
- Feauture : Debug mode
- Feature : Limit instalment.
- Feature : Limit instalment by product
- Feature : Remote connection test
- Feature : Dealer informations test
- Feature : Debug mode
- Improvement : Translations updated
- Security : Subscription queries updated

Expand All @@ -31,7 +37,7 @@
- Improvement : Installment tab.
- Improvement : Performence issue.
- Improvement : Translations updated.
- Feauture : Option to show instalment total amount.
- Feature : Option to show instalment total amount.
- Security : Installement rate calculation logic has been changed.
- Security : Oder Total calculation logic has been changed.

Expand Down
12 changes: 8 additions & 4 deletions core/library/Moka_Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ private function saveComissionDecision( $params )
$order = self::fetchOrder(data_get($params, 'orderId'));

$orderFee = new \WC_Order_Item_Fee();
$orderFee->set_props(
/*$orderFee->set_props(
[
'name' => __('Installment Fee', 'moka-woocommerce'),
'tax_class' => '',
Expand All @@ -975,9 +975,13 @@ private function saveComissionDecision( $params )
'taxes' => [],
'order_id' => $order->get_id(),
]
);
$orderFee->save();

);*/
$orderFee->set_name( __('Installment Fee', 'moka-woocommerce') );
$orderFee->set_amount( $installmentFee );
$orderFee->set_tax_class( '' );
$orderFee->set_tax_status( 'none' );
$orderFee->set_total( $installmentFee );

$order->add_item( $orderFee );
$order->calculate_totals(true);
$order->save();
Expand Down
18 changes: 18 additions & 0 deletions core/library/Moka_Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ public function __construct()
add_action( 'add_meta_boxes', [ $this, 'add_meta_box' ] );
add_action( 'save_post', [ $this, 'save_meta_box' ] );

add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 2 );

}

public function plugin_row_meta( $links, $file ) {
if ( plugin_basename( OPTIMISTHUB_MOKA_FILE ) !== $file ) {
return $links;
}

$more = [
'<a href="https://github.com/optimisthub/moka-woocommerce/wiki" target="_blank">' . __( 'Wiki', 'moka-woocommerce' ) . '</a>',
'<a href="https://github.com/optimisthub/moka-woocommerce/issues" target="_blank">' . __( 'Report Issue',
'moka-woocommerce' ) .
'</a>',
'<a href="#" class="moka-woocommerce-check-update" data-default="' . __( 'Check Update', 'moka-woocommerce' ) . '" data-check="' . __( 'Checking', 'moka-woocommerce' ) . '">' . __( 'Check Update', 'moka-woocommerce' ) . '</a>',
];

return array_merge( $links, $more );
}

public function add_meta_box( $post_type ) {
Expand Down
14 changes: 14 additions & 0 deletions core/library/Optimisthub_Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public function optimisthub_ajax()
if( $method == 'debug_clear' ) {
self::debug_clear();
}

if( $method == 'update_check' ) {
self::update_check();
}

wp_die();
}
Expand Down Expand Up @@ -503,6 +507,16 @@ private function debug_clear(){
}
wp_send_json($result);
}

private function update_check(){
$result = [
'time' => time(),
'status' => true,
'message' => __( 'Success', 'moka-woocommerce' )
];
wp_update_plugins();
wp_send_json($result);
}

}

Expand Down
11 changes: 9 additions & 2 deletions core/library/Optimisthub_Update_Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public function update( $transient ) {
$remote = $this->request();

if(
$remote
$remote
&& data_get($remote, 'version')
&& version_compare( $this->version, $remote->version, '<' )
) {
$_response = new stdClass();
Expand All @@ -157,7 +158,13 @@ public function update( $transient ) {
$_response->tested = data_get($remote, 'tested');
$_response->package = data_get($remote, 'download_url');

$transient->response[ $_response->plugin ] = $_response;
if( is_array($transient->response) ){
$transient->response[ $_response->plugin ] = $_response;
}else{
$transient->response = [
$_response->plugin => $_response,
];
}

}

Expand Down
13 changes: 7 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Moka Payment Gateway for WooCommerce
* Plugin URI: https://github.com/optimisthub/moka-woocommerce
* Description: Moka Payment gateway for woocommerce
* Version: 3.8.2
* Version: 3.8.3
* Author: Optimist Hub
* Author URI: https://optimisthub.com/?utm_source=moka-woocommerce&utm_campaign=moka-woocommerce&utm_content=plugins
* Domain Path: /languages/
Expand All @@ -14,10 +14,11 @@
exit;
}

define( 'OPTIMISTHUB_MOKA_PAY_VERSION', '3.8.2' );
define( 'OPTIMISTHUB_MOKA_BASENAME', plugin_basename( __FILE__ ) );
define( 'OPTIMISTHUB_MOKA_DIR', plugin_dir_path( __FILE__ ) );
define( 'OPTIMISTHUB_MOKA_URL', plugin_dir_url( __FILE__ ) );
define( 'OPTIMISTHUB_MOKA_PAY_VERSION', '3.8.3' );
define( 'OPTIMISTHUB_MOKA_FILE', __FILE__ );
define( 'OPTIMISTHUB_MOKA_BASENAME', plugin_basename( OPTIMISTHUB_MOKA_FILE ) );
define( 'OPTIMISTHUB_MOKA_DIR', plugin_dir_path( OPTIMISTHUB_MOKA_FILE ) );
define( 'OPTIMISTHUB_MOKA_URL', plugin_dir_url( OPTIMISTHUB_MOKA_FILE ) );
define( 'OPTIMISTHUB_MOKA_UPDATE', 'https://moka.wooxup.com/' );
define( 'OPTIMISTHUB_MOKA_DOMAIN', 'moka-woocommerce' );

Expand All @@ -29,7 +30,7 @@
function loadOptimisthubMoka()
{
require __DIR__ . '/vendor/autoload.php';
$path = dirname( plugin_basename(__FILE__) ) . '/languages';
$path = dirname( plugin_basename( OPTIMISTHUB_MOKA_FILE ) ) . '/languages';
load_plugin_textdomain( OPTIMISTHUB_MOKA_DOMAIN, false, $path );
}

Expand Down
Binary file modified languages/moka-woocommerce-en_US.mo
Binary file not shown.
Loading

0 comments on commit 78ee413

Please sign in to comment.