From d23da5fcf9f5336b62fc938c7e4616b019aeb888 Mon Sep 17 00:00:00 2001 From: "said.ozgat" Date: Wed, 18 Aug 2021 12:16:40 +0300 Subject: [PATCH] +pwi check 2.1v --- .../controller/extension/payment/iyzico.php | 31 ++++++++++++++++--- .../en-gb/extension/payment/iyzico.php | 6 +++- .../tr-tr/extension/payment/iyzico.php | 7 ++++- .../payment/iyzico_pwi_load_control.twig | 23 ++++++++++++++ .../controller/extension/payment/iyzico.php | 2 +- 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 upload/admin/view/template/extension/payment/iyzico_pwi_load_control.twig diff --git a/upload/admin/controller/extension/payment/iyzico.php b/upload/admin/controller/extension/payment/iyzico.php index 8f44e79..b7db152 100755 --- a/upload/admin/controller/extension/payment/iyzico.php +++ b/upload/admin/controller/extension/payment/iyzico.php @@ -1,6 +1,6 @@ 'blank', 'name' => 'webhook_iyzico_webhook_url_key', ) - ); public function index() { @@ -113,7 +112,6 @@ public function index() { } } - $this->document->setTitle($this->language->get('heading_title')); $this->document->addStyle('view/stylesheet/iyzico/iyzico.css'); $this->document->addScript('view/javascript/iyzico/accordion_iyzico.js','footer'); @@ -146,7 +144,24 @@ public function index() { $data['iyzico_webhook_url'] = HTTPS_CATALOG.'index.php?route=extension/payment/iyzico/webhook&key=' .$this->config->get('webhook_iyzico_webhook_url_key'); $data['module_version'] = $this->module_version; - $this->response->setOutput($this->load->view('extension/payment/iyzico', $data)); + $pwi_status = $this->config->get('payment_paywithiyzico_status'); + $pwi_status_after_enabled_pwi = $this->config->get('payment_iyzico_pwi_first_enabled_status'); + + $data_pwi_load_check['pwi_status_error'] = $this->language->get('pwi_status_error'); + $data_pwi_load_check['pwi_status_error_detail'] = $this->language->get('pwi_status_error_detail'); + $data_pwi_load_check['dev_iyzipay_opencart_link'] = $this->language->get('dev_iyzipay_opencart_link'); + $data_pwi_load_check['dev_iyzipay_detail'] = $this->language->get('dev_iyzipay_detail'); + $data_pwi_load_check['header'] = $this->load->controller('common/header'); + $data_pwi_load_check['column_left'] = $this->load->controller('common/column_left'); + + //if pwi disabled and pwi first enabled status 0, set output pwi load page + if ($pwi_status == 0 && $pwi_status_after_enabled_pwi != 1){ + $this->response->setOutput($this->load->view('extension/payment/iyzico_pwi_load_control', $data_pwi_load_check)); + } + else{ + $this->setPWIModuleFirstStatus($pwi_status_after_enabled_pwi); + $this->response->setOutput($this->load->view('extension/payment/iyzico', $data)); + } } private function getApiConnection($api_key,$secret_key) { @@ -241,6 +256,7 @@ public function install() { public function uninstall() { $this->load->model('extension/payment/iyzico'); + $this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE store_id = '0' AND code = 'payment_iyzico_pwi_status'"); $this->model_extension_payment_iyzico->uninstall(); $this->model_setting_event->deleteEventByCode('overlay_script'); $this->model_setting_event->deleteEventByCode('module_notification'); @@ -337,4 +353,11 @@ private function setIyziWebhookUrlKey() return true; } + //if pwi enabled, set pwi_status key in setting table + private function setPWIModuleFirstStatus($pwiStatus) + { + if (!isset($pwiStatus)){ + $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` (`code`, `key`, `value`, `serialized`) VALUES ('payment_iyzico_pwi_status', 'payment_iyzico_pwi_first_enabled_status', '1', '0');"); + } + } } diff --git a/upload/admin/language/en-gb/extension/payment/iyzico.php b/upload/admin/language/en-gb/extension/payment/iyzico.php index 16bd6f2..f2ca8c0 100755 --- a/upload/admin/language/en-gb/extension/payment/iyzico.php +++ b/upload/admin/language/en-gb/extension/payment/iyzico.php @@ -1,7 +1,7 @@ iyzico'; $_['general_select'] = 'Select'; $_['live'] = 'Live'; @@ -56,3 +56,7 @@ $_['webhook_url_description'] = "Don't forget to do webhook Integration."; $_['iyzico_webhook_url_key_error'] = "Webhook URL Error! Please, try these steps respectively. 1- Refresh web page 1-2 times. 2- If webhook url doesn't create , Please, after delete the iyzico plugin, re-install the iyzico plugin and save module settings. 3- Send an email to entegrasyon@iyzico.com"; +$_['pwi_status_error'] = "Pay with iyzico module is not enable!"; +$_['pwi_status_error_detail'] = "You can not access Settings of iyzico Checkout Form Module without installing the pay with iyzico module."; +$_['dev_iyzipay_opencart_link'] = "https://dev.iyzipay.com/tr/acik-kaynak/opencart"; +$_['dev_iyzipay_detail'] = "Complete the installation of the Opencart 3.x - Pay with iyzico module via dev.iyzipay:"; \ No newline at end of file diff --git a/upload/admin/language/tr-tr/extension/payment/iyzico.php b/upload/admin/language/tr-tr/extension/payment/iyzico.php index 6fb5427..d40d11d 100755 --- a/upload/admin/language/tr-tr/extension/payment/iyzico.php +++ b/upload/admin/language/tr-tr/extension/payment/iyzico.php @@ -1,7 +1,7 @@ iyzico'; $_['general_select'] = 'Seçiniz'; $_['live'] = 'Live'; @@ -57,3 +57,8 @@ $_['iyzico_webhook'] = 'Webhook Entegrasyonu'; $_['webhook_url_description'] = "Webhook entegrasyonunu yapmayı unutmayınız."; $_['iyzico_webhook_url_key_error'] = "Webhook URL üretilemedi. Lütfen sırasıyla bu adımları deneyin. 1- Web sayfasını 1-2 defa yenileyin. 2- Webhook URL üretilmediyse lütfen plugini kaldırıp, yeniden kurun ve ayarları kaydedin. 3- Sorun devam ederse entegrasyon@iyzico.com'a mail atınız."; + +$_['pwi_status_error'] = "iyzico İle Öde modülü aktif değil!"; +$_['pwi_status_error_detail'] = "iyzico ile Öde modülünü kurmadan iyzico Ödeme Formu ayarlarına erişemezsiniz."; +$_['dev_iyzipay_opencart_link'] = "https://dev.iyzipay.com/tr/acik-kaynak/opencart"; +$_['dev_iyzipay_detail'] = "Opencart 3.x - iyzico ile Öde modülünün kurulumunu tamamlayınız: "; \ No newline at end of file diff --git a/upload/admin/view/template/extension/payment/iyzico_pwi_load_control.twig b/upload/admin/view/template/extension/payment/iyzico_pwi_load_control.twig new file mode 100644 index 0000000..0a52b21 --- /dev/null +++ b/upload/admin/view/template/extension/payment/iyzico_pwi_load_control.twig @@ -0,0 +1,23 @@ +{{ header }}{{ column_left }} +
+ + +
+
+ +

{{ pwi_status_error_detail }}

+ {{ dev_iyzipay_detail }} {{ dev_iyzipay_opencart_link }}

+
+
+
\ No newline at end of file diff --git a/upload/catalog/controller/extension/payment/iyzico.php b/upload/catalog/controller/extension/payment/iyzico.php index c3b72a2..c7b07ec 100755 --- a/upload/catalog/controller/extension/payment/iyzico.php +++ b/upload/catalog/controller/extension/payment/iyzico.php @@ -2,7 +2,7 @@ class ControllerExtensionPaymentIyzico extends Controller { private $module_version = VERSION; - private $module_product_name = 'eleven-2.0'; + private $module_product_name = 'eleven-2.1'; private $paymentConversationId; private $webhookToken;