Show detailed error information for erroneous documents

- Extract error details from Binect API for documents with status 7
- Display error details in a highlighted box below the status
- Map status 7 (ERRONEOUS) to 'failed' status in refresh handler
- Add CSS styling for error details display

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-16 21:29:45 +01:00
parent 4f0f7ed9eb
commit f4c0481eda
3 changed files with 33 additions and 1 deletions

View File

@@ -334,6 +334,7 @@ export interface DocumentStatusInfo {
statusText: string;
price?: number;
recipientAddress?: string;
errorDetails?: string; // Error details for erroneous documents
}
/**
@@ -425,17 +426,25 @@ export async function getDocumentStatus(
// Extract price and recipient if available
let price: number | undefined;
let recipientAddress: string | undefined;
let errorDetails: string | undefined;
if (doc.letter?.letterData) {
price = doc.letter.letterData.price?.priceAfterTax;
recipientAddress = doc.letter.letterData.recipientAddress;
}
// Extract error details for erroneous documents (status 7)
if (doc.status.code === 7 && doc.letter?.errors && doc.letter.errors.length > 0) {
errorDetails = doc.letter.errors.map(e => e.message).join('; ');
console.log('[Binect API] Document errors:', errorDetails);
}
return {
status: doc.status.code,
statusText: doc.status.text || getStatusText(doc.status.code),
price,
recipientAddress,
errorDetails,
};
} catch (error) {
console.error('[Binect API] Get status error:', error);