Skip to content

Commit

Permalink
v3.8.0 released
Browse files Browse the repository at this point in the history
  • Loading branch information
trgino committed Oct 18, 2023
1 parent a090cc2 commit ffbc3a5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### Version 3.8.0
- Improvement : Additional Filters
- Issue : Minumum Installment Message

#### Version 3.7.9
- Improvement : Debug file anonymization
- Improvement : Missing language values
Expand Down
21 changes: 13 additions & 8 deletions core/library/Moka_Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ public function renderMinInstallmentMessage($price)
$productPrice = $product->get_price();

$options = get_option( 'woocommerce_mokapay_settings' );
$isavaliable = data_get($options, 'installment_message', 'yes') === 'yes';
$limitInstallment = data_get($options, 'limitInstallment');
$isavaliable = data_get( $options, 'installment_message', 'yes' ) === 'yes';
$isavaliable = apply_filters( 'mokapay_mininstallment_message_avaliable', $isavaliable, $product);
$limitInstallment = data_get( $options, 'limitInstallment', 12 );
$stock = $product->get_stock_status() == 'instock' ? true : false;

if(
Expand All @@ -257,12 +258,16 @@ public function renderMinInstallmentMessage($price)
)
{
$installments = get_option( 'woocommerce_mokapay-installments' );
$maxInstallment = self::calculateMaxInstallment($options, $product->get_id());
$minRate = data_get(end($installments), 'rates.'.$maxInstallment.'.value');
$minRatePrice = self::calculateComission($limitInstallment, $minRate, $productPrice);

$return .= '
<div class="min--installment--price"><span>'.self::moka_price($minRatePrice['unit_price']). '</span> ' .' \' '.__( 'With installments starting from', 'moka-woocommerce' ).' ...</div>';
if($installments && !empty($installments)){
$maxInstallment = self::calculateMaxInstallment($options, $product->get_id());
$minRate = data_get(end($installments), 'rates.'.$maxInstallment.'.value');
if($minRate){
$minRatePrice = self::calculateComission($limitInstallment, $minRate, $productPrice);

$return_html = apply_filters( 'mokapay_mininstallment_message', '<div class="min--installment--price"><span>'.self::moka_price($minRatePrice['unit_price']). '</span> ' .' '.__( 'With installments starting from', 'moka-woocommerce' ).' ...</div>', self::moka_price($minRatePrice['unit_price']), $product );
$return .= $return_html;
}
}
} else {
$return = $price;
}
Expand Down
4 changes: 2 additions & 2 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.7.9
* Version: 3.8.0
* 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,7 +14,7 @@
exit;
}

define( 'OPTIMISTHUB_MOKA_PAY_VERSION', '3.7.9' );
define( 'OPTIMISTHUB_MOKA_PAY_VERSION', '3.8.0' );
define( 'OPTIMISTHUB_MOKA_BASENAME', plugin_basename( __FILE__ ) );
define( 'OPTIMISTHUB_MOKA_DIR', plugin_dir_path( __FILE__ ) );
define( 'OPTIMISTHUB_MOKA_URL', plugin_dir_url( __FILE__ ) );
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ For sandbox usage : https://developer.moka.com/home.php?page=test-kartlari

Version history : https://github.com/optimisthub/moka-woocommerce/wiki/Changelog

### Filters & Actions

Filters & Actions : https://github.com/optimisthub/moka-woocommerce/wiki/Filters-&-Actions

### Other integrations

- Moka PHP Client : https://github.com/optimisthub/moka-php
Expand Down

0 comments on commit ffbc3a5

Please sign in to comment.