Skip to main content
Glama
full-test-leumi-saola.cjs9.08 kB
#!/usr/bin/env node const https = require('https'); const axios = require('axios'); // Create axios instance that ignores SSL certificate errors const axiosInstance = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false }) }); // Expected values from MANUAL_ANSWERS.txt const EXPECTED_VALUES = { bankLeumi: { august2025: 0.0026837670123269763, accountId: '696314371547', customerKey: '22676', divisionId: '139' }, saola: { march2025: 104755.07426900661, april2025: 111340.42435642441, may2025: 149774.23802783, june2025: 165666.57014308573, july2025: 183920.57814672764, accountId: '932213950603' } }; async function testBankLeumi() { console.log('\n' + '='.repeat(70)); console.log('🏦 TESTING BANK LEUMI (MSP Customer - AllCloud)'); console.log('='.repeat(70)); const baseUrl = 'https://api.umbrellacost.io/api/v1'; try { // Authenticate as AllCloud MSP user console.log('\n1️⃣ Authenticating as david+allcloud@umbrellacost.com...'); const authResponse = await axiosInstance.post(`${baseUrl}/authentication/token/generate`, { username: 'david+allcloud@umbrellacost.com', password: 'Dsamsung1!123' }); const token = authResponse.data.Authorization || authResponse.data.token; const apikey = authResponse.data.apikey; console.log('✅ Authentication successful'); console.log(` API Key format: ${apikey}`); // Query for Bank Leumi August 2025 console.log('\n2️⃣ Querying Bank Leumi costs for August 2025...'); const params = { customer_account_key: '22676', customer_division_id: '139', startDate: '2025-08-01', endDate: '2025-08-31', periodGranLevel: 'month', groupBy: 'none', costType: ['cost', 'discount'], isUnblended: true }; const response = await axiosInstance.get(`${baseUrl}/invoices/caui`, { params, headers: { 'Authorization': token, 'apikey': apikey } }); console.log('\n📊 Response received:'); if (response.data && response.data.length > 0) { const data = response.data[0]; console.log(` Account ID: ${data.account_id}`); console.log(` Period: ${data.usage_date}`); console.log(` Total Cost: $${data.total_cost}`); console.log(` Usage Quantity: ${data.total_usage_quantity}`); // Validate results console.log('\n3️⃣ Validating results:'); const expectedCost = EXPECTED_VALUES.bankLeumi.august2025; const actualCost = data.total_cost; const difference = Math.abs(actualCost - expectedCost); console.log(` Expected Cost: $${expectedCost.toFixed(10)}`); console.log(` Actual Cost: $${actualCost}`); console.log(` Difference: $${difference.toFixed(10)}`); if (difference < 0.0001) { console.log(' ✅ PASS - Cost matches expected value!'); } else { console.log(' ❌ FAIL - Cost does not match expected value'); } if (data.account_id === EXPECTED_VALUES.bankLeumi.accountId) { console.log(' ✅ PASS - Account ID matches!'); } else { console.log(` ❌ FAIL - Account ID mismatch (expected: ${EXPECTED_VALUES.bankLeumi.accountId})`); } } else { console.log(' ❌ No data returned'); } } catch (error) { console.error('❌ Error testing Bank Leumi:', error.response?.data || error.message); if (error.response?.status === 500) { console.log(' Note: 500 error might indicate Keycloak issue, system may fallback to Cognito'); } } } async function testSaola() { console.log('\n' + '='.repeat(70)); console.log('🌟 TESTING SAOLA (Direct Customer)'); console.log('='.repeat(70)); const baseUrl = 'https://api.umbrellacost.io/api/v1'; try { // Authenticate as SAOLA user console.log('\n1️⃣ Authenticating as david+saola@umbrellacost.com...'); const authResponse = await axiosInstance.post(`${baseUrl}/authentication/token/generate`, { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' }); const token = authResponse.data.Authorization || authResponse.data.token; const apikey = authResponse.data.apikey; console.log('✅ Authentication successful'); console.log(` API Key format: ${apikey}`); // Query for SAOLA March-July 2025 console.log('\n2️⃣ Querying SAOLA costs for March-July 2025...'); const params = { startDate: '2025-03-01', endDate: '2025-07-31', periodGranLevel: 'month', groupBy: 'usagedate', costType: ['cost', 'discount'], isUnblended: true }; const response = await axiosInstance.get(`${baseUrl}/invoices/caui`, { params, headers: { 'Authorization': token, 'apikey': apikey } }); console.log('\n📊 Response received:'); if (response.data && response.data.length > 0) { const months = { '2025-03': { name: 'March', expected: EXPECTED_VALUES.saola.march2025 }, '2025-04': { name: 'April', expected: EXPECTED_VALUES.saola.april2025 }, '2025-05': { name: 'May', expected: EXPECTED_VALUES.saola.may2025 }, '2025-06': { name: 'June', expected: EXPECTED_VALUES.saola.june2025 }, '2025-07': { name: 'July', expected: EXPECTED_VALUES.saola.july2025 } }; console.log('\n Monthly Costs:'); response.data.forEach(item => { const monthInfo = months[item.usage_date]; if (monthInfo) { console.log(` ${monthInfo.name} 2025: $${item.total_cost.toFixed(2)}`); } }); // Validate results console.log('\n3️⃣ Validating results:'); let allPass = true; response.data.forEach(item => { const monthInfo = months[item.usage_date]; if (monthInfo) { const difference = Math.abs(item.total_cost - monthInfo.expected); const pass = difference < 0.01; console.log(` ${monthInfo.name}: ${pass ? '✅ PASS' : '❌ FAIL'} (diff: $${difference.toFixed(2)})`); if (!pass) allPass = false; } }); // Check account ID if (response.data[0].account_id === EXPECTED_VALUES.saola.accountId) { console.log(` Account ID: ✅ PASS (${EXPECTED_VALUES.saola.accountId})`); } else { console.log(` Account ID: ❌ FAIL (expected: ${EXPECTED_VALUES.saola.accountId}, got: ${response.data[0].account_id})`); allPass = false; } if (allPass) { console.log('\n ✅✅✅ ALL TESTS PASSED FOR SAOLA! ✅✅✅'); } } else { console.log(' ❌ No data returned'); } } catch (error) { console.error('❌ Error testing SAOLA:', error.response?.data || error.message); if (error.response?.status === 500) { console.log(' Note: 500 error might indicate Keycloak issue, system may fallback to Cognito'); } } } async function monitorServerLogs() { console.log('\n' + '='.repeat(70)); console.log('📋 MONITORING INSTRUCTIONS'); console.log('='.repeat(70)); console.log('\nCheck the server logs (background process 5a96ea) to verify:'); console.log('1. NO hardcoded account 9350 selection'); console.log('2. Dynamic customer detection working'); console.log('3. Correct API keys being built'); console.log('4. Proper authentication flow (Keycloak with Cognito fallback)'); } async function main() { console.log('\n🚀 FULL TESTING SUITE FOR BANK LEUMI AND SAOLA'); console.log('=' .repeat(70)); console.log('Server: https://gonna-opens-glossary-presence.trycloudflare.com'); console.log('Testing with fixes applied (no hardcoded account selection)'); await testBankLeumi(); await testSaola(); await monitorServerLogs(); console.log('\n' + '='.repeat(70)); console.log('✅ Testing complete. Check results above.'); console.log('='.repeat(70)); } main().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daviddraiumbrella/invoice-monitoring'

If you have feedback or need assistance with the MCP directory API, please join our Discord server