diff --git a/lemonway.ocmod/upload/admin/controller/extension/payment/lemonway.php b/lemonway.ocmod/upload/admin/controller/extension/payment/lemonway.php
index 719dbd9..cf85996 100644
--- a/lemonway.ocmod/upload/admin/controller/extension/payment/lemonway.php
+++ b/lemonway.ocmod/upload/admin/controller/extension/payment/lemonway.php
@@ -46,6 +46,8 @@ public function index()
$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_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;
@@ -61,7 +63,6 @@ public function index()
} 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);
@@ -170,6 +171,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)) {
diff --git a/lemonway.ocmod/upload/admin/language/en-gb/extension/payment/lemonway.php b/lemonway.ocmod/upload/admin/language/en-gb/extension/payment/lemonway.php
index c3fb256..f4387dd 100644
--- a/lemonway.ocmod/upload/admin/language/en-gb/extension/payment/lemonway.php
+++ b/lemonway.ocmod/upload/admin/language/en-gb/extension/payment/lemonway.php
@@ -39,6 +39,8 @@
$_['text_custom_environment'] = 'CUSTOM ENVIRONMENT';
$_['text_environment_name'] = 'Custom environment name';
$_['text_wallet'] = 'Technical wallet name';
+$_['tpl_name'] = 'Template name';
+
// CREDIT CARD
$_['text_method_config'] = 'METHOD CONFIGURATION ';
diff --git a/lemonway.ocmod/upload/admin/view/template/extension/payment/lemonway_config.twig b/lemonway.ocmod/upload/admin/view/template/extension/payment/lemonway_config.twig
index 9570e59..9dfab1b 100644
--- a/lemonway.ocmod/upload/admin/view/template/extension/payment/lemonway_config.twig
+++ b/lemonway.ocmod/upload/admin/view/template/extension/payment/lemonway_config.twig
@@ -16,7 +16,8 @@
-
+
{{ text_help_login }}
@@ -34,7 +35,8 @@
-
+
{{ text_help_password }}
@@ -44,11 +46,12 @@
{{ error_custom_env }}
-
+
@@ -138,12 +142,31 @@
-
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/lemonway.ocmod/upload/catalog/controller/extension/payment/lemonway.php b/lemonway.ocmod/upload/catalog/controller/extension/payment/lemonway.php
index 1ebda3d..a86e0f6 100644
--- a/lemonway.ocmod/upload/catalog/controller/extension/payment/lemonway.php
+++ b/lemonway.ocmod/upload/catalog/controller/extension/payment/lemonway.php
@@ -21,8 +21,9 @@ class ControllerExtensionPaymentLemonWay extends Controller
private $money_in_trans_details;
- private function prefix() {
- return (version_compare(VERSION, '3.0', '>=')) ? 'payment_' : '';
+ private function prefix()
+ {
+ return (version_compare(VERSION, '3.0', '>=')) ? 'payment_' : '';
}
/*
@@ -63,7 +64,7 @@ private function postValue($key)
private function getLemonWayConfig()
{
$config = array();
-
+
if ($this->config->get($this->prefix() . 'lemonway_is_test_mode')) {
// TEST
$config['dkURL'] = $this->config->get($this->prefix() . 'lemonway_directkit_url_test'); //DIRECT KIT URL TEST
@@ -76,9 +77,10 @@ private function getLemonWayConfig()
$config['login'] = $this->config->get($this->prefix() . 'lemonway_api_login');
$config['pass'] = $this->config->get($this->prefix() . 'lemonway_api_password');
- $config['wallet'] = empty($this->config->get($this->prefix() . 'lemonway_environment_name')) ?
- $this->config->get($this->prefix() . 'lemonway_wallet') : $this->config->get($this->prefix() . 'lemonway_custom_wallet');
+ $config['wallet'] = empty($this->config->get($this->prefix() . 'lemonway_environment_name')) ? $this->config->get($this->prefix() . 'lemonway_wallet') : $this->config->get($this->prefix() . 'lemonway_custom_wallet');
$config['cssURL'] = $this->config->get($this->prefix() . 'lemonway_css_url');
+ $config['tplName'] = $this->config->get($this->prefix() . 'lemonway_template_name');
+
$config['autoCommission'] = (int)!empty($this->config->get($this->prefix() . 'lemonway_environment_name'));
// Autocom = 0 if lwecommerce, 1 if custom environment
@@ -116,19 +118,21 @@ private function getMoneyInTransDetails($wkToken)
/*
Check the real paid amount
*/
- private function checkAmount($amount, $realAmount) {
+ private function checkAmount($amount, $realAmount)
+ {
return ($amount == $realAmount);
}
/*
Double check
*/
- private function doublecheckAmount($amount, $wkToken) {
+ private function doublecheckAmount($amount, $wkToken)
+ {
$details = $this->getMoneyInTransDetails($wkToken);
// CREDIT + COMMISSION
$realAmountDoublecheck = $details->TRANS->HPAY[0]->CRED + $details->TRANS->HPAY[0]->COM;
-
+
// Status 3 means success
return (($details->TRANS->HPAY[0]->STATUS == '3') && ($amount == $realAmountDoublecheck));
}
@@ -170,7 +174,7 @@ public function index()
$data['lemonway_oneclick_enabled'] = $this->config->get($this->prefix() . 'lemonway_oneclick_enabled');
$data['customerId'] = empty($this->customer->getId()) ? 0 : $this->customer->getId();
// A guest customer has no Id, we consider it 0
-
+
$data['card'] = $this->model_extension_payment_lemonway->getCustomerCard($this->customer->getId());
return $this->load->view('extension/payment/lemonway', $data);
@@ -182,18 +186,12 @@ public function index()
*/
public function checkout()
{
- $available_cards = array('CB', 'VISA', 'MASTERCARD');
if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
// Redirect to the cart
$this->response->redirect($this->url->link('checkout/cart', '', true));
}
- if (!isset($this->request->post['cc_type']) || !in_array($this->request->post['cc_type'], $available_cards)) {
- // Redirect to the cart and display error
- $this->session->data['error'] = $this->language->get('error_card_type');
- $this->response->redirect($this->url->link('checkout/cart', '', true));
- }
//Load Language
$this->load->language('extension/payment/lemonway');
@@ -211,7 +209,7 @@ public function checkout()
$this->session->data['error'] = $this->language->get('error_order_not_found');
$this->response->redirect($this->url->link('checkout/cart', '', true));
}
-
+
// Lemon Way config
$config = $this->getLemonWayConfig();
@@ -224,11 +222,11 @@ public function checkout()
);
$params = array();
-
+
$params['wallet'] = $config['wallet'];
$total = number_format((float)$order_info['total'], 2, '.', '');
$params['amountTot'] = $total;
- $params['comment'] = $this->config->get('config_name') . " (OpenCart) - " . $order_id . " - " .
+ $params['comment'] = $this->config->get('config_name') . " - " . $order_id . " - " .
$this->customer->getLastName() . " " . $this->customer->getFirstName() . " - " .
$this->customer->getEmail();
$params['autoCommission'] = $config['autoCommission'];
@@ -236,7 +234,7 @@ public function checkout()
$customerId = empty($this->customer->getId()) ? 0 : $this->customer->getId(); // A guest customer has no Id, we consider it 0
$useCard = (
- $this->config->get($this->prefix() . 'lemonway_oneclick_enabled') &&
+ $this->config->get($this->prefix() . 'lemonway_oneclick_enabled') &&
$customerId &&
$this->postValue('lemonway_oneclick') === 'use_card'
);
@@ -302,54 +300,10 @@ public function checkout()
$moneyInToken = (string)$res->MONEYINWEB->TOKEN;
$lang = substr($this->language->get('code'), 0, 2);
$lang = array_key_exists($lang, $this->supportedLangs) ? $this->supportedLangs[$lang] : self::DEFAULT_LANG;
+// . '&tpl=' . urlencode($config['tplName'])
+ $lwUrl = $config['wkURL'] . '?moneyintoken=' . $moneyInToken . '&p=' . urlencode($config['cssURL']) . '&lang=' . $lang . '&tpl=' . urlencode($config['tplName']);
+ $this->response->redirect($lwUrl);
- $lwUrl = $config['wkURL'] . '?moneyintoken=' . $moneyInToken . '&p=' . urlencode($config['cssURL']) . '&lang=' . $lang;
-
- $cc_type = $this->request->post['cc_type'];
-
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $lwUrl);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- curl_setopt($ch, CURLOPT_CAINFO, DIR_SYSTEM . "/library/lemonway/cacert.pem");
-
- $response = curl_exec($ch);
-
- $matches = array();
-
- $patternFormActionAndData = '/(action="|name=data value=")([^"]*)"/i';
- if (preg_match_all($patternFormActionAndData, $response, $matches)) {
- if (isset($matches[2])) {
- list($actionUrl, $data) = $matches[2];
- $postFields = array(
- 'DATA' => $data,
- $cc_type => 1
- );
-
- $text_redirect = $this->language->get('text_redirect');
-
- $html = '' . "\n";
- $html .= '' . "\n";
- $html .= ' ' . "\n";
- $html .= ' ';
- $html .= ' ';
- $html .= '
' . $text_redirect . '
' . "\n";
- $html .= ' ' . "\n";
- $html .= ' ' . "\n";
- $html .= '
' . "\n";
- $html .= ' ' . "\n";
- $html .= ' ' . "\n";
- $html .= '';
-
- die($html);
- }
- }
} else { // If the client use a saved card => MoneyInWithCardId
if (($card = $this->model_extension_payment_lemonway->getCustomerCard($this->customer->getId())) && $this->customer->isLogged()) {
//Call API for MoneyInWithCardId
@@ -402,8 +356,8 @@ public function checkoutReturn()
if ($this->isGet()) { // If redirection
// GET params
if ($this->config->get($this->prefix() . 'lemonway_debug')) {
- $debug_log = new Log('lemonway_debug.log');
- $debug_log->write('GET params: ' . print_r($this->request->get, true));
+ $debug_log = new Log('lemonway_debug.log');
+ $debug_log->write('GET params: ' . print_r($this->request->get, true));
}
$wkToken = $this->getValue('response_wkToken');
@@ -457,8 +411,8 @@ public function checkoutReturn()
} elseif ($this->isPost()) { // If IPN
// Get response by IPN
if ($this->config->get($this->prefix() . 'lemonway_debug')) {
- $debug_log = new Log('lemonway_debug.log');
- $debug_log->write('IPN: ' . print_r($this->request->post, true));
+ $debug_log = new Log('lemonway_debug.log');
+ $debug_log->write('IPN: ' . print_r($this->request->post, true));
}
$response_code = $this->postValue('response_code');
diff --git a/lemonway.ocmod/upload/catalog/language/en-gb/extension/payment/lemonway.php b/lemonway.ocmod/upload/catalog/language/en-gb/extension/payment/lemonway.php
index d13c78d..9013907 100644
--- a/lemonway.ocmod/upload/catalog/language/en-gb/extension/payment/lemonway.php
+++ b/lemonway.ocmod/upload/catalog/language/en-gb/extension/payment/lemonway.php
@@ -2,6 +2,7 @@
// Text
$_['text_redirect'] = 'You will be redirected to payment page in a few seconds';
$_['text_card'] = 'Credit Card';
+$_['text_sofort'] = 'Sofort Card';
$_['text_use_card'] = 'Use my saved card';
$_['text_save_new_card'] = 'Save new card data';
$_['text_not_use_card'] = 'Not use saved card data';
diff --git a/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_cb.gif b/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_cb.gif
deleted file mode 100644
index cbbd626..0000000
Binary files a/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_cb.gif and /dev/null differ
diff --git a/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_mastercard.gif b/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_mastercard.gif
deleted file mode 100644
index 9dc0ccf..0000000
Binary files a/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_mastercard.gif and /dev/null differ
diff --git a/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_visa.gif b/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_visa.gif
deleted file mode 100644
index cd93a68..0000000
Binary files a/lemonway.ocmod/upload/catalog/view/theme/default/image/lemonway_visa.gif and /dev/null differ
diff --git a/lemonway.ocmod/upload/catalog/view/theme/default/template/extension/payment/lemonway.tpl b/lemonway.ocmod/upload/catalog/view/theme/default/template/extension/payment/lemonway.tpl
index bd66eb2..d362a85 100644
--- a/lemonway.ocmod/upload/catalog/view/theme/default/template/extension/payment/lemonway.tpl
+++ b/lemonway.ocmod/upload/catalog/view/theme/default/template/extension/payment/lemonway.tpl
@@ -41,28 +41,28 @@
-
+ {**}
+ {*
*}
+ {*
*}
+ {*
*}
+ {*
*}
+ {*
*}
+ {*
*}