import { prisma } from '../lib/prisma'; import { lexofficeService } from '../lib/lexoffice'; async function main() { console.log('πŸ” PrΓΌfe LexOffice Quotation Status...\n'); // Hole die Test-Buchung const booking = await prisma.booking.findFirst({ where: { bookingNumber: 'STM-2511-9237' }, select: { id: true, bookingNumber: true, lexofficeOfferId: true, }, }); if (!booking) { console.log('❌ Buchung nicht gefunden'); return; } console.log('πŸ“‹ Buchung:', booking.bookingNumber); console.log('πŸ†” LexOffice Offer ID:', booking.lexofficeOfferId); if (!booking.lexofficeOfferId) { console.log('❌ Keine LexOffice Angebots-ID vorhanden'); return; } try { console.log('\nπŸ” Lade Quotation Details von LexOffice...'); const quotation = await lexofficeService.getQuotation(booking.lexofficeOfferId); console.log('\nπŸ“Š Quotation Details:'); console.log(' Voucher Number:', quotation.voucherNumber); console.log(' Created:', quotation.createdDate); console.log(' Updated:', quotation.updatedDate); console.log('\n Full Response:', JSON.stringify(quotation, null, 2)); console.log('\nπŸ“„ Versuche PDF Download...'); const pdf = await lexofficeService.getQuotationPDF(booking.lexofficeOfferId); console.log('βœ… PDF erfolgreich heruntergeladen! Grâße:', pdf.length, 'bytes'); } catch (error: any) { console.error('\n❌ Fehler:', error.message); } } main() .catch((e) => { console.error(e); process.exit(1); }) .finally(async () => { await prisma.$disconnect(); });