fix a possible crash in payrexx integration

This commit is contained in:
2023-09-22 16:49:22 +02:00
parent a6c6a4feb0
commit 0019b25244

View File

@@ -133,8 +133,13 @@ module.exports = ( app, settings ) => {
} ); } );
app.post( '/payments/webhook', bodyParser.json(), async ( req, res ) => { app.post( '/payments/webhook', bodyParser.json(), async ( req, res ) => {
if ( !req.body ) {
if ( !req.body.transaction ) {
res.status( 400 ).send( 'ERR_REQ_WRONG' );
return;
}
}
if ( req.body.transaction.status === 'confirmed' ) { if ( req.body.transaction.status === 'confirmed' ) {
console.error( gatewayReference[ req.body.transaction.referenceId ] );
const response = await payrexx.getGateway( gatewayReference[ req.body.transaction.referenceId ] ); const response = await payrexx.getGateway( gatewayReference[ req.body.transaction.referenceId ] );
if ( response.status === 200 ) { if ( response.status === 200 ) {