refs #5001 notificación cobros perdidos
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Andrés 2022-12-16 16:13:21 +01:00
parent 98b8d652cb
commit 3e18deb096
7 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,10 @@
INSERT INTO `util`.`notification` (`name`, `description`)
VALUES
('client-web-payment-confirm-lost', 'A client web payment has not confirmation');
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
SELECT n.id, r.id
FROM util.notification n
JOIN account.role r
WHERE n.name='client-web-payment-confirm-lost'
AND r.name = 'financial';

View File

@ -0,0 +1,43 @@
DROP PROCEDURE IF EXISTS `vn`.`tpvTransaction_checkStatus`;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`tpvTransaction_checkStatus`()
BEGIN
/**
* Envia notificaiones de los cobros web
* que no se han trasladado a la ficha del cliente
*/
DECLARE vAmount DECIMAL (10,2);
DECLARE vClientFk INT;
DECLARE vCreated DATE;
DECLARE vDone INT DEFAULT FALSE;
DECLARE vCursor CURSOR FOR
SELECT t.amount / 100 amount, t.clientFk, t.created
FROM hedera.tpvTransaction t
WHERE t.receiptFk IS NULL
AND t.status = 'ok'
AND t.created < (NOW() - INTERVAL 2 DAY)
GROUP BY t.clientFk;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vCursor;
read_loop: LOOP
FETCH vCursor INTO vAmount, vClientFk, vCreated;
IF vDone THEN
LEAVE read_loop;
END IF;
SET vParams = JSON_OBJECT(
'amount', vAmount,
'clientFk', vClientFk,
'created', vCreated
);
SELECT util.notification_send('client-web-payment-confirm-lost', vParams, NULL) INTO @id;
END LOOP;
CLOSE vCursor;
END$$
DELIMITER ;

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,8 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p v-html="$t('description', [amount, clientFk, dated])"></p>
</div>
</div>
</email-body>

View File

@ -0,0 +1,23 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'client-web-payment-confirm-lost',
components: {
'email-body': emailBody.build()
},
props: {
amount: {
type: Number,
required: true
},
clientFk: {
type: Number,
required: true
},
dated: {
type: Date,
required: true
}
}
};

View File

@ -0,0 +1,6 @@
subject: Web charge not transferred to client file
title: Web charge not transferred to client file
description: There is an amount of {0}€ from the cliente {1} dated {2} that has not been transferred to receipts.
If the amount has arrived at the bank, confirm the payment here
<a href="https://salix.verdnatura.es/#!/client/{1}/web-payment">
https://salix.verdnatura.es/#!/client/{1}/web-payment</a>

View File

@ -0,0 +1,6 @@
subject: Cobro web no trasladado a la ficha del cliente
title: Cobro web no trasladado a la ficha del cliente
description: Hay un importe de {0}€ del cliente {1} con fecha {2} que no se ha trasladado a recibos.
Si nos ha llegado el importe al banco confirme el pago en
<a href="https://salix.verdnatura.es/#!/client/{1}/web-payment">
https://salix.verdnatura.es/#!/client/{1}/web-payment</a>