Skip to content

Commit

Permalink
WooCommerce Amount Issue fixed for latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihtoprak committed Feb 14, 2022
1 parent 7c4e4df commit 2998769
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions core/library/Moka_Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ public function process_payment( $orderId )
'result_message'=> self::mokaPosErrorMessages($callbackResult),
'result' => 1, // 1 False 0 True
'created_at' => date('Y-m-d H:i:s'),
];

];

## Display Error on Checkout
if($callbackResult != 'Success')
Expand Down Expand Up @@ -560,14 +559,15 @@ private function formatOrder( $orderId )

$selectedInstallment = data_get($postData, $this->id.'-installment');
$currentComission = data_get($rates, $selectedInstallment.'.value');

$getAmount = $order->get_total();

$orderData = [
'CardHolderFullName' => (string) data_get($postData, $this->id.'-name-oncard'),
'CardNumber' => (string) self::formatCartNumber(data_get($postData, $this->id.'-card-number')),
'ExpMonth' => (string) data_get($expriyDate,'month' ),
'ExpYear' => (string) self::formatExpiryDate(data_get($expriyDate,'year' )),
'CvcNumber' => (string) data_get($postData, $this->id.'-card-cvc'),
'Amount' => (string) self::calculateComissionRate(data_get($postData, $this->id.'-order-total'),$currentComission),
'Amount' => (string) self::calculateComissionRate($getAmount,$currentComission),
'Currency' => (string) $order->get_currency() == 'TRY' ? 'TL' : $order->get_currency() ,
'InstallmentNumber' => (int) $selectedInstallment,
'ClientIP' => (string) self::getUserIp(),
Expand Down Expand Up @@ -658,7 +658,7 @@ private function formatExperyDate($string)
* @return void
*/
private function calculateComissionRate( $total, $percent )
{
{
$total = ( ( ($total*$percent)/100) + $total);
return number_format($total,2,'.', '');
}
Expand All @@ -670,7 +670,7 @@ private function calculateComissionRate( $total, $percent )
* @return void
*/
private function fetchOrder($orderId)
{
{
return wc_get_order( $orderId );
}

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');
define('OPTIMISTHUB_MOKA_PAY_VERSION', '2.9.1');

global $mokaVersion;
$mokaVersion = OPTIMISTHUB_MOKA_PAY_VERSION;
Expand Down
4 changes: 2 additions & 2 deletions core/library/Optimisthub_Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
* @return void
*/
public function validate_bin($params)
{
{
$postData = $params;
$action = data_get($postData, 'action');

Expand Down Expand Up @@ -55,7 +55,7 @@ public function validate_bin($params)
}
}
}

## installments
$data= [
'cardInformation' => $response,
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
* Version: 2.9.1
* Author: Optimist Hub
* Author URI: https://optimisthub.com?ref=mokaPayment
* Domain Path: /languages/
Expand Down

0 comments on commit 2998769

Please sign in to comment.