Retrieve SDI notifications for sent and received invoices.
import { NotificationsClient } from '@fatturazione-elettronica-aruba/notifications';
const notifications = new NotificationsClient(client.http);
const result = await notifications.getSentNotifications({
invoiceFilename: 'IT01234567890_00001.xml',
});
for (const n of result.notifications) {
console.log(`${n.docType}: ${n.filename}`);
}
| Code | Name | Description |
|---|---|---|
RC | Delivery Receipt | Invoice delivered to recipient |
NS | Rejection Notice | Invoice rejected for errors |
MC | Failed Delivery | Unable to deliver |
NE | Outcome Notice | Recipient outcome (EC01/EC02) |
DT | Term Expiry | No outcome within 15 days |
AT | Transmission Certificate | PA transmission confirmation |
async function waitForDelivery(filename: string): Promise<boolean> {
for (let i = 0; i < 10; i++) {
const result = await notifications.getSentNotifications({
invoiceFilename: filename,
});
if (result.notifications.some(n => n.docType === 'RC')) {
return true;
}
if (result.notifications.some(n => n.docType === 'NS')) {
return false;
}
await new Promise(r => setTimeout(r, 60000));
}
return false;
}