Implementation
See the corresponding how-to article for API usage and step-by-step instructions:When Attachment Handling Occurs
Attachments must be processed:- After Export Items are fetched and validated
- After bookkeeping method resolution
- Before posting entries to the Accounting System
Processing Rules
1. Download Attachments
For each Export Item:- Iterate through
data[].files[] - Download each attachment using
files.url - Preserve original file format and filename when possible
2. Associate Attachments
Attachments must be linked to:- the Journal Entry, or
- the Accounts Payable invoice/payment
3. Multiple Attachments
If multiple attachments exist:- Upload all files when the Accounting System supports multiple attachments.
- Combine files into a single document before upload.
- PDF merge (preferred)
- ZIP archive (fallback)
4. Failure Handling
Attachment failures must not silently discard files. Recommended behaviour:- Retry download on transient failure
- Log failed attachments
- Optionally allow posting without attachment only if accounting entry succeeds
5. Idempotency
Integrations should avoid duplicate uploads when exports are retried. Recommended strategies:- store processed attachment IDs, or
- check existing attachments before upload.
Edge Cases
| Scenario | Expected Behaviour |
|---|---|
| No attachments | Continue export normally |
| Attachment download fails | Retry and log error |
| Unsupported file type in AS | Convert or store externally |
| Multiple attachments but AS allows one | Merge files |
Upstream Dependencies
- Export Job has been claimed (status = in_progress)
- Fetch Export Item Data (data layer)
- Bookkeeping method resolved
- Accounts Mapping – determines which GL accounts are debited and credited
- Data Mapping – ensures amounts, dates, dimensions, identifiers, and VAT/tax information are recorded correctly
Downstream Dependencies
- Accounting Periods – assigns entries to the correct accounting period
- Posting Behaviour – determines whether entries are created as drafts or finalised
- Export Item status update – updates outcome of Export Item (
successfulorfailed) - Export Job status update – updates outcome of Export Job (
completed,completed_with_errorsorfailed)