From 07b71b697a45dd57490381be8cfc68d8287ee833 Mon Sep 17 00:00:00 2001 From: Fatih Toprak Date: Thu, 20 Oct 2022 01:55:59 +0300 Subject: [PATCH] 3.0.2 released. --- core/library/Moka_Core.php | 11 ++++++-- core/library/Moka_Gateway.php | 21 +++++++++----- core/library/Moka_Init.php | 5 ++-- core/library/Moka_Subscriptions.php | 33 ++++++++++++---------- core/library/static/Optimisthub.php | 4 ++- index.php | 2 +- languages/moka-woocommerce-en_US.mo | Bin 6356 -> 5944 bytes languages/moka-woocommerce-en_US.po | 42 ++++++---------------------- languages/moka-woocommerce-tr_TR.mo | Bin 6921 -> 6479 bytes languages/moka-woocommerce-tr_TR.po | 42 ++++++---------------------- 10 files changed, 65 insertions(+), 95 deletions(-) diff --git a/core/library/Moka_Core.php b/core/library/Moka_Core.php index 405f6c1..f82b3fd 100644 --- a/core/library/Moka_Core.php +++ b/core/library/Moka_Core.php @@ -174,6 +174,9 @@ public function setInstallments($params) public function generateInstallmentsTableHtml($params) { + $assetDir = str_replace('/core/library/', '/assets/' , plugin_dir_url( __FILE__ )); + + $storedData = get_option( 'woocommerce_mokapay-installments' ); $avaliableInstallmentsCount = data_get($params, 'maxInstallment'); $paymentId = data_get($params, 'paymentGatewayId'); @@ -198,7 +201,7 @@ public function generateInstallmentsTableHtml($params) foreach($storedData as $perStoredInstallmentKey => $perStoredInstallment) { $return.=''; - $imagePath = plugins_url( 'moka-woocommerce-master/assets/img/cards/banks/' ); + $imagePath = $assetDir. '/img/cards/banks/'; $return.= ''; $cardImageSlug = data_get($perStoredInstallment, 'groupName'); @@ -250,7 +253,7 @@ public function generateInstallmentsTableHtml($params) */ public function generateInstallmentsTableShortcode() { - + $storedData = get_option( 'woocommerce_mokapay-installments' ); if(!$storedData) @@ -266,12 +269,14 @@ public function generateInstallmentsTableShortcode() } $return.= ''; + + $assetDir = str_replace('/core/library/', '/assets/' , plugin_dir_url( __FILE__ )); foreach($storedData as $perStoredInstallmentKey => $perStoredInstallment) { $return.=''; - $imagePath = plugins_url( 'moka-woocommerce-master/assets/img/cards/banks/' ); + $imagePath = $assetDir.'img/cards/banks/'; $cardImageSlug = data_get($perStoredInstallment, 'groupName'); $cardSymbol = ''; if(!$cardImageSlug) diff --git a/core/library/Moka_Gateway.php b/core/library/Moka_Gateway.php index 13a8278..de436de 100644 --- a/core/library/Moka_Gateway.php +++ b/core/library/Moka_Gateway.php @@ -21,7 +21,7 @@ class OptimistHub_Moka_Gateway extends WC_Payment_Gateway { public function __construct() { - + $this->id = 'mokapay'; $this->icon = ''; // TODO : Moka Icon $this->has_fields = true; @@ -691,6 +691,9 @@ private function formatOrder( $orderId ) $getAmount = $order->get_total(); $customerId = $order->get_user_id(); + $orderItems = $order->get_items(); + $hasSubscription = $this->isOrderHasSubscriptionProduct($orderItems); + $orderData = [ 'CardHolderFullName' => (string) data_get($postData, $this->id.'-name-oncard'), 'CardNumber' => (string) self::formatCartNumber(data_get($postData, $this->id.'-card-number')), @@ -736,6 +739,11 @@ private function formatOrder( $orderId ) // TODO : Basket Product Details //'BasketProduct' => self::formatBaksetProducts($order), ]; + + if($hasSubscription) + { + $orderData['Description'] = 'RecurringPayment-'.$orderId; + } return $orderData; @@ -1290,19 +1298,18 @@ private function getSubscriptionProductPeriod($orderItems) $__data = get_post_meta($productId); $__per = data_get($__data, '_period_per.0', null); $__in = data_get($__data, '_period_in.0', null); - - $__inString = ['gun' => 'day', 'ay' => 'month', 'hafta' => 'week']; $currentTime = Carbon::parse(current_datetime()->format('Y-m-d H:i:s')); - $__per = str_replace(['her-','her_', 'her'], '1', $__per); - $nextTry = $currentTime::now()->add($__per, $__inString[$__in]); + $nextTry = $currentTime::now()->add($__per, $__in); $period = [ 'current_time' => Carbon::parse($currentTime)->format('Y-m-d H:i:s'), 'next_try' => Carbon::parse($nextTry)->format('Y-m-d H:i:s'), - 'period_string' => $__per.'-'.$__inString[$__in], - ]; + 'period_string' => $__per.' '.$__in, + ]; + + ray($period); } } } diff --git a/core/library/Moka_Init.php b/core/library/Moka_Init.php index 88e0e0f..dfd7c31 100644 --- a/core/library/Moka_Init.php +++ b/core/library/Moka_Init.php @@ -3,7 +3,7 @@ exit; } -define('OPTIMISTHUB_MOKA_PAY_VERSION', '3.0.1'); +define('OPTIMISTHUB_MOKA_PAY_VERSION', '3.0.2'); global $mokaVersion; $mokaVersion = OPTIMISTHUB_MOKA_PAY_VERSION; @@ -65,7 +65,8 @@ public function optimisthubDashBoardWidgetInit() */ public function recentNewsByOptimisthub() { - echo '

Ücretsiz Moka POS WooCommerce Eklentisi Optimist Hub Bünyesinde geliştirilmiştir. Açık kaynak kodlu eklentiye sizler de katkıda bulunabilirsiniz. >

'; + $assetDir = str_replace('/core/library/', '/assets/' , plugin_dir_url( __FILE__ )); + echo '

Ücretsiz Moka POS WooCommerce Eklentisi Optimist Hub Bünyesinde geliştirilmiştir. Açık kaynak kodlu eklentiye sizler de katkıda bulunabilirsiniz. >

'; } } diff --git a/core/library/Moka_Subscriptions.php b/core/library/Moka_Subscriptions.php index 1987448..1b27525 100644 --- a/core/library/Moka_Subscriptions.php +++ b/core/library/Moka_Subscriptions.php @@ -204,10 +204,10 @@ public function registerSubscriptionProductTabContent($tabs) 'label' => __( 'Abonelik Periyodu', 'moka-woocommerce' ), 'value' => $product_object->get_meta( '_period_per', true ), 'options' => [ - 'her' => 'Her', - 'her_2' => 'Her 2.', - 'her_3' => 'Her 3.', - 'her_4' => 'Her 4.', + '1' => 'Her', + '2' => 'Her 2.', + '3' => 'Her 3.', + '4' => 'Her 4.', ], 'default' => '', 'placeholder' => __( 'Period', 'moka-woocommerce' ), @@ -219,7 +219,7 @@ public function registerSubscriptionProductTabContent($tabs) 'class' => 'select short', 'label' => '', 'value' => $product_object->get_meta( '_period_in', true ), - 'options' => ['gun' => 'Gün','hafta' => 'Hafta', 'ay' => 'Ay'], + 'options' => ['day' => 'Gün','week' => 'Hafta', 'month' => 'Ay', 'year'=> 'Yıl'], 'default' => '', 'placeholder' => __( 'Period', 'moka-woocommerce' ), ] @@ -301,7 +301,8 @@ public function addToCartButtonProductSummary()

-

".__('Renewal Period', 'moka-woocommerce').' : '.__($periodString, 'moka-woocommerce'); ?>

+

".__('Renewal Period', 'moka-woocommerce').' : '.data_get($period, '_period_per.0'). ' ' .__(data_get($period,'_period_in.0'), 'moka-woocommerce'); ?> +

__('Renewal Period', 'moka-woocommerce'), - 'value' => __($periodString, 'moka-woocommerce'), + 'value' => $periodString, 'display' => '', ]; return $itemData; @@ -515,10 +516,11 @@ public function runSubscriptionPayments() 'Description' => 'RecurringPayment-'.$orderId, 'isSubscriptionPayment' => true, ]; + $doPayment = $payment->initializePayment($requestParams); $isSuccess = data_get($doPayment, 'Data.IsSuccessful'); - + if($isSuccess) { // Save Log @@ -538,17 +540,18 @@ public function runSubscriptionPayments() // Update Subscription information $subscriptionPeriod = data_get($perValue, 'subscription_period'); $currentTime = Carbon::parse(current_datetime()->format('Y-m-d H:i:s')); - $__inString = ['day', 'month', 'week']; - - $__per = str_replace(['her-', 'her_'], '1 ', $subscriptionPeriod); - $__per = explode('-',$__per); + + $__data = get_post_meta($productId); + $__per = data_get($__data, '_period_per.0', null); + $__in = data_get($__data, '_period_in.0', null); + + $nextTry = $currentTime::now()->add($__per, $__in); - $nextTry = $currentTime::now()->add($__per[0],$__per[1]); $period = [ 'current_time' => Carbon::parse($currentTime)->format('Y-m-d H:i:s'), 'next_try' => Carbon::parse($nextTry)->format('Y-m-d H:i:s'), - 'period_string' => implode('-',$__per), + 'period_string' => $__per.' '.$__in, ]; $wpdb->query( diff --git a/core/library/static/Optimisthub.php b/core/library/static/Optimisthub.php index 45e8c23..89ecd65 100644 --- a/core/library/static/Optimisthub.php +++ b/core/library/static/Optimisthub.php @@ -44,7 +44,9 @@

- +

Ücretsiz Moka POS WooCommerce Eklentisi Optimist Hub Bünyesinde geliştirilmiştir.

diff --git a/index.php b/index.php index 1b24cf3..7022837 100644 --- a/index.php +++ b/index.php @@ -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.0.1 + * Version: 3.0.2 * Author: Optimist Hub * Author URI: https://optimisthub.com?ref=mokaPayment * Domain Path: /languages/ diff --git a/languages/moka-woocommerce-en_US.mo b/languages/moka-woocommerce-en_US.mo index 1bea85bc6eb879e91cba7363c139d4e5a80b2e83..5a06c1ef29b4e6eda852eff1cdc79a38fc5f4a8a 100644 GIT binary patch delta 1504 zcmZwHOGs2v9LMp0lW9Iu8||TGT1`G`v>7!`t!&C3i=ws?SZ0P0CP*Ly!W7cNbYY2s zZQK=E;lhoJ*+kHT7DZUJsEnYXur}Fa(W39~-XpZ=aR2vn@0sI0|9j5=Ivbs-O1ulE zj2SIPtS3SNvsMhJaH5SYGb_cbSb;On56-MqzrPOC`27@eSQn=(>~Z#EI`@N^iKCcf zmaqvoV9J@q3NfQjP^C^arMsq&SR*FPM{vxfvSaWR4rUYE&VvE7Ve-{ z=sv0zp69au+LLc|D8nG5HBm7tp>3#IXhPM(ad$t495%^GwU9*p{T#BrHt+6#I0Iy* zTF61V>?ms9lL;=gL<87_S5O%~bp0<;Z}tW?!6&?l-%+)2BhRmew>ZpwA=#=HZlRuY z54D0x)Ji=<)xtAWEhIj3p<+0~`luG-tNmICt??gJj;e(!XALskYYeq!B0|)7J**gR zAT&t>p``z9Te%6jj_#fDYxdOPkRl$csMQB7#i^<|V0 zWyE45XRqz#93`|Byf<6T{%d*kpHBs$A_)*`bp&PM)j^{=X!=UD9a`eWR>4Irp?&28 z@tU?$O z&bw{DZ@Au+zgbaq(kPpWN@DK}vjmP7aiK(?HLJxYtiv7dF?ZCxfwMJ%3sswg#aQZA z;#}HwI1gi3YL>SSzoF0V$LF|VAL_=e`>8vG{Macjdf+*%z!7{AFJU>}z!z`=pT~c( z3QOjg)!=F@W_|0UqJ{dA9a#z&;1TS`avHMwg0ri{_WXLWe zFKs{KV*C|%;~iY{44<5b=SS!mED0B`X0|4*L~S67db2ifcOi3atM|X-{ky&YfcGEq z{?EMsOWehR!&uAwhordCsOxIA~^d1Ha zGg%8&qc&8JI!o(OXX$Nk4o2WRL?(^w{jVq+8;RwF zzB!q;dg2vAMF*>gXjFspQb=&E=DLPZ%A1H*LgnQUYgOu35ju1#YYBa)USbKM)2qUt zh~R&O4w+8=(y`;S?$6Grl9@;%XX5=s2Ln@yfowvx_nLi(iVsqo9*#X3j!g~63WnoP zhT~JiaUb56Nq>;slda!;;%rIVyl88Ev?bEi($?HEcDtl=ZhmX}U^aCiXWfZ?T(>8a z`=MtrnaM@6htrV{HT-cw$KFJ)uz8pXQ|(kHnf%X;psR3B&@nx$F&7y~AIdyEE9fbh J6tu%Rj{y_T\n" "Language-Team: \n" "Language: en_US\n" @@ -155,41 +155,17 @@ msgstr "Subscribe" msgid "Renewal Period" msgstr "Renewal Period" -msgid "her gun" -msgstr "Daily" +msgid "day" +msgstr "day" -msgid "her hafta" -msgstr "Weekly" +msgid "week" +msgstr "week" -msgid "her ay" -msgstr "Monthly" +msgid "month" +msgstr "month" -msgid "her_2 gun" -msgstr "Every two days" - -msgid "her_2 hafta" -msgstr "Every two weeks" - -msgid "her_2 ay" -msgstr "Every two months" - -msgid "her_3 gun" -msgstr "Every three days" - -msgid "her_3 hafta" -msgstr "Every three weeks" - -msgid "her_3 ay" -msgstr "Every three months" - -msgid "her_4 gun" -msgstr "Every four days" - -msgid "her_4 hafta" -msgstr "Every four weeks" - -msgid "her_4 ay" -msgstr "Every four months" +msgid "year" +msgstr "year" msgid "Subscription" msgstr "Subscription" diff --git a/languages/moka-woocommerce-tr_TR.mo b/languages/moka-woocommerce-tr_TR.mo index bc934fafc3848fd1655f20a96ca26054a9182c03..c230e5f23fc3c435a4677703547e45e6068c2c22 100644 GIT binary patch delta 1503 zcmYk+Pe_zO7{~FaTD8>7Kb2WoR;F2Nt^cw2Sfn}uW7Iq`MVLn!&=ftBjn1RgQvM~ewcn*)De}&m2 zj69~{9iyzm{?E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zuJKC#U(pr4mue7|V%JcF0kYnqLb5(k`D7iLq7u~n`qC<7+8xpSFDW|9$ z<(z{``be!NFI0sz*~hzPa?K{|rOqW6kd+R0_ z)1BwKE1DX2*X(G{DLZp9r7$T_kP`@J4%9!qS!ZkG-3|5e?m8>g zioB*$))}pf^5p7BMpd-QdK-3eZ*@(-CU2pAZi{!vuk|13wfr-Zw(@KKGW(3Jj(0UR P_aE#x{WIEc>^t*s67%\n" "Language-Team: \n" "Language: tr_TR\n" @@ -156,41 +156,17 @@ msgstr "Aboneliği Başlat" msgid "Renewal Period" msgstr "Yenilenme Periyodu" -msgid "her gun" -msgstr "Günlük" +msgid "day" +msgstr "gün" -msgid "her hafta" -msgstr "Haftalık" +msgid "week" +msgstr "hafta" -msgid "her ay" -msgstr "Aylık" +msgid "month" +msgstr "ay" -msgid "her_2 gun" -msgstr "Her iki günde bir" - -msgid "her_2 hafta" -msgstr "Her iki haftada bir" - -msgid "her_2 ay" -msgstr "Her iki ayda bir" - -msgid "her_3 gun" -msgstr "Her üç günde bir" - -msgid "her_3 hafta" -msgstr "Her üç haftada bir" - -msgid "her_3 ay" -msgstr "Her üç ayda bir" - -msgid "her_4 gun" -msgstr "Her dört günde bir" - -msgid "her_4 hafta" -msgstr "Her dört haftada bir" - -msgid "her_4 ay" -msgstr "Her dört ayda bir" +msgid "year" +msgstr "yıl" msgid "Subscription" msgstr "Abonelikler"