From 3e18deb09655ba1b8a2e31e0a80cb7b79b3b5e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 16 Dec 2022 16:13:21 +0100 Subject: [PATCH] =?UTF-8?q?refs=20#5001=20notificaci=C3=B3n=20cobros=20per?= =?UTF-8?q?didos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/225001/03-notification_ACL.sql | 10 +++++ .../225001/03-tpvTransaction_checkStatus.sql | 43 +++++++++++++++++++ .../assets/css/import.js | 11 +++++ .../client-web-payment-confirm-lost.html | 8 ++++ .../client-web-payment-confirm-lost.js | 23 ++++++++++ .../locale/en.yml | 6 +++ .../locale/es.yml | 6 +++ 7 files changed, 107 insertions(+) create mode 100644 db/changes/225001/03-notification_ACL.sql create mode 100644 db/changes/225001/03-tpvTransaction_checkStatus.sql create mode 100644 print/templates/email/client-web-payment-confirm-lost/assets/css/import.js create mode 100644 print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.html create mode 100755 print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.js create mode 100644 print/templates/email/client-web-payment-confirm-lost/locale/en.yml create mode 100644 print/templates/email/client-web-payment-confirm-lost/locale/es.yml diff --git a/db/changes/225001/03-notification_ACL.sql b/db/changes/225001/03-notification_ACL.sql new file mode 100644 index 0000000000..3945426a6e --- /dev/null +++ b/db/changes/225001/03-notification_ACL.sql @@ -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'; diff --git a/db/changes/225001/03-tpvTransaction_checkStatus.sql b/db/changes/225001/03-tpvTransaction_checkStatus.sql new file mode 100644 index 0000000000..7939ce2151 --- /dev/null +++ b/db/changes/225001/03-tpvTransaction_checkStatus.sql @@ -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 ; diff --git a/print/templates/email/client-web-payment-confirm-lost/assets/css/import.js b/print/templates/email/client-web-payment-confirm-lost/assets/css/import.js new file mode 100644 index 0000000000..4b4bb70869 --- /dev/null +++ b/print/templates/email/client-web-payment-confirm-lost/assets/css/import.js @@ -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(); diff --git a/print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.html b/print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.html new file mode 100644 index 0000000000..474a593997 --- /dev/null +++ b/print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.html @@ -0,0 +1,8 @@ + +
+
+

{{ $t('title') }}

+

+
+
+
\ No newline at end of file diff --git a/print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.js b/print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.js new file mode 100755 index 0000000000..46961df17b --- /dev/null +++ b/print/templates/email/client-web-payment-confirm-lost/client-web-payment-confirm-lost.js @@ -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 + } + } +}; diff --git a/print/templates/email/client-web-payment-confirm-lost/locale/en.yml b/print/templates/email/client-web-payment-confirm-lost/locale/en.yml new file mode 100644 index 0000000000..266bc91864 --- /dev/null +++ b/print/templates/email/client-web-payment-confirm-lost/locale/en.yml @@ -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 + + https://salix.verdnatura.es/#!/client/{1}/web-payment \ No newline at end of file diff --git a/print/templates/email/client-web-payment-confirm-lost/locale/es.yml b/print/templates/email/client-web-payment-confirm-lost/locale/es.yml new file mode 100644 index 0000000000..4338fda2ce --- /dev/null +++ b/print/templates/email/client-web-payment-confirm-lost/locale/es.yml @@ -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 + + https://salix.verdnatura.es/#!/client/{1}/web-payment \ No newline at end of file