This commit is contained in:
2025-03-09 23:50:32 +01:00
parent 1e498b41c7
commit 67c05416ac
190 changed files with 8061 additions and 3363 deletions

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>santandercredit</name>
<displayName><![CDATA[Santander - System ratalny]]></displayName>
<version><![CDATA[1.9.24]]></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,48 @@
<?php
/*
Tylko PAYMENT_DECLARED powinien być ustawiany ręcznie. Reszta przez ProposalSeviceHybrid
*/
define('EHP_APP_STATES', [
'PAYMENT_DECLARED' => 'EHP 01: Wybrano finansowanie kredytem',
'APPLICATION_PROCEDING' => 'EHP 02: oczekiwanie na decyzję Banku', //yellow
'ABANDONED' => 'EHP 03: Porzucono wniosek kredytowy', //red
'CREDIT_GRANTED' => 'EHP 04: Udzielono kredytu', //green
'CREDIT_REJECTED' => 'EHP 05: Bank odmówił udzielenia kredytu', //red
'CANCELLED' => 'EHP 06: Anulowano wniosek kredytowy', //red
'GOODS_CONFIRMATION' => 'EHP 07: Potwierdź dostępność towaru'
]);
define('EHP_ORDER_STATE_PREFIX', 'SCB_EHP_ST_');
define('BANK2SHOP_STATE_MAP', [
'Bank' => 'APPLICATION_PROCEDING',
'Bank (-101)' => 'APPLICATION_PROCEDING',
'Bank (-105)' => 'APPLICATION_PROCEDING',
'Klient' => 'APPLICATION_PROCEDING',
'Klient (-100)' => 'APPLICATION_PROCEDING',
'Klient (-104)' => 'APPLICATION_PROCEDING',
'Klient(-127)' => 'APPLICATION_PROCEDING',
'Odmowa' => 'CREDIT_REJECTED',
'Sklep' => 'GOODS_CONFIRMATION',
'Wydaj_towar' => 'CREDIT_GRANTED',
'Zakonczona' => 'CREDIT_GRANTED'
]);
define('CHECK_THIS_STATES', [
'PAYMENT_DECLARED',
'APPLICATION_PROCEDING',
'ABANDONED',
]);
define('CAN_SEND_APPLICATION',['NO' => 0, 'YES' => 1, 'MAYBE' => 2]);
define('EHP_DEF_URLS',[
'EHP_DEF_URL_SYMULATOR' => 'https://wniosek.eraty.pl/symulator/oblicz/',
'EHP_DEF_URL_WNIOSEK' => 'https://wniosek.eraty.pl/formularz/',
'EHP_DEF_SVC_LOCATION' => 'https://api.santanderconsumer.pl/ProposalServiceHybrid'
]);
define('EHP_DEF_QUERIES',[
'EHP_DEF_QTY_QUERY' => str_replace('<','&lt;', str_replace('>', '&gt;', str_replace('"','&quot;',str_replace("'", "&#039;", "$('#quantity_wanted').val();")))),
'EHP_DEF_PRICE_QUERY' => str_replace('<','&lt;', str_replace('>', '&gt;', str_replace('"','&quot;',str_replace("'", "&#039;", "$('div.current-price > span[itemprop=\"price\"],div.current-price > span.current-price-value').attr(\"content\");"))))
]);

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[1.9.24]]></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,34 @@
<?php
/**
* 2007-2021 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-2021 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,57 @@
<?php
include_once 'config/ehpcfg.php';
include_once 'sql/ScbDbUtil.php';
class SantandercreditSantanderCreditReturnModuleFrontController extends ModuleFrontController {
public function __construct() {
parent::__construct();
}
public function initContent() {
parent::initContent();
$returnTemplate = 'santanderCreditReturn.tpl';
$errors = '';
// Tools::getValue('orderId') != '' BO PRZESTANIE BYĆ NUMERYKIEM
// if (Tools::getValue('orderId') != 0 && Tools::getValue('id_wniosku') != '') {
if (Tools::getValue('orderId') != '' && Tools::getValue('id_wniosku') != '') {
// $order = new Order(Tools::getValue('orderId'));
$order = new Order(ScbDbUtil::getIdOrder(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' => $_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,42 @@
<?php
class santandercreditsantanderCreditValidateModuleFrontController extends ModuleFrontController
{
public function postProcess()
{
if (!($this->module instanceof SantanderCredit)) {
Tools::redirect('index.php?controller=order&step=1');
return;
}
$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');
$customer = new Customer($cart->id_customer);
if (!Validate::isLoadedObject($customer))
Tools::redirect('index.php?controller=order&step=1');
$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,
[],
$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);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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;

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,34 @@
<?php
/**
* 2007-2021 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-2021 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,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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
<?php
class AppStateDocument {
public $Identity;
public $ShopApplicationNumbers;
public function __construct($i, $a){
$this->Identity = $i;
$this->ShopApplicationNumbers = $a;
}
};

View File

@@ -0,0 +1,44 @@
<?php
class Application {
/**
* Agreement date
*/
public $AgreementDate;
/**
* Credit Agreement number
*/
public $AgreementNumber;
/**
* Credit application number
*/
public $ApplicationNumber;
/**
* Application state change date
*/
public $ChangeDate;
/**
* Application state
*/
public $CreditState;
/**
* Downpayment(reduces total price in credit application)
*/
public $Downpayment;
/**
* This is order number. In PrestaShop - order reference (in previous module versions it was order id)
*/
public $ShopApplicationNumber;
/**
* Shop number (in the Bank database)
*/
public $ShopNumber;
/**
* Total Price paid for the order
*/
public $TotalPrice;
public $check_date;
}

View File

@@ -0,0 +1,15 @@
<?php
class ClientIdentity {
public $Login;
public $Password;
/*sklep testowy 99995 mozna wykorzystać jeśli jest przypisany do loginu sklepu.
Jeśli nie - testy można wykonywać na własnym sklepie.*/
public $ShopNumber;
public function __construct($Login, $Password, $ShopNumber) {
$this->Login = $Login;
$this->Password = $Password;
$this->ShopNumber = $ShopNumber;
}
};

View File

@@ -0,0 +1,19 @@
<?php
class SimulationResult {
public $APR;
public $AdjustmentInstalmentAmount;
public $Clause;
public $CommissionAmount;
public $CreditAmount;
public $Downpayment;
public $FirstInstallmentDate;
public $InstalmentAmount;
public $InstalmentsNumber;
public $InterestAmount;
public $InterestRate;
public $TotalAdditionalFee;
public $TotalAmountToPay;
public $TotalCreditCost;
}

View File

@@ -0,0 +1,10 @@
<?php
class ISActiveResult{
public $ErrorCode;
public $IsCorrect;
public $LogMarker;
public $Message;
public $UserMessage;
}

View File

@@ -0,0 +1,9 @@
<?php
class OperationStatus{
public $ErrorCode;
public $IsCorrect;
public $LogMarker;
public $Message;
public $UserMessage;
}

View File

@@ -0,0 +1,152 @@
<?php
include_once "Application.php";
include_once "AppStateDocument.php";
include_once "ClientIdentity.php";
include_once "FinancialDataResult.php";
include_once "IsActiveResult.php";
include_once "OperationStatus.php";
include_once "Simulation.php";
class PSHClient {
private $client;
private $login;
private $pass;
private $pemCert;
private $serviceLocation;
private $shopNumber;
public $applications;
public $operationStatus;
public $lastException;
public $isCorrect;
public $simulationResult;
public function __construct($login, $pass, $serviceLocation, $pemCert, $shopNumber) {
$this->applications = new ArrayObject();
$this->operationStatus = new OperationStatus();
$this->login = $login;
$this->pass = $pass;
$this->serviceLocation = $serviceLocation;
$this->pemCert = $pemCert;
$this->shopNumber = $shopNumber;
$wsdl = $serviceLocation . "?wsdl";
$this->client = new SoapClient(
$wsdl,
array(
'local_cert' => $pemCert,
'verify_peer' => false,
'exceptions' => 0,
'cache_wsdl' => WSDL_CACHE_NONE,
'passphrase' => $pass,
'location' => $serviceLocation
)
);
}
public function checkAppStatus($arrayOfOrderReference){
$this->lastException = null;
$this->operationStatus = new OperationStatus();
$this->isCorrect = false;
$this->applications = new ArrayObject();
$identyfikacja = new ClientIdentity($this->login, $this->pass,$this->shopNumber);
try {
$resp = $this->client->GetApplicationState(
new AppStateDocument($identyfikacja, $arrayOfOrderReference)
);
if ($this->validateResponse($resp)) {
$ap = $resp->GetApplicationStateResult->Applications->ApplicationData;
if (is_array($ap)){
$this->applications = new ArrayObject($ap);
} elseif (is_object($ap)){
$this->applications->append($ap);
} else {
$this->isCorrect = false;
$this->lastException = "Bad response structure: !no Application object!";
}
}
}
catch(Exception $e) {
$this->lastException = $e;
}
}
private function validateResponse($response) : bool{
$isOk = true;
// var_dump($response);
$msg = "Bad response structure: ";
if(!is_object($response)){
$isOk = false;
$msg= $msg . " !response is not object!";
};
if($isOk and !is_object($response->GetApplicationStateResult)){
$isOk = false;
$msg= $msg . " !GetApplicationStateResult is not object!";
};
if($isOk and !is_object($response->GetApplicationStateResult->OperationStatus)){
$isOk = false;
$msg= $msg . " !response->GetApplicationStateResult->OperationStatus is not object!";
};
if($isOk and !isset($response->GetApplicationStateResult->OperationStatus->IsCorrect)){
$isOk = false;
$msg= $msg . " !response->GetApplicationStateResult->OperationStatus->IsCorrect is not set!";
};
$this->isCorrect = $isOk;
if($isOk) {
$this->operationStatus = $response->GetApplicationStateResult->OperationStatus;
$this->isCorrect = $response->GetApplicationStateResult->OperationStatus->IsCorrect;
$this->lastException = $response->GetApplicationStateResult->OperationStatus->Message;
if($this->isCorrect and !is_object($response->GetApplicationStateResult->Applications)){
$this->isCorrect = false;
$msg= $msg . " !response->GetApplicationStateResult->Applications is not object!";
$this->lastException = $msg;
};
} else{
$this->lastException = $msg;
}
return $this->isCorrect;
}
/**
* $dnp downpayment
* $inr installment number
* $prd product/credit line
* $price
*/
public function calculateCredit($dnp, $inr, $prd, $price){
$this->lastException = null;
$this->simulationResult = null;
$this->isCorrect = false;
$identyfikacja = new ClientIdentity($this->login, $this->pass,$this->shopNumber);
try {
$resp = $this->client->GetFinancialData(
new FinancialDataDocument(
new Identyfikacja(), new Simulation($dnp, $inr, $prd, $price)));
$this->operationStatus = $resp->GetFinancialDataResult->OperationStatus;
$this->simulationResult = $resp->GetFinancialDataResult->SimulationResult;
$this->isCorrect = $this->operationStatus->IsCorrect;
}
catch(Exception $e) {
$this->lastException = $e;
}
}
public function isActive(){
$this->lastException = null;
try {
$resp = $this->client->IsActive();
$this->isActive = $resp->IsActiveResult;
$this->isCorrect = true;
}
catch(Exception $e) {
$this->lastException = $e;
$this->isCorrect = false;
}
return $this->isCorrect;
}
}

View File

@@ -0,0 +1,14 @@
<?php
class Simulation {
public $Downpayment;
public $InstalmentsNumber;
public $ProductNumber;
public $TotalPrice;
public function __construct($dnp, $inr, $prd, $price){
$this->Downpayment = $dnp;
$this->InstalmentsNumber = $inr;
$this->ProductNumber = $prd;
$this->TotalPrice = $price;
}
};

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
// parametr wywołania: id_order
require_once dirname(__FILE__).'/../../../../../config/config.inc.php';
include_once dirname(__FILE__).'/../../../config/ehpcfg.php';
include_once dirname(__FILE__).'/../HybridClient/PSHClient.php';
include_once dirname(__FILE__).'/../../../sql/ScbDbUtil.php';
$pshLocation = Configuration::get('SANTANDERCREDIT_SVC_LOCATION');
$pshLogin = Configuration::get('SANTANDERCREDIT_PSH_LOGIN');
$pshPass = Configuration::get('SANTANDERCREDIT_PSH_PASS');
$pshCrt = Configuration::get('SANTANDERCREDIT_CRT_FILE');
$shopNumber = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
$pshCrt = dirname(__FILE__).'/../../../CERT/' . trim($pshCrt);
$oid = Tools::getValue('id_order');
$shopAppNr = ScbDbUtil::getShopApplicationNumber($oid);
$client = new PSHClient($pshLogin, $pshPass, $pshLocation, $pshCrt, $shopNumber);
if($client->isActive()) {
$client->checkAppStatus([$shopAppNr]);
if($client->isCorrect and is_object($client->applications) and $client->applications->count() == 1){
//log request, response and perform notification
if(isset($client->applications[0]->ApplicationNumber)) {
ScbDbUtil::RegisterSuccessfullPshResponse($shopAppNr, $client->operationStatus, $client->applications[0]);
} else {
// response formalnie poprawny ale brak wniosku
// ScbDbUtil::LogIncorrectPshResponse($shopAppNr, $client->operationStatus, $client->applications[0]->CreditState);
ScbDbUtil::RegisterSuccessfullPshResponse($shopAppNr, $client->operationStatus, $client->applications[0]);
}
} else{
// bad request - log it
ScbDbUtil::LogIncorrectPshResponse($shopAppNr, $client->operationStatus, $client->lastException);
}
}
echo '{"isOk":"1"}';

View File

@@ -0,0 +1,27 @@
<?php
require_once dirname(__FILE__).'/../../../../../config/config.inc.php';
include_once dirname(__FILE__).'/../../../config/ehpcfg.php';
include_once dirname(__FILE__).'/../HybridClient/PSHClient.php';
include_once dirname(__FILE__).'/../../../sql/ScbDbUtil.php';
/**
* Sprawdzanie co 5 minut, wysyłany request max 20 wniosków w kolejności check_date
*/
$pshLocation = Configuration::get('SANTANDERCREDIT_SVC_LOCATION');
$pshLogin = Configuration::get('SANTANDERCREDIT_PSH_LOGIN');
$pshPass = Configuration::get('SANTANDERCREDIT_PSH_PASS');
$pshCrt = Configuration::get('SANTANDERCREDIT_CRT_FILE');
$shopNumber = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
$pshCrt = dirname(__FILE__).'/../../../CERT/' . trim($pshCrt);
// select top 20 wniosków (wszystkie niezakończone w kolejności check_date)
$ordersArray = ScbDbUtil::getOrders2check();
$client = new PSHClient($pshLogin, $pshPass, $pshLocation, $pshCrt, $shopNumber);
if(count($ordersArray) > 0 and $client->isActive()) {
// buduj request
// getApplicationState
$client->checkAppStatus($ordersArray);
// oznaczenie daty synchronizacji statusu na sprawdzanych wnioskach
ScbDbUtil::updateCheckDate($ordersArray);
// przetwarzanie odpowiedzi w pętli
ScbDbUtil::updateAppStates($client->applications, $client->operationStatus);
}

View File

@@ -0,0 +1,37 @@
<?php
// parametr wywołania: id_order musi, w przypadku tego skryptu, zawierać POSApplicationNumber (nie ma konwersji z id)
require_once dirname(__FILE__).'/../../../../../config/config.inc.php';
include_once dirname(__FILE__).'/../../../config/ehpcfg.php';
include_once dirname(__FILE__).'/../HybridClient/PSHClient.php';
include_once dirname(__FILE__).'/../../../sql/ScbDbUtil.php';
$pshLocation = Configuration::get('SANTANDERCREDIT_SVC_LOCATION');
$pshLogin = Configuration::get('SANTANDERCREDIT_PSH_LOGIN');
$pshPass = Configuration::get('SANTANDERCREDIT_PSH_PASS');
$pshCrt = Configuration::get('SANTANDERCREDIT_CRT_FILE');
$shopNumber = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
$pshCrt = dirname(__FILE__).'/../../../CERT/' . trim($pshCrt);
$oid = Tools::getValue('id_order');
$shopAppNr = $oid;
$responseJson = '{"isOk":"false"}';
$client = new PSHClient($pshLogin, $pshPass, $pshLocation, $pshCrt, $shopNumber);
if($client->isActive()) {
$client->checkAppStatus([$shopAppNr]);
if($client->isCorrect and is_object($client->applications) and $client->applications->count() == 1){
//log request, response and perform notification
if(isset($client->applications[0]->ApplicationNumber)) {
ScbDbUtil::RegisterSuccessfullPshResponse($shopAppNr, $client->operationStatus, $client->applications[0]);
$responseJson = '{"isOk":"true"}';
} else {
// response formalnie poprawny ale brak wniosku
// ScbDbUtil::LogIncorrectPshResponse($shopAppNr, $client->operationStatus, $client->applications[0]->CreditState);
ScbDbUtil::RegisterSuccessfullPshResponse($shopAppNr, $client->operationStatus, $client->applications[0]);
$responseJson = '{"isOk":"true"}';
}
} else{
// bad request - log it
ScbDbUtil::LogIncorrectPshResponse($shopAppNr, $client->operationStatus, $client->lastException);
}
}
echo $responseJson;

View File

@@ -0,0 +1,20 @@
<?php
// parametr wywołania: id_order
require_once dirname(__FILE__).'/../../../../../config/config.inc.php';
include_once dirname(__FILE__).'/../../../config/ehpcfg.php';
include_once dirname(__FILE__).'/../HybridClient/PSHClient.php';
include_once dirname(__FILE__).'/../../../sql/ScbDbUtil.php';
$pshLocation = Configuration::get('SANTANDERCREDIT_SVC_LOCATION');
$pshLogin = Configuration::get('SANTANDERCREDIT_PSH_LOGIN');
$pshPass = Configuration::get('SANTANDERCREDIT_PSH_PASS');
$pshCrt = Configuration::get('SANTANDERCREDIT_CRT_FILE');
$shopNumber = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
$pshCrt = dirname(__FILE__).'/../../../CERT/' . trim($pshCrt);
$client = new PSHClient($pshLogin, $pshPass, $pshLocation, $pshCrt, $shopNumber);
if($client->isActive()) {
echo 'OK';
} else {
echo 'Błąd';
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,218 @@
<?php
use PhpParser\Node\Stmt\TryCatch;
require_once dirname(__FILE__) . '/../../../config/config.inc.php';
include_once dirname(__FILE__) . '/../services/ProposalService/HybridClient/Application.php';
include_once dirname(__FILE__) . '/../services/ProposalService/HybridClient/OperationStatus.php';
/**
* Source Application Number to id_order converter
*
*/
class ScbDbUtil {
public static function getIdOrder($ShopApplicationNumber) {
$query = 'SELECT id_order FROM ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping where pos_app_number = \''.$ShopApplicationNumber. '\'';
$idOrder = Db::getInstance()->getValue($query);
if($idOrder){
return $idOrder;
}
return -1;
}
public static function getShopApplicationNumber($IdOrder){
$query = 'SELECT pos_app_number FROM ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping where id_order = '.$IdOrder;
$san = Db::getInstance()->getValue($query);
return $san;
}
public static function RegisterSuccessfullPshResponse($shopAppNr, $operationStatus, $application) {
$shop = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
$numbers2check = [];
$cnt = count(CHECK_THIS_STATES);
for($i = 0; $i < $cnt; $i++) {
array_push($numbers2check, Configuration::get(EHP_ORDER_STATE_PREFIX . CHECK_THIS_STATES[$i]));
}
$token = '';
$orderObj = new Order(ScbDbUtil::getIdOrder($shopAppNr));
$currentOrderState = $orderObj->getCurrentOrderState();
$newOrderState = ScbDbUtil::mapCreditStateToOrderState($application->CreditState, $currentOrderState);
$checkIt = '0';
$cnt = count($numbers2check);
for($i = 0; $i < $cnt; $i++){
if($newOrderState == $numbers2check[$i]){
$checkIt = '1';
break;
}
}
$request_date = date("Y-m-d H:i:s");
$agreementDate = null;
$appStatusChgDate = null;
if(isset($application->AgreementDate)){
$agreementDate = date("Y-m-d H:i:s",strtotime($application->AgreementDate));
}
if(isset($application->ChangeDate)){
$appStatusChgDate = date("Y-m-d H:i:s",strtotime($application->ChangeDate));
}
$sql = [
'INSERT INTO ' . _DB_PREFIX_ . 'scb_ehp_log (
id_order,
pos_app_number,
application_number,
agreement_number,
agreement_date,
shop_number,
ehp_token,
request_date,
success,
application_status,
app_status_chg_date,
downpayment,
total_price
) VALUES ('
.ScbDbUtil::getIdOrder($shopAppNr) . ',\''
.$shopAppNr . '\',\''
.$application->ApplicationNumber . '\',\''
.$application->AgreementNumber . '\',\''
.$agreementDate . '\',\''
.$shop . '\',\''
.$token . '\',\''
.$request_date . '\','
.'1,\''
.$application->CreditState . '\',\''
.$appStatusChgDate . '\','
.$application->Downpayment . ','
.$application->TotalPrice . ');'
,'UPDATE ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping SET '
.'application_number = \'' . $application->ApplicationNumber . '\', '
.'agreement_number = \'' . $application->AgreementNumber . '\', '
.'agreement_date = \'' . $agreementDate . '\', '
.'ehp_token = \'' . $token . '\', '
.'order_status = \'' . $newOrderState . '\', '
.'application_status = \'' . $application->CreditState . '\', '
.'app_status_chg_date = \'' . $appStatusChgDate . '\', '
.'downpayment = ' . $application->Downpayment . ','
.'total_price = ' . $application->TotalPrice . ', '
.'check_date = \'' . $request_date . '\', '
.'check_it = ' . $checkIt
.' WHERE pos_app_number = \'' . $shopAppNr .'\''
];
foreach ($sql as $query) {
Db::getInstance()->execute($query);
}
if ($currentOrderState->id <> $newOrderState) {
$orderObj->setCurrentState($newOrderState);
$orderObj->save();
};
}
public static function LogIncorrectPshResponse($shopAppNr, $operationStatus, $errorInfo) {
if(isset($shopAppNr) and is_object($operationStatus) and is_string($errorInfo)) {
$shop = trim(Configuration::get('SANTANDERCREDIT_SHOP_ID'));
$request_date = date("Y-m-d H:i:s");
$token = '';
$sql = [
'INSERT INTO ' . _DB_PREFIX_ . 'scb_ehp_log (
id_order,
pos_app_number,
shop_number,
ehp_token,
request_date,
success,
message
) VALUES ('
.ScbDbUtil::getIdOrder($shopAppNr) . ',\''
.$shopAppNr . '\',\''
.$shop . '\',\''
.$token . '\',\''
.$request_date . '\','
.'0,\'' . $errorInfo . '\')'
];
foreach ($sql as $query) {
Db::getInstance()->execute($query);
}
}
}
public static function mapCreditStateToOrderState($CreditState, $currentOrderState){
$currentOrderStateId = $currentOrderState->id;
$newOrderState = $currentOrderStateId;
$luckyNumbers = [];
foreach(EHP_APP_STATES as $key => $value) {
$statNameNoPrefix = $key;
$orderStateName = EHP_ORDER_STATE_PREFIX . $statNameNoPrefix;
$StateId = Configuration::get($orderStateName);
array_push($luckyNumbers, $StateId);
}
$editable = false;
$cnt = count($luckyNumbers);
for($i = 0; $i < $cnt; $i++) {
if($currentOrderStateId == $luckyNumbers[$i]) {
$editable = true;
}
}
if($editable){
if(array_key_exists($CreditState, BANK2SHOP_STATE_MAP)) {
$statNameNoPrefix = BANK2SHOP_STATE_MAP[$CreditState];
$orderStateName = EHP_ORDER_STATE_PREFIX . $statNameNoPrefix;
$newOrderState = (int) Configuration::get($orderStateName);
}
}
return $newOrderState;
}
public static function getFullApplicationInfo($id_order){
$app = new Application();
$query = 'SELECT * FROM ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping where id_order = '.$id_order;
$result = Db::getInstance()->executeS($query);
foreach($result as $row){
$app->AgreementDate = $row['agreement_date'];
$app->AgreementNumber = $row['agreement_number'];
$app->ApplicationNumber = $row['application_number'];
$app->ChangeDate = $row['app_status_chg_date'];
$app->CreditState = $row['application_status'];
$app->Downpayment = $row['downpayment'];
$app->ShopApplicationNumber = $row['pos_app_number'];
$app->ShopNumber = $row['shop_number'];
$app->TotalPrice = $row['total_price'];
$app->check_date = $row['check_date'];
}
return $app;
}
public static function getOrders2check(){
$orderArray = [];
$query = 'SELECT pos_app_number FROM ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping WHERE `date_add` > DATE_ADD(NOW(), INTERVAL -14 DAY) AND check_it = 1 order by check_date limit 20';
$result = Db::getInstance()->executeS($query);
foreach($result as $row){
array_push($orderArray, $row['pos_app_number']);
}
return $orderArray;
}
public static function updateCheckDate($arrayOfOrders){
$request_date = date("Y-m-d H:i:s");
$query = 'UPDATE ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping SET ';
$query = $query . ' check_date = \'' . $request_date . '\' WHERE pos_app_number in (';
$notEmpty = 0;
foreach ($arrayOfOrders as $shopAppNumber) {
$query = $query . '\'' . $shopAppNumber . '\',';
$notEmpty = 1;
}
if($notEmpty > 0){
$query = substr($query, 0, strlen($query) - 1);
$query = $query . ')';
Db::getInstance()->execute($query);
}
}
public static function updateAppStates($apps, $opState){
foreach ($apps as $key => $a) {
ScbDbUtil::RegisterSuccessfullPshResponse($a->ShopApplicationNumber, $opState, $a);
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,77 @@
<?php
/**
* service: HTTP_POST/ProposalServiceHybrid
* method: POST/GetOrderStatus
*
*/
$sql = array();
//(0 if there is no ehp db)
$dbv = SantanderCredit::getEhpDbVersion();
//next db version
if($dbv < 1){
$sql = [
'CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'scb_ehp_log (
id INT(10) NOT NULL AUTO_INCREMENT ,
id_order int(10),
pos_app_number varchar(64) NOT NULL,
application_number varchar(64) NULL ,
agreement_number varchar(64) NULL ,
agreement_date DATETIME NULL ,
shop_number VARCHAR(10) NOT NULL ,
ehp_token VARCHAR(128) NULL ,
request_date DATETIME NOT NULL ,
success INT(1) NOT NULL ,
application_status VARCHAR(60) NULL ,
app_status_chg_date DATETIME NULL ,
downpayment DECIMAL(10,2) NULL,
total_price DECIMAL(10,2) NULL,
message TEXT NULL,
PRIMARY KEY (`id`),
INDEX `scb_ehp_san_idx` (`pos_app_number`),
INDEX `scb_ehp_app_number_idx` (`application_number`),
INDEX `scb_ehp_id_order_idx` (`id_order`));',
'CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping (
id_order int(10) NOT NULL,
date_add DATETIME NOT NULL ,
pos_app_number varchar(64) NOT NULL,
reference varchar(64) NULL ,
application_number varchar(64) NULL ,
agreement_number varchar(64) NULL ,
agreement_date DATETIME NULL ,
ehp_token VARCHAR(128) NULL ,
order_status VARCHAR(60) NULL ,
application_status VARCHAR(60) NULL ,
app_status_chg_date DATETIME NULL ,
shop_number VARCHAR(10) NOT NULL ,
downpayment DECIMAL(10,2) NULL,
total_price DECIMAL(10,2) NULL,
post_data TEXT NULL,
check_date DATETIME NULL,
check_it INT (1) NOT NULL ,
PRIMARY KEY (`pos_app_number`),
INDEX `scb_ehp_app_number_idx` (`application_number`),
INDEX `scb_ehp_check_date_idx` (`check_date`),
INDEX `scb_ehp_check_it_idx` (`check_it`),
INDEX `scb_ehp_id_order_idx` (`id_order`));',
'CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'scb_ehp_phist (
id int(10) NOT NULL AUTO_INCREMENT,
h_date datetime NOT NULL ,
db_ver int(10) NULL ,
module_ver varchar(10),
params VARCHAR(1024) NULL ,
PRIMARY KEY (`id`));'
];
}
$dbv = 1;
$qUpdDbv = 'INSERT INTO ' . _DB_PREFIX_ . 'scb_ehp_phist (h_date, db_ver, module_ver) VALUES (';
$qUpdDbv = $qUpdDbv.'\''.date("Y-m-d H:i:s").'\','.strval($dbv).',\''.$this->version.'\')';
array_push($sql, $qUpdDbv);
foreach ($sql as $query) {
Db::getInstance()->execute($query);
}

View File

@@ -0,0 +1,23 @@
<?php
use PhpParser\Node\Stmt\TryCatch;
/**
* Reference is used only for checking if there is correct id_order in
* scb_ehp_order_app_mapping record.
* As POSApplicationNumber is used id_order with time stamp in addition.
* Construction: id_order_yyyy_MM_dd_hh_mm_ss
* Something like this: 12_2023_11_25_12_54_45.
* id_order = 12
* time stamp: 2023-11-25 12:54:45
*/
require_once dirname(__FILE__) . '/../../../config/config.inc.php';
try {
$query = 'update ' . _DB_PREFIX_ . 'scb_ehp_order_app_mapping oa_map left join ';
$query = $query . _DB_PREFIX_ . 'orders o on o.reference = oa_map.order_reference set oa_map.id_order = o.id_order';
Db::getInstance()->execute($query);
echo '{"isOk":"1"}';
} catch (\Throwable $th) {
echo '{"isOk":"0"}';
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* 2007-2021 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-2021 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* In some cases you should not drop the tables.
* Maybe the merchant will just try to reset the module
* but does not want to loose all of the data associated to the module.
*/
$sql = array();
foreach ($sql as $query) {
if (Db::getInstance()->execute($query) == false) {
return false;
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,46 @@
/* The Modal (background) */
.ehp-modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 10000; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.ehp-modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
vertical-align:top;
}
.ehp-modal header {
/* background-color: #0a7ad4;
color: #aaaaaa;*/
font-weight: bold;
}
/* The Close Button */
.ehp-close {
color: #aaaaaa;
float: right;
font-size: 32px;
font-weight: bold;
}
.ehp-close:hover,
.ehp-close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}

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,34 @@
<?php
/**
* 2007-2021 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-2021 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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,137 @@
function jakKupicEhp() {
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 obliczRateEhp(nrSklepu, symUrl, qtySelector, basketSelector) {
let koszyk, ilo, qty, basket, scbQty, scbPrice;
scbQty = -1;
scbPrice = -1;
if ($("#scb_price") && typeof($("#scb_price")) == 'object') {
scbPrice = $("#scb_price").text();
}
if ($("#scb_quantity") && typeof($("#scb_quantity")) == 'object') {
scbQty = $("#scb_quantity").text();
}
if (scbQty > 0 && scbPrice > 0) {
qty = $(qtySelector);
basket = $(basketSelector);
if(qty.length == 1 && basket.length == 1) {
scbQty = qty.val();
scbPrice = basket.attr('content');
}
scbPrice = scbPrice * scbQty;
scbPrice = Math.round(scbPrice * 100, 2) / 100; //some stupid code just to solve strange js numeric results problem
if (scbPrice > 100) {
window.open(symUrl + 'numerSklepu/' + nrSklepu + '/wariantSklepu/1/typProduktu/0/wartoscTowarow/' + scbPrice);
} else {
alert("Kredytujemy zakupy w cenie powyżej 100zł");
}
} else {
alert('Wrong parameters for calculate');
}
}
function simulationEhp(displayModal, shopNumber, symUrl, quantity, price) {
let scbQty, scbPrice;
scbQty = -1;
scbPrice = -1;
if ($("#scb_price") && typeof($("#scb_price")) == 'object') {
scbPrice = $("#scb_price").text();
}
if ($("#scb_quantity") && typeof($("#scb_quantity")) == 'object') {
scbQty = $("#scb_quantity").text();
}
if (scbQty > 0 && scbPrice > 0) {
/**
* if quantity an price are ok then use it for simulation. Otherwise - use defaults(
* scbQty and scbPrice) set on server side as smarty value
*/
if(quantity >= scbQty) {
scbQty = quantity;
// scbPrice = price;
}
if(price > 0){
scbPrice = price;
}
eHpSimRequestPrepare(displayModal, shopNumber, symUrl, scbPrice, scbQty);
} else {
alert('Wrong parameters for calculate');
}
}
function eHpSimRequestPrepare(displayModal, shopNumber, symUrl, unitPrice, orderQuantity){
let modal = document.getElementById('simInputModal');
/**
* tu - dialog z edycją unitPrice i orderQuantity. Pokazywany w zależności od parametru w konfiguracji wtyczki.
*
*/
if(displayModal == 1){
$('#ehpModalPrice').val(unitPrice);
$('#ehpModalQuantity').val(orderQuantity);
//display modal
modal.style.display = "block";
} else {
orderPrice = ehpCalcOrderPrice(unitPrice, orderQuantity);
/*
Jeśli w konfiguracji określono że dialog nie ma być pokazywany - wywołanie ehpSimRequest będzie robione stąd a nie z onclick
*/
ehpSimRequest(shopNumber, symUrl, orderPrice);
}
}
function ehpSimRequest(shopNumber, symUrl, orderPrice){
let modal = document.getElementById('simInputModal');
modal.style.display = "none";
if(!isNaN(orderPrice)){
if (orderPrice <= 100) {
alert("Uwaga, niewielka wartość towarów. Bank może nie udzielić tak niskiego kredytu.");
}
window.open(symUrl + 'numerSklepu/' + shopNumber + '/wariantSklepu/1/typProduktu/0/wartoscTowarow/' + orderPrice);
} else {
alert("Pola cena i ilość muszą zawierać liczby.");
}
}
function ehpCalcOrderPrice(unitPrice, qty){
let op = NaN;
unitPrice = parseFloat(unitPrice);
qty = parseFloat(qty);
if(!isNaN(qty) && !isNaN(unitPrice)){
op = unitPrice * qty;
op = Math.round(op * 100, 2) / 100;
}
return op;
}
function santanderCreditValidateForm() {
if ($('#santanderAgreement').is(':checked')) {
$('#scbSubmitBtn').removeAttr('disabled');
} else {
$('#scbSubmitBtn').attr('disabled','disabled');
}
}
function ehpStateRefresh() {
$('#busy').css('visibility','visible');
$('#refreshBtn').prop('disabled', true);
$.ajax({
type: 'POST',
url: $('#refreshCommand').val()+'?id_order=' + $('#ehp_id_order').val(),
// data: 'id_order=' + $('#id_order').val(),
// dataType: 'json',
timeout: 30000
}).done(function(json) {
location.reload(true);
// alert('done');
}).fail(function(json){
alert("Błąd przy wywołaniu serwisu bankowego.");
});
};

View File

@@ -0,0 +1,143 @@
window.onload = function () {
(function () {
// will be executed after page loading
if (!isNaN(parseFloat($("#downpaymentEhp").text()))){
let downpayment = parseFloat($("#downpaymentEhp").text());
if(downpayment > 0) {
$('#downpaymentEhp').css('background-color','red');
$('#downpaymentEhp').css('color','white');
$('#downpaymentEhp').css('font-weight','bold');
}
}
$("#refreshBtn").click(function(){
$('#busy').css('visibility','visible');
$('#refreshBtn').prop('disabled', true);
$.ajax({
type: 'POST',
url: $('#refreshCommand').val()+'?id_order=' + $('#id_order').val(),
// data: 'id_order=' + $('#id_order').val(),
// dataType: 'json',
timeout: 30000
}).done(function(json) {
location.reload(true);
// alert('done');
}).fail(function(json){
alert("Błąd przy wywołaniu serwisu bankowego.");
});
});
$("#OrderMapBtn").click(function(){
alert($('#OrderMapCmd').val());
});
$("[name='SCB_EHP_defaultQUeries']").on('change', function(){
if(this.value == 1){
try {
$("[name='SANTANDERCREDIT_QTY_QUERY']")[0].value = $('#EHP_CURRENT_QTY_QUERY').val();
$("[name='SANTANDERCREDIT_PRICE_QUERY']")[0].value = $('#EHP_CURRENT_PRICE_QUERY').val();
} catch (error) {
}
} else {
try {
$("[name='SANTANDERCREDIT_QTY_QUERY']")[0].value = $('#EHP_DEF_QTY_QUERY').val();
$("[name='SANTANDERCREDIT_PRICE_QUERY']")[0].value = $('#EHP_DEF_PRICE_QUERY').val();
} catch (error) {
}
}
});
$("#SCB_EHP_defaultUrls").on('change', function(){
if(this.value == 1){
try {
$("[name='SANTANDERCREDIT_URL_SYMULATOR']")[0].value = $('#EHP_CURRENT_URL_SYMULATOR').val();
$("[name='SANTANDERCREDIT_URL_WNIOSEK']")[0].value = $('#EHP_CURRENT_URL_WNIOSEK').val();
$("[name='SANTANDERCREDIT_SVC_LOCATION']")[0].value = $('#EHP_CURRENT_SVC_LOCATION').val();
} catch (error) {
}
} else {
try {
$("[name='SANTANDERCREDIT_URL_SYMULATOR']")[0].value = $('#EHP_DEF_URL_SYMULATOR').val();
$("[name='SANTANDERCREDIT_URL_WNIOSEK']")[0].value = $('#EHP_DEF_URL_WNIOSEK').val();
$("[name='SANTANDERCREDIT_SVC_LOCATION']")[0].value = $('#EHP_DEF_SVC_LOCATION').val();
} catch (error) {
}
}
});
$('#configuration_form').on('submit', function(){
scbQueryEncode($('#EHP_CURRENT_QTY_QUERY'));
scbQueryEncode($('#EHP_CURRENT_PRICE_QUERY'));
scbQueryEncode($('#EHP_DEF_QTY_QUERY'));
scbQueryEncode($('#EHP_DEF_PRICE_QUERY'));
scbQueryEncode($('#SANTANDERCREDIT_QTY_QUERY'));
scbQueryEncode($('#SANTANDERCREDIT_PRICE_QUERY'));
});
function scbQueryEncode(jqObj){
let tmpVal = jqObj.val();
tmpVal = tmpVal.replaceAll(')', '_nawiasP_',tmpVal).replaceAll('(','_nawiasL_',tmpVal);
// tmpVal = window.btoa(tmpVal);
jqObj.val(tmpVal);
};
$('#pshPassButton').on('click',function pshPassChange(){
let currentPass = $('#SANTANDERCREDIT_PSH_PASS').val();
let modal = document.getElementById('pshPassModal');
$('#pshPass1').val(currentPass);
$('#pshPass2').val(currentPass);
modal.style.display = "block";
});
$('#pshPassSaveBtn').on('click',function pshPassSave(){
let modal = document.getElementById('pshPassModal');
let pass1 = $('#pshPass1').val();
let pass2 = $('#pshPass2').val();
if(pass1 == pass2){
modal.style.display = "none";
$('#SANTANDERCREDIT_PSH_PASS').val(pass1);
$('#configuration_form_submit_btn').click();
} else {
alert('Różne hasła w obu polach!');
}
});
$('#pshTestButton').on('click',function pshTestConn(){
let modal = document.getElementById('pshTestModal');
let msgText = "Test 1 - Łączność z serwisem: ";
$('#pshTestResult').text('Trwa weryfikacja połączenia...');
modal.style.display = "block";
$.ajax({
type: 'POST',
url: $('#pshIsActiveCommand').val(),
timeout: 30000
}).done(function(json) {
msgText = msgText + json;
msgText = msgText + ', Test 2 - Logowanie do usługi: ';
$.ajax({
type: 'POST',
url: $('#pshLoginChckCommand').val()+'?id_order=nosuchorder',
timeout: 30000
}).done(function(json) {
msgText = msgText + ' ' + json;
$('#pshTestResult').text(msgText);
}).fail(function(json){
msgText = msgText + " Błąd przy wywołaniu serwisu bankowego.";
$('#pshTestResult').text(msgText);
});
}).fail(function(json){
msgText = msgText + " Błąd przy wywołaniu serwisu bankowego.";
$('#pshTestResult').text(msgText);
});
});
})();
};

View File

@@ -0,0 +1,60 @@
function jakKupicEhp() {
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 obliczRateEhp(nrSklepu, symUrl, qtySelector, basketSelector) {
let koszyk, ilo, qty, basket, scbQty, scbPrice;
scbQty = -1;
scbPrice = -1;
if ($("#scb_price") && typeof($("#scb_price")) == 'object') {
scbPrice = $("#scb_price").text();
}
if ($("#scb_quantity") && typeof($("#scb_quantity")) == 'object') {
scbQty = $("#scb_quantity").text();
}
if (scbQty > 0 && scbPrice > 0) {
qty = $(qtySelector);
basket = $(basketSelector);
if(qty.length == 1 && basket.length == 1) {
scbQty = qty.val();
scbPrice = basket.attr('content');
}
scbPrice = scbPrice * scbQty;
scbPrice = Math.round(scbPrice * 100, 2) / 100; //some stupid code just to solve strange js numeric results problem
if (scbPrice > 100) {
window.open(symUrl + 'numerSklepu/' + nrSklepu + '/wariantSklepu/1/typProduktu/0/wartoscTowarow/' + scbPrice);
} else {
alert("Kredytujemy zakupy w cenie powyżej 100zł");
}
} else {
alert('Wrong parameters for calculate');
}
}
function santanderCreditValidateForm() {
if ($('#santanderAgreement').is(':checked')) {
$('#scbSubmitBtn').removeAttr('disabled');
} else {
$('#scbSubmitBtn').attr('disabled','disabled');
}
}
function ehpStateRefresh() {
$('#busy').css('visibility','visible');
$('#refreshBtn').prop('disabled', true);
$.ajax({
type: 'POST',
url: $('#refreshCommand').val()+'?id_order=' + $('#ehp_id_order').val(),
// data: 'id_order=' + $('#id_order').val(),
// dataType: 'json',
timeout: 30000
}).done(function(json) {
location.reload(true);
// alert('done');
}).fail(function(json){
alert("Błąd przy wywołaniu serwisu bankowego.");
});
};

View File

@@ -0,0 +1,136 @@
{
"applicationURL": "https://wniosek.eraty.pl/formularz/",
"jq_qtySelector": "#quantity_wanted",
"jq_priceSelector": "div.current-price > span[itemprop="price"],div.current-price > span.current-price-value",
"orderId": "13_odt_2023_11_26_16_34_22",
"shopId": "99995",
"shopName": "ps811b",
"shopMailAdress": "rklepacz@gmail.com",
"shopPhone": false,
"shopHttp": "http://localhost/presta/ps811b/",
"returnTrue": "http://localhost/presta/ps811b/module/santandercredit/santanderCreditReturn?status=true&orderId=",
"returnFalse": "http://localhost/presta/ps811b/module/santandercredit/santanderCreditReturn?status=false&orderId=",
"email": "alfa@beta.com",
"imie": "Jan",
"nazwisko": "Test",
"telKontakt": "",
"ulica": "ul. Legnicka 1",
"ulica2": "",
"miasto": "Wrocu0142aw",
"kodPocz": "54-216",
"shipping": 0,
"products": [
{
"id_product_attribute": 1,
"id_product": 1,
"cart_quantity": 26,
"id_shop": 1,
"id_customization": null,
"name": "Hummingbird printed t-shirt",
"is_virtual": 0,
"description_short": "<p>Regular fit, round neckline, short sleeves. Made of extra long staple pima cotton. </p><br /><p></p>",
"available_now": "",
"available_later": "",
"id_category_default": 4,
"id_supplier": 1,
"id_manufacturer": 1,
"manufacturer_name": "Studio Design",
"on_sale": 0,
"ecotax": "0.000000",
"additional_shipping_cost": "0.000000",
"available_for_order": 1,
"show_price": 1,
"price": 19.120000000000000994759830064140260219573974609375,
"active": 1,
"unity": "",
"unit_price": 0,
"quantity_available": 253,
"width": "0.000000",
"height": "0.000000",
"depth": "0.000000",
"out_of_stock": 2,
"weight": 0.299999999999999988897769753748434595763683319091796875,
"available_date": "0000-00-00",
"date_add": "2023-11-17 18:30:47",
"date_upd": "2023-11-17 18:30:47",
"quantity": 26,
"link_rewrite": "hummingbird-printed-t-shirt",
"category": "men",
"unique_id": "0000000001000000000170",
"id_address_delivery": 7,
"advanced_stock_management": 0,
"supplier_reference": "demo_1_46",
"customization_quantity": null,
"price_attribute": "0.000000",
"ecotax_attr": "0.000000",
"reference": "demo_1",
"weight_attribute": 0.299999999999999988897769753748434595763683319091796875,
"ean13": "",
"isbn": "",
"upc": "",
"mpn": "",
"minimal_quantity": 1,
"wholesale_price": "5.490000",
"id_image": "1-2",
"legend": "Hummingbird printed t-shirt",
"reduction_type": "percentage",
"is_gift": false,
"reduction": 5.879400000000000403588273911736905574798583984375,
"reduction_without_tax": 4.78000000000000024868995751603506505489349365234375,
"price_without_reduction": 29.39699999999999846522769075818359851837158203125,
"specific_prices": {
"id_specific_price": 1,
"id_specific_price_rule": 0,
"id_cart": 0,
"id_product": 1,
"id_shop": 0,
"id_shop_group": 0,
"id_currency": 0,
"id_country": 0,
"id_group": 0,
"id_customer": 0,
"id_product_attribute": 0,
"price": "-1.000000",
"from_quantity": 1,
"reduction": "0.200000",
"reduction_tax": 1,
"reduction_type": "percentage",
"from": "0000-00-00 00:00:00",
"to": "0000-00-00 00:00:00",
"score": 0
},
"unit_price_ratio": 0,
"unit_price_tax_excluded": 0,
"unit_price_tax_included": 0,
"stock_quantity": 253,
"price_without_reduction_without_tax": 23.89999999999999857891452847979962825775146484375,
"price_with_reduction": 23.5176000000000016143530956469476222991943359375,
"price_with_reduction_without_tax": 19.120000000000000994759830064140260219573974609375,
"total": 497.1200000000000045474735088646411895751953125,
"total_wt": 611.4600000000000363797880709171295166015625,
"price_wt": 23.5176000000000016143530956469476222991943359375,
"reduction_applies": true,
"quantity_discount_applies": true,
"allow_oosp": 0,
"features": [
{
"id_feature": 1,
"id_product": 1,
"id_feature_value": 4
},
{
"id_feature": 2,
"id_product": 1,
"id_feature_value": 8
}
],
"attributes": "Rozmiar: S - Kolor: Biau0142y",
"attributes_small": "S - Biau0142y",
"rate": 23,
"tax_name": "PTU PL 23%"
}
],
"totalOrder": 611.4600000000000363797880709171295166015625,
"ehpToken": "3121f0a09e529984670b5456036194ce_2023_11_26_16_34_25",
"modDir": "http://localhost/presta/ps811b/modules/santandercredit"
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,34 @@
<?php
/**
* 2007-2021 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-2021 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,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,92 @@
<section id="ehp" class="box">
<h2>Płatność w systemie eRaty - status wniosku kredytowego</h2>
<div id="applicationNextTry" style="margin:auto;width:100%;text-align:center;">
<p>{$ehpMessage}</p>
<p><a href="{$userDoc}">Finansowanie zakupu kredytem ratalnym - instrukcja</a></p>
</div>
<div class="row" style="margin-bottom:10px;">
<div class="col-md-6 left-column" style="padding-bottom:2px;">
<input type="text" name="refreshCommand" id="refreshCommand" style="display:none;" value="{$refreshCommand}">
<input type="text" name="ehp_id_order" id="ehp_id_order" style="display:none;" value="{$id_order}">
<button id="refreshBtn" class="btn btn-primary" onclick="ehpStateRefresh();">Odśwież informację z Banku</button>
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/busy.gif" id="busy" style="visibility:hidden;"/>
</div>
<div class="col-md-6 right-column" style="text-align:right;padding-bottom:2px;">
<form name="ehpCreditForm" id="ehpCreditForm" 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['product_id']}" />
<input name="nazwaTowaru{$nr}" readonly="readonly" type="hidden" value="{$product['product_name']}" />
<input name="wartoscTowaru{$nr}" readonly="readonly" type="hidden" value="{round($product['unit_price_tax_incl'], 2)}" />
<input name="liczbaSztukTowaru{$nr}" readonly="readonly" type="hidden" value="{$product['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="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}" />
<button type="submit" class="btn btn-primary" {$sendApplicationDisabled}>{$backToApp_sendApp}</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-4 left-column">
<p class="mb-1"><strong>POSApplicationNumber:</strong></p>
<p class="mb-1">{$application->ShopApplicationNumber}</p>
<p class="mb-1"><strong>Numer wniosku:</strong></p>
<p class="mb-1">{$application->ApplicationNumber}</p>
<p class="mb-1"><strong>Status wniosku:</strong></p>
<p class="mb-1">{$application->CreditState}</p>
<p class="mb-1"><strong>Data statusu:</strong></p>
<p class="mb-1">{$application->ChangeDate}</p>
</div>
<div class="col-md-4 right-column">
<p class="mb-1"><strong>Numer umowy:</strong></p>
<p class="mb-1">{$application->AgreementNumber}</p>
<p class="mb-1"><strong>Data umowy:</strong></p>
<p class="mb-1">{$application->AgreementDate}</p>
</div>
<div class="col-md-4 right-column">
<p class="mb-1"><strong>Wplata własna:</strong></p>
<p class="mb-1">{$application->Downpayment}</p>
<p class="mb-1"><strong>Cena całokwita:</strong></p>
<p class="mb-1">{$application->TotalPrice}</p>
<p class="mb-1"><strong>Numer Sklepu:</strong></p>
<p class="mb-1">{$application->ShopNumber}</p>
</div>
</div>
</section>

View File

@@ -0,0 +1,17 @@
<div class="mt-2">
<!-- Nav tabs -->
<ul class="nav nav nav-tabs d-print-none " role="tablist">
<li class="nav-item">
<a class="nav-link active show" href="#details" role="tab" data-toggle="tab">eHP - status wniosku kredytowego</a>
</li>
<li class="nav-item">
<a class="nav-link show" href="#ehplog" role="tab" data-toggle="tab">eHP log</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="details">{include file='./ehpDisplayDetails.tpl'}</div>
<div class="tab-pane" id="ehplog">{include file='./ehpDisplayLog.tpl'}</div>
</div>
</div>

View File

@@ -0,0 +1,42 @@
<div class="panel card" style="padding-left:10px;padding-right:10px;">
<div class="row">
<div class="col-xxl-4 text-xxl-left">
<input type="text" name="refreshCommand" id="refreshCommand" style="display:none;" value="{$refreshCommand}">
<input type="text" name="id_order" id="id_order" style="display:none;" value="{$id_order}">
<div style="padding-top:10px;padding-bottom:10px;"><button class="btn btn-primary" id="refreshBtn">Pobierz informacje z Banku</button></div>
<img src="{$module_dir|escape:'html':'UTF-8'}views/img/busy.gif" id="busy" style="visibility:hidden;"/>
</div>
<div class="col-xxl-4 text-xxl-left">&nbsp;</div>
<div class="col-xxl-4 text-xxl-left">
<div style="padding-top:10px;padding-bottom:10px;"><a href="{$instrukcja}">Instrukcja obsługi eHP</a></div>
</div>
</div>
<div class="row">
<div class="col-md-4 left-column">
<p class="mb-1"><strong>POSApplicationNumber:</strong></p>
<p class="mb-1">{$fullAppInfo->ShopApplicationNumber}</p>
<p class="mb-1"><strong>Numer wniosku:</strong></p>
<p class="mb-1">{$fullAppInfo->ApplicationNumber}</p>
<p class="mb-1"><strong>Status wniosku:</strong></p>
<p class="mb-1">{$fullAppInfo->CreditState}</p>
<p class="mb-1"><strong>Data statusu:</strong></p>
<p class="mb-1">{$fullAppInfo->ChangeDate}</p>
</div>
<div class="col-md-4 right-column">
<p class="mb-1"><strong>Numer umowy:</strong></p>
<p class="mb-1">{$fullAppInfo->AgreementNumber}</p>
<p class="mb-1"><strong>Data umowy:</strong></p>
<p class="mb-1">{$fullAppInfo->AgreementDate}</p>
</div>
<div class="col-md-4 right-column">
<p class="mb-1"><strong>Wplata własna:</strong></p>
<p class="mb-1" id="downpaymentEhp">{$fullAppInfo->Downpayment}</p>
<p class="mb-1"><strong>Cena całkowita:</strong></p>
<p class="mb-1">{$fullAppInfo->TotalPrice}</p>
<p class="mb-1"><strong>Numer Sklepu:</strong></p>
<p class="mb-1">{$fullAppInfo->ShopNumber}</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,51 @@
<div class="panel">
<div class="row">
<div class="col-md-12 d-print-block left-column">
<div class="panel card mt-2" style="text-align:left;">
<div class="card-header">
<h3 class="card-header-title">Log komunikacji z systemem bankowym:</h3>
</div>
<div class="card-body" style="text-align:right;overflow: scroll; padding-right:6px;">
<table class="table" style="margin-right:6px; matgin-left:auto;">
<thead>
<tr>
<th class="table-head-date">request_date</th>
<th>success</th>
<th>shop_number</th>
<th>id_order</th>
<th>pos_app_number</th>
<th>application_number</th>
<th>application_status</th>
<th>app_status_chg_date</th>
<th>agreement_number</th>
<th>agreement_date</th>
<th>message</th>
<th>downpayment</th>
<th>total_price</th>
</tr>
</thead>
<tbody>
{foreach from=$log item=row}
<tr>
<td>{$row['request_date']}</td>
<td>{$row['success']}</td>
<td>{$row['shop_number']}</td>
<td>{$row['id_order']}</td>
<td>{$row['pos_app_number']}</td>
<td>{$row['application_number']}</td>
<td>{$row['application_status']}</td>
<td>{$row['app_status_chg_date']}</td>
<td>{$row['agreement_number']}</td>
<td>{$row['agreement_date']}</td>
<td><textarea cols="20" rows="3">{$row['message']}</textarea>
<td>{$row['downpayment']}</td>
<td>{$row['total_price']}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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,106 @@
{*
* 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="panel">
<div class="row">
<div class="col-md-4 left-column"><img src="../modules/santandercredit/views/img/logo_254x83.png" style="float:left; margin-right:15px;"></div>
<div class="col-md-8 right-column" style="text-align:right;">
<a id="docDnldBtn" href="{$scbEhpDocUrl}">
<button class="btn ">Dokumentacja dla Klienta</button>
</a>
<a id="docDnldBtn" href="{$scbEhpSlsDocUrl}">
<button class="btn ">Dokumentacja dla Sprzedawcy</button>
</a>
<a id="docDnldBtn" href="{$scbEhpAdmDocUrl}">
<button class="btn ">Dokumentacja dla Administratora</button>
</a>
</div>
</div>
<form>
<input type="hidden" name="EHP_DEF_URL_SYMULATOR" id="EHP_DEF_URL_SYMULATOR" value="{$EHP_DEF_URL_SYMULATOR}" />
<input type="hidden" name="EHP_DEF_URL_WNIOSEK" id="EHP_DEF_URL_WNIOSEK" value="{$EHP_DEF_URL_WNIOSEK}" />
<input type="hidden" name="EHP_DEF_SVC_LOCATION" id="EHP_DEF_SVC_LOCATION" value="{$EHP_DEF_SVC_LOCATION}" />
<input type="hidden" name="EHP_DEF_QTY_QUERY" id="EHP_DEF_QTY_QUERY" value="{$EHP_DEF_QTY_QUERY}" />
<input type="hidden" name="EHP_DEF_PRICE_QUERY" id="EHP_DEF_PRICE_QUERY" value="{$EHP_DEF_PRICE_QUERY}" />
<input type="hidden" name="EHP_CURRENT_URL_SYMULATOR" id="EHP_CURRENT_URL_SYMULATOR" value="{$EHP_CURRENT_URL_SYMULATOR}" />
<input type="hidden" name="EHP_CURRENT_URL_WNIOSEK" id="EHP_CURRENT_URL_WNIOSEK" value="{$EHP_CURRENT_URL_WNIOSEK}" />
<input type="hidden" name="EHP_CURRENT_SVC_LOCATION" id="EHP_CURRENT_SVC_LOCATION" value="{$EHP_CURRENT_SVC_LOCATION}" />
<input type="hidden" name="EHP_CURRENT_QTY_QUERY" id="EHP_CURRENT_QTY_QUERY" value="{$EHP_CURRENT_QTY_QUERY}" />
<input type="hidden" name="EHP_CURRENT_PRICE_QUERY" id="EHP_CURRENT_PRICE_QUERY" value="{$EHP_CURRENT_PRICE_QUERY}" />
</form>
</div>
<!-- The Modal -->
<div id="pshPassModal" class="ehp-modal">
<!-- Modal content -->
<div class="ehp-modal-content">
<header style="vertical-align: top">
<div style="padding-bottom: 10px" class="ehp-close" onclick="document.getElementById('pshPassModal').style.display = 'none';">&times;</div>
<div style="padding-bottom:10px">Zmiana hasła do usługi ProposalServiceHybrid</div>
</header>
<div>
<div style="display:inline-block">
<div>Hasło</div>
<div><input type="password" value="" id="pshPass1"></div>
</div>
<div style="display:inline-block">
<div>Powtórz Hasło</div>
<div><input type="password" value="" id="pshPass2"></div>
</div>
<div style="display:inline-block">
<input type="button" class="btn" value="Anuluj" onclick="document.getElementById('pshPassModal').style.display = 'none';">
</div>
<div style="display:inline-block">
<input type="button" class="btn" value="Zapisz" id='pshPassSaveBtn'>
</div>
</div>
</div>
</div>
<!-- The Modal for PSH test-->
<div id="pshTestModal" class="ehp-modal">
<!-- Modal content -->
<div class="ehp-modal-content">
<header style="vertical-align: top">
<div style="padding-bottom: 10px" class="ehp-close" onclick="document.getElementById('pshTestModal').style.display = 'none';">&times;</div>
<div style="padding-bottom:10px">Test połączenia z usługą ProposalServiceHybrid</div>
</header>
<div>
<p id="pshTestResult">Trwa weryfikacja połączenia...</p>
<div style="display:inline-block">
<input type="button" class="btn" value="Zamknij" onclick="document.getElementById('pshTestModal').style.display = 'none';">
</div>
</div>
<input type="hidden" id="pshLoginChckCommand" value="{$pshLoginChckCommand}" />
<input type="hidden" id="pshIsActiveCommand" value="{$pshIsActiveCommand}" />
</div>
</div>

View File

@@ -0,0 +1,115 @@
{*
* 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="panel">
<div class="panel-heading">
<i class="icon-cogs"></i>
Uwaga:
</div>
<p id="qvalid_msg">
<span style="color:red; font-weight: bold;">Wykryto problem w parametrach QTY_QUERY i/lub PRICE_QUERY!
Zapoznaj się z dokumentacją i <a href="#" style="color:red;font-size:large">obejrzyj film instruktażowy</a></SPAN>
<br/>
<span style="color:red;">
Do czasu rozwiązania problemu zalecamy przywrócenie wartości domyślnych. Można też ustawić "Potwierdzaj dane do symulacji" na TAK.
</span>
</p>
<p style="text-align: center;">Konfigurację osadzania widgetu wywołującego symulator rat na stronie sklepu należy wykonywać bardzo ostrożnie. W szczególności chodzi o parametry QTY_QUERY oraz
PRICE_QUERY. W założeniu są to funkcje jQuery pozwalające na odczyt aktualnej wartości ceny jednostkowej oraz ilości towaru z aktualnie wyświetlanej strony
produktu. Jeśli są skonfigurowane poprawnie - mamy gwarancję że do symulatora wysłana zostanie kwota uwzględnijąca aktualnie ustawioną przez klienta ilość towaru.
Jeśli moduł stwierdzi że nie jest w stanie odnaleźć ceny i ilości na stronie - wyśle do symulatora kwotę wynikającą z ceny jednostkowej i minimalnej
ilości towaru określonej dla danego produktu w parametrach sklepu. Domyślnie, parametry QTY_QUERY i PRICE_QUERY są zgodne z defaultowym templatem PrestaShop.
Jeśli Twój template zachowuje zgodnosć z defaultowym - nie trzeba nic zmieniać. Wskazane jest by zmian tych parametrów dokonywała osoba znająca bibliotekę jQuery.
Jeśli nie jesteś w stanie poprawnie skonfigurować QTY_QUERY i PRICE_QUERY, możesz
użyć opcji "Potwierdzaj dane do symulacji". Zostanie wtedy wyświetlony dodatkowy dialog który pozwoli Klientowi ustawić właściwą ilość towaru.
Parametry te należy weryfikować po każdej zmianie szablonu wykorzystywanego w Sklepie. Jest to zadanie Webmastera/Administratora instancji PrestaShop.
Zanim zaczniesz modyfikować QTY_QUERY i PRICE_QUERY zapoznaj się z <a id="docDnldBtn" href="{$scbEhpAdmDocUrl}">dokumentacją.</a>
</p>
</div>
</div>
<script type="text/javascript">
{$quantityFn nofilter}
{$priceFn nofilter}
function testQueries(quantity, price) {
let pmessage = document.getElementById('qvalid_msg');
let qq = $('#EHP_CURRENT_QTY_QUERY').val();
let qp = $('#EHP_CURRENT_PRICE_QUERY').val();
let isOk = 1;
//start z dolara
if(!(qq.charAt(0) == '$')) {
isOk = isOk - 1;
};
if(!(qp.charAt(0) == '$')) {
isOk = isOk - 1;
};
//liczba nawiasow lewych == liczba nawiasow prawych
if(!(qq.split('(').length == qq.split(')').length)) {
isOk = isOk - 1;
};
if(!(qp.split('(').length == qp.split(')').length)) {
isOk = isOk - 1;
};
//parzysta ilość apostrofów
if((qq.split("'").length % 2) == 0) {
isOk = isOk - 1;
};
if((qp.split("'").length % 2) == 0) {
isOk = isOk - 1;
};
//parzysta ilość cudzysłowów
if((qq.split('"').length % 2) == 0) {
isOk = isOk - 1;
};
if((qp.split('"').length % 2) == 0) {
isOk = isOk - 1;
};
// max liczba średników = 1 i średnik na ostatnim miejscu
if(qq.indexOf(';') >= 0) {
if(!(qq.indexOf(';') == qq.lastIndexOf(';'))) {
isOk = isOk -1;
};
}
if(qp.indexOf(';') >= 0) {
if(!(qp.indexOf(';') == qp.lastIndexOf(';'))) {
isOk = isOk -1;
};
}
if(isOk == 1) {
pmessage.style.display = "none";
}
}
testQueries(ehpGetPquantity(), ehpGetPprice());
</script>

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,59 @@
<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;">Złóż 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 style="text-align:center;">
<input type="submit" id="scbSubmitBtn" name="submit" value="{l s='Opłać zamówienie - złóż wniosek' mod='santandercredit'}" class="btn btn-primary center-block"/>
</p>
</form>

View File

@@ -0,0 +1,44 @@
<script type="text/javascript">
{$quantityFn nofilter}
{$priceFn nofilter}
</script>
<!-- The Modal -->
<div id="simInputModal" class="ehp-modal">
<!-- Modal content -->
<div class="ehp-modal-content">
<header style="vertical-align: top">
<div style="padding-bottom: 10px" class="ehp-close" onclick="document.getElementById('simInputModal').style.display = 'none';">&times;</div>
<div style="padding-bottom:10px">Dane wejściowe dla symulatora rat</div>
</header>
<div>
<div style="display:inline-block">
<div>cena jednostkowa</div>
<div><input type="number" value="1234" id="ehpModalPrice"></div>
</div>
<div style="display:inline-block">
<div>ilość jednostek</div>
<div><input type="number" value="1234" id="ehpModalQuantity"></div>
</div>
<div style="display:inline-block">
<input type="button" value="Oblicz ratę" onclick="ehpSimRequest('{$shopId}', '{$symulatorURL}', ehpCalcOrderPrice($('#ehpModalPrice').val(), $('#ehpModalQuantity').val()))">
</div>
</div>
</div>
</div>
<!--<div style="text-align:right;"> -->
<p id="eraty" class="buttons_bottom_block" >
<a onClick="simulationEhp({$displaySimInputModal},'{$shopId}', '{$symulatorURL}', ehpGetPquantity(), ehpGetPprice());" title="Kupuj na eRaty Santander Consumer Banku!" align="right" style="cursor: pointer;">
<img src="{$module_dir}views/img/obliczRate.png" alt="Oblicz ratę!"/>
</a>
<div style="position:absolute;visibility:hidden" id="scb_quantity">{$scb_quantity}</div>
<div style="position:absolute;visibility:hidden" id="scb_price">{$santanderCreditProductPrice}</div>
</p>
<!--</div>-->

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2021 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-2021 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;