-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-server-health.js
More file actions
63 lines (54 loc) · 2.34 KB
/
Copy pathtest-server-health.js
File metadata and controls
63 lines (54 loc) · 2.34 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const axios = require('axios');
async function testServerHealth() {
try {
console.log('Testing server health...');
// Test basic health endpoint
const healthResponse = await axios.get('http://localhost:4000/api/v1/health');
console.log('Health check:', healthResponse.data);
// Test if we can create a payment link (this will test database connectivity)
console.log('\nTesting payment link creation...');
try {
const createResponse = await axios.post('http://localhost:4000/api/v1/payment-links', {
merchantId: 'debug-merchant',
userId: 'debug-user',
amount: '10.00',
currency: 'USD',
token: 'USDT',
selectedCurrency: 'USD',
paymentType: 'card',
description: 'Debug test'
});
console.log('✅ Payment link created:', createResponse.data.data.id);
// Now test accessing the newly created link
const newId = createResponse.data.data.id;
console.log(`\nTesting access to newly created link: ${newId}`);
const accessResponse = await axios.post(`http://localhost:4000/api/v1/payment-links/${newId}/access`);
console.log('✅ New link access successful');
} catch (createError) {
console.error('❌ Payment link creation failed:');
if (createError.response) {
console.error('Status:', createError.response.status);
console.error('Data:', createError.response.data);
} else {
console.error('Error:', createError.message);
}
}
// Test the specific problematic ID
console.log('\nTesting problematic ID: 697ecadd88e5e54e39285e80');
try {
const specificResponse = await axios.post('http://localhost:4000/api/v1/payment-links/697ecadd88e5e54e39285e80/access');
console.log('✅ Specific ID access successful:', specificResponse.data);
} catch (specificError) {
console.error('❌ Specific ID access failed:');
if (specificError.response) {
console.error('Status:', specificError.response.status);
console.error('Data:', specificError.response.data);
} else {
console.error('Error:', specificError.message);
}
}
} catch (error) {
console.error('❌ Server health test failed:', error.message);
}
}
testServerHealth();