/api/v1/businesses/:businessId/accounting/amicus/sync
auth: apikeyOn-premise AMICUS agent push. Scope-bound to `amicus`. Per-row register→till routing (null till → sign-but-don't-print), `PosSaleId` persisted on `Invoices`, refund referent resolution via `originalPosSaleId`. Supports split-tender (one payment with `tenders[]`). Unrouted invoices return `outcomes[].outcome='register_unmapped'` and fire `AMICUS_RECEIPT_UNROUTED` audit.
handlers: AccountingAgentSyncController.syncAmicus
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
Authorization headerstring | yes | — | `ApiKey <key>`. |
invoices bodyPushInvoice[] | yes | — | Array of pushed invoices. Each may carry `posSaleId`, `posRegisterId`, `originalPosSaleId`, `cashierId`, and split-tender `payments[].tenders[]`. |
APIResponseDataObject<PushInvoicesResponse>APIErrorAPIError/api/v1/accounting/amicus/tax-mappings
auth: jwt (administrator)List AMICUS tax-mappings for the business (`Provider='amicus'`).
handlers: AccountingAgentTaxMappingsController.listFor('amicus')
No parameters.
APIResponseDataList<TaxRateMappingDTO>/api/v1/accounting/amicus/tax-mappings
auth: jwt (administrator)Upsert one AMICUS tax-mapping.
handlers: AccountingAgentTaxMappingsController.upsertFor('amicus')
| name | required | default | description |
|---|---|---|---|
providerTaxType bodystring | yes | — | AMICUS tax-code (typically `VAT` or `EXEMPT`). |
providerTaxName bodystring | null | no | — | Human-readable tax name. |
providerRate bodynumber | null | no | — | Provider tax rate. |
vsdcTaxLabel bodystring | yes | — | V-SDC label. |
vsdcRate bodynumber | null | no | — | V-SDC rate percent. |
APIResponseDataObject<TaxRateMappingDTO>APIError/api/v1/accounting/amicus/tax-mappings/:providerTaxType
auth: jwt (administrator)Soft-delete an AMICUS tax-mapping (`IsActive=0`). Idempotent.
handlers: AccountingAgentTaxMappingsController.removeFor('amicus')
| name | required | default | description |
|---|---|---|---|
providerTaxType pathstring | yes | — | AMICUS tax-code to deactivate. |
empty/api/v1/accounting/amicus/tax-mappings/:providerTaxType/restore
auth: jwt (administrator)Re-activate a deactivated AMICUS mapping (`IsActive=1`). Idempotent.
handlers: AccountingAgentTaxMappingsController.restoreFor('amicus')
| name | required | default | description |
|---|---|---|---|
providerTaxType pathstring | yes | — | AMICUS tax-code to re-activate. |
empty/api/v1/businesses/:businessId/accounting/amicus/register-manifest
auth: apikeyAMICUS register discovery. The sales agent posts its `dbo.Sites` + `dbo.Tills` snapshot (incrementally: only rows changed since its watermark). The cloud upserts one `Locations` row per site, left `proposed` for admin review, and one `Tills` row per till keyed on `PosRegisterId`, with `MachineId` hostname-normalised. A till's site is resolved from the payload first, then by a DB lookup of the existing location. Existing rows are never overwritten except for source-wins renames and till site moves. Fires `AMICUS_MANIFEST_RECEIVED` plus per-row rename/move audits.
handlers: AccountingAgentSyncController.registerAmicusManifest
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. Must match the API key's `BusinessId`; a mismatch is rejected with 403. |
Authorization headerstring | yes | — | `ApiKey <key>` — validated by `requireApiKey` against the stored key hash. |
capturedAt bodynumber | yes | — | Epoch-ms time the agent captured the snapshot. |
sites body{ amicusSiteNumber: number; name: string; address1: string|null; address2: string|null; suburb: string|null; postcode: string|null }[] | yes | — | AMICUS sites. |
tills body{ amicusTillNumber: number; name: string; computerName: string; amicusSiteNumber: number }[] | yes | — | AMICUS tills. A till whose site cannot be resolved is skipped. |
APIResponseDataObject<AmicusRegisterManifestResponse>APIErrorAPIErrorAPIErrorAPIError/api/v1/accounting/amicus/tax-mappings/seed-from-agent
auth: apikeyAMICUS agent tax-rate seed. The sales agent posts its `dbo.SalesTax` snapshot on startup and whenever a push response carries `requestTaxRateSeed`. Every not-yet-confirmed code is written as a PROPOSAL (`UnmappedTaxTypes`) with its name and rate; nothing is auto-confirmed into `TaxRateMappings`. Already-confirmed codes are skipped unless the source rate or name has drifted, in which case the mapping is deactivated for admin review. The backend also appends the synthetic `VAT-EXCL` exempt sentinel to the proposals (never un-confirming an existing mapping). The business comes from the API key (no path businessId); only `requireApiKey` runs, with no scope check.
handlers: AmicusTaxMappingsController.seedFromAgent
| name | required | default | description |
|---|---|---|---|
Authorization headerstring | yes | — | `ApiKey <key>` — validated by `requireApiKey` against the stored key hash. |
taxRates body{ code: string; name?: string|null; rate?: number|null }[] | yes | — | Rows from AMICUS `dbo.SalesTax` (`code` and `name` are the Name value, `rate` a percentage). |
APIResponseDataObject<{ proposed: { code: string; name: string|null; rate: number|null }[]; alreadyMapped: number; driftDetected: number }>APIErrorAPIError/api/v1/accounting/amicus/tax-mappings/request-seed
auth: jwt (administrator)Admin request for a AMICUS tax-rate re-seed. Sets an in-memory per-business flag; the next AMICUS agent push response carries `requestTaxRateSeed: true`, prompting the agent to call seed-from-agent again. Business is taken from the JWT. Fires `AMICUS_TAX_MAPPING_SEED_REQUESTED`.
handlers: AmicusTaxMappingsController.requestSeed
No parameters.
APIResponseDataObject<{ requested: true }>APIErrorAPIErrorAPIError/api/v1/businesses/:businessId/accounting/amicus/branch-mappings
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)List every AMICUS branch the admin should see: the union of currently discovered branches and stored mappings, so a mapping whose branch vanished from the source is still visible. Each row carries branchId, branchName, locationId (null when unmapped), status ('active' | 'inactive'), discoveredLocationId and proposalStatus.
handlers: AmicusBranchMappingController.list
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<{ branches: AMICUSBranchMappingView[] }>APIError/api/v1/businesses/:businessId/accounting/amicus/branch-mappings/resync-blocked
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Re-evaluate every invoice blocked by branch-certificate routing and dispatch the ones that can now be signed. A parallel action to POST /invoices/reprocess-unmapped, which is scoped to unmapped tax codes and cannot see these block reasons. Quotes (PROFORMA) that become eligible are counted but not dispatched. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is an `APIResponseDataObject` of the re-sync counts (`reprocessed`, `nowEligible`, `nowEligibleInvoices`, `nowEligibleQuotes`, `stillBlocked`, `autoFiscalisationJobIds`).
handlers: AmicusBranchMappingController.resyncBlocked
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<BackgroundRunAcceptedDTO>APIErrorAPIErrorAPIError/api/v1/businesses/:businessId/accounting/amicus/branch-mappings/request-manifest
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Ask the AMICUS sales agent to re-send its sites and tills, so a branch or till added on the AMICUS side appears without restarting the agent. Sets a request that the agent receives as `requestManifest: true` on its next push; the agent then re-sends asynchronously, so the new rows appear shortly after this call returns.
handlers: AmicusBranchMappingController.requestManifest
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
emptyAPIErrorAPIError/api/v1/businesses/:businessId/accounting/amicus/branch-mappings/backfill
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Seed branch mappings from what already-fiscalised invoices attest to, and report which target locations hold no usable certificate. Idempotent and never overwrites an admin's own mapping; a branch whose history names several signing locations is skipped ('conflicting_history') rather than guessed.
handlers: AmicusBranchMappingController.backfill
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<object>APIErrorAPIError/api/v1/businesses/:businessId/accounting/amicus/branch-mappings/:branchId
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Assign this AMICUS branch to a business Location. The mapping decides which certificate signs the branch's invoices, so a write changes fiscalisation behaviour for its future sales. locationId is required and non-null; clearing is the separate DELETE.
handlers: AmicusBranchMappingController.setMapping
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
branchId pathstring | yes | — | AMICUS Sites.number — the source system's own identifier (1-100 chars, not a uuid). |
locationId bodyuuid | yes | — | Business Location whose certificate signs this branch's invoices. |
branchName bodystring | no | — | Branch display name at assignment time (max 255 chars), cached so the row stays labelled if the branch later disappears from the source. |
emptyAPIErrorAPIErrorAPIError/api/v1/businesses/:businessId/accounting/amicus/branch-mappings/:branchId
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Clear the mapping for this AMICUS branch. Idempotent: clearing an absent mapping is still 204. The branch's future invoices then block rather than falling back to the business default certificate.
handlers: AmicusBranchMappingController.clearMapping
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
branchId pathstring | yes | — | AMICUS Sites.number — the source system's own identifier (1-100 chars, not a uuid). |
emptyAPIErrorAPIError