Skip to content

Approved time and payroll handoff

Payroll handoff starts from attested own-company time, not planned hours or an imported approved label. The row needs recorded approval identity/time and the trusted approval origin. A prepared or submitted handoff remains different from accepted payroll processing or wages paid.

The agreed first-stage destination is the accounting bureau’s Fortnox Lön through PAX. Issue #450 still owns format/encoding, employee/code/salary-form agreement and a controlled receiving-system import. The implemented direct connector path remains a separate disabled later stage. Its existence does not establish an accepted PAX export or permission to enable direct payroll.

Dimension Inspected direct-handoff requirement Refusal or limit
Time ownership Own-company, non-deleted report UE time is excluded
Attestation Approved status, approved_at, fk_approved_by, no self-approval Historical status alone is insufficient
Origin No external source ID and approval_origin=backoffice Imported/history-origin rows never autoqueue
Corrections No unresolved correction relationship Correction requires explicit review
Employee One active, non-deleted provider employee mapping Missing or ambiguous mapping blocks; PAX employee-number agreement is a separate identity contract
Time type Explicit activity/overtime-to-CauseCode mapping A provider code’s existence does not decide payroll treatment
Connection Active exact binding, salary scope, verified license, configured connector and payroll gate Every gate must pass; destination changes clear verification and disable the gate

The backoffice approval endpoint records the actor, timestamp and origin using its current-version checks. For a newly attested native row, _autoqueue_new_attestation can prepare and queue the durable export when activation, mappings and all other gates pass. It performs no connector I/O in the route. Its response distinguishes not activated, needs action, queued and already queued.

The explicit prepare and confirmed-queue endpoints also remain available. Preparing freezes the source, exact destination, payload and hash. An existing pending/submitted/succeeded attempt is reused rather than creating another command. A retry after a lost approval response observes durable state; mismatched prepared facts require review. Imported approvals remain historical_import and do not enter that automatic path.

This distinction matters for functional testing: clicking approval can create downstream work. Vi Målar is bound to real Fortnox company 1160465. Neither a time approval that queues payroll nor a send/export/final attest may be used as a test there. The permitted test company 1026975 has no bound Toolora tenant at this review.

flowchart LR
Report[Reported own-company time] --> Attest[Actor-bound attestation]
Attest --> Gates[Origin, mappings and activation gates]
Gates --> Frozen[Frozen intent and payload]
Frozen --> Queue[Durable queue]
Queue --> Check[Worker rechecks source and claim]
Check --> Connector[Shared connector command]
Connector --> Outcome[Provider receipt or needs review]
Outcome --> Payroll[Separate bureau payroll acceptance]
Attestation and queued handoff remain separate from provider acceptance and payroll.

The worker rechecks source/destination, gate and claim at submission. Source freeze guards prevent edits racing queued work. The request has a stable report/revision identity and exact payload hash. Disabling the gate stops future submissions but cannot recall an already submitted command.

An ambiguous submission or success without a provider transaction ID enters reconciliation. It must not be blindly replayed. Proven-unsent attempts can be deliberately re-prepared while preserving earlier snapshots. Background outcomes explains why a queue status is not an external receipt.

A native eight-hour report with another person’s backoffice attestation and unique employee/code mapping can be eligible when every destination gate passes. The same hours imported with an external source ID are excluded from automatic handoff. Neither example proves the bureau imported a PAX file or calculated salary correctly.

Tests specify attestation/replay, historical exclusion, mapping ambiguity, claim loss and uncertain outcomes with substitutes. Real receiving-system reconciliation and the first PAX acceptance remain open. Integration recovery and source identity retain those limits.