-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-imb-webhook.js
More file actions
31 lines (26 loc) · 858 Bytes
/
test-imb-webhook.js
File metadata and controls
31 lines (26 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const fetch = require('node-fetch');
async function testWebhook() {
const webhookUrl = 'http://localhost:3000/api/webhook/imb';
const orderId = 'REPLACE_WITH_ACTUAL_DOC_ID'; // You can get this from creating a test order
const formData = new URLSearchParams();
formData.append('status', 'COMPLETED');
formData.append('order_id', orderId);
formData.append('result', JSON.stringify({
utr: '123456789012',
txnStatus: 'SUCCESS',
txnAmount: '1.00',
txnDate: '2026-02-10 16:00:00',
bank_txn_id: 'BANK123'
}));
console.log('Sending mock webhook...');
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: formData.toString()
});
const data = await response.json();
console.log('Response:', data);
}
// testWebhook();