SubpoenaLabelService¶
Generates certified-mail shipping labels for subpoena recipients and opposing-counsel/worker copies by building CertifiedLabelData from subpoena, recipient, provider, and legal-case address data and rendering it to a GIF via Proxy.ISimpleCertifiedMailServiceProxy. It resolves recipient/provider addresses through IProviderInformationService, and when SaveLabelAsGif reports an invalid address it emails the responsible approver, mailroom, and support teams through IEmailService with the specific address and subpoena details.
Purpose¶
- Batch-generates certified labels for every recipient of ready-to-pay subpoenas flagged for certified mail special handling.
- Generates the certified label(s) for all recipients of a single subpoena, branching between witness and provider/registered-agent label formats.
- Generates the opposing-counsel (or, absent an attorney firm, worker) certified label for a subpoena and reports the required envelope size back to the caller.
- Sends a notification email identifying the invalid address, claim, WCB number, worker name, and subpoena when the certified-mail proxy rejects a label as undeliverable.
Context¶
- Namespace:
SAIF.Services.Legal.Subpoenas - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| SubpoenaLabelService (constructor) | public SubpoenaLabelService(IUnitOfWork unitOfWork, IEnvironmentService environmentService, IProviderInformationService providerInformationService, IEmailService emailService, Proxy.ISimpleCertifiedMailServiceProxy certifiedMailService) |
Wires the unit of work, environment configuration, provider address lookups, email sending, and the SimpleCertified label-rendering proxy; null-checks all but emailService. |
| GenerateBatchLabels | public long GenerateBatchLabels() |
Finds all ready-to-pay subpoenas flagged for certified special handling, generates recipient labels for each, and returns the total number of recipient labels produced across the batch. |
| GenerateRecipientLabels | public long GenerateRecipientLabels(long subpoenaId) |
Builds and saves a certified label GIF for every recipient of the subpoena — witness-format for witness-type subpoenas, provider/registered-agent format otherwise — emailing an invalid-address notice for any recipient whose label the proxy rejects, and returns the recipient count (0 if the subpoena has no recipients). |
| GenerateOpposingCounselLabel | public Label.LabelSizeOptions GenerateOpposingCounselLabel(long subpoenaId, ref string addressee) |
Builds and saves the opposing-counsel (or worker, if no attorney firm) certified label GIF for the subpoena, sets addressee to the formatted "to" address, emails an invalid-address notice if the proxy rejects it, and returns the resulting LabelSizeOptions (Unknown if the subpoena has no recipients or the label could not be sized). |
Behavioral notes¶
- Catches
Proxy.SimpleCertifiedExceptionaround everySaveLabelAsGifcall and, on failure, sends an invalid-address notification email rather than propagating the exception, so a bad address does not abort label generation for other recipients.* InitializeLabelreturns an emptyCertifiedLabelData(rather than throwing) when the requesting employee or the SAIF hearing-location address cannot be found, signaling a no-op label to callers.- Page count for the label is computed as
(recipientCount * 2) + (includesPayment ? 2 : 1), andCreateOpposingCounselLabel/CreateWorkerLabelswallowProxy.InvalidNumberOfPagesExceptionby returning aLabelSize = Unknownresult.* - Opposing-counsel addressing prefers the attorney firm's non-expired correspondence address, falling back to its non-expired physical address; worker addressing prefers the most recently updated home address, then mailing address, then primary address.
FormatEmailForInvalidAddresssends to the subpoena approver plus mailroom in production, or to a configured developer distribution list outside production, always CC'ing the developer emails.*
Constraints and usage notes¶
SendEmailForInvalidAddressthrows viaEnforce.ArgumentNotNullifsubpoenaisnull.FormatEmailForInvalidAddressthrows viaEnforce.ArgumentNotNullifsubpoenaormessageisnull.- Address zip codes for witness/policy/opposing-counsel labels are left-padded to standard lengths (5-digit zip, 4-digit plus-four) before being written to the label, defaulting to
"0000"when a plus-four segment is absent.*
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/SubpoenaLabelService.cs