Skip to content

Commit

Permalink
Version 2.9.3 released
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihtoprak committed Feb 17, 2022
1 parent c7fafb7 commit 73c6208
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
2 changes: 2 additions & 0 deletions assets/moka.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $(document).ready(function () {
*/
$(document).on('keyup','input#mokapay-card-number',function( e ) {
let binValue = $(this).val();
let total = $('#mokapay-current-order-total').val();
binValue = binValue.replace(/\s/g, '');
if(binValue.length >= 6) {
$.ajax({
Expand All @@ -19,6 +20,7 @@ $(document).ready(function () {
action : 'optimisthub_ajax',
method : 'validate_bin',
binNumber : binValue,
total : total
},
success: function(response){
$('#ajaxify-installment-table').html('');
Expand Down
27 changes: 27 additions & 0 deletions core/library/Moka_Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,34 @@ public function admin_options()
*/
public function payment_form_fields($cc_fields , $payment_id)
{

global $woocommerce;
$referer = is_wc_endpoint_url( 'order-pay' ) ? 'order-pay' : 'checkout';
$total = data_get($woocommerce, 'cart.total');

if ( get_query_var('order-pay') ) {
$order = wc_get_order(get_query_var('order-pay'));
$total = $order->get_total();
}

$cc_fields = [
'current-step-of-payment' => '
<p class="form-row form-row-wide">
<input
id="'.$payment_id.'-current-step-of-payment"
class="current-step-of-payment"
type="hidden"
value="'.$referer.'"
name="' .$payment_id. '-current-step-of-payment"
/>
<input
id="'.$payment_id.'-current-order-total"
class="current-order-total"
type="hidden"
value="'.$total.'"
name="' .$payment_id. '-current-order-total"
/>
</p>',
'name-on-card' => '
<p class="form-row form-row-wide">
<label for="'. $payment_id.'-card-holder">' . __('Name On Card','moka-woocommerce') . ' <span class="required">*</span></label>
Expand Down
2 changes: 1 addition & 1 deletion core/library/Moka_Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exit;
}

define('OPTIMISTHUB_MOKA_PAY_VERSION', '2.9.2');
define('OPTIMISTHUB_MOKA_PAY_VERSION', '2.9.3');

global $mokaVersion;
$mokaVersion = OPTIMISTHUB_MOKA_PAY_VERSION;
Expand Down
10 changes: 3 additions & 7 deletions core/library/Optimisthub_Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function __construct()
public function validate_bin($params)
{
$postData = $params;

$action = data_get($postData, 'action');

if(!$action)
Expand Down Expand Up @@ -60,7 +61,7 @@ public function validate_bin($params)
$data= [
'cardInformation' => $response,
'installments' => $avaliableInstallment,
'renderedHtml' => self::renderedHtml(['card' => $response, 'installments' => $avaliableInstallment]),
'renderedHtml' => self::renderedHtml(['card' => $response, 'installments' => $avaliableInstallment, 'total' => data_get($postData, 'total')]),
];

if(!$response)
Expand Down Expand Up @@ -145,12 +146,7 @@ private function fetchInstallment()
*/
private function renderedHtml( $params )
{
global $woocommerce;

$orderId = $woocommerce->session->order_awaiting_payment;
$order = new WC_Order($orderId);

$total = $order->get_total();
$total = data_get($params, 'total');
$maxInstallment = data_get($params, 'card.MaxInstallmentNumber');
$installmentRates = data_get($params, 'installments.rates');
$orderTotal = $total;
Expand Down
2 changes: 1 addition & 1 deletion 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: 2.9.2
* Version: 2.9.3
* Author: Optimist Hub
* Author URI: https://optimisthub.com?ref=mokaPayment
* Domain Path: /languages/
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Moka Pos, Moka Pay plugin;

### Changelog

#### Version 2.9.3
- Issue : Installment issues.

#### Version 2.9.2
- Issue : Installment issues.
- Feature : Added, ray package for remote debugging.
Expand Down

0 comments on commit 73c6208

Please sign in to comment.