diff --git a/i18n/languages/woocommerce-iyzico-en_US.mo b/i18n/languages/woocommerce-iyzico-en_US.mo index 88f375c..d59f6b5 100755 Binary files a/i18n/languages/woocommerce-iyzico-en_US.mo and b/i18n/languages/woocommerce-iyzico-en_US.mo differ diff --git a/i18n/languages/woocommerce-iyzico-en_US.po b/i18n/languages/woocommerce-iyzico-en_US.po index 6b37a8a..fbf14f9 100755 --- a/i18n/languages/woocommerce-iyzico-en_US.po +++ b/i18n/languages/woocommerce-iyzico-en_US.po @@ -1,5 +1,5 @@ msgid "" -msgsen "" +msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: \n" "PO-Revision-Date: \n" @@ -10,65 +10,113 @@ msgsen "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 1.8.11\n" "Plural-Forms: nplurals=1; plural=0;\n" -"Language: en_US\n" +"Language: tr_TR\n" # This file is distributed under the GNU General Public License v2 or later. msgid "Api Type" -msgsen "Api Type" +msgstr "Api Type" msgid "Api Key" -msgsen "Api Key" +msgstr "Api Key" msgid "Secret Key" -msgsen "Secret Key" +msgstr "Secret Key" msgid "Payment Value" -msgsen "Payment Value" +msgstr "Payment Value"" msgid "Payment Value Message" -msgstr "Online Payment" +msgstr "Payment Value Message" msgid "Payment Form Description Value" -msgsen "Payment Form Description Value" +msgstr "Payment Form Description Value"" msgid "Enable/Disable" -msgsen "Enable/Disable" +msgstr "Enable/Disable" msgid "Enable iyzico checkout" -msgsen "Enable iyzico checkout" +msgstr "Enable iyzico checkout" msgid "Payment Form Design" -msgsen "Payment Form Design" +msgstr "Payment Form Design" msgid "Left" -msgsen "Bottom Left" +msgstr "Bottom Left" msgid "Right" -msgsen "Bottom Right" +msgstr "Bottom Right" msgid "Hide" -msgsen "Hide" +msgstr "Hide" msgid "Overlay Script" -msgsen "Overlay Script" +msgstr "Overlay Script" msgid "Installment" -msgsen "Installment" +msgstr "Installment" msgid "Installment Fee" -msgsen "Installment Fee" +msgstr "Installment Fee" msgid "This message will show to the user during checkout." -msgsen "This message will show to the user during checkout.." +msgstr "This message will show to the user during checkout." msgid "Pay with your credit card via iyzico." -msgsen "Pay with your credit card via iyzico." +msgstr "Pay with your credit card via iyzico." msgid "Thank you for your order, please click the button below to pay with iyzico Checkout." -msgsen "Thank you for your order, please click the button below to pay with iyzico Checkout." +msgstr "Thank you for your order, please click the button below to pay with iyzico Checkout." msgid "Pay With Card" -msgsen "Pay With Card" +msgstr "Pay with Credit/Bank Card" + +msgid "Order Status" +msgstr "Order Status" + +msgid "Recommended, Default" +msgstr "Recommended, Default" + +msgid "Siparişi onayla" +msgstr "Pay with Credit/Bank Card" + +msgid "Default" +msgstr "Default" + +msgid "Pending" +msgstr "Pending" + +msgid "Processing" +msgstr "Processing" + +msgid "On-Hold" +msgstr "On-Hold" + +msgid "Completed" +msgstr "Completed" + +msgid "Cancelled" +msgstr "Cancelled" + +msgid "Refunded" +msgstr "Refunded" + +msgid "Failed" +msgstr "Failed" + +msgid "iyzico Protected Shopping, Shipping Tracking" +msgstr "iyzico Protected Shopping, Shipping Tracking" + +msgid "By entering the shipping tracking number of this order, you can ensure your customer have real time order tracking." +msgstr "By entering the shipping tracking number of this order, you can ensure your customer have real time order tracking." + +msgid "Select" +msgstr "Select" + +msgid "Shipping Company" +msgstr "Shipping Company" + +msgid "Shipping Tracking Number" +msgstr "Shipping Tracking Number" \ No newline at end of file diff --git a/i18n/languages/woocommerce-iyzico-tr_TR.mo b/i18n/languages/woocommerce-iyzico-tr_TR.mo index 0d66f11..51958ee 100755 Binary files a/i18n/languages/woocommerce-iyzico-tr_TR.mo and b/i18n/languages/woocommerce-iyzico-tr_TR.mo differ diff --git a/i18n/languages/woocommerce-iyzico-tr_TR.po b/i18n/languages/woocommerce-iyzico-tr_TR.po index d5160ca..1efdceb 100755 --- a/i18n/languages/woocommerce-iyzico-tr_TR.po +++ b/i18n/languages/woocommerce-iyzico-tr_TR.po @@ -40,7 +40,6 @@ msgstr "iyzico ile ödemeyi etkinleştir" msgid "Payment Form Design" msgstr "Ödeme Formu Görünümü" - msgid "Left" msgstr "Alt Sol" @@ -104,4 +103,19 @@ msgid "Refunded" msgstr "İade Edildi" msgid "Failed" -msgstr "Başarısız" \ No newline at end of file +msgstr "Başarısız" + +msgid "iyzico Protected Shopping, Shipping Tracking" +msgstr "iyzico Korumalı Alışveriş, Kargo Takibi" + +msgid "By entering the shipping tracking number of this order, you can ensure your customer have real time order tracking." +msgstr "Siparişin kargo takip numarasını girerek, müşterinizin anlık kargo takibi yapmasını sağlayabilirsiniz." + +msgid "Select" +msgstr "Seçiniz" + +msgid "Shipping Company" +msgstr "Kargo Firması" + +msgid "Shipping Tracking Number" +msgstr "Kargo Takip Numarası" \ No newline at end of file diff --git a/library/iyzico-for-woocommerce-buyer-protection.php b/library/iyzico-for-woocommerce-buyer-protection.php index 1eb333c..b34f39c 100644 --- a/library/iyzico-for-woocommerce-buyer-protection.php +++ b/library/iyzico-for-woocommerce-buyer-protection.php @@ -1,11 +1,157 @@ get_id(); + + $cargoCodeValue = 'iyzico_cargo_no_'.$orderId; + $cargoNameValue = 'iyzico_cargo_name_'.$orderId; + + $cargoTrackingNumber = get_option($cargoCodeValue); + $cargoNumber = get_option($cargoNameValue); + $currentOrderStatus = $order->get_status(); + $orderStatusArray = array('processing','on-hold','completed'); + $orderStatus = in_array($currentOrderStatus,$orderStatusArray); + $paymentMethod = $order->get_payment_method(); + $protectedControl = get_option('iyzico_overlay_token'); + + /* Payment Gateways */ + $gateway_controller = WC_Payment_Gateways::instance(); + $all_gateways = $gateway_controller->payment_gateways(); + $iyzico = $all_gateways['iyzico']->settings; + $apiType = $iyzico['api_type']; + + if($apiType == 'https://sandbox-api.iyzipay.com') { + $protectedControl = true; + } + + /* Cargo Object */ + $cargoArray = array(array('name' => 'MNG Kargo', 'value' => 1), + array('name' => 'Aras Kargo', 'value' => 4), + array('name' => 'Yurtiçi Kargo', 'value' => 6), + array('name' => 'UPS Kargo', 'value' => 10), + array('name' => 'Sürat Kargo', 'value' => 15) + ); + + + foreach ($cargoArray as $key => $cargo) { + + $cargoObject[$key] = new stdClass(); + $cargoObject[$key]->name = $cargo['name']; + $cargoObject[$key]->value = $cargo['value']; + } + + $pluginUrl = plugins_url().IYZICO_PLUGIN_NAME; + ?> + + + +
+ + + + + + + payment_gateways(); + $iyzico = $all_gateways['iyzico']->settings; + + $apiKey = $iyzico['api_key']; + $secretKey = $iyzico['secret_key']; + $randNumer = rand(1,99999); + + $iyziModel = new Iyzico_Checkout_For_WooCommerce_Model(); + $paymentId = $iyziModel->findPaymentId($orderId); + + /* Post iyzico */ + $formObjectGenerate = new Iyzico_Checkout_For_WooCommerce_FormObjectGenerate(); + $pkiBuilder = new Iyzico_Checkout_For_WooCommerce_PkiBuilder(); + $iyzicoRequest = new Iyzico_Checkout_For_WooCommerce_iyzicoRequest(); + $baseUrl = $iyzico['api_type']; + + if($baseUrl == 'https://api.iyzipay.com') { + $baseUrl = 'https://iyziup.iyzipay.com'; + } + + $cargoObject = $formObjectGenerate->generateCargoTracking($cargoTrackingNumber,$paymentId,$cargoNumber); + $pkiString = $pkiBuilder->pkiStringGenerate($cargoObject); + $authorizationData = $pkiBuilder->authorizationGenerate($pkiString,$apiKey,$secretKey,$randNumer); + + + $iyzicoJson = json_encode($cargoObject,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); + $requestResponse = $iyzicoRequest->iyzicoCargoTracking($baseUrl,$iyzicoJson,$authorizationData); + + if(isset($requestResponse->status)) { + + if($requestResponse->status == 'success') { + + if(empty($createOrUpdateControl)) { + + add_option($cargoNumberField,$cargoNumber,'','yes'); + add_option($cargoTrackingField,$cargoTrackingNumber,'','yes'); + + } else { + + update_option($cargoNumberField,$cargoNumber); + update_option($cargoTrackingField,$cargoTrackingNumber); + } + + } else { + + return; + } + } + + } + + public static function getOverlayScript() { $token = get_option('iyzico_overlay_token'); $position = get_option('iyzico_overlay_position'); @@ -24,4 +170,4 @@ public function getOverlayScript() { echo $overlayScript; } -} +} \ No newline at end of file diff --git a/library/iyzico-for-woocommerce-gateway-fields.php b/library/iyzico-for-woocommerce-gateway-fields.php index 833ee1d..674b9ad 100755 --- a/library/iyzico-for-woocommerce-gateway-fields.php +++ b/library/iyzico-for-woocommerce-gateway-fields.php @@ -15,7 +15,7 @@ public static function iyzicoAdminFields() { 'default' => 'popup', 'options' => array( - 'https://api.iyzipay.com' => __('Live', 'iyzico-checkout-for-woocommerce'), + 'https://api.iyzipay.com' => __('Live', 'woocommerce-iyzico'), 'https://sandbox-api.iyzipay.com' => __('Sandbox / Test', 'woocommerce-iyzico') )), 'api_key' => array( diff --git a/library/iyzico-for-woocommerce-gateway-formobjectgenerate.php b/library/iyzico-for-woocommerce-gateway-formobjectgenerate.php index 2bfda04..9a8a73b 100755 --- a/library/iyzico-for-woocommerce-gateway-formobjectgenerate.php +++ b/library/iyzico-for-woocommerce-gateway-formobjectgenerate.php @@ -28,7 +28,7 @@ public function generateOption($items,$data,$apiKey) { $iyzico->forceThreeDS = "0"; $iyzico->callbackUrl = add_query_arg('wc-api', 'WC_Gateway_Iyzico', $data->get_checkout_order_received_url()); $iyzico->cardUserKey = $iyziModel->findUserCardKey($user->ID,$apiKey); - $iyzico->paymentSource = 'WOOCOMMERCE|'.WOOCOMMERCE_VERSION.'|CARRERA-1.1.1'; + $iyzico->paymentSource = 'WOOCOMMERCE|'.WOOCOMMERCE_VERSION.'|CARRERA-1.1.3'; return $iyzico; @@ -158,4 +158,15 @@ public function oneProductCalc($order) { return $basketItems; } + + public function generateCargoTracking($trackingNumber,$paymentId,$shippingCompanyId) { + + $cargoObject = new stdClass(); + + $cargoObject->trackingNumber = $trackingNumber; + $cargoObject->paymentId = $paymentId; + $cargoObject->shippingCompanyId = $shippingCompanyId; + + return $cargoObject; + } } \ No newline at end of file diff --git a/library/iyzico-for-woocommerce-gateway-iyzicorequest.php b/library/iyzico-for-woocommerce-gateway-iyzicorequest.php index 78551e7..c1a3821 100755 --- a/library/iyzico-for-woocommerce-gateway-iyzicorequest.php +++ b/library/iyzico-for-woocommerce-gateway-iyzicorequest.php @@ -11,7 +11,6 @@ public function iyzicoCheckoutFormRequest($baseUrl,$json,$authorizationData) { $url = $baseUrl.'/payment/iyzipos/checkoutform/initialize/auth/ecom'; return $this->curlPost($json,$authorizationData,$url); - } public function iyzicoCheckoutFormDetailRequest($baseUrl,$json,$authorizationData) { @@ -19,7 +18,6 @@ public function iyzicoCheckoutFormDetailRequest($baseUrl,$json,$authorizationDat $url = $baseUrl.'/payment/iyzipos/checkoutform/auth/ecom/detail'; return $this->curlPost($json,$authorizationData,$url); - } @@ -28,9 +26,14 @@ public function iyzicoOverlayScriptRequest($baseUrl,$json,$authorizationData) { $baseUrl = "https://iyziup.iyzipay.com/"; $url = $baseUrl."v1/iyziup/protected/shop/detail/overlay-script"; - return $this->curlPost($json,$authorizationData,$url); + } + public function iyzicoCargoTracking($baseUrl,$json,$authorizationData) { + + $url = $baseUrl.'/v1/iyziup/create-zen-order-shipment-over-plugin-framework'; + + return $this->curlPost($json,$authorizationData,$url); } diff --git a/library/iyzico-for-woocommerce-gateway.php b/library/iyzico-for-woocommerce-gateway.php index f3db081..36626c4 100755 --- a/library/iyzico-for-woocommerce-gateway.php +++ b/library/iyzico-for-woocommerce-gateway.php @@ -9,7 +9,7 @@ class Iyzico_Checkout_For_WooCommerce_Gateway extends WC_Payment_Gateway { public function __construct() { $this->id = 'iyzico'; - $this->iyziV = '1.1.2'; + $this->iyziV = '1.1.3'; $this->method_title = __('iyzico', 'woocommerce-iyzico'); $this->method_description = __('Easy Checkout'); $this->has_fields = true; @@ -22,7 +22,7 @@ public function __construct() { $this->title = $this->get_option( 'title' ); $this->description = $this->get_option( 'description' ); $this->enabled = $this->get_option( 'enabled' ); - $this->icon = plugins_url().IYZICO_PLUGIN_NAME.'/image/cards.png'; + $this->icon = plugins_url().IYZICO_PLUGIN_NAME.'/image/cards.png?v='.$this->iyziV.''; add_action('init', array(&$this, 'iyzico_response')); add_action('woocommerce_api_wc_gateway_iyzico', array($this, 'iyzico_response')); @@ -223,7 +223,6 @@ public function iyzico_response() { try { - if(!$_POST['token']) { throw new \Exception("Token not found"); @@ -445,6 +444,6 @@ private function verifyTLS($url) { curl_close($curl); return $response; - } + } } diff --git a/woocommerce-gateway-iyzico.php b/woocommerce-gateway-iyzico.php index 6a7e009..0830d81 100755 --- a/woocommerce-gateway-iyzico.php +++ b/woocommerce-gateway-iyzico.php @@ -5,10 +5,11 @@ * Description: iyzico Payment Gateway for WooCommerce. * Author: iyzico * Author URI: https://iyzico.com - * Version: 1.1.1 + * Version: 1.1.3 * Text Domain: iyzico WooCommerce * Domain Path: /i18n/languages/ - * + * WC requires at least: 3.0.0 + * WC tested up to: 3.5.4 */ define('IYZICO_PATH',untrailingslashit( plugin_dir_path( __FILE__ ))); define('IYZICO_LANG_PATH',plugin_basename(dirname(__FILE__)) . '/i18n/languages/'); @@ -123,6 +124,14 @@ public function InitIyzicoPaymentGateway() { add_action('wp_footer', array('Iyzico_Checkout_For_WooCommerce_Buyer_Protection', 'getOverlayScript')); + + add_action('woocommerce_admin_order_data_after_shipping_address', + array('Iyzico_Checkout_For_WooCommerce_Buyer_Protection', + 'iyziCargoTracking')); + + add_action('woocommerce_process_shop_order_meta', + array('Iyzico_Checkout_For_WooCommerce_Buyer_Protection', + 'iyziCargoTrackingSave')); }