UNPKG

self-serve-integration-service

Version:

Self-Serve Integration Service for managing multiple funder integrations including REST APIs, SOAP APIs, and UI automation

73 lines (65 loc) 1.85 kB
const axios = require('axios'); // Test the new calculateQuote endpoint async function testCalculateQuote() { try { console.log('Testing /api/lex/calculateQuote endpoint...'); const requestBody = { asset: { cap_id: 12345, cap_code: "XXXX19125SBDTM2L", model_year: 2020.5, options: ["12345"] }, accessories: [ { type: "DealerFit", description: "Accessory 1", price: 100.00 }, { type: "ThirdParty", description: "Accessory 2", price: 299.99 } ], financials: { contract_type_id: 3, plan: 106, term: 36, mileage: 12000, relief_vehicle: 0, customer_initial_payment: 2500.00, estimated_sales_value: null, cust_reference: "Any text", estimated_delivery_date: "26-09-2024" }, adjustments: { off_invoice_support: null, otrp: null, commission: null, discount: null, customer_terms: 1, co2_emission: 180 } }; console.log('Request body:', JSON.stringify(requestBody, null, 2)); const response = await axios.post('http://localhost:3003/api/lex/calculateQuote', requestBody, { headers: { 'Content-Type': 'application/json' } }); console.log('Response status:', response.status); console.log('Response data:', JSON.stringify(response.data, null, 2)); } catch (error) { if (error.response) { console.error('Error response:', { status: error.response.status, data: error.response.data }); } else { console.error('Error:', error.message); } } } // Run the test testCalculateQuote();