Skip to content

SubpoenaDocumentService

Builds and prints the individual legal-document package for a subpoena — the notice/certificate text, addressee (recipient, opposing counsel, hearing location, worker) blocks, and any accompanying witness cash-disbursement request or process-server email — using IDocumentService to render/print the assembled XML package, IProviderInformationService/IPolicyInformationService to resolve mailing addresses, IUserProfileService to stamp the requesting user's contact details, and ICCClaimApiService/IUnitOfWork to read claim and subpoena data. It is also the shared document-record factory (AddSubpoenaDocumentToList) consumed by the opposing-counsel, witness, and zero-pay batch processes to build their own print packages.

Purpose

  • Generates a PDF preview of a single subpoena document for on-screen review before printing.
  • Prints the full subpoena document package (duplexed for medical-records/claims/other-medical types) and, for non-zero-pay witness subpoenas, also generates the associated cash-disbursement request document.
  • Emails the process server the subpoena PDF and instructions when a process-server email list is supplied.
  • Supplies the per-recipient SubpoenaDocument records (addressee, hearing, and attorney/worker details) used by other batch-print processes to assemble their own document configurations.
  • Produces the raw cash-disbursement-request XML fragment for a single subpoena recipient.

Context

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

Public members

Member Signature Purpose
SubpoenaDocumentService (constructor) public SubpoenaDocumentService(IUnitOfWork unitOfWork, IDocumentService documentService, IProviderInformationService providerInformationService, IPolicyInformationService policyInformationService, IUserProfileService userProfileService, IEnvironmentService environmentService, ILogService logService, ICCClaimApiService claimApiService) Wires the unit of work, document rendering/printing service, provider and policy address lookups, current-user profile, environment configuration, logging, and Claim Center claim API client used to build subpoena documents.
GetPreviewSubpoena public byte[] GetPreviewSubpoena(long id) Builds the single-recipient document XML (defaulting the opening text when absent, appending the certified/no-mail special-handling marker) for the subpoena's first recipient and renders it to a PDF byte array via IDocumentService.GeneratePdf; returns an empty-body PDF if the subpoena has no recipients.
PrintSubpoena public bool PrintSubpoena(long id, string processServerEmailList) Assembles the full print package for every recipient of the subpoena (duplex for medical/claims/other-medical types, two copies for un-emailed process-server or zero-pay-no-mail cases), sends it to IDocumentService.PrintService, additionally generates witness cash-disbursement documents for non-zero-pay witness subpoenas, and emails the process server when an email list is supplied; returns false if the subpoena has no recipients.
AddSubpoenaDocumentToList public IList<SubpoenaDocument> AddSubpoenaDocumentToList(long id, long recipientId) Returns the SubpoenaDocument record(s) for the subpoena — for every recipient when recipientId is 0, or for the single matching recipient otherwise — used as building blocks by other batch print processes; returns an empty list if the subpoena or its recipients cannot be found.
GenerateCashDisbursement public string GenerateCashDisbursement(long id, long recipientId) Builds the cash-disbursement-request XML fragment for the given subpoena recipient and returns it with the XML declaration stripped; returns an empty string if the subpoena has no recipients.

Behavioral notes

  • Carries a CA1506:AvoidExcessiveClassCoupling suppression, reflecting its dependency on document, provider, policy, user-profile, environment, logging, and claim-API collaborators.*
  • PrintSubpoena conditionally forces duplex printing for medical-records, claims, and other-medical subpoena types, and forces two copies when there is no process server or when the subpoena is zero-pay/do-not-mail and unemailed.*
  • Cash-disbursement generation (GenerateCashDisbursements/AddRecipientCashRequestToEmail) is only triggered from PrintSubpoena for witness-type, non-zero-pay subpoenas.
  • Recipient addressing (DetermineRecipientAddress, GetWitnessAddresses, GetPolicyLocationAddress, GetProviderAddress, GetOpposingCounselAddress) resolves from provider location, legal-person, or policy-location data depending on recipient type, falling back through multiple address sources.*
  • Renames internal DTO element names to the external XPressions schema (ArrayOfSubpoena→Subpoenas, SubpoenaDocument→Subpoena) before emitting document XML, matching the same convention used by the opposing-counsel, witness, and zero-pay batch processes.

Constraints and usage notes

  • Only unitOfWork, documentService, environmentService, providerInformationService, policyInformationService, userProfileService, and logService are null-checked in the constructor via Enforce.ArgumentNotNull; claimApiService is not.*
  • SetProcessServerAddress throws via Enforce.ArgumentNotNull if its subpoenaConfiguration argument is null.

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/SubpoenaDocumentService.cs