fix: update webhook signature retrieval and enhance error logging; correct file path in payment link test
This commit is contained in:
parent
164e62c234
commit
1db068bfb2
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue