Skip to content

DocumentDeferredService

Implements IDocumentDeferredService, supporting the certified-mail deferred print workflow: it reads XPression output-tracking XML to determine sheet counts, builds CertifiedLabelData for the ISimpleCertifiedMailServiceProxy from a DocumentLabelData payload, deserializes/normalizes label data (including splitting ZIP+4 codes) from JSON, and validates required certified-mail address fields.

Purpose

  • Determines the number of physical sheets in a generated document batch by reading an XPression-produced tracking XML file from the configured output directory.
  • Builds a CertifiedLabelData request for the certified-mail service from label data, normalizing ZIP/ZIP+4 formatting.
  • Deserializes and normalizes label data supplied as a JSON string (splitting combined 9-digit ZIPs into ZIP and ZIP+4).
  • Validates that all required certified-mail "from"/"to" address fields are present, returning the first missing-field message.

Context

  • Namespace: SAIF.Services.Documents
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
DocumentDeferredService(...) public DocumentDeferredService(Proxy.ISimpleCertifiedMailServiceProxy certifiedMailService, IEnvironmentService environmentService) Stores the certified-mail service proxy and environment collaborators, requiring both to be non-null.
SheetCount public long SheetCount(string itemXml) Locates the XPression DC40-CertifiedSheetCount.ps.xml tracking file in the configured output directory and returns the TotalSheetsInPackage attribute value found there, defaulting to 1 if no matching attribute is found, or 0 if no tracking file exists.
GetCertifiedLabel public CertifiedLabelData GetCertifiedLabel(DocumentLabelData documentLabelData) Builds a CertifiedLabelData request (from/to address, contact, credentials, and page count) from documentLabelData for submission to the certified-mail service, defaulting a blank ZIP+4 to four spaces.
GetDocumentLabel public DocumentLabelData GetDocumentLabel(string labelValues) Deserializes labelValues (JSON) into a DocumentLabelData, splitting any 9+ digit ZIP into a 5-digit ZIP and separate ZIP+4, and normalizing a literal "0000" ZIP+4 to blank spaces.
AddressErrorMessage public string AddressErrorMessage(DocumentLabelData certifiedLabelData) Returns the first descriptive error message for a missing required certified-mail "from"/"to" address field, or an empty string if all required fields are present.

Behavioral notes

  • SheetCount ignores its itemXml parameter's originally intended per-batch document key lookup (that logic is commented out) and instead always searches for the same fixed DC40-CertifiedSheetCount.ps.xml filename*.
  • AddressErrorMessage checks fields in a fixed order and returns on the first failure, so only one missing-field message is ever surfaced per call even if multiple fields are blank.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/Documents/DocumentDeferredService.cs