Skip to content

Commit

Permalink
+pwi check 2.1v
Browse files Browse the repository at this point in the history
  • Loading branch information
sozgat committed Aug 18, 2021
1 parent 56ba760 commit d23da5f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 7 deletions.
31 changes: 27 additions & 4 deletions upload/admin/controller/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
class ControllerExtensionPaymentIyzico extends Controller {
private $module_version = '2.0';
private $module_version = '2.1';

private $error = array();

Expand Down Expand Up @@ -65,7 +65,6 @@ class ControllerExtensionPaymentIyzico extends Controller {
'validateField' => 'blank',
'name' => 'webhook_iyzico_webhook_url_key',
)

);

public function index() {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');");
}
}
}
6 changes: 5 additions & 1 deletion upload/admin/language/en-gb/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Heading
$_['heading_title'] = 'iyzico';
$_['heading_title'] = 'iyzico Checkout Form';
$_['text_iyzico'] = '<a href="http://www.iyzico.com/" target="_blank"><img src="view/image/payment/iyzico_logo.png" alt="iyzico" title="iyzico" /></a>';
$_['general_select'] = 'Select';
$_['live'] = 'Live';
Expand Down Expand Up @@ -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 [email protected]";

$_['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:";
7 changes: 6 additions & 1 deletion upload/admin/language/tr-tr/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Heading
$_['heading_title'] = 'iyzico';
$_['heading_title'] = 'iyzico Ödeme Formu';
$_['text_iyzico'] = '<a href="http://www.iyzico.com/" target="_blank"><img src="view/image/payment/iyzico_logo.png" alt="iyzico" title="iyzico" /></a>';
$_['general_select'] = 'Seçiniz';
$_['live'] = 'Live';
Expand Down Expand Up @@ -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 [email protected]'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: ";
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ header }}{{ column_left }}
<div id="content">
<ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %}
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
{% endfor %}
</ul>
<div class="page-header">
<div class="container-fluid">
<div class="pull-right"></div>
<h1><i class="fa fa-credit-card"></i> {{ heading_title }}</h1>
</div>
</div>
<div class="container-fluid">
<div class="panel-body">
<div class="alert alert-danger" role="alert">
<h1>{{ pwi_status_error }}</h1>
</div>
<h4>{{ pwi_status_error_detail }}<br><br>
{{ dev_iyzipay_detail }} <a href="{{ dev_iyzipay_opencart_link }}" target="_blank"> {{ dev_iyzipay_opencart_link }}</a></h4>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion upload/catalog/controller/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d23da5f

Please sign in to comment.