Skip to content

Commit

Permalink
Merge pull request #19 from sozgat/pwi
Browse files Browse the repository at this point in the history
Opencart3.x pwi-1.2v
  • Loading branch information
sozgat authored Apr 22, 2021
2 parents 8420b09 + a45ae01 commit 340326b
Show file tree
Hide file tree
Showing 12 changed files with 625 additions and 600 deletions.
60 changes: 39 additions & 21 deletions upload/admin/controller/extension/payment/paywithiyzico.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

class ControllerExtensionPaymentPaywithiyzico extends Controller {
private $module_version = '1.0';
private $module_product_name = 'eleven';


private $module_version = '1.2';
private $module_product_name = 'eleven';

private $error = array();

private $fields = array(
Expand All @@ -18,23 +20,38 @@ class ControllerExtensionPaymentPaywithiyzico extends Controller {
'validateField' => 'error_cancel_order_status',
'name' => 'payment_paywithiyzico_order_cancel_status',
)

);


public function install() {

$this->load->model('extension/payment/paywithiyzico');
$this->model_extension_payment_paywithiyzico->install();
$this->model_setting_event->addEvent('pwi_logo_css_for_order_history', 'catalog/controller/common/footer/after', 'extension/payment/paywithiyzico/injectPwiLogoCss');
}

public function uninstall() {

$this->load->model('extension/payment/paywithiyzico');
$this->model_extension_payment_paywithiyzico->uninstall();
$this->model_setting_event->deleteEventByCode('pwi_logo_css_for_order_history');
}

public function index() {

$this->load->language('extension/payment/paywithiyzico');
$this->load->model('setting/setting');
$this->load->model('user/user');
$this->load->model('extension/payment/paywithiyzico');
$this->load->model('extension/payment/paywithiyzico');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {

$request = $this->requestIyzico($this->request->post,'add','');

$this->model_setting_setting->editSetting('payment_paywithiyzico',$request);



$this->response->redirect($this->url->link('extension/payment/paywithiyzico', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true));
}
Expand All @@ -43,14 +60,15 @@ public function index() {
$this->load->model('localisation/order_status');
$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();


$data['action'] = $this->url->link('extension/payment/paywithiyzico', 'user_token=' . $this->session->data['user_token'], true);
$data['heading_title'] = $this->language->get('heading_title');
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$data['locale'] = $this->language->get('code');

$data['version'] = $this->module_version;


foreach ($this->fields as $key => $field) {

Expand All @@ -59,15 +77,15 @@ public function index() {
} else {
$data[$field['validateField']] = '';
}

if (isset($this->request->post[$field['name']])) {
$data[$field['name']] = $this->request->post[$field['name']];
} else {
$data[$field['name']] = $this->config->get($field['name']);
}
}


$this->response->setOutput($this->load->view('extension/payment/paywithiyzico', $data));
}

Expand All @@ -78,25 +96,25 @@ protected function validate() {
}

foreach ($this->fields as $key => $field) {

if($field['validateField'] != 'blank') {

if (!$this->request->post[$field['name']]){
$this->error[$field['validateField']] = $this->language->get($field['validateField']);
$this->error[$field['validateField']] = $this->language->get($field['validateField']);
}
}

}

return !$this->error;
}

public function requestIyzico($request,$method_type,$extra_request = false) {

$request_modify = array();

if ($method_type == 'add') {


foreach ($this->fields as $key => $field) {

Expand All @@ -106,11 +124,11 @@ public function requestIyzico($request,$method_type,$extra_request = false) {
$request[$field['name']] = str_replace(' ','',$request[$field['name']]);

$request_modify[$field['name']] = $request[$field['name']];

}

}


}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Heading
$_['heading_title'] = 'Pay with iyzico';
$_['text_paywithiyzico'] = '<a href="http://www.paywithiyzico.com/" target="_blank"><img src="view/image/payment/paywithiyzico_logo.png" alt="paywithiyzico" title="paywithiyzico" /></a>';
$_['text_paywithiyzico'] = '<a href="https://www.iyzico.com/isim-icin/iyzico-ile-ode" target="_blank"><img src="view/image/payment/paywithiyzico_logo.png" alt="paywithiyzico" title="paywithiyzico" /></a>';
$_['general_select'] = 'Select';
$_['live'] = 'Live';
$_['sandbox'] = 'Sandbox / Test';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Heading
$_['heading_title'] = 'iyzico ile Öde';
$_['text_paywithiyzico'] = '<a href="http://www.paywithiyzico.com/" target="_blank"><img src="view/image/payment/paywithiyzico_logo.png" alt="paywithiyzico" title="paywithiyzico" /></a>';
$_['text_paywithiyzico'] = '<a href="https://www.iyzico.com/isim-icin/iyzico-ile-ode" target="_blank"><img src="view/image/payment/paywithiyzico_logo.png" alt="paywithiyzico" title="paywithiyzico" /></a>';
$_['general_select'] = 'Seçiniz';
$_['live'] = 'Live';
$_['sandbox'] = 'Sandbox / Test';
Expand Down
Loading

0 comments on commit 340326b

Please sign in to comment.