@accounter/server
Version:
Accounter GraphQL server
16 lines (15 loc) • 986 B
TypeScript
import type { Document, DocumentCharge, Transaction, TransactionCharge } from '../types.js';
/**
* Classify a candidate charge into the shape the matching algorithm consumes.
*
* Mirrors the auto-match unmatched-charge semantics: a charge is only a valid
* match candidate when it is transaction-based (has transactions but no receipt
* documents) or document-based (has accounting documents but no transactions).
* Matched charges (both sides) and empty charges (neither) return `null`.
*
* @param chargeId - Candidate charge UUID
* @param transactions - All transactions on the charge
* @param accountingDocuments - The charge's documents, pre-filtered to accounting documents
* @returns A `TransactionCharge`/`DocumentCharge` for valid candidates, or `null`
*/
export declare function classifyCandidateCharge(chargeId: string, transactions: Transaction[] | null | undefined, accountingDocuments: Document[] | null | undefined): TransactionCharge | DocumentCharge | null;