vsmsconnect — API — atrex

← all endpoints

POST/api/v1/businesses/:businessId/accounting/atrex/sync auth: apikey

On-premise Atrex agent push. Same shape as the other agent sync routes but scope-bound to `atrex`. A pushed row with `voided: true` is a cancellation signal for an already-pushed source invoice (identified by `posSaleId`) rather than a new sale. When an admin has requested an Atrex tax-rate re-seed, the response carries `requestTaxRateSeed: true`; an empty `invoices` array is allowed.

handlers: AccountingAgentSyncController.syncAtrex

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Must match the API key's `BusinessId`; a mismatch is rejected with 403.
Authorization header
string
yes—`ApiKey <key>` — validated by `requireApiKey` against the stored key hash.
invoices body
PushInvoice[]
yes—Array of pushed invoices (`AccountingInvoice` shape). Optional provider fields include `posSaleId`, `voided`, `originalPaymentExternalId` and payment `sourceReceiptId`. Empty array allowed.

Outputs

200
APIResponseDataObject<PushInvoicesResponse>
Push result summary (accepted / skipped / errors / outcomes). Includes `requestTaxRateSeed: true` when a re-seed was requested.
401
APIError
AUTH_UNAUTHORIZED — missing or invalid (unknown or revoked) API key.
403
APIError
USER_FORBIDDEN — the API key does not belong to the business in the path.
403
APIError
USER_FORBIDDEN — API key scope does not match `atrex`. Unscoped keys pass.
422
APIError
VALIDATION_ERROR — body or path failed schema validation.
POST/api/v1/accounting/atrex/tax-mappings/seed-from-agent auth: apikey

Atrex agent tax-rate seed. The sales agent posts its `TaxCat` 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. Also refreshes the business's V-SDC tax-rate snapshot, best-effort. The business comes from the API key (no path businessId); only `requireApiKey` runs, with no scope check.

handlers: AtrexTaxMappingsController.seedFromAgent

Inputs

namerequireddefaultdescription
Authorization header
string
yes—`ApiKey <key>` — validated by `requireApiKey` against the stored key hash.
taxCats body
{ code: string; name?: string|null; rate?: number|null }[]
yes—Rows from the Atrex `TaxCat` table. Atrex has no native V-SDC label, so the admin still picks the label.

Outputs

200
APIResponseDataObject<{ proposed: { code: string; name: string|null; rate: number|null }[]; driftDetected: number }>
Codes proposed this call and count of drift deactivations.
401
APIError
AUTH_UNAUTHORIZED — missing or invalid (unknown or revoked) API key.
422
APIError
VALIDATION_ERROR — body or path failed schema validation.
POST/api/v1/accounting/atrex/tax-mappings/request-seed auth: jwt (administrator)

Admin request for a Atrex tax-rate re-seed. Sets an in-memory per-business flag; the next Atrex agent push response carries `requestTaxRateSeed: true`, prompting the agent to call seed-from-agent again. Business is taken from the JWT. Fires `ATREX_TAX_MAPPING_SEED_REQUESTED`.

handlers: AtrexTaxMappingsController.requestSeed

Inputs

No parameters.

Outputs

202
APIResponseDataObject<{ requested: true }>
Re-seed flagged for the next agent push.
401
APIError
AUTH_UNAUTHORIZED — missing or invalid access token.
403
APIError
USER_FORBIDDEN — caller is not an administrator.
409
APIError
BUSINESS_CONTEXT_REQUIRED — no active business on the JWT.
GET/api/v1/accounting/atrex/tax-mappings auth: jwt (administrator)

List Atrex tax-mappings for the caller's business (`Provider='atrex'`). Registered by the generic per-provider loop in AccountingAgentTaxMappingsRoute.

handlers: AccountingAgentTaxMappingsController.listFor('atrex')

Inputs

No parameters.

Outputs

200
APIResponseDataList<TaxRateMappingDTO>
Atrex mappings, including deactivated rows (isActive=false).
409
APIError
BUSINESS_CONTEXT_REQUIRED — no active business on the JWT.
PUT/api/v1/accounting/atrex/tax-mappings auth: jwt (administrator)

Upsert one Atrex tax-mapping (provider tax code to V-SDC label). Same body shape as the other tax-mapping CRUD surfaces; the service validates the V-SDC label.

handlers: AccountingAgentTaxMappingsController.upsertFor('atrex')

Inputs

namerequireddefaultdescription
providerTaxType body
string
yes—Atrex tax-code (1-100 chars).
providerTaxName body
string | null
no—Human-readable tax name (max 500 chars).
providerRate body
number | null
no—Provider tax rate.
vsdcTaxLabel body
string
yes—V-SDC tax label (1-10 chars).
vsdcRate body
number | null
no—V-SDC rate percent.

Outputs

200
APIResponseDataObject<TaxRateMappingDTO>
Upserted mapping.
422
APIError
Invalid V-SDC label or schema violation.
409
APIError
BUSINESS_CONTEXT_REQUIRED — no active business on the JWT.
DELETE/api/v1/accounting/atrex/tax-mappings/:providerTaxType auth: jwt (administrator)

Soft-delete a Atrex tax-mapping (`IsActive=0`). Idempotent.

handlers: AccountingAgentTaxMappingsController.removeFor('atrex')

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—Atrex tax-code to deactivate.

Outputs

204
empty
No content.
409
APIError
BUSINESS_CONTEXT_REQUIRED — no active business on the JWT.
PATCH/api/v1/accounting/atrex/tax-mappings/:providerTaxType/restore auth: jwt (administrator)

Re-activate a deactivated Atrex mapping (`IsActive=1`). Idempotent.

handlers: AccountingAgentTaxMappingsController.restoreFor('atrex')

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—Atrex tax-code to re-activate.

Outputs

204
empty
No content.
409
APIError
BUSINESS_CONTEXT_REQUIRED — no active business on the JWT.