Skip to content

Commit

Permalink
Version 2.9.5 released
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihtoprak committed Apr 25, 2022
1 parent 81b22b2 commit 83c4b8c
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 5 deletions.
68 changes: 65 additions & 3 deletions core/library/Moka_Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ public function receipt_page( $orderId )
{

global $woocommerce;


$fetchData = self::getHash(['orderId' => $orderId]);
$orderDetails = json_decode( data_get($fetchData, 'order_details'), true );
Expand Down Expand Up @@ -524,11 +525,22 @@ public function receipt_page( $orderId )
exit;

} else {
wc_add_notice('Ödemeniz tahsil edilemedi. Lütfen yeniden deneyiniz.', 'error' );

$order = new WC_order($orderId);
$order->update_status('pending', __('Waiting for user payment.', 'moka-woocommerce'));
$recordParams['result_message'] = __('Waiting for user payment.', 'moka-woocommerce');
self::saveRecord($recordParams);

if(isset($_POST) && data_get($_POST, 'resultCode') && data_get($_POST, 'hashValue'))
{
wc_add_notice('Ödemeniz tahsil edilemedi. Lütfen yeniden deneyiniz.', 'notice' );
echo '<div class="woocommerce-notices-wrapper"><ul class="woocommerce-error" role="alert"><li class="">'.self::errorMessagesWithErrorCodes(data_get($_POST, 'resultCode')).' : <a class="moka-continue-checkout" href="'.wc_get_checkout_url().'">'.get_the_title(wc_get_page_id('checkout')).'</a></li></ul></div>';
$recordParams['result_message'] = self::errorMessagesWithErrorCodes(data_get($_POST, 'resultCode'));
self::saveRecord($recordParams);

} else {
wc_add_notice('Ödemeniz tahsil edilemedi. Lütfen yeniden deneyiniz.', 'notice' );
$recordParams['result_message'] = __('Waiting for user payment.', 'moka-woocommerce');
self::saveRecord($recordParams);
}
}

}
Expand Down Expand Up @@ -782,6 +794,9 @@ private function mokaPosErrorMessages($string)
case "PaymentDealer.CheckPaymentDealerAuthentication.InvalidRequest":
$errorOutput = "Hatalı hash bilgisi";
break;
case "Limit is insufficient":
$errorOutput = "Kart limitiniz yetersiz.";
break;
case "PaymentDealer.RequiredFields.AmountRequired":
$errorOutput = "Tutar Göndermek Zorunludur.";
break;
Expand Down Expand Up @@ -821,6 +836,53 @@ private function mokaPosErrorMessages($string)
return $errorOutput;
}

/**
* Error Codes
*
* @param [string] $code
*/
private function errorMessagesWithErrorCodes($code)
{
$codes = [
'000' => 'Genel Hata',
'001' => 'Kart Sahibi Onayı Alınamadı',
'002' => 'Kartınızın limiti yetersiz.',
'003' => 'Kredi Kartı Numarası Geçerli Formatta Değil',
'004' => 'Genel Red',
'005' => 'Kart Sahibine Açık Olmayan İşlem',
'006' => 'Kartın Son Kullanma Tarihi Hatali',
'007' => 'Geçersiz İşlem',
'008' => 'Bankaya Bağlanılamadı',
'009' => 'Tanımsız Hata Kodu',
'010' => 'Banka SSL Hatası',
'011' => 'Manual Onay İçin Bankayı Arayınız',
'012' => 'Kart Bilgileri Hatalı - Kart No veya CVV2',
'013' => 'Visa MC Dışındaki Kartlar 3D Secure Desteklemiyor',
'014' => 'Geçersiz Hesap Numarası',
'015' => 'Geçersiz CVV',
'016' => 'Onay Mekanizması Mevcut Değil',
'017' => 'Sistem Hatası',
'018' => 'Çalıntı Kart',
'019' => 'Kayıp Kart',
'020' => 'Kısıtlı Kart',
'021' => 'Zaman Aşımı',
'022' => 'Geçersiz İşyeri',
'023' => 'Sahte Onay',
'024' => '3D Onayı Alındı Ancak Para Karttan Çekilemedi',
'025' => '3D Onay Alma Hatası',
'026' => 'Kart Sahibi Banka veya Kart 3D-Secure Üyesi Değil',
'027' => 'Kullanıcı Bu İşlemi Yapmaya Yetkili Değil',
'028' => 'Fraud Olasılığı',
'029' => 'Kartınız e-ticaret İşlemlerine Kapalıdır',
];

if(in_array($code, array_keys($codes))) {
return $codes[$code];
} else {
return 'Beklenmeyen bir hata oluştu';
}
}

/**
* Save Installment Rates to DB
*
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.4');
define('OPTIMISTHUB_MOKA_PAY_VERSION', '2.9.5');

global $mokaVersion;
$mokaVersion = OPTIMISTHUB_MOKA_PAY_VERSION;
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.4
* Version: 2.9.5
* 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.5
- Issues : Moka api errors on reciept page.

#### Version 2.9.4
- Feature : You can choose what the status of the order will be when your payments are successfully completed.
- Issue : Customer notes replaced system notes in order notes.
Expand Down

0 comments on commit 83c4b8c

Please sign in to comment.