first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>santandercredit</name>
<displayName><![CDATA[Santander - System ratalny]]></displayName>
<version><![CDATA[5.5]]></version>
<description><![CDATA[Santander - Zakupy na raty w internecie]]></description>
<author><![CDATA[Ryszard Klepacz]]></author>
<tab><![CDATA[payments_gateways]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>santandercredit</name>
<displayName><![CDATA[Santander - System ratalny]]></displayName>
<version><![CDATA[5.5]]></version>
<description><![CDATA[Santander - Zakupy na raty w internecie]]></description>
<author><![CDATA[Santander Consumer Bank]]></author>
<tab><![CDATA[payments_gateways]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../');
exit;

View File

@@ -0,0 +1,50 @@
<?php
class SantandercreditSantanderCreditReturnModuleFrontController extends ModuleFrontController {
public function __construct() {
parent::__construct();
}
public function initContent() {
parent::initContent();
$returnTemplate = 'santanderCreditReturn.tpl';
$errors = '';
if (Tools::getValue('orderId') != 0 && Tools::getValue('id_wniosku') != '') {
$order = new Order(Tools::getValue('orderId'));
if ($order) {
$orderPaymentCollection = $order->getOrderPaymentCollection();
$payment = $orderPaymentCollection->getFirst();
if ($payment) {
$payment->transaction_id = Tools::getValue('id_wniosku');
$payment->save();
$this->context->smarty->assign(
array('wniosekId' => preg_replace('#[^0-9/ZAG]#', '', $_GET['id_wniosku']),
'orderId' => (int) $_GET['orderId']
)
);
// $returnTemplate = 'santanderCreditReturn.tpl';
} else {
$errors .= "Błąd w trakcie aktualizacji numeru transakcji (transactionId, wniosekId).";
$this->context->smarty->assign(array('errors' => $errors, 'wniosekId' => preg_replace('#[^0-9/ZAG]#', '', $_GET['id_wniosku']),
'orderId' => $_GET['orderId']));
$returnTemplate = 'paymentErrors.tpl';
}
} else {
$errors .= "Błędny numer zamówienia w sklepie (orderId).";
$this->context->smarty->assign(array('errors' => $errors, 'wniosekId' => preg_replace('#[^0-9/ZAG]#', '', $_GET['id_wniosku']),
'orderId' => $_GET['orderId']));
$returnTemplate = 'paymentErrors.tpl';
}
} else {
$errors .= "Nieokreślony numer wniosku lub numer zamówienia w odpowiedzi Banku (orderId, id_wniosku).";
$this->context->smarty->assign(array('errors' => $errors));
$returnTemplate = 'paymentErrors.tpl';
}
$this->setTemplate('module:santandercredit/views/templates/front/'.$returnTemplate);
}
}

View File

@@ -0,0 +1,49 @@
<?php
class santandercreditsantanderCreditValidateModuleFrontController extends ModuleFrontController {
public function initContent() {
parent::initContent();
$santanderCredit = new SantanderCredit();
$santanderCredit->execValidation();
$this->setTemplate('santanderCreditValidate.tpl');
}
public function postProcess() {
$cart = $this->context->cart;
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active)
Tools::redirect('index.php?controller=order&step=1');
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
$authorized = false;
foreach (Module::getPaymentModules() as $module)
if ($module['name'] == 'santandercredit') {
$authorized = true;
break;
}
if (!$authorized)
die('NOT AUTHORIZED: santanderCreditValidate');
$customer = new Customer($cart->id_customer);
if (!Validate::isLoadedObject($customer))
Tools::redirect('index.php?controller=order&step=1');
/*
$currency = $this->context->currency;
$total = (float) $cart->getOrderTotal(true, Cart::BOTH);
$this->module->validateOrder($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $this->module->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
*/
$currency = $this->context->currency;
$total = floatval(number_format($cart->getOrderTotal(true, 3), 2, '.', ''));
$useOrderState = Configuration::get('SANTANDERCREDIT_USE_ORDER_STATE');
$this->module->validateOrder($cart->id, (int) Configuration::get($useOrderState), $total, $this->module->displayName, NULL, NULL, $currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
}
}
?>

View File

@@ -0,0 +1,31 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* http://localhost/presta/prestashop_1.7.1.0/module/santandercredit/test
*/
class SantandercreditTestModuleFrontController extends ModuleFrontController {
public function __construct(){
parent::__construct();
}
public function initContent(){
parent::initContent();
$mess = Tools::getValue('orderId');
$this->context->smarty->assign('test', 'to tylko test '. $mess);
$this->setTemplate('module:santandercredit/views/templates/front/test.tpl');
}
public function postProcess()
{
// global $smarty;
// $templatePath = dirname(__FILE__).'/../../views/templates/front/test.tpl';
// $smarty->assign(array(
// 'test' => 'to tylko test'
// ));
// $smarty->display($templatePath);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,11 @@
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,11 @@
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,11 @@
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,37 @@
function jakKupic() {
window.open('https://www.santanderconsumer.pl/raty-jak-kupic', 'jakKupic', 'width=710,height=500,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
return false;
}
function obliczRate(nrSklepu, symUrl, qtySelector, basketSelector) {
// qtySelector, basketSelector should be parameter
/* var qtySelector, basketSelector;
qtySelector = '#quantity_wanted';
basketSelector = "div.current-price > span"; */
// ------
var koszyk, ilo, qty, basket;
koszyk = 0;
ilo = 0
qty = $(qtySelector);
basket = $(basketSelector);
if(qty.length == 1 && basket.length == 1) {
ilo = qty.val();
koszyk = basket.attr('content') * ilo;
koszyk = Math.round(koszyk * 100, 2) / 100; //some stupid code just to solve strange js numeric results problem
if (koszyk > 100) {
window.open(symUrl + 'numerSklepu/' + nrSklepu + '/wariantSklepu/1/typProduktu/0/wartoscTowarow/' + koszyk);
} else {
alert("Kredytujemy zakupy w cenie powyżej 100zł");
}
} else {
alert('quantity or price selector problem, call to Admin');
}
}
function santanderCreditValidateForm() {
if ($('#santanderAgreement').is(':checked')) {
$('#scbSubmitBtn').removeAttr('disabled');
} else {
$('#scbSubmitBtn').attr('disabled','disabled');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,389 @@
<?php
use PrestaShop\PrestaShop\Core\Payment\PaymentOption;
if (!defined('_PS_VERSION_'))
exit;
class SantanderCredit extends PaymentModule {
private $_errorsArray = array();
private $shopTestId = '99995';
private $ssl = false;
public function __construct() {
$this->name = 'santandercredit';
$this->tab = 'payments_gateways';
$this->version = 5.5;
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
$this->author = 'Santander Consumer Bank';
$this->bootstrap = true;
parent::__construct();
$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('Santander - System ratalny');
$this->description = $this->l('Santander - Zakupy na raty w internecie');
if (array_key_exists('HTTPS', $_SERVER) && $_SERVER['HTTPS'] == "on") {
$this->ssl = true;
}
}
public function install() {
if (
!parent::install() ||
!Configuration::updateValue('SANTANDERCREDIT_SHOP_ID', $this->shopTestId) ||
!Configuration::updateValue('SANTANDERCREDIT_BLOCK', 'left') ||
!Configuration::updateValue('SANTANDERCREDIT_BLOCK_TITLE', 'eRaty Santander Consumer Bank') ||
!Configuration::updateValue('SANTANDERCREDIT_SYMULATOR', 'true') ||
!Configuration::updateValue('SANTANDERCREDIT_URL_SYMULATOR', 'https://wniosek.eraty.pl/symulator/oblicz/') ||
!Configuration::updateValue('SANTANDERCREDIT_URL_WNIOSEK', 'https://wniosek.eraty.pl/formularz/') ||
!Configuration::updateValue('SANTANDERCREDIT_QTY_SELECTOR', '#quantity_wanted') ||
!Configuration::updateValue('SANTANDERCREDIT_PRICE_SELECTOR', 'div.current-price > span[itemprop="price"]') ||
!$this->registerHook('paymentOptions') ||
!$this->registerHook('paymentReturn') ||
!$this->registerHook('displayProductAdditionalInfo') ||
!$this->createOrderState() ||
// !$this->registerHook('displayRightColumnProduct') ||
// !$this->registerHook('displayCompareExtraInformation') ||
// !$this->registerHook('displayFooterProduct') ||
// !$this->registerHook('rightColumn') ||
// !$this->registerHook('leftColumn') ||
// !$this->registerHook('productActions') ||
!Configuration::updateValue('SANTANDERCREDIT_USE_ORDER_STATE', 'SANTANDERCREDIT_OS_AUTHORIZATION')
) {
return false;
}
return true;
}
public function uninstall() {
if (
!Configuration::deleteByName('SANTANDERCREDIT_SHOP_ID') ||
!Configuration::deleteByName('SANTANDERCREDIT_BLOCK') ||
!Configuration::deleteByName('SANTANDERCREDIT_BLOCK_TITLE') ||
!Configuration::deleteByName('SANTANDERCREDIT_SYMULATOR') ||
!Configuration::deleteByName('SANTANDERCREDIT_USE_ORDER_STATE') ||
!Configuration::deleteByName('SANTANDERCREDIT_URL_SYMULATOR') ||
!Configuration::deleteByName('SANTANDERCREDIT_URL_WNIOSEK') ||
!Configuration::deleteByName('SANTANDERCREDIT_QTY_SELECTOR') ||
!Configuration::deleteByName('SANTANDERCREDIT_PRICE_SELECTOR') ||
!parent::uninstall()
) {
return false;
}
return true;
}
public function getContent() {
$output = null;
if (Tools::isSubmit('submit' . $this->name)) {
$scbShopID = strval(Tools::getValue('SANTANDERCREDIT_SHOP_ID'));
if (!$scbShopID || empty($scbShopID) || !Validate::isGenericName($scbShopID))
$output .= $this->displayError($this->l('Nieprawidłowy numer Sklepu'));
else {
Configuration::updateValue('SANTANDERCREDIT_SHOP_ID', '1234');
Configuration::updateValue('SANTANDERCREDIT_SHOP_ID', trim(Tools::getValue('SANTANDERCREDIT_SHOP_ID')));
Configuration::updateValue('SANTANDERCREDIT_SYMULATOR', strval(Tools::getValue('SANTANDERCREDIT_SYMULATOR')));
Configuration::updateValue('SANTANDERCREDIT_URL_SYMULATOR', Tools::getValue('SANTANDERCREDIT_URL_SYMULATOR'));
Configuration::updateValue('SANTANDERCREDIT_URL_WNIOSEK', Tools::getValue('SANTANDERCREDIT_URL_WNIOSEK'));
Configuration::updateValue('SANTANDERCREDIT_QTY_SELECTOR', Tools::getValue('SANTANDERCREDIT_QTY_SELECTOR'));
Configuration::updateValue('SANTANDERCREDIT_PRICE_SELECTOR', Tools::getValue('SANTANDERCREDIT_PRICE_SELECTOR'));
$output .= $this->displayConfirmation($this->l('Zmiany zostały zapisane'));
}
}
$output = $output . $this->display(__FILE__, 'infos.tpl');
return $output . $this->displayForm();
}
public function displayForm() {
// Get default language
$default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
// Init Fields form array
$fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('Parametry bramki płatniczej eRaty Santander:'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Numer Sklepu'),
'name' => 'SANTANDERCREDIT_SHOP_ID',
'size' => 20,
'required' => true
),
array(
'type' => 'switch',
'label' => $this->l('Kalkulator na stronie produktu'),
'name' => 'SANTANDERCREDIT_SYMULATOR',
'is_bool' => true,
'hint' => $this->l('Umożliwia obliczanie wysokości raty na stronie produktu'),
'values' => array(
array(
'id' => 'active_on',
'value' => true,
'label' => $this->l('TAK'),
),
array(
'id' => 'active_off',
'value' => false,
'label' => $this->l('NIE'),
)
),
),
array(
'type' => 'text',
'label' => $this->l('Adres symulatora'),
'name' => 'SANTANDERCREDIT_URL_SYMULATOR',
'size' => 128,
'required' => true
),
array(
'type' => 'text',
'label' => $this->l('Adres rejestratora wniosków'),
'name' => 'SANTANDERCREDIT_URL_WNIOSEK',
'size' => 128,
'required' => true
),
array(
'type' => 'text',
'label' => $this->l('Selektor ilości towaru'),
'name' => 'SANTANDERCREDIT_QTY_SELECTOR',
'hint' => 'Selektor (jQuery) wskazujący na pole zawierające ilość jednostek produktu. Odczyt wartości metodą val().',
'size' => 128,
'required' => true
),
array(
'type' => 'text',
'label' => $this->l('Selektor ceny towaru'),
'name' => 'SANTANDERCREDIT_PRICE_SELECTOR',
'hint' => 'Selektor (jQuery) wskazujący na pole zawierające cenę jednostkową. Odczyt wartości z atrybutu content.',
'size' => 128,
'required' => true
),
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-default pull-right'
)
);
$helper = new HelperForm();
// Module, token and currentIndex
$helper->module = $this;
$helper->name_controller = $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
// Language
$helper->default_form_language = $default_lang;
$helper->allow_employee_form_lang = $default_lang;
// Title and toolbar
$helper->title = $this->displayName;
$helper->show_toolbar = true; // false -> remove toolbar
$helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen.
$helper->submit_action = 'submit' . $this->name;
$helper->toolbar_btn = array(
'save' =>
array(
'desc' => $this->l('Save'),
'href' => AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name .
'&token=' . Tools::getAdminTokenLite('AdminModules'),
),
'back' => array(
'href' => AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules'),
'desc' => $this->l('Back to list')
)
);
// Load current value
$helper->fields_value['SANTANDERCREDIT_SHOP_ID'] = Configuration::get('SANTANDERCREDIT_SHOP_ID');
$helper->fields_value['SANTANDERCREDIT_SYMULATOR'] = Configuration::get('SANTANDERCREDIT_SYMULATOR');
$helper->fields_value['SANTANDERCREDIT_URL_SYMULATOR'] = Configuration::get('SANTANDERCREDIT_URL_SYMULATOR');
$helper->fields_value['SANTANDERCREDIT_URL_WNIOSEK'] = Configuration::get('SANTANDERCREDIT_URL_WNIOSEK');
$helper->fields_value['SANTANDERCREDIT_QTY_SELECTOR'] = Configuration::get('SANTANDERCREDIT_QTY_SELECTOR');
$helper->fields_value['SANTANDERCREDIT_PRICE_SELECTOR'] = Configuration::get('SANTANDERCREDIT_PRICE_SELECTOR');
return $helper->generateForm($fields_form);
}
public function hookPaymentOptions($params) {
// Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
// 'imgDir' => $this->context->link->getModuleLink('santandercredit','images')
if ($params['cart']->getOrderTotal() < 100)
return;
$this->smarty->assign(array(
'totalOrderC' => Tools::displayPrice($params['cart']->getOrderTotal(true, Cart::BOTH)),
'shopId' => trim(Configuration::get('SANTANDERCREDIT_SHOP_ID')),
'symulatorURL' => Configuration::get('SANTANDERCREDIT_URL_SYMULATOR'),
'jq_qtySelector' => Configuration::get('SANTANDERCREDIT_QTY_SELECTOR'),
'jq_priceSelector' => Configuration::get('SANTANDERCREDIT_PRICE_SELECTOR'),
'totalOrder' => $params['cart']->getOrderTotal(),
'imgDir' => $this->_path . 'images'
));
if (!isset($this->context)) {
$this->context = Context::getContext();
}
$newOption = new PaymentOption();
$newOption->setModuleName($this->name)
->setCallToActionText('eRaty Santander Consumer Bank')
->setAction($this->context->link->getModuleLink('santandercredit', 'santanderCreditValidate', array(), true))
->setAdditionalInformation($this->fetch('module:santandercredit/views/templates/hook/santanderCreditInfo.tpl'));
$payment_options = [
$newOption,
];
return $payment_options;
}
function hookPaymentReturn($params) {
// global $cart, $cookie, $currency;
$cart = new Cart(intval($params['order']->id_cart));
$cookie = $this->context->cookie;
$address = new Address(intval($cart->id_address_invoice));
$customer = new Customer(intval($cart->id_customer));
$total = floatval(number_format($cart->getOrderTotal(true, Cart::BOTH), 2, '.', ''));
$santanderCreditShopId = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
/*
if (!Validate::isUnsignedInt($santanderCreditShopId)) {
return $this->l('Błąd płatności: nieprawidłowy numer sklepu.');
}
*/
if (!Validate::isLoadedObject($address) || !Validate::isLoadedObject($customer)) {
return $this->l('Błąd płatności: nieprawidłowy adres lub dane klienta.');
}
// $productsInputs = '';
// $products = $cart->getProducts(true);
$summaryDetails = $cart->getSummaryDetails();
$proto = 'http://';
if ($this->ssl) {
$proto = 'https://';
}
$this->smarty->assign(array(
'applicationURL' => Configuration::get('SANTANDERCREDIT_URL_WNIOSEK'),
'jq_qtySelector' => Configuration::get('SANTANDERCREDIT_QTY_SELECTOR'),
'jq_priceSelector' => Configuration::get('SANTANDERCREDIT_PRICE_SELECTOR'),
'orderId' => $params['order']->id,
'shopId' => $santanderCreditShopId,
'shopName' => Configuration::get('PS_SHOP_NAME'),
'shopMailAdress' => Configuration::get('PS_SHOP_EMAIL'),
'shopPhone' => Configuration::get('PS_SHOP_PHONE'),
'shopHttp' => $proto . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__,
// http://localhost/presta/prestashop_1.7.1.0/module/santandercredit/test
'returnTrue' => $proto . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'module/' . $this->name . '/santanderCreditReturn?status=true&orderId=',
'returnFalse' => $proto . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'module/' . $this->name . '/santanderCreditReturn?status=false&orderId=',
'email' => $customer->email,
'imie' => ( $cookie->logged ? $cookie->customer_firstname : false ),
'nazwisko' => ( $cookie->logged ? $cookie->customer_lastname : false ),
'telKontakt' => $address->phone_mobile,
'ulica' => $address->address1,
'ulica2' => $address->address2,
'miasto' => $address->city,
'kodPocz' => $address->postcode,
// 'productsInputs' => $productsInputs,
'shipping' => round($summaryDetails['total_shipping'], 2),
'products' => $cart->getProducts(true),
'totalOrder' => $total,
'modDir' => $proto . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/' . $this->name
));
$this->context->controller->registerJavascript(
$this->name . '-scb_js', 'modules/' . $this->name . '/js/santanderCredit.js', [
'priority' => 200,
'attribute' => 'async',
]
);
return $this->fetch('module:santandercredit/views/templates/hook/santanderCreditPayment.tpl');
}
public function displaySymulator($params) {
global $smarty;
$id_product = Tools::getValue('id_product');
$product = new Product($id_product, true);
$smarty->assign(array(
'shopId' => trim(Configuration::get('SANTANDERCREDIT_SHOP_ID')),
'santanderCreditProductPrice' => round($product->getPrice(true), 2),
'jq_qtySelector' => Configuration::get('SANTANDERCREDIT_QTY_SELECTOR'),
'jq_priceSelector' => Configuration::get('SANTANDERCREDIT_PRICE_SELECTOR'),
'symulatorURL' => Configuration::get('SANTANDERCREDIT_URL_SYMULATOR')
));
if (Configuration::get('SANTANDERCREDIT_SYMULATOR') <> null) {
return $this->display(__FILE__, 'santanderCreditProduct.tpl');
}
}
public function hookDisplayProductAdditionalInfo($params){
return $this->displaySymulator($params);
}
public function hookDisplayFooterProduct($params){
return $this->displaySymulator($params);
}
public function hookDisplayCompareExtraInformation($params) {
return $this->displaySymulator($params);
}
public function hookDisplayRightColumnProduct($params) {
return $this->displaySymulator($params);
}
public function hookProductActions($params) {
return $this->displaySymulator($params);
}
public function hookRightColumn($params) {
return $this->displaySymulator($params);
}
public function hookLeftColumn($params) {
return $this->displaySymulator($params);
}
/**
* Creates new order state for eRaty payment system and configuration parameter SANTANDERCREDIT_OS_AUTHORIZATION
* containing new order id. If parameter already exists - do nothing.
*
* @boolean creating order result
*/
function createOrderState() {
$result = true;
if (!Configuration::get('SANTANDERCREDIT_OS_AUTHORIZATION')) {
try {
$order_state = new OrderState();
$order_state = new OrderState();
$order_state->name = array();
foreach (Language::getLanguages() as $language) {
if (Tools::strtolower($language['iso_code']) == 'pl')
$order_state->name[$language['id_lang']] = 'Płatność eRaty status decyzji Banku dostępny w Panel Sklep.';
else
$order_state->name[$language['id_lang']] = 'eRaty payment - decision state available in Panel Sklep.';
}
$order_state->send_email = false;
$order_state->color = '#DDEEFF';
$order_state->hidden = false;
$order_state->delivery = false;
$order_state->logable = true;
$order_state->invoice = true;
$order_state->module_name = 'eRaty';
$order_state->add();
$result = Configuration::updateValue('SANTANDERCREDIT_OS_AUTHORIZATION', (int) $order_state->id);
} catch (Exception $exc) {
$result = false;
}
}
return $result;
}
}

View File

@@ -0,0 +1,25 @@
{extends file='page.tpl'}
{block name="page_content"}
<p>
<span style="font-size: 16px; font-weight: bold;">Wystąpiły błędy przy realizacji płatności.</span>
<br /><br /><br />
<span style="font-size: 16px;">Numer wniosku kredytowego: <b>{$wniosekId}</b></span>.
<br /><br />
<span style="font-size: 16px;">Numer zamówienia w sklepie: <b>{$orderId}</b></span>.
<br/>
<hr/>
<p>
{$errors}
</p>
<hr/>
<br/>
W razie jakichkolwiek pytań prosimy o kontakt z <a href="{$base_dir}contact-form.php">Działem Obsługi Klienta</a>.
</p>
{/block}

View File

@@ -0,0 +1,45 @@
{extends file='page.tpl'}
{block name="page_content"}
{if $status == 'false'}
<p class="warning">
Zrezygnowałes z otrzymania kredytu ratalnego.
</p>
{else}
<p>
<span style="font-size: 16px; font-weight: bold;">Dziękujemy za złożenie wniosku w Santander Consumer Bank.</span>
<br /><br /><br />
<span style="font-size: 16px;">Numer wniosku kredytowego: <b>{$wniosekId}</b></span>.
<br /><br />
<span style="font-size: 16px;">Numer zamówienia w sklepie: <b>{$orderId}</b></span>.
<br /><br /><br />
<b>W przypadku pozytywnej wstępnej weryfikacji oczekuj na kontakt telefoniczny z konsultantem Santander.</b>
<br /><br />
Podczas rozmowy telefonicznej sporządzi razem z Toba umowę ratalna.
<br /><br />
<b>Przygotuj: dowód osobisty oraz drugi dokument tożsamosci.</b>
<br /><br />
Kiedy tylko otrzymamy informację o otrzymaniu płatności będziesz mógł śledzić stan swojego zamówienia w sekcji "Moje konto".
</p>
{/if}
{/block}

View File

@@ -0,0 +1,8 @@
{extends file='page.tpl'}
{block name="page_content"}
<h1>test</h1>
<p>
{$test}
</p>
{/block}

View File

@@ -0,0 +1,31 @@
{*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="alert alert-info">
<img src="../modules/santandercredit/images/logo_254x83.png" style="float:left; margin-right:15px;">
<p><strong>{l s="Ten moduł pozwala na zakupy w systemie ratalnym eRaty Santander Consumer Bank." d='Modules.Santandercredit.Admin'}</strong></p>
<p>{l s="Jeśli Klient wybierze ten sposób płatności, status zmieni się na 'Płatność eRaty status decyzji Banku dostępny w Panel Sklep.'" d='Modules.Santandercredit.Admin'}</p>
<p>{l s="Oznacza to że należy ręcznie zmodyfikować status zakupu na opłacony, po weryfikacji wniosku kredytowego na stronie Banku." d='Modules.Santandercredit.Admin'}</p>
</div>

View File

@@ -0,0 +1,20 @@
<section>
<h3>{l s='Zakupy na raty z systemem eRaty Santander Consumer Bank' mod='santandercredit'}</h3>
<p>
Całkowita wartość Twojego zamówienia wynosi <span style="color: #ff0000;" class="bold">{$totalOrderC}</span>
</p>
<p>
Przed złożeniem wniosku możesz zapoznać się z procedurą udzielenia kredytu ratalnego oraz obliczyć raty.
</p>
<p>
<a href="https://www.santanderconsumer.pl/raty-jak-kupic" target="_blank">
<img src="{$imgDir}/jakKupicSmall.png" style="cursor: pointer; float: left;" title="Zapoznaj się z procedurą" alt="Zapoznaj się z procedurą" border="0" />
</a>
<!--default part href="https://wniosek.eraty.pl/symulator/oblicz/" (with backslash at the end)-->
<a href="{$symulatorURL}numerSklepu/{$shopId}/wariantSklepu/1/typProduktu/0/wartoscTowarow/{$totalOrder}/" target="_blank">
<img src="{$imgDir}/obliczRate.png" style="cursor: pointer; float: right;" title="Oblicz ratę" alt="Oblicz ratę" border="0" />
</a>
</p>
<div style="clear: both"></div>
</section>

View File

@@ -0,0 +1,63 @@
<h2 style="margin-left: auto; margin-right: auto; color:red; text-align: center;">{l s='Zakupy na raty z systemem eRaty Santander Consumer Bank' mod='santandercredit'}</h2>
<div style="margin-left: auto; margin-right: auto; margin-bottom: 3em; color:red; text-align: center;">Zarejestruj wniosek o kredyt ratalny aby sfinalizowac płatność.</div>
<!--default action="https://wniosek.eraty.pl/formularz/" (with backslash at the end)-->
<form name="santanderCreditForm" id="santanderCreditForm" action="{$applicationURL}" method="post">
{assign var='nr' value='0'}
{foreach from=$products item=product}
{$nr = $nr + 1}
<input name="idTowaru{$nr}" readonly="readonly" type="hidden" value="{$product['id_product']}" />
<input name="nazwaTowaru{$nr}" readonly="readonly" type="hidden" value="{$product['name']}" />
<input name="wartoscTowaru{$nr}" readonly="readonly" type="hidden" value="{round($product['price_wt'], 2)}" />
<input name="liczbaSztukTowaru{$nr}" readonly="readonly" type="hidden" value="{$product['quantity']}" />
<input name="jednostkaTowaru{$nr}" readonly="readonly" type="hidden" value="szt" />
{/foreach}
{if $shipping gt 0}
{$nr = $nr + 1}
<input type="hidden" name="idTowaru{$nr}" readonly="readonly" value="KosztPrzesylki" />
<input type="hidden" name="nazwaTowaru{$nr}" readonly="readonly" value="Koszt przesyłki" />
<input type="hidden" name="wartoscTowaru{$nr}" readonly="readonly" value="{$shipping}" />
<input type="hidden" name="liczbaSztukTowaru{$nr}" readonly="readonly" value="1" />
<input type="hidden" name="jednostkaTowaru{$nr}" readonly="readonly" value="szt" />'
{/if}
<input type="hidden" name="liczbaSztukTowarow" value="{$nr}" />
<input type="hidden" name="typProduktu" value="0" />
<input type="hidden" name="wariantSklepu" value="1" />
<input type="hidden" name="nrZamowieniaSklep" value="{$orderId}" id="orderId"/>
<input type="hidden" name="wartoscTowarow" value="{$totalOrder}" />
<input type="hidden" name="action" value="getklientdet_si" />
<input type="hidden" name="pesel" value="" />
<input type="hidden" name="imie" value="{$imie}" />
<input type="hidden" name="nazwisko" value="{$nazwisko}" />
<input type="hidden" name="email" value="{$email}" />
<input type="hidden" name="telKontakt" value="{$telKontakt}" />
<input type="hidden" name="ulica" value="{$ulica}" />
<input type="hidden" name="nrDomu" value="{$ulica2}" />
<input type="hidden" name="nrMieszkania" value="" />
<input type="hidden" name="miasto" value="{$miasto}" />
<input type="hidden" name="kodPocz" value="{$kodPocz}" />
<input type="hidden" name="char" value="UTF" />
<input type="hidden" name="numerSklepu" value="{$shopId}" />
<input type="hidden" name="shopName" value="{$shopName}" />
<input type="hidden" name="shopHttp" value="{$shopHttp}" />
<input type="hidden" name="wniosekZapisany" value="{$returnTrue}" />
<input type="hidden" name="wniosekAnulowany" value="{$returnFalse}" />
<input type="hidden" name="shopMailAdress" value="{$shopMailAdress}" />
<input type="hidden" name="shopPhone" value="{$shopPhone}" />
<p>
<input type="checkbox" id="santanderAgreement" onclick="santanderCreditValidateForm();"/>
Zapoznałem się <a onclick="return jakKupic();" style="cursor: pointer;"><b><u>z procedurą udzielenia kredytu konsumenckiego na zakup towarów i usług eRaty Santander Consumer Bank</u></b></a>
</p>
<p>
<input type="submit" id="scbSubmitBtn" name="submit" disabled="disabled" value="{l s='Kupuję na raty z Santander Consumer Bank' mod='santandercredit'}" class="btn btn-primary center-block"/>
</p>
</form>

View File

@@ -0,0 +1,6 @@
<div class="single_raty">
<script type="text/javascript" src="{$module_dir}js/santanderCredit.js"></script>
<a onClick="obliczRate('{$shopId}', '{$symulatorURL}', '{$jq_qtySelector}', '{$jq_priceSelector}');" title="Kupuj na eRaty Santander Consumer Banku!" align="right" style="cursor: pointer;">
<img src="{$module_dir}images/obliczRate.png" alt="Oblicz ratę!" />
</a>
</div>