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 ID: HR-PAY-08-AZ
Status: πŸ“ Planned
Last Updated: 2026-02-16
This document describes the outbound integration from Encore Health OS to Arizona Department of Revenue (AZ DOR) and Arizona Department of Economic Security (AZ DES). No cross-core dependencies; integration is external agency only.

Integration Summary

FromToPatternProtocolPhaseDescription
HR-PAY-08-AZAZ DOROutboundSOAP Web Services (AZFSET)Phase 2A1-QRT, A1-R, A1-APR, W-2/W-2c state data via AZFSET SendSubmissions
HR-PAY-08-AZAZ DOROutboundFile Download (Manual Upload)Phase 1XML file generation for manual upload to AZFSET portal
HR-PAY-08-AZAZ DESOutboundSFTP over SSHPhase 2/3New hire CSV upload to AZ DES SFTP server
HR-PAY-08-AZAZ DESOutboundFile Download (Manual Upload)Phase 1CSV file generation for manual upload to AZ DES portal

AZ DOR (Arizona Department of Revenue)

AZFSET SOAP Web Services API

  • API Version: Implementation Guide v1.5
  • Protocol: SOAP 1.1/1.2 with MTOM attachments
  • Authentication: WS-Security username/password token per request
    • SAML and X.509 documented but β€œnot released for use at this time”
  • Credentials: Stored in Lovable Cloud Secrets (AZ_DOR_WS_USERNAME, AZ_DOR_WS_PASSWORD)

Endpoints

EnvironmentBase URLPurpose
Productionefile.azdor.gov/fset/{ServiceName}Live submissions
Testquatefile.azdor.gov/fset/{ServiceName}Validation and testing

Available Services

ServicePurposeRequest
SendSubmissionsSubmit returns (XML in nested ZIP, MTOM)Submission package
GetNewAcksRetrieve unread acknowledgmentsTransmitter ID
GetAcksRetrieve acks by date rangeDate range + Transmitter ID
GetAckRetrieve specific ack by submission IDSubmission ID
GetAcksByMsgIDRetrieve acks by message IDMessage ID

Submission Format

  • Payload: XML per AZFSET schemas (A1-QRT, A1-R, A1-APR, A1-WP)
  • Packaging: Nested ZIP per PKWARE 6.2.0
    • Inner submission ZIPs: compressed
    • Outer container ZIP: uncompressed (store mode)
    • Transmitted as MTOM attachment in SOAP envelope
  • Submission ID: 20 chars = EFIN(6) + ccyyddd(7) + sequence(7)
  • Message ID: ETIN + ccyyddd + 8-char alphanumeric

Submission Categories

CategoryForm Types
StateWHA1-QRT, A1-WP (quarterly withholding)
StateAnnualA1-APR, A1-R (annual reconciliation)
StatePaymentPayment submissions
EnrollmentTransmitter enrollment

Registration Requirements

  • ETIN: IRS-issued Electronic Transmitter ID (stored in Cloud Secrets as AZ_DOR_ETIN)
  • EFIN: IRS-issued Electronic Filer ID (stored in Cloud Secrets as AZ_DOR_EFIN)
  • Portal: Register at AZFSET as β€œWeb Service – Transmitter”
  • Client list: Must be updated by the first of each month

Error Codes

AZFSET returns error codes in the pattern 1xxyyy:
Code RangeCategoryDescription
101xxxMissing required fieldsEIN, name, address, period
102xxxIncorrect amountsWithholding, wages, payments mismatch
103xxxQuarter/year/liabilityInvalid quarter, year, or liability
104xxxSubmission formatInvalid XML, ZIP, or field format
109xxxPayment/bank errorsInvalid routing, account, or payment amount

Manual Upload (Phase 1 Fallback)

  • Portals: AZ Web File (AZFSET) at efile.aztaxes.gov/AZFSETPortal; AZTaxes at aztaxes.gov/Home/Page
  • Formats: XML per AZFSET schemas (same format as SOAP, without SOAP envelope/ZIP)
  • Contract: File download from Encore Health OS β†’ manual upload to portal with instructions

AZ DES (Arizona Department of Economic Security) β€” New Hire

SFTP Integration (Phase 2/3)

  • Protocol: SFTP over SSH
  • Credentials: Stored in Lovable Cloud Secrets:
    • AZ_DES_SFTP_HOST β€” SFTP server hostname
    • AZ_DES_SFTP_USERNAME β€” SFTP username
    • AZ_DES_SFTP_PASSWORD β€” SFTP password (or SSH key)
  • Library: npm:ssh2 in Supabase Edge Functions (Deno)

CSV Format

  • Layout: 35-field CSV (see spec for complete field list)
  • Key fields:
    • Fields 1-2: Record header (β€œAZ Newhire Record”, β€œCSV1”)
    • Fields 3-20: Employee data (name, SSN, address, DOB, hire date, medical insurance)
    • Fields 21-35: Employer data (FEIN, name, DBA, address, phone, multistate indicator)
  • Date format: MMDDYYYY (no separators)
  • SSN/FEIN: 9 digits, no hyphens
  • Frequency: Within 20 days of hire

Manual Upload (Phase 1 Fallback)

  • Portal: AZ DES New Hire Reporting
  • Methods: Secure web upload, file upload
  • Contract: CSV file download from Encore Health OS β†’ manual upload to portal with instructions

Secrets Requirements

SecretPurposePhase
AZ_DOR_WS_USERNAMEAZFSET Web Service usernamePhase 2
AZ_DOR_WS_PASSWORDAZFSET Web Service passwordPhase 2
AZ_DOR_ETINElectronic Transmitter IDPhase 2
AZ_DOR_EFINElectronic Filer IDPhase 2
AZ_DES_SFTP_HOSTNew Hire SFTP server hostnamePhase 2/3
AZ_DES_SFTP_USERNAMESFTP usernamePhase 2/3
AZ_DES_SFTP_PASSWORDSFTP password (or SSH key)Phase 2/3
All secrets stored via Lovable Cloud Secrets (Settings > Cloud > Secrets). Accessed in edge functions via Deno.env.get('SECRET_NAME'). Never in code, migrations, or database columns.

Technical Implementation Notes

  • SOAP from Deno: No native SOAP library; XML hand-built with template strings. WS-Security username/password header is straightforward. MTOM attachment requires ZIP packaging.
  • ZIP packaging: AZFSET requires PKWARE 6.2.0 nested ZIPs. Outer ZIP uncompressed (store mode), inner ZIPs compressed. Use fflate npm package (npm:fflate in Deno).
  • SFTP from Deno: Use npm:ssh2 package. Deno.Command not available in Supabase Edge Functions.
  • Test routing: hr_module_settings.az_efile_test_mode determines endpoint (production vs test). All test submissions tagged test_mode = true in hr_tax_efile_submissions.

CROSS_CORE_INTEGRATIONS.md

No cross-core integration; HR-PAY-08-AZ depends only on HR-PAY-04 (data source) and PF. External integrations are outbound to AZ DOR (SOAP/manual) and AZ DES (SFTP/manual) only.