-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from omise/feature/1-offsite
- Loading branch information
Showing
103 changed files
with
2,653 additions
and
4,763 deletions.
There are no files selected for viewing
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
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
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,161 @@ | ||
<?php | ||
|
||
class ControllerPaymentOmiseOffsite extends Controller { | ||
/** | ||
* Render Omise Payment Gateway - Internet Banking extension setting page | ||
* | ||
* @return void | ||
*/ | ||
public function index() { | ||
/** | ||
* Prepare and loading necessary scripts. | ||
* | ||
*/ | ||
// Load model. | ||
$this->load->model('setting/setting'); | ||
|
||
// Load language. | ||
$this->language->load('payment/omise'); | ||
$this->language->load('payment/omise_offsite'); | ||
|
||
/** | ||
* POST Request handle. | ||
* | ||
*/ | ||
if (($this->request->server['REQUEST_METHOD'] == 'POST')) { | ||
if ($this->request->post['omise_offsite_status'] == 1 && $this->config->get('omise_status') != 1) { | ||
$this->session->data['error'] = $this->language->get('error_need_omise_extension'); | ||
$this->data['input_error']['omise_offsite_status'] = $this->language->get('error_need_omise_extension'); | ||
} else { | ||
$this->model_setting_setting->editSetting('omise_offsite', $this->request->post); | ||
$this->data['input_error'] = array(); | ||
$this->data = array_merge($this->data, $this->request->post); | ||
|
||
$this->session->data['success'] = $this->language->get('text_session_save'); | ||
$this->redirect($this->url->link('payment/omise_offsite', 'token=' . $this->session->data['token'], 'SSL')); | ||
} | ||
} | ||
|
||
/** | ||
* Language setup. | ||
* | ||
*/ | ||
$this->document->setTitle('Omise Payment Gateway Internet Banking Configuration'); | ||
|
||
// Set form label with language. | ||
$this->data['heading_title'] = $this->language->get('heading_title'); | ||
$this->data['button_save'] = $this->language->get('text_button_save'); | ||
$this->data['button_cancel'] = $this->language->get('text_button_cancel'); | ||
$this->data['entry_order_status'] = $this->language->get('entry_order_status'); | ||
$this->data['text_enabled'] = $this->language->get('text_enabled'); | ||
$this->data['text_disabled'] = $this->language->get('text_disabled'); | ||
$this->data['entry_status'] = $this->language->get('entry_status'); | ||
|
||
// Set action button. | ||
$this->data['action'] = $this->url->link('payment/omise_offsite', 'token=' . $this->session->data['token'], 'SSL'); | ||
$this->data['cancel'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'); | ||
|
||
/** | ||
* Page data setup. | ||
* | ||
*/ | ||
$this->data['omise_offsite_status'] = $this->config->get('omise_offsite_status'); | ||
|
||
/** | ||
* Page setup. | ||
* | ||
*/ | ||
$this->_setBreadcrumb() | ||
->_getSessionFlash(); | ||
|
||
/** | ||
* Template setup. | ||
* | ||
*/ | ||
// Set template. | ||
$this->template = 'payment/omise_offsite_setting.tpl'; | ||
|
||
// Include sub-template. | ||
$this->children = array('common/header', | ||
'common/footer'); | ||
|
||
// Render output. | ||
$this->response->setOutput($this->render()); | ||
} | ||
|
||
/** | ||
* Set page breadcrumb | ||
* | ||
* @return self | ||
*/ | ||
private function _setBreadcrumb($current = null) { | ||
// Set Breadcrumbs. | ||
$this->data['breadcrumbs'] = array(); | ||
|
||
$this->data['breadcrumbs'][] = array( | ||
'text' => $this->language->get('text_home'), | ||
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), | ||
'separator' => false, | ||
); | ||
|
||
$this->data['breadcrumbs'][] = array( | ||
'text' => $this->language->get('text_payment'), | ||
'href' => $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'), | ||
'separator' => ' :: ', | ||
); | ||
|
||
$this->data['breadcrumbs'][] = array( | ||
'text' => $this->language->get('heading_title'), | ||
'href' => $this->url->link('payment/omise_offsite', 'token=' . $this->session->data['token'], 'SSL'), | ||
'separator' => ' :: ', | ||
); | ||
|
||
if (!is_null($current)) { | ||
$this->data['breadcrumbs'][] = $current; | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get session flash from session variable and unset it | ||
* | ||
* @return self | ||
*/ | ||
private function _getSessionFlash() { | ||
$this->data['success'] = ''; | ||
if (isset($this->session->data['success'])) { | ||
$this->data['success'] = $this->session->data['success']; | ||
|
||
unset($this->session->data['success']); | ||
} | ||
|
||
$this->data['error'] = ''; | ||
if (isset($this->session->data['error'])) { | ||
$this->data['error'] = $this->session->data['error']; | ||
|
||
unset($this->session->data['error']); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* This method will fire when user click `install` button from `extension/payment` page | ||
* | ||
* @return void | ||
*/ | ||
public function install() { | ||
// Set `success` session if it completely done. | ||
$this->session->data['success'] = 'Installed'; | ||
} | ||
|
||
/** | ||
* This method will fire when user click `Uninstall` button from `extension/payment` page | ||
* Uninstall anything about Omise Payment Gateway module that installed. | ||
* | ||
* @return void | ||
*/ | ||
public function uninstall() { | ||
} | ||
} |
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
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,8 @@ | ||
<?php | ||
// Module title | ||
$_['heading_title'] = 'Omise Payment Gateway - Internet Banking'; | ||
$_['text_omise_offsite'] = '<a href="https://www.omise.co" target="_blank" style="border: 1px solid #EEEEEE; padding: 2px; width: 94px; max-height:25px; display: inline-block;" alt="Omise Payment Gateway"" title="Omise Payment Gateway"><img src="view/image/payment/omise-payment.png" alt="Omise Payment Gateway"" title="Omise Payment Gateway" style="max-height:18px;" /></a>'; | ||
|
||
// Errors | ||
$_['error_need_omise_extension'] = 'Please install and enable <strong>Omise Payment Gateway</strong> extension before enabling <strong>Omise Payment Gateway - Internet Banking</strong> (check \'Setting\' tab).'; | ||
?> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,65 @@ | ||
<?php | ||
/** | ||
* Include header. | ||
* | ||
*/ | ||
echo $header; ?> | ||
|
||
<!-- Include Omise's stylesheet --> | ||
<link rel="stylesheet" type="text/css" href="view/stylesheet/omise/omise-admin.css"> | ||
|
||
<div id="content"> | ||
<!-- Breadcrumb --> | ||
<div class="breadcrumb"> | ||
<?php | ||
foreach ($breadcrumbs as $breadcrumb): | ||
echo $breadcrumb['separator']; | ||
echo '<a href="'.$breadcrumb['href'].'">'.$breadcrumb['text'].'</a>'; | ||
endforeach; | ||
?> | ||
</div> <!-- /END .breadcrumb --> | ||
|
||
<!-- Session flash box --> | ||
<?php if ($success) echo '<div class="success">'.$success.'</div>'; ?> | ||
<?php if ($error) echo '<div class="warning">'.$error.'</div>'; ?> | ||
|
||
<!-- Content --> | ||
<div class="box"> | ||
<div class="heading"> | ||
<h1><img src="view/image/payment.png" alt="" /> <?php echo $heading_title; ?></h1> | ||
<div class="buttons"> | ||
<a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a> | ||
<a href="<?php echo $cancel; ?>" class="button"><?php echo $button_cancel; ?></a> | ||
</div> | ||
</div> <!-- /END .heading --> | ||
|
||
<div class="content"> | ||
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form"> | ||
<!-- Module config --> | ||
<h3>Module config</h3> | ||
<table class="form"> | ||
<tr> | ||
<td><?php echo $entry_status; ?></td> | ||
<td> | ||
<select name="omise_offsite_status"> | ||
<option value="1" <?php echo $omise_offsite_status ? 'selected="selected"' : ''; ?>><?php echo $text_enabled; ?></option> | ||
<option value="0" <?php echo !$omise_offsite_status ? 'selected="selected"' : ''; ?>><?php echo $text_disabled; ?></option> | ||
</select> | ||
</td> | ||
</tr> | ||
</table> | ||
</form> | ||
|
||
<div class="text-right" style="margin-top: 40px;"> | ||
<a href="<?php echo $cancel; ?>" class="button">Back</a> | ||
</div> | ||
</div> <!-- /END .content --> | ||
</div> <!-- /END .box --> | ||
</div> | ||
|
||
<?php | ||
/** | ||
* Include footer. | ||
* | ||
*/ | ||
echo $footer; ?> |
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
Oops, something went wrong.