Skip to content

WitnessSubpoenaProcess

Batch-generates the mail-room print package for witness-type subpoenas (excluding those with a process server or flagged zero-pay-no-mail) and the separate cash-disbursement request package for witness fee payments, using ISubpoenaDocumentService to build per-recipient document XML, ISubpoenaLabelService to pre-generate certified mailing labels for the standard "WITNESS" batch, IEnvironmentService to resolve Xpressions file paths, and IUnitOfWork to persist the resulting XPrintControl/XDocument batch records — including OnBase imaging index (IDX) metadata per document.

Purpose

  • Generates the XPressions print-batch XML and imaging index entries for witness subpoena documents ready to pay, writing an empty placeholder XML file when there is nothing to print.
  • Pre-generates recipient certified mailing labels before building the document batch, but only for the standard "WITNESS" process (not "CASHDISBURSEMENT" or process-server variants).
  • Generates the combined cash-disbursement-request XML package for all recipients of ready-to-pay witness subpoenas, aggregating per-recipient disbursement fragments into one XPressions document.

Context

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

Public members

Member Signature Purpose
WitnessSubpoenaProcess (constructor) public WitnessSubpoenaProcess(IUnitOfWork unitOfWork, ISubpoenaDocumentService subpoenaDocumentService, ISubpoenaLabelService subpoenaLabelService, IEnvironmentService environmentService) Wires the unit of work, subpoena document service, subpoena label service, and environment configuration accessor, null-checking all four collaborators.
GenerateWitnessDocuments public long GenerateWitnessDocuments(XPrintBatchArguments batchArguments) Resolves check/XML output paths from configuration, selects ready-to-pay witness subpoenas without a process server (excluding zero-pay-no-mail), pre-generates recipient labels for the "WITNESS" process, builds a SubpoenaDocumentsConfiguration per recipient (with an OnBase IDX index string per document) inside a transaction, writes the resulting XPressions XML (or an empty placeholder if there are no documents), and returns the number of documents generated.
GenerateWitnessCashDisbursementRequest public long GenerateWitnessCashDisbursementRequest(XPrintBatchArguments batchArguments) Resolves output paths, selects the approved witness-type subpoenas for the given process, builds and concatenates each recipient's cash-disbursement XML fragment via ISubpoenaDocumentService.GenerateCashDisbursement, records a single print-control/document entry for the batch inside a transaction, writes the assembled <Documents> XML (or an empty placeholder if none), and returns the number of qualifying subpoenas.

Behavioral notes

  • GetApprovedSubpoenas branches subpoena selection by processType: "WITNESS"/"CASHDISBURSEMENT" select witness-type subpoenas with no process server and not zero-pay-no-mail; any other process type selects the complementary set (has a process server, or is zero-pay-no-mail).
  • Recipient labels are only pre-generated for the "WITNESS" process type inside GenerateWitnessDocuments, not for "CASHDISBURSEMENT" or process-server document runs.*
  • Uses a different mail-room instruction string ("Deliver to Transformers Team") when IEnvironmentService.IsProduction is false, redirecting non-production batches away from the live mail room, for both document and cash-disbursement instructions.*
  • Do-not-mail subpoenas suppress the window-envelope flag and certified-label file path on their generated document configuration.
  • Sanitizes generated XML by renaming internal DTO element names to the external XPressions schema (SubpoenaDocumentsConfiguration→clsPaymentTransaction, ArrayOfclsPaymentTransaction→clsPaymentTransactionCollection, SubpoenaDocument→Subpoena) and un-escaping doubly-encoded <br> tags before writing the file, matching the convention used by OpposingCounselService and ZeroPaySubpoenaProcess.
  • GenerateCashDisbursements skips a recipient's disbursement fragment (returning an empty string) if the generated XML lacks a <DocumentDate> element, silently omitting that recipient from the final package.*

Constraints and usage notes

  • GenerateWitnessDocuments and GenerateWitnessCashDisbursementRequest both throw via Enforce.ArgumentNotNull if batchArguments is null.
  • CreateIdxString hardcodes several OnBase imaging fields (BatchJobName = "AUTOIMPORT", ImageFileCode = "LEGAL", CreateUser = "BATCH", Spec = "OnBase16"), so document imaging metadata is not configurable per batch run.*

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/Legal/Subpoenas/WitnessSubpoenaProcess.cs