salix/db/routines/hedera/procedures/tpvTransaction_end.sql

22 lines
672 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`tpvTransaction_end`(
vSelf INT,
vStatus VARCHAR(12))
BEGIN
/**
* Ends a transaction by setting its status to 'ok' or 'ko' depending on
* if this has been done correctly.
* This procedure must be called directly by the client when the transaction
* ends, it is only valid until the arrival of the definitive notification from
* the payment platform.
*
* @param vSelf Transaction indentifier
* @param vStatus The status, 'ok' o 'ko'
*/
IF vStatus IN ('ok', 'ko') THEN
UPDATE tpvTransaction SET `status` = vStatus
WHERE id = vSelf AND response IS NULL;
END IF;
END$$
DELIMITER ;