---
title: PositivePayService
summary: API reference for PositivePayService.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# PositivePayService

Implements `IPositivePayService`, building the bank Positive Pay fixed-width file that reports newly issued and newly canceled checks for a given processing date, using `PositivePayView` reporting data. It depends only on `IUnitOfWork` for querying `PositivePayView`; it writes the resulting file via the `FileWriter<PositivePayView>` helper and `PositivePayConfig` layout.

## Purpose
- Identifies newly issued checks (unreleased/reconciled statuses excluded) and newly canceled checks for a processing date, tagging each as a detail record.
- Builds a summary totals record (record count and total dollar amount) to append after the detail records.
- Writes the accumulated detail and totals records to a fixed-width `.prn` file at the requested output path.
- Exposes any exception encountered during processing via a settable `DataException` property.

## Context
- Namespace: `SAIF.Services.PositivePay`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| PositivePayService(...) | `public PositivePayService(IUnitOfWork uow)` | Validates `uow` is non-null via `Enforce.ArgumentNotNull` and wires it in. |
| DataException | `public Exception DataException { get; set; }` | Holds an exception captured by the caller during file processing, for later inspection; not set internally by this type. |
| ProcessDetailRecords | `public bool ProcessDetailRecords(DateTime positivePayDate)` | Loads newly issued checks (issue date matches, status in {1,3,4,5,6}, not yet reconciled) and newly canceled checks (reconciliation date matches, status in {3,4,5,6}) for the given date, tags them as detail records, and returns whether any records were found. |
| CreatePositivePayFile | `public int CreatePositivePayFile(ILogWriter controlLog, string outputFilePath, string fileName, DateTime positivePayDate)` | Calls `ProcessDetailRecords`, and if any detail records were produced, appends a totals record and writes the full record set to `{outputFilePath}\{fileName}.prn`; returns the number of detail records processed (0 if none). |

## Behavioral notes
- Detail record accumulation (`_positivePayFileRecords`) is instance state built up across calls to `ProcessDetailRecords`, so calling it more than once on the same instance for different dates would accumulate records from all calls rather than replacing them*.
- The totals record's dollar amount is computed by parsing each detail record's `DollarAmount` string as a `long`, implying Positive Pay amounts are represented as whole-cent or whole-dollar integer strings rather than decimals*.
- No output file is written at all when there are zero detail records for the requested date, avoiding an empty/header-only Positive Pay submission to the bank.

> **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/PositivePay/PositivePayService.cs
