refs #4922 pnpm migration, unused deps removed, clean back deprecated files
gitea/hedera-web/pipeline/head There was a failure building this commit Details
gitea/hedera-web/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Juan Ferrer 2024-11-27 14:24:21 +01:00
parent f1f40527bc
commit fed067c533
30 changed files with 9168 additions and 28472 deletions

View File

@ -1,8 +1,7 @@
{
"name": "hedera-web-back",
"version": "24.50.11",
"version": "24.50.12",
"description": "Verdnatura web page backend",
"license": "GPL-3.0",
"productName": "Salix",
"author": "Verdnatura"
"author": "Verdnatura Levante SL"
}

View File

@ -1,4 +0,0 @@
{
"Recover password": "Recover password",
"Press on the following link to change your password.": "Press on the following link to change your password."
}

View File

@ -1,4 +0,0 @@
{
"Recover password": "Restaurar contraseña",
"Press on the following link to change your password.": "Pulsa en el siguiente link para cambiar tu contraseña."
}

View File

@ -1,4 +0,0 @@
{
"Recover password": "Réinitialisation du mot de passe",
"Press on the following link to change your password.": "Appuyez sur le lien suivant pour changer votre mot de passe."
}

View File

@ -1,4 +0,0 @@
{
"Recover password": "Recuperar palavra-passe",
"Press on the following link to change your password.": "Pressione o botão para modificar sua palavra-passe."
}

View File

@ -1,7 +0,0 @@
<?php $title = s('Recover password') ?>
<p>
<?=s('Press on the following link to change your password.')?>
</p>
<a href="<?=$url?>">
<?=s('Recover password')?>
</a>

View File

@ -1,3 +0,0 @@
Start: Start
End: End
Pallet: Pallet

View File

@ -1,3 +0,0 @@
Start: Inicio
End: Fin
Pallet: Palé

View File

@ -1,3 +0,0 @@
Start: Inicio
End: Final
Pallet: Palete

View File

@ -1,359 +0,0 @@
Hedera.ShelvesReport = new Class({
Extends: Hedera.Report
,nItem: -1
,nColors: 5
,trayThickness: 2
,trayMargin: 5
,async open(lot) {
this.lot = lot;
const query =
'SELECT id, name, nTrays, topTrayHeight, trayHeight, width, depth '+
'FROM shelf WHERE id = #shelf; '+
'CALL item_listAllocation(#warehouse, #date, #family, #namePrefix, #useIds)';
const resultSet = await this.conn.execQuery(query, lot.$);
// Fetch query data
const row = resultSet.fetchObject();
// Calculates the scale
var maxWidth = 160;
var maxHeight = 160;
var shelfWidth = row.width;
var shelfHeight = row.trayHeight * (row.nTrays - 1) + row.topTrayHeight;
var scale = maxWidth / shelfWidth;
if (shelfHeight * scale > maxHeight)
scale = maxHeight / shelfHeight;
// Calculates the shelf dimensions
var shelf = this.shelf = {
nTrays: row.nTrays
,trayHeight: row.trayHeight * scale
,topTrayHeight: row.topTrayHeight * scale
,width: row.width * scale
,depth: row.depth * scale
};
// Gets the items
var items = this.items = [];
var remainings = this.remainings = [];
var res = resultSet.fetchData();
if (res.length == 0) {
Htk.Toast.showError(_('No items found, check that all fields are correct'));
return;
}
var boxScale = scale * 10;
for (const row of res) {
if (!this.maxAmount || row.etiquetas <= this.maxAmount) {
items.push({
id: row.Id_Article
,name: row.Article
,packing: row.packing
,amount: row.etiquetas
,boxHeight: row.height * boxScale
,boxWidth: row.width * boxScale
,boxDepth: row.depth * boxScale
});
} else {
remainings.push({
id: row.Id_Article
,name: row.Article
,packing: row.packing
,amount: row.etiquetas
});
}
}
// Intializes the allocator
alloc = this.alloc = new Vn.Allocator();
alloc.items = items;
alloc.shelfFunc = this.drawShelf.bind(this);
alloc.boxFunc = this.drawBox.bind(this);
alloc.stack = this.stack;
alloc.nTrays = shelf.nTrays;
alloc.width = shelf.width;
alloc.depth = shelf.depth;
alloc.trayHeight = shelf.trayHeight;
alloc.topTrayHeight = shelf.topTrayHeight;
// Opens the report
this.createWindow();
}
,onWindowCreate() {
// Remaining amount
var remainings = this.remainings;
if (remainings.length > 0) {
var sheet = this.doc.createElement('div');
sheet.className = 'sheet';
this.doc.body.appendChild(sheet);
var title = this.doc.createElement('h1');
title.className = 'title';
title.appendChild(this.doc.createTextNode(this.title));
sheet.appendChild(title);
var subtitle = this.doc.createElement('h2');
subtitle.className = 'subtitle';
subtitle.appendChild(this.doc.createTextNode(_('Pallets')));
sheet.appendChild(subtitle);
var ul = this.doc.createElement('ul');
sheet.appendChild(ul);
for (var i = 0; i < remainings.length; i++) {
var li = this.doc.createElement('li');
ul.appendChild(li);
var span = this.doc.createElement('span');
span.className = 'item-id';
span.appendChild(this.doc.createTextNode(remainings[i].id.toLocaleString()));
li.appendChild(span);
var span = this.doc.createElement('span');
span.className = 'item';
span.appendChild(this.doc.createTextNode(remainings[i].name));
li.appendChild(span);
if (this.showPacking)
span.appendChild(this.doc.createTextNode(' '+ remainings[i].packing));
var span = this.doc.createElement('span');
span.className = 'amount';
span.appendChild(this.doc.createTextNode(remainings[i].amount));
li.appendChild(span);
}
}
// Draws the shelves
this.alloc.run();
this.drawShelfRange(this.lastItem, false);
}
,drawShelf(allocator, item) {
var shelf = this.shelf;
var sheet = this.doc.createElement('div');
sheet.className = 'sheet';
this.doc.body.appendChild(sheet);
// Draws the title
var pageNumber = this.doc.createElement('h1');
pageNumber.className = 'page-number';
pageNumber.appendChild(this.doc.createTextNode(allocator.currentShelf + 1));
sheet.appendChild(pageNumber);
var title = this.doc.createElement('h1');
title.className = 'title';
title.appendChild(this.doc.createTextNode(this.title));
sheet.appendChild(title);
if (this.subtitles)
this.drawShelfRange(this.lastItem, false);
this.subtitles = this.doc.createElement('div');
sheet.appendChild(this.subtitles);
this.drawShelfRange(item, true);
this.lastSubtitles = this.subtitles;
// Draws the shelf
var trayWidth = shelf.width + this.trayMargin * 2;
var shelfHeight = shelf.trayHeight * (shelf.nTrays - 1) + shelf.topTrayHeight
+ (this.trayThickness + this.trayMargin) * shelf.nTrays;
var shelfDiv = this.shelfDiv = this.doc.createElement('div');
shelfDiv.className = 'shelf';
shelfDiv.style.width = this.mm(trayWidth);
shelfDiv.style.height = this.mm(shelfHeight);
sheet.appendChild(shelfDiv);
// Draws trays
for (var i = 0; i < shelf.nTrays; i++) {
var tray = this.doc.createElement('div');
tray.className = 'tray';
tray.style.bottom = this.mm((shelf.trayHeight + this.trayThickness + this.trayMargin) * i);
tray.style.width = this.mm(trayWidth);
tray.style.height = this.mm(this.trayThickness);
shelfDiv.appendChild(tray);
}
}
,drawShelfRange(item, isFirst) {
var labelText = isFirst ? _('Start') : _('End');
var label = this.doc.createElement('label');
label.className = 'range-label';
label.appendChild(this.doc.createTextNode(labelText));
this.subtitles.appendChild(label);
var subtitle = this.doc.createElement('h2');
subtitle.className = 'subtitle';
subtitle.appendChild(this.doc.createTextNode(this.getItemLabel(item)));
this.subtitles.appendChild(subtitle);
}
,getItemLabel(item) {
if (!this.useIds) {
var packing = this.showPacking ? (' x'+ item.packing) : '';
return item.name + packing;
} else
return item.id.toLocaleString();
}
,mm(size) {
return size.toFixed(2) +'mm';
}
,drawBox(allocator, item, amount) {
if (item.boxWidth == 0 || item.boxHeight == 0)
return;
var shelf = this.shelf;
var x = allocator.trayX + this.trayMargin;
var y = allocator.trayY + this.trayThickness
+ this.trayMargin * allocator.currentTray
+ allocator.currentTray * (shelf.trayHeight + this.trayThickness);
var box = this.doc.createElement('div');
box.className = 'box';
this.shelfDiv.appendChild(box);
box.style.left = this.mm(x);
box.style.bottom = this.mm(y);
box.style.width = this.mm(item.boxWidth);
box.style.height = this.mm(item.boxHeight);
if (amount == 0)
this.nItem++;
var nColor = this.nItem % this.nColors;
Vn.Node.addClass(box, 'color'+ nColor);
if (amount == 0 || allocator.firstShelfBox) {
var boxLabel = this.doc.createElement('div');
if (this.useIds) {
var fontSize = item.boxWidth / 5.2;
if (fontSize > item.boxHeight - 1)
fontSize = item.boxHeight - 1;
boxLabel.style.fontSize = this.mm(fontSize);
var cssClass = 'id';
} else
var cssClass = 'name';
boxLabel.className = 'box-label '+ cssClass;
var labelText = this.doc.createTextNode(this.getItemLabel(item));
boxLabel.appendChild(labelText);
box.appendChild(boxLabel);
}
this.lastItem = item;
}
});
Vn.Allocator = new Class({
addShelf(item) {
this.currentShelf++;
this.firstShelfBox = true;
if (this.shelfFunc)
this.shelfFunc(this, item);
}
,addTray(item) {
if (this.currentTray <= 0) {
this.addShelf(item);
this.currentTray = this.nTrays - 1;
} else
this.currentTray--;
this.trayX = 0;
}
,addColumn(item) {
if (this.trayX + this.columnWidth + item.boxWidth > this.width
|| this.currentTray == -1)
this.addTray(item);
else
this.trayX += this.columnWidth;
this.trayY = 0;
this.columnWidth = item.boxWidth;
this.lastBoxWidth = item.boxWidth;
}
,addBox(item, amount) {
var trayHeight = this.trayHeight;
if (this.currentTray == this.nTrays - 1)
trayHeight = this.topTrayHeight;
if (this.trayY + item.boxHeight > trayHeight
|| item.boxWidth > this.lastBoxWidth
|| (!this.stack && amount == 0))
this.addColumn(item);
if (this.boxFunc)
this.boxFunc(this, item, amount);
this.trayY += item.boxHeight;
if (item.boxWidth < this.lastBoxWidth)
this.lastBoxWidth = item.boxWidth;
}
,run() {
this.firstShelfBox = false;
this.currentShelf = -1;
this.currentTray = -1;
this.columnWidth = 0;
this.lastBoxWidth = 0;
this.trayX = 0;
this.trayY = 0;
this.remaining = false;
for (var i = 0; i < this.items.length; i++) {
var item = this.items[i];
var boxIncrement = Math.floor(this.depth / item.boxDepth);
if (boxIncrement < 1)
boxIncrement = 1;
for (var amount = 0; amount < item.amount; amount += boxIncrement) {
this.addBox(item, amount);
this.firstShelfBox = false;
}
}
return this.currentShelf + 1;
}
});

View File

@ -1,118 +0,0 @@
/* Shelves */
h1
{
font-weight: normal;
font-size: 500%;
margin: 0;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-bottom: 4mm;
}
label.range-label
{
color: #777;
}
h2.subtitle
{
margin: 0;
font-size: 200%;
margin-bottom: 2mm;
font-weight: normal;
color: #333;
}
h1.page-number
{
padding-left: 4mm;
float: right;
text-align: right;
}
.shelf
{
position: relative;
margin: 0 auto;
padding-top: 10mm;
}
.edge,
.tray
{
position: absolute;
border-top: 2px solid black;
box-sizing: border-box;
}
.edge
{
width: 0;
}
.box
{
position: absolute;
border: 1px solid black;
border-bottom: 0;
box-sizing: border-box;
}
.box-label
{
font-size: 2.55mm;
word-wrap: break-word;
box-sizing: border-box;
padding: 1% 2%;
}
.box-label.id
{
text-align: right;
}
.color0
{
background-color: #FDD !important;
}
.color1
{
background-color: #DFD !important;
}
.color2
{
background-color: #DDF !important;
}
.color3
{
background-color: #DFF !important;
}
.color4
{
background-color: #FFD !important;
}
/* Remaining amounts*/
ul
{
list-style-type: none;
}
li *
{
font-size: 200%;
line-height: 200%;
}
.item-id
{
display: inline-block;
text-align: right;
margin: 0 5mm;
width: 30mm;
}
.item
{
display: inline-block;
width: 80mm;
}
.amount
{
color: #666;
width: 10mm;
text-align: right;
padding-right: 1mm;
}

View File

@ -1,10 +0,0 @@
<vn>
<div id="report" class="shelves">
<h1>
<htk-text id="title"/>
</h1>
<div>
<htk-text id="page-number"/>
</div>
</div>
</vn>

View File

@ -1,98 +0,0 @@
<?php
require_once(__DIR__.'/tpv.php');
/**
* Gets transaction confirmations from the IMAP mailbox.
*/
class ConfirmMail extends Vn\Lib\Method {
function run($db) {
$imap = NULL;
$imapConf = $db->getObject(
'SELECT host, user, pass, cleanPeriod, successFolder, errorFolder
FROM tpvImapConfig'
);
$mailbox = sprintf('{%s/imap/ssl/novalidate-cert}',
$imapConf->host);
$imap = imap_open($mailbox
,$imapConf->user
,base64_decode($imapConf->pass)
);
if (!$imap)
throw new Exception(imap_last_error());
// Fetchs and confirms new transaction mails
$count = 0;
$inbox = imap_search($imap, 'ALL');
if ($inbox)
foreach ($inbox as $msg) {
// Decodes the mail body
$params = [];
$body = imap_fetchbody($imap, $msg, '1');
$strings = explode(';', $body);
foreach ($strings as $string) {
$x = explode(':', $string);
$params[trim($x[0])] = trim($x[1]);
}
// Confirms the transaction
$success = FALSE;
try {
$success = Tpv::confirm($db, $params);
} catch (\Exception $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
}
// Moves the processed mail to another folder
if ($success)
$folder = $imapConf->successFolder;
else
$folder = $imapConf->errorFolder;
if (!imap_mail_move($imap, $msg, "$folder"))
trigger_error(imap_last_error(), E_USER_WARNING);
$count++;
}
imap_expunge($imap);
// Cleans the old mails
$deleted = 0;
if (rand(1, 20) == 1) {
$folders = array(
$imapConf->successFolder
,$imapConf->errorFolder
);
$date = new \DateTime(NULL);
$date->sub(new \DateInterval($imapConf->cleanPeriod));
$filter = sprintf('BEFORE "%s"', $date->format('D, j M Y'));
foreach ($folders as $folder)
if (imap_reopen($imap, $mailbox.$folder))
if ($messages = imap_search($imap, $filter)) {
foreach ($messages as $message)
imap_delete($imap, $message);
imap_expunge($imap);
$deleted += count($messages);
}
}
echo "$count mails processed, $deleted mails deleted.\n";
}
}

View File

@ -1,13 +0,0 @@
<?php
require_once(__DIR__.'/tpv.php');
/**
* Gets transaction confirmation from HTTP POST.
*/
class ConfirmPost extends Vn\Web\RestRequest {
function run($db) {
Tpv::confirm($db, $_POST);
}
}

View File

@ -1,91 +0,0 @@
<?php
require_once('vn/web/util.php');
require_once(__DIR__.'/tpv.php');
/**
* Gets transaction confirmation from SOAP service.
*/
class ConfirmSoap extends Vn\Web\RestRequest {
function run($db) {
global $tpvConfirmSoap;
$tpvConfirmSoap = $this;
ini_set('soap.wsdl_cache_enabled', FALSE);
$server = new SoapServer(__DIR__ .'/soap.wsdl');
$server->addFunction('procesaNotificacionSIS');
$server->handle();
}
}
function procesaNotificacionSIS($XML) {
global $tpvConfirmSoap;
$db = $tpvConfirmSoap->app->getSysConn();
$status = 'OK';
$requestString = $XML;
// Processes the request
try {
$xml = new SimpleXMLElement($requestString);
$params =(array) $xml->{'Request'};
if (!(isset($params['Ds_Amount'])
&& isset($params['Ds_Order'])
&& isset($params['Ds_MerchantCode'])
&& isset($params['Ds_Currency'])
&& isset($params['Ds_Response'])))
throw new Exception('Missing required parameters');
// Checks the signature
$start = strpos($requestString, '<Request');
$end = strrpos($requestString, '</Request>');
$shaString = substr($requestString, $start, $end - $start + 10);
$key = $db->getValue(
'SELECT secretKey FROM tpvMerchant WHERE id = #'
,[$params['Ds_MerchantCode']]
);
if (sha1($shaString.$key) != $xml->{'Signature'})
throw new Exception('Invalid signature');
// Confirms the transaction
Tpv::confirm($db, $params);
} catch (Exception $e) {
$status = 'KO';
}
// Generates the response
$responseString = file_get_contents(__DIR__ .'/soap-reply.xml');
$xml = new SimpleXMLElement($responseString);
$response = $xml->{'Response'};
$response->{'Ds_Response_Merchant'} = $status;
$xml->{'Signature'} = sha1($response->asXML().$key);
return $xml->asXML();
/*
// Another way to generate the response
$xmlResponse =
'<Response Ds_Version="0.0">
<Ds_Response_Merchant>'. $status .'</Ds_Response_Merchant>
</Response>';
$xmlMessage =
'<Message>
'. $xmlResponse .'
<Signature>'. sha1($xmlResponse.$key) .'</Signature>
</Message>';
return $xmlMessage;
*/}

View File

@ -1,6 +0,0 @@
<Message>
<Response Ds_Version="0.0">
<Ds_Response_Merchant></Ds_Response_Merchant>
</Response>
<Signature></Signature>
</Message>

View File

@ -1,40 +0,0 @@
<!ELEMENT Message (Request, Signature)>
<!ELEMENT Request (
Fecha,
Hora,
Ds_SecurePayment,
Ds_Amount,
Ds_Currency,
Ds_Order,
Ds_MerchantCode,
Ds_Terminal,
Ds_Response,
Ds_MerchantData?,
Ds_Card_Type?,
Ds_TransactionType,
Ds_ConsumerLanguage,
Ds_ErrorCode?,
Ds_CardCountry?,
Ds_AuthorisationCode?
)>
<!ATTLIST Request Ds_Version CDATA #REQUIRED>
<!ELEMENT Fecha (#PCDATA)>
<!ELEMENT Hora (#PCDATA)>
<!ELEMENT Ds_SecurePayment (#PCDATA)>
<!ELEMENT Ds_Amount (#PCDATA)>
<!ELEMENT Ds_Currency (#PCDATA)>
<!ELEMENT Ds_Order (#PCDATA)>
<!ELEMENT Ds_MerchantCode (#PCDATA)>
<!ELEMENT Ds_Terminal (#PCDATA)>
<!ELEMENT Ds_Response (#PCDATA)>
<!ELEMENT Ds_MerchantData (#PCDATA)>
<!ELEMENT Ds_Card_Type (#PCDATA)>
<!ELEMENT Ds_TransactionType (#PCDATA)>
<!ELEMENT Ds_ConsumerLanguage (#PCDATA)>
<!ELEMENT Ds_ErrorCode (#PCDATA)>
<!ELEMENT Ds_CardCountry (#PCDATA)>
<!ELEMENT Ds_AuthorisationCode (#PCDATA)>
<!ELEMENT Signature (#PCDATA)>

View File

@ -1,20 +0,0 @@
<Message>
<Request Ds_Version='0.0'>
<Fecha>21/10/2014</Fecha>
<Hora>17:56</Hora>
<Ds_SecurePayment>1</Ds_SecurePayment>
<DS_Card_Type>D</DS_Card_Type>
<Ds_Card_Country>724</Ds_Card_Country>
<Ds_Amount>1</Ds_Amount>
<Ds_Currency>978</Ds_Currency>
<Ds_Order>000000007216</Ds_Order>
<Ds_MerchantCode>329744999</Ds_MerchantCode>
<Ds_Terminal>001</Ds_Terminal>
<Ds_Response>0000</Ds_Response>
<Ds_MerchantData></Ds_MerchantData>
<Ds_TransactionType>0</Ds_TransactionType>
<Ds_ConsumerLanguage>1</Ds_ConsumerLanguage>
<Ds_AuthorisationCode>563451</Ds_AuthorisationCode>
</Request>
<Signature>b97d1aba50aac5efc0915f59a70e24fc94cb3ffe</Signature>
</Message>

View File

@ -1,56 +0,0 @@
<?php
if (isset($_POST['key'])) {
ini_set('soap.wsdl_cache_enabled', FALSE);
$requestString = file_get_contents(__DIR__.'/soap-request.xml');
$client = new SoapClient(__DIR__.'/soap.wsdl');
$result = $client->__soapCall('procesaNotificacionSIS', [
'XML' => $requestString
]);
$xml = new SimpleXMLElement($result);
$key = $_POST['key'];
$start = strpos($result, '<Response');
$end = strrpos($result, '</Response>');
$shaString = substr($result, $start, $end - $start + 11);
$shaHash = sha1($shaString.$key);
$isValid = $xml->{'Signature'} == $shaHash;
} else {
$key = '';
$result = '';
$shaHash = '';
$isValid = FALSE;
}
?>
<html>
<head>
<title>
TPV SOAP Client
</title>
</head>
<body>
<form action="?" method="post">
<label>Key:</label>
<input type="password" value="<?=$key?>" name="key"/>
<input type="submit"/>
</form>
<h2>Response</h2>
<p>
<pre><?=htmlentities($result)?></pre>
</p>
<h2>Signature</h2>
<p>
Calculated: <?=$shaHash?>
</p>
<p>
Valid: <input type="checkbox" <?=($isValid ? 'checked' : '')?>/>
</p>
</body>
</html>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="InotificacionSIS"
targetNamespace="https://sis.sermepa.es/sis/InotificacionSIS.wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="https://sis.sermepa.es/sis/InotificacionSIS.wsdl"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="procesaNotificacionSISRequest">
<part name="XML" type="xs:string"/>
</message>
<message name="procesaNotificacionSISResponse">
<part name="return" type="xs:string"/>
</message>
<portType name="InotificacionSISPortType">
<operation name="procesaNotificacionSIS">
<input message="tns:procesaNotificacionSISRequest"/>
<output message="tns:procesaNotificacionSISResponse"/>
</operation>
</portType>
<binding name="InotificacionSISBinding" type="tns:InotificacionSISPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="procesaNotificacionSIS">
<soap:operation
soapAction="urn:InotificacionSIS#procesaNotificacionSIS" style="rpc"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="InotificacionSIS"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="InotificacionSIS"/>
</output>
</operation>
</binding>
<service name="InotificacionSISService">
<port name="InotificacionSIS" binding="tns:InotificacionSISBinding">
<soap:address
location="http://localhost/~juan/hedera-web/tpv/soap.php"/>
</port>
</service>
</definitions>

View File

@ -1,33 +0,0 @@
<?php
class Tpv {
/**
* Tryes to confirm a transaction with the given params.
*/
static function confirm($db, $params) {
if (!(isset($params['Ds_Amount'])
&& isset($params['Ds_Order'])
&& isset($params['Ds_MerchantCode'])
&& isset($params['Ds_Currency'])
&& isset($params['Ds_Response'])))
return FALSE;
if (isset($params['Ds_ErrorCode']))
$error = $params['Ds_ErrorCode'];
else
$error = NULL;
return $db->query(
'CALL tpvTransaction_confirm(#, #, #, #, #, #)',
[
$params['Ds_Amount']
,$params['Ds_Order']
,$params['Ds_MerchantCode']
,$params['Ds_Currency']
,$params['Ds_Response']
,$error
]
);
}
}

View File

@ -1,67 +0,0 @@
<?php
/**
* Starts a new TPV transaction and returns the params.
*/
class Transaction extends Vn\Web\JsonRequest {
const PARAMS = ['amount'];
function run($db) {
$amount = (int) $_REQUEST['amount'];
$companyId = empty($_REQUEST['company']) ? NULL : $_REQUEST['company'];
$row = $db->getObject('CALL myTpvTransaction_start(#, #)',
[$amount, $companyId]);
if (!isset($row))
throw new Exception('Transaction error');
$transactionId = str_pad($row->transactionId, 12, '0', STR_PAD_LEFT);
$merchantUrl = $row->merchantUrl ? $row->merchantUrl : '';
$urlOk = empty($_REQUEST['urlOk']) ? '' :
str_replace('_transactionId_', $transactionId, $_REQUEST['urlOk']);
$urlKo = empty($_REQUEST['urlKo']) ? '' :
str_replace('_transactionId_', $transactionId, $_REQUEST['urlKo']);
$params = [
'Ds_Merchant_Amount' => $amount
,'Ds_Merchant_Order' => $transactionId
,'Ds_Merchant_MerchantCode' => $row->merchant
,'Ds_Merchant_Currency' => $row->currency
,'Ds_Merchant_TransactionType' => $row->transactionType
,'Ds_Merchant_Terminal' => $row->terminal
,'Ds_Merchant_MerchantURL' => $merchantUrl
,'Ds_Merchant_UrlOK' => $urlOk
,'Ds_Merchant_UrlKO' => $urlKo
];
$encodedParams = base64_encode(json_encode($params));
$key = base64_decode($row->secretKey);
$bytes = [0, 0, 0, 0, 0, 0, 0, 0];
$iv = implode(array_map('chr', $bytes));
$paddedData = $transactionId;
if (strlen($paddedData) % 8) {
$paddedData = str_pad($paddedData,
strlen($paddedData) + 8 - strlen($paddedData) % 8, "\0");
}
$encryptedData = openssl_encrypt($paddedData,
'des-ede3-cbc', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING , $iv);
$signature = base64_encode(hash_hmac('sha256', $encodedParams, $encryptedData, TRUE));
$url = $row->url;
$postValues = [
'Ds_SignatureVersion' => 'HMAC_SHA256_V1'
,'Ds_MerchantParameters' => $encodedParams
,'Ds_Signature' => $signature
];
return [
'url' => $url
,'postValues' => $postValues
];
}
}

View File

@ -1,40 +0,0 @@
<?php
class Account {
static function trySync($db, $userName, $password = NULL) {
$sync = $db->getValue(
'SELECT COUNT(*) > 0 FROM account.userSync WHERE name = #',
[$userName]
);
if ($sync)
self::sync($db, $userName, $password);
}
static function sync($db, $userName, $password = NULL) {
$bcryptPassword = password_hash($password, PASSWORD_BCRYPT);
$userId = $db->getValue(
'SELECT id FROM account.user WHERE `name` = #',
[$userName]
);
$db->query(
'UPDATE account.user SET
bcryptPassword = #
WHERE id = #',
[$bcryptPassword, $userId]
);
$hasAccount = $db->getValue(
'SELECT COUNT(*) > 0
FROM account.user u
JOIN account.account a ON u.id = a.id
WHERE u.name = #',
[$userName]
);
if (!$hasAccount)
$db->query('DELETE FROM account.userSync WHERE name = #',
[$userName]
);
}
}

View File

@ -1,36 +0,0 @@
<?php
use Vn\Web;
class RecoverPassword extends Vn\Web\JsonRequest {
const PARAMS = ['recoverUser'];
function run($db) {
$recoverUser = $_REQUEST['recoverUser'];
$user = $db->getRow(
'SELECT email, active FROM account.user WHERE name = #',
[$recoverUser]
);
if (!($user['active'] && $user['email']))
return TRUE;
$verificationToken = bin2hex(random_bytes(16));
$db->query(
'UPDATE account.user SET verificationToken = #
WHERE name = #',
[$verificationToken, $recoverUser]
);
$service = $this->service;
$token = $service->createToken($recoverUser);
$url = $service->getUrl() ."#!form=account/conf&verificationToken=$verificationToken&token=$token";
$report = new Vn\Web\Report($db, 'recover-password', ['url' => $url]);
$report->sendMail($user['email']);
return TRUE;
}
}

View File

@ -1,20 +0,0 @@
<?php
include __DIR__.'/account.php';
/**
* Restores the user password.
*/
class RestorePassword extends Vn\Web\JsonRequest {
const PARAMS = ['verificationToken', 'newPassword'];
function run($db) {
$verificationToken = $_REQUEST['verificationToken'];
$newPassword = $_REQUEST['newPassword'];
$db->query('CALL account.myUser_restorePassword(#, #)',
[$verificationToken, $newPassword]);
return TRUE;
}
}

View File

@ -1,9 +0,0 @@
<?php
class Supplant extends Vn\Web\JsonRequest {
const PARAMS = ['supplantUser'];
function run($db) {
return $this->service->createToken($_REQUEST['supplantUser']);
}
}

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (24.50.11) stable; urgency=low
hedera-web (24.50.12) stable; urgency=low
* Initial Release.

27343
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +1,52 @@
{
"name": "hedera-web",
"version": "24.50.11",
"version": "24.50.12",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"productName": "Salix",
"author": "Verdnatura",
"productName": "Verdnatura",
"author": "Verdnatura Levante SL",
"repository": {
"type": "git",
"url": "https://git.verdnatura.es/hedera-web"
},
"packageManager": "pnpm@8.15.1",
"devDependencies": {
"@babel/eslint-parser": "^7.13.14",
"@babel/preset-env": "^7.20.2",
"@intlify/vue-i18n-loader": "^4.2.0",
"@quasar/app-webpack": "^3.0.0",
"@quasar/cli": "^2.4.1",
"archiver": "^5.3.1",
"assets-webpack-plugin": "^7.1.1",
"babel-loader": "^9.1.0",
"bundle-loader": "^0.5.6",
"css-loader": "^5.2.7",
"cypress": "^13.15.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-vue": "^9.27.0",
"eslint-webpack-plugin": "^3.1.1",
"file-loader": "^6.2.0",
"eslint-webpack-plugin": "^4.2.0",
"fs-extra": "^10.1.0",
"glob": "^8.0.3",
"html-webpack-plugin": "^5.5.0",
"json-loader": "^0.5.7",
"glob": "^11.0.0",
"mini-css-extract-plugin": "^2.7.0",
"node-sass": "^7.0.1",
"postcss": "^8.4.39",
"postcss-import": "^13.0.0",
"postcss-loader": "^4.3.0",
"postcss-url": "^10.1.3",
"raw-loader": "^4.0.2",
"sass-loader": "^12.6.0",
"style-loader": "^3.3.1",
"url-loader": "^4.1.1",
"webpack": "^5.75.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0",
"yaml-loader": "^0.5.0"
"postcss-url": "^10.1.3"
},
"dependencies": {
"@quasar/extras": "^1.0.0",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"eslint-plugin-cypress": "^2.13.3",
"js-yaml": "^3.12.1",
"mootools": "^1.5.2",
"pinia": "^2.0.11",
"promise-polyfill": "^8.2.3",
"quasar": "^2.6.0",
"require-yaml": "0.0.1",
"require-yaml": "^0.0.1",
"tinymce": "^6.3.0",
"vue": "^3.3.4",
"vue-i18n": "^9.2.2",

9153
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff