import { ok, type ReadonlyDB } from "@tailor-platform/erp-kit/core"; import type { DB } from "../generated/kysely-tailordb"; export interface GetIncomingPaymentInput { id: string; } /** Returns the AR payment facts required by downstream cash reconciliation. */ export async function run(db: ReadonlyDB, input: GetIncomingPaymentInput) { const incomingPayment = await db .selectFrom("IncomingPayment") .selectAll() .where("id", "=", input.id) .executeTakeFirst(); return ok({ incomingPayment: incomingPayment ?? null }); }