fix: update webhook signature retrieval and enhance error logging; correct file path in payment link test #22

Merged
root merged 1 commits from epic-6-snap-hybrid-complete into dev 2025-12-08 05:06:11 +00:00
2 changed files with 3 additions and 2 deletions

View File

@ -708,7 +708,7 @@ function verifyWebhookSignature(body, mode) {
const grossAmount = body?.gross_amount
if (mode === 'SNAP') {
const signature = req.headers['x-signature'] || req.headers['signature'] || body?.signature
const signature = body?.signature_key
if (!signature) return false
const data = `${orderId}${statusCode}${grossAmount}${serverKey}`
@ -1194,6 +1194,7 @@ app.post('/api/payments/notification', async (req, res) => {
}
} catch (e) {
console.log(e);
logError('webhook.error', { message: e?.message, stack: e?.stack })
return res.status(500).json({
ok: false,

View File

@ -3,7 +3,7 @@ const fs = require('fs');
async function createPaymentLink() {
// Read file and remove BOM if present
let jsonContent = fs.readFileSync('../temp/tmp-createtransaksi.json', 'utf8');
let jsonContent = fs.readFileSync('temp/tmp-createtransaksi.json', 'utf8');
// Remove BOM
if (jsonContent.charCodeAt(0) === 0xFEFF) {
jsonContent = jsonContent.slice(1);