Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logo opencart method #16

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ControllerExtensionPaymentLemonway extends Controller
private $variables = array();

public function index()
{
{
// Load settings
$this->load->model('setting/setting');

Expand Down Expand Up @@ -45,7 +45,11 @@ public function index()
$this->variables['lemonway_environment_name'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_environment_name');
$this->variables['lemonway_custom_wallet'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_custom_wallet');
$this->variables['lemonway_status'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_status');
$this->variables['lemonway_sofort_status'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_sofort_status');
$this->variables['lemonway_ideal_status'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_ideal_status');
$this->variables['lemonway_oneclick_enabled'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_oneclick_enabled');
$this->variables['lemonway_template_name'] = $this->model_setting_setting->getSettingValue($this->prefix() . 'lemonway_template_name');


// Alerts
$this->variables['no_permission'] = false;
Expand All @@ -62,19 +66,42 @@ public function index()
$this->variables['no_method'] = true;
}

if ($this->variables['lemonway_sofort_status']) { // If enabled
// Test the config
if ($this->testConfig()) {
$this->variables['success'] = true;
}
} else { // If no method enabled
$this->variables['no_method'] = true;
}

if ($this->variables['lemonway_ideal_status']) { // If enabled
// Test the config
if ($this->testConfig()) {
$this->variables['success'] = true;
}
} else { // If no method enabled
$this->variables['no_method'] = true;
}
// Load tabs
// About us
$this->variables['about_us'] = $this->load->view('extension/payment/lemonway_aboutus', $this->variables);
// Configuration
$this->variables['config'] = $this->load->view('extension/payment/lemonway_config', $this->variables);
// Credit Card
$this->variables['cc'] = $this->load->view('extension/payment/lemonway_cc', $this->variables);
// Sofort
$this->variables['sofort'] = $this->load->view('extension/payment/lemonway_sofort', $this->variables);
// iDeal
$this->variables['ideal'] = $this->load->view('extension/payment/lemonway_ideal', $this->variables);


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

private function prefix() {
return (version_compare(VERSION, '3.0', '>=')) ? 'payment_' : '';
private function prefix()
{
return (version_compare(VERSION, '3.0', '>=')) ? 'payment_' : '';
}

private function validate()
Expand Down Expand Up @@ -109,7 +136,7 @@ private function validate()
// If custom environment
$env_name = $this->request->post['lemonway_environment_name'];
}

// Generate API links
$this->request->post['lemonway_directkit_url'] = sprintf(self::LEMONWAY_DIRECTKIT_FORMAT_URL_PROD, $env_name);
$this->request->post['lemonway_webkit_url'] = sprintf(self::LEMONWAY_WEBKIT_FORMAT_URL_PROD, $env_name);
Expand All @@ -120,7 +147,18 @@ private function validate()
if (!isset($this->request->post['lemonway_status'])) {
$this->request->post['lemonway_status'] = 0;
}


//Sofort status
if (!isset($this->request->post['lemonway_sofort_status'])) {
$this->request->post['lemonway_sofort_status'] = 0;
}

//iDeal status
if (!isset($this->request->post['lemonway_ideal_status'])) {
$this->request->post['lemonway_ideal_status'] = 0;
}


// One-click
if (!isset($this->request->post['lemonway_oneclick_enabled'])) {
$this->request->post['lemonway_oneclick_enabled'] = 0;
Expand Down Expand Up @@ -170,6 +208,7 @@ private function testConfig()
}

$res = $lemonwayService->getWalletDetails($params);
//var_dump($res->WALLET->ID);
if (empty($this->variables['lemonway_environment_name'])) {
// If lwecommerce, get wallet
if (isset($res->WALLET->ID)) {
Expand All @@ -195,6 +234,8 @@ public function install()
$this->load->model('setting/setting');
$this->model_setting_setting->editSetting($this->prefix() . 'lemonway', [
$this->prefix() . 'lemonway_status' => 1,
$this->prefix() . 'lemonway_sofort_status' => 1,
$this->prefix() . 'lemonway_ideal_status' => 1,
$this->prefix() . 'lemonway_css_url' => self::CSS_URL_DEFAULT,
$this->prefix() . 'lemonway_directkit_url' => sprintf(self::LEMONWAY_DIRECTKIT_FORMAT_URL_PROD, self::LEMONWAY_ENVIRONMENT_DEFAULT),
$this->prefix() . 'lemonway_webkit_url' => sprintf(self::LEMONWAY_WEBKIT_FORMAT_URL_PROD, self::LEMONWAY_ENVIRONMENT_DEFAULT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
$_['text_debug_mode'] = 'Debug Mode';
$_['text_custom_environment'] = 'CUSTOM ENVIRONMENT';
$_['text_environment_name'] = 'Custom environment name';
$_['text_wallet'] = 'Technical wallet name';
$_['text_wallet'] = 'Wallet name';
$_['tpl_name'] = 'Template name';


// CREDIT CARD
$_['text_method_config'] = 'METHOD CONFIGURATION ';
Expand All @@ -49,6 +51,10 @@
$_['tab_about_us'] = 'ABOUT US';
$_['tab_config'] = 'CONFIGURATION';
$_['tab_cc'] = 'CREDIT CARD';
$_['tab_sofort'] = 'SOFORT';
$_['tab_ideal'] = 'iDEAL';



// Error
$_['error_permission'] = 'You do not have permission to modify the configuration!';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

class ModelExtensionPaymentLemonway extends Model
{
public function install()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<div class="page-header">
<div class="container-fluid">
<div class="pull-right">
<button type="submit" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
<a href="{{ cancel_link }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a>
<button type="submit" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i
class="fa fa-save"></i></button>
<a href="{{ cancel_link }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i
class="fa fa-reply"></i></a>
</div>
<h1>{{ heading_title }}</h1>
</div>
Expand All @@ -14,29 +16,29 @@
<div class="container-fluid">
<!-- Alerts -->
{% if no_permission %}
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_permission }}</div>
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_permission }}</div>
{% endif %}

{% if no_method %}
<div class="alert alert-warning"><i class="fa fa-exclamation-triangle"></i> {{ error_no_method }}
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
<div class="alert alert-warning"><i class="fa fa-exclamation-triangle"></i> {{ error_no_method }}
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
{% endif %}

{% if lemonway_is_test_mode %}
<div class="alert alert-warning"><i class="fa fa-exclamation-triangle"></i> {{ error_test_mode }}
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
<div class="alert alert-warning"><i class="fa fa-exclamation-triangle"></i> {{ error_test_mode }}
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
{% endif %}

{% if success %}
<div class="alert alert-success"><i class="fa fa-check-circle"></i> {{ error_success }}
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
<div class="alert alert-success"><i class="fa fa-check-circle"></i> {{ error_success }}
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
{% endif %}

{% if api_error %}
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_api }}</div>
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_api }}</div>
{% endif %}
<!-- End alerts -->

Expand All @@ -46,16 +48,27 @@
<div role="tabpanel">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist" data-tabs="tabs">
<li class="active"><a id="aboutus_tab" href="#aboutus" role="tab" data-toggle="tab"><i class="fa fa-info-circle"></i> {{ tab_about_us }}</a></li>
<li><a id="config_tab" href="#config" role="tab" data-toggle="tab"><i class="fa fa-cog"></i> {{ tab_config }}</a></li>
<li><a id="cc_tab" href="#cc" role="tab" data-toggle="tab"><i class="fa fa-credit-card"></i> {{ tab_cc }}</a></li>
<li class="active"><a id="aboutus_tab" href="#aboutus" role="tab" data-toggle="tab"><i
class="fa fa-info-circle"></i> {{ tab_about_us }}</a></li>
<li><a id="config_tab" href="#config" role="tab" data-toggle="tab"><i
class="fa fa-cog"></i> {{ tab_config }}</a></li>
<li><a id="cc_tab" href="#cc" role="tab" data-toggle="tab"><i
class="fa fa-credit-card"></i> {{ tab_cc }}</a></li>
<li><a id="sofort_tab" href="#sofort" role="tab" data-toggle="tab"><i
class="fa fa-credit-card"></i> {{ tab_sofort }}</a></li>
<li><a id="ideal_tab" href="#ideal" role="tab" data-toggle="tab"><i
class="fa fa-credit-card"></i> {{ tab_ideal }}</a></li>

</ul>

<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane fade in active" id="aboutus">{{ about_us }}</div>
<div class="tab-pane fade" id="config">{{ config }}</div>
<div class="tab-pane fade" id="cc">{{ cc }}</div>
<div class="tab-pane fade" id="sofort">{{ sofort }}</div>
<div class="tab-pane fade" id="ideal">{{ ideal }}</div>

</div>
</div>
</form>
Expand All @@ -70,20 +83,23 @@
{{ footer }}

<script>
$(function()
{
$(function () {
// Show config tab
$("#config_link").click(function(e)
{
$("#config_link").click(function (e) {
e.preventDefault();
$("#config_tab").tab('show');
});

// Show cc tab
$("#cc_link").click(function(e)
{
$("#cc_link").click(function (e) {
e.preventDefault();
$("#cc_tab").tab('show');
});

// Show cc tab
$("#sofort_link").click(function (e) {
e.preventDefault();
$("#sofort_tab").tab('show');
});
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
</label>

<div class="col-lg-7">
<input type="checkbox" name="lemonway_status" id="lemonway_status" value="1" {{ lemonway_status ? 'checked' : '' }} />
<input type="checkbox" name="lemonway_status" id="lemonway_status"
value="1" {{ lemonway_status ? 'checked' : '' }} />
</div>
</div>

<div class="form-group">
<label class="control-label col-lg-3">
{{ text_oneclick }}
</label>

<div class="col-lg-7">
<input type="checkbox" name="lemonway_oneclick_enabled" id="lemonway_cc_oneclick_enabled_on" value="1" {{ lemonway_oneclick_enabled ? 'checked' : '' }} />
<input type="checkbox" name="lemonway_oneclick_enabled" id="lemonway_cc_oneclick_enabled_on"
value="1" {{ lemonway_oneclick_enabled ? 'checked' : '' }} />
<p class="help-block">
{{ text_help_oneclick }}
{{ text_help_oneclick }}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<span class="input-group-addon">
<i class="fa fa-user"></i>
</span>
<input type="text" name="lemonway_api_login" value="{{ lemonway_api_login }}" class="form-control" required />
<input type="text" name="lemonway_api_login" value="{{ lemonway_api_login }}"
class="form-control" required/>
</div>
<p class="help-block">
{{ text_help_login }}
Expand All @@ -34,7 +35,8 @@
<span class="input-group-addon">
<i class="fa fa-lock"></i>
</span>
<input type="password" name="lemonway_api_password" class="form-control" {{ (lemonway_api_password is empty) ? "required" : "placeholder='#{text_masked}'" }} />
<input type="password" name="lemonway_api_password"
class="form-control" {{ (lemonway_api_password is empty) ? "required" : "placeholder='#{text_masked}'" }} />
</div>
<p class="help-block">
{{ text_help_password }}
Expand All @@ -44,11 +46,12 @@

<div class="form-group">
<label class="control-label col-lg-3">
{{ text_test_mode }}
{{ text_test_mode }}
</label>

<div class="col-lg-7">
<input type="checkbox" name="lemonway_is_test_mode" value="1" {{ lemonway_is_test_mode ? 'checked' : '' }} />
<input type="checkbox" name="lemonway_is_test_mode"
value="1" {{ lemonway_is_test_mode ? 'checked' : '' }} />
<p class="help-block">
{{ text_help_test_mode }}
</p>
Expand Down Expand Up @@ -76,7 +79,7 @@
<span class="input-group-addon">
<i class="fa fa-css3"></i>
</span>
<input type="text" name="lemonway_css_url" class="form-control" value="{{ lemonway_css_url }}" />
<input type="text" name="lemonway_css_url" class="form-control" value="{{ lemonway_css_url }}"/>
</div>
<p class="help-block">
{{ text_help_css }}
Expand Down Expand Up @@ -109,19 +112,20 @@
<i class="fa fa-wrench"></i> {{ text_custom_environment }}
</div>
<div class="alert alert-warning"><i class="fa fa-exclamation-triangle"></i> {{ error_custom_env }}</div>

<!-- Custom environment name -->
<div class="form-group">
<label class="control-label col-lg-3">
{{ text_environment_name }}
{{ text_environment_name }}
</label>

<div class="col-lg-7">
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-leaf"></i>
</span>
<input type="text" name="lemonway_environment_name" value="{{ lemonway_environment_name }}" class="form-control" />
<input type="text" name="lemonway_environment_name" value="{{ lemonway_environment_name }}"
class="form-control"/>
</div>
</div>
</div>
Expand All @@ -138,12 +142,31 @@
<span class="input-group-addon">
<i class="fa fa-google-wallet"></i>
</span>
<input type="hidden" name="lemonway_wallet" />
<input type="text" name="lemonway_custom_wallet" value="{{ lemonway_custom_wallet }}" class="form-control" />
<input type="hidden" name="lemonway_wallet"/>
<input type="text" name="lemonway_custom_wallet" value="{{ lemonway_custom_wallet }}"
class="form-control"/>
</div>
</div>
</div>
<!-- End Wallet ID -->

<!-- Template name Atos v2-->
<div class="form-group">
<label class="control-label col-lg-3">
{{ tpl_name }}
</label>

<div class="col-lg-7">
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa fa-file-archive-o"></i>
</span>
<input type="hidden" name="lemonway_template"/>
<input type="text" name="lemonway_template_name" value="{{ lemonway_template_name }}"
class="form-control"/>
</div>
</div>
</div>
</div>
<!-- End Custom environment panel -->
</div>
</div>
Loading