-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdb95bb
commit fb26c83
Showing
81 changed files
with
1,640 additions
and
2,100 deletions.
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
146 changes: 146 additions & 0 deletions
146
paywithiyzico/admin/controller/payment/paywithiyzico.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?php | ||
namespace Opencart\Admin\Controller\Extension\paywithiyzico\Payment; | ||
use stdClass; | ||
class paywithiyzico extends \Opencart\System\Engine\Controller | ||
{ | ||
|
||
private $module_version = '1.0'; | ||
private $module_product_name = 'starter-1.0'; | ||
|
||
private $error = array(); | ||
|
||
private $fields = array( | ||
array( | ||
'validateField' => 'blank', | ||
'name' => 'payment_paywithiyzico_status', | ||
), | ||
array( | ||
'validateField' => 'error_order_status', | ||
'name' => 'payment_paywithiyzico_order_status', | ||
), | ||
array( | ||
'validateField' => 'error_cancel_order_status', | ||
'name' => 'payment_paywithiyzico_order_cancel_status', | ||
) | ||
|
||
); | ||
|
||
|
||
public function install() { | ||
|
||
$this->load->model('extension/paywithiyzico/payment/paywithiyzico'); | ||
$this->model_extension_paywithiyzico_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/paywithiyzico/payment/paywithiyzico'); | ||
$this->model_extension_paywithiyzico_payment_paywithiyzico->uninstall(); | ||
$this->model_setting_event->deleteEventByCode('pwi_logo_css_for_order_history'); | ||
} | ||
|
||
public function index(): void { | ||
|
||
$this->load->language('extension/paywithiyzico/payment/paywithiyzico'); | ||
$this->load->model('setting/setting'); | ||
$this->load->model('user/user'); | ||
$this->load->model('extension/paywithiyzico/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/paywithiyzico/payment/paywithiyzico', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true)); | ||
} | ||
|
||
/* Get Order Status */ | ||
$this->load->model('localisation/order_status'); | ||
$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses(); | ||
$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment'); | ||
|
||
|
||
$data['action'] = $this->url->link('extension/paywithiyzico/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; | ||
$data['pwi_module_logo']=$this->language->get('pwi_module_setting_logo'); | ||
|
||
|
||
foreach ($this->fields as $key => $field) { | ||
|
||
if (isset($this->error[$field['validateField']])) { | ||
$data[$field['validateField']] = $this->error[$field['validateField']]; | ||
} 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/paywithiyzico/payment/paywithiyzico', $data)); | ||
} | ||
|
||
protected function validate() { | ||
|
||
if (!$this->user->hasPermission('modify', 'extension/paywithiyzico/payment/paywithiyzico')) { | ||
$this->error['warning'] = $this->language->get('error_permission'); | ||
} | ||
|
||
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']); | ||
} | ||
} | ||
|
||
} | ||
|
||
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) { | ||
|
||
if(isset($request[$field['name']])) { | ||
|
||
if($field['name'] == 'payment_paywithiyzico_api_key' || $field['name'] == 'payment_paywithiyzico_secret_key') | ||
$request[$field['name']] = str_replace(' ','',$request[$field['name']]); | ||
|
||
$request_modify[$field['name']] = $request[$field['name']]; | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
return $request_modify; | ||
} | ||
|
||
|
||
|
||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.