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
// 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;