Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Spec Reference: HR-PAY-02 Payroll Deductions Management
Status: ๐ŸŸก Partial โ€” Phase 1 (schema/RLS) complete; event contracts (HR-11 โ†’ HR-PAY-02) planned but not yet implemented
Last Updated: 2026-02-27
This document summarizes integration points between HR-PAY-02 (Payroll Deductions) and HR-07, HR-PAY-01, HR-11, and PF-11. Event payloads are defined in EVENT_CONTRACTS.md; API/flow details are expanded in the spec Implementation Plan and Phase 2/3 expansion.

Integration Summary

FromToPatternDescription
HR-11HR-PAY-02EventBenefit enrollment created/terminated โ†’ auto-create or end-date deductions. Payloads in EVENT_CONTRACTS.md.
HR-PAY-02HR-07Data (inbound to HR-07)Payroll run reads active employee deductions, applies order and caps, creates hr_payroll_deduction_items on finalization.
HR-PAY-02HR-PAY-01Data (inbound to HR-PAY-01)Pre-tax deductions reduce federal taxable income before tax calculation; HR-PAY-01 receives adjusted taxable base.
HR-PAY-02PF-11OutboundCourt order PDFs stored in pf-documents; link via custom_fields on hr_employee_deductions.

HR-11 (Benefits Administration) โ€” Event

  • Events: hr.benefit_enrollment.created, hr.benefit_enrollment.terminated
  • Payload schema and subscriber: EVENT_CONTRACTS.md ยง HR-11 / HR-PAY-02
  • HR-PAY-02 behavior: On created โ†’ create hr_employee_deductions row (amount from payload, pre_tax flag); on terminated โ†’ set end_date on matching deduction. Reconciliation utility (Phase 4) can match existing deductions to enrollments.

HR-07 (Payroll Processing) โ€” Data

  • Usage: Payroll run (wizard) loads active deductions per employee, calls deduction calculation service (Phase 3), shows breakdown in preview step, and on finalization writes hr_payroll_deduction_items and updates hr_employee_deductions.ytd_amount.
  • Data consumed: hr_deduction_types, hr_employee_deductions (effective date filter, status = active). No new API contract; same-core read via Supabase client with RLS.
  • Implementation: See HR-PAY-02 Implementation Plan Phase 3 and HR-PAY-02-PHASE-2-3-EXPANSION.

HR-PAY-01 (Tax Calculation) โ€” Data

  • Usage: Pre-tax deductions reduce federal (and state, where applicable) taxable income before HR-PAY-01 runs. HR-07 (or deduction service) computes taxable gross after pre-tax deductions and passes it to tax calculation.
  • Contract: In-process (same payroll run); no separate API. Flow documented in spec and expansion Phase 3.
  • Implementation: Deduction service returns pre-tax total; payroll run subtracts from gross before calling HR-PAY-01 tax logic.

PF-11 (Document Management) โ€” Outbound

  • Usage: Garnishment court order PDFs stored in pf-documents bucket with restricted access. hr_employee_deductions.custom_fields may store document reference (e.g., document_id or path).
  • Reference: PF-11 Document Management โ€” use platform document APIs for upload and link; no new event contract.

CROSS_CORE_INTEGRATIONS.md

The following rows are recorded in CROSS_CORE_INTEGRATIONS.md:
  • HR-11 โ†’ HR-PAY-02: Event โ€” Benefit enrollment created/terminated; EVENT_CONTRACTS.md
  • HR-PAY-02 โ†’ HR-07: Data โ€” Payroll run consumes deductions and creates deduction items
  • HR-PAY-02 โ†’ HR-PAY-01: Data โ€” Pre-tax deductions reduce taxable income input to tax calculation
  • HR-PAY-02 โ†’ PF-11: Outbound โ€” Court order document storage and link from employee deduction record

Last Updated: 2026-02-27