make payment processing more robust

This commit is contained in:
2023-10-15 08:02:02 +02:00
parent 9b6fd1355e
commit a679c5915e
7 changed files with 64 additions and 23 deletions

View File

@@ -22,8 +22,8 @@ module.exports = ( app ) => {
} );
app.get( '/tickets/tickets.pdf', ( req, res ) => {
if ( req.session.id ) {
fs.readFile( path.join( __dirname + '/../tickets/store/' + req.session.id + '.pdf' ), ( error, data ) => {
if ( req.session.lastOrderID ) {
fs.readFile( path.join( __dirname + '/../tickets/store/' + req.session.lastOrderID + '.pdf' ), ( error, data ) => {
if ( error ) res.sendFile( path.join( __dirname + '/../../ui/en/errors/404.html' ) );
else res.send( data );
} );