---
title: Finance reconciliation packs
description: Ready-made Reconciliation setups for a type of business. The hotel pack, what installing one does, upgrades, the pack JSON format, the synthetic hotel month, who may install, and the tools.
section: finance
order: 75
audience: [user, operator, agent]
sources: [services/nodejs-cloud/lib/finance/recon/packs, services/nodejs-cloud/app/(finance)/finance/recon/packs, services/nodejs-cloud/components/finance/recon/PackInstallDialog.tsx, services/nodejs-cloud/migrations/0467_fin_recon_pack_installs.sql]
features: [cloud.page-finance]
---

A **pack** sets an entity up for one type of business in one step. It holds the [sources](/docs/finance/reconciliation-sources.md)
that business reconciles, with a column mapping for each, a [ruleset](/docs/finance/reconciliation-rules.md), a
[contract](/docs/finance/recon-contracts.md) template for each counterparty, and the [case kinds](/docs/finance/reconciliation-runs.md#cases) it
looks for. Packs are configuration, not code, so a new type of business is a new pack file.

Open **Finance > Reconciliation > Packs** (`/finance/recon/packs`). Each pack shows its sources and their columns, its rules in plain words, its
contract templates, its case kinds, and the entities it is installed on.

## The hotel pack {#hotel}

The hotel pack checks one property's money each day:

| Source | Kind | What it holds |
|---|---|---|
| Property system | operational | One line per reservation: confirmation number, channel, departure, rate plan, room revenue, currency, card last four digits, and the virtual card's expiry date |
| Agency A statement | channel | Booking lines (room sales, commission, net) and payout lines, comma separated, `YYYY-MM-DD` dates |
| Agency B remittance | channel | Booking and remittance lines, semicolon separated, `1.234,56` amounts, `DD.MM.YYYY` dates |
| Payment gateway settlement | gateway | Charges, refunds (gross and fee), and the daily batch payouts |
| Bank statement | bank | Booking date, value date, description, amount, currency |

**The file layouts are invented examples.** They do not come from any vendor's real export. Before your first
import, change each source's mapping to match your own files.

The rules, in order:

1. Each Agency A booking line pairs with its reservation by confirmation number. The agency's contract prices the stay.
2. The same for Agency B.
3. Each gateway charge pairs with its direct reservation by reference, within 2 days.
4. Agency A's payout lines pair with bank credits whose description contains the payout ID, within 5 days.
5. The same for Agency B's remittances.
6. Gateway batch payouts pair with bank credits by batch ID, within 3 days.

The contract templates:

- Agency A: 15% commission, 12% on the non-refundable rate (`NRF`), paid 7 days after checkout.
- Agency B: 18% commission, paid 10 days after checkout, no commission on a no-show.

Check both templates against your signed contracts.

The pack detects these cases:

- `over_commission`
- `short_payment`
- `late_payout`
- `missing_payout`
- `duplicate_charge`
- `unexpected_refund`
- `over_payment`
- `unmatched`

It names three cases it does not detect yet:

- `fx_difference`: a payout converted on the way shows as a `short_payment` of the difference.
- `vcc_not_charged`: an agency's virtual card that was not charged before it expired. This is meant as a list for a
  person to act on, because Petawork does not charge cards.
- `unclaimed_no_show`: this needs no-show lines in the property system's export.

The pack also lists two reports: a daily property reconciliation and a monthly agency commission audit.

## Installing {#install}

Click **Install**, then choose:

- the entity;
- a party for each counterparty. Leave one empty to add its contract later;
- the contracts' currency (default: the entity's currency);
- the date the contracts start (default: the first day of this month).

One transaction then makes:

- the sources, with the pack's mappings saved as confirmed by you;
- the ruleset, pointing at the new sources;
- a contract for each counterparty you named a party for.

Each source, ruleset and contract gets its usual event on the Finance event chain. The install itself gets a
`finance.recon_pack.installed` event.

- **Installing again** with nothing new changes nothing and writes no event.
- **Naming a party later** sets it on the source and adds its contract (`finance.recon_pack.completed`).
- **A newer version of a pack** adds what it brings. Each ruleset whose rules changed gets its next version, and the
  old versions stay in its history (`finance.recon_pack.upgraded`). A mapping or contract you changed is never
  overwritten.
- **An older version** than the one installed is refused.
- **A name clash** with one of your own sources or rulesets is refused. Rename or archive yours, then install again.

## The pack format {#format}

A pack is one JSON file in `services/nodejs-cloud/lib/finance/recon/packs/` (`hotel.json`). It is listed in `index.ts`
and checked when it loads.

```json
{
  "format": "petawork.recon-pack/1",
  "key": "hotel", "version": 1, "name": "Hotel", "description": "...",
  "counterparties": [{ "key": "agency_a", "name": "Agency A", "description": "..." }],
  "sources": [{
    "key": "agency_a", "name": "Agency A statement", "kind": "channel", "format": "csv",
    "counterparty": "agency_a", "template": "...",
    "mapping": { "date": "Payout date", "dateFormat": "YYYY-MM-DD", "amount": { "type": "signed", "column": "Net" },
                 "currencyColumn": "Currency", "fields": { "commission": { "column": "Commission", "type": "amount" } },
                 "kindColumn": "Type", "kinds": { "Reservation": "sale", "Payout": "payout" } },
    "sample": { "filename": "...", "description": "...", "example": true, "columns": [{ "name": "Net", "meaning": "..." }] }
  }],
  "contracts": [{ "key": "agency_a", "counterparty": "agency_a", "name": "...", "terms": { "commission": { "default": { "type": "percent", "percent": "15" } } } }],
  "rulesets": [{ "key": "daily", "name": "...", "rules": [{ "key": "agency_a_stays", "type": "grouped", "left": "agency_a", "right": "pms" }] }],
  "case_kinds": [{ "kind": "fx_difference", "label": "...", "detected": false, "note": "why not yet" }],
  "reports": [{ "key": "daily_property", "name": "...", "description": "..." }]
}
```

The checker is strict and names the exact path of each problem. It refuses:

- a key it does not know, at any level;
- a mapping column missing from the sample's columns;
- a mapping with a fixed `currency` (a pack names a currency column);
- a rule that names a source the pack does not have;
- contract terms that the [contract checker](/docs/finance/recon-contracts.md) refuses;
- a counterparty that is not declared, or two contracts for one counterparty;
- a repeated key or source name;
- a detected case kind that the engine does not open;
- an undetected case kind with no note saying why.

The mapping `fields`, `kindColumn` and `kinds` keys are described in
[Extra fields and record kinds](/docs/finance/reconciliation-sources.md#fields).

## The synthetic hotel month {#synthetic}

`lib/finance/recon/packs/hotel-month.ts` writes one month of the hotel pack's five files for a test or a demo, with a
manifest of the cases a run should open. The defaults are seed 1, 3,000 reservations, March 2026 and EUR. It is
deterministic: no clock, no `Math.random`, and integer money only, so the same options give the same bytes. It plants
these problems:

| Problem | Planted as | Expected case |
|---|---|---|
| Over-commission | Agency A takes 3 points too much on one stay | `over_commission` of the excess |
| Short payment | Agency A's second-week payout arrives 50.00 short | `short_payment` of −50.00 |
| Missing payout | Agency B's first remittance never reaches the bank | `missing_payout` of the remittance |
| Late payout | Agency B pays two stays on the 27th | one `late_payout` per stay |
| Duplicate charge | The gateway charges one direct booking twice | `duplicate_charge` of the charge |
| Unexpected refund | A 45.00 refund on a direct booking with no cancellation | `unexpected_refund` of −45.00 |
| FX difference | Agency B's third remittance arrives 4.37 lighter | Undetected: a `short_payment` of −4.37 |

The acceptance test (`test/db/finance-recon-packs.test.ts`) runs the whole flow:

1. It installs the pack.
2. It imports the five files through the real import job.
3. It runs the ruleset over the month.
4. It checks that the run's cases equal the manifest exactly, kind and amounts, and that only the three planted
   records stay unmatched.

## Who may do what {#rights}

| Action | Needs |
|---|---|
| See the packs and where they are installed | `recon.read` (controller, reconciliation clerk, auditor) |
| Install a pack on an entity | `recon.run` and `recon.import` on that entity (controller, reconciliation clerk) |

The organisation needs the Finance Reconciliation module (`finance.recon`). Without it, the tools answer 403
`product_not_enabled`.

## For agents {#agents}

- `finance_pack_list`: the packs with their versions, and where they are installed. Pass `pack_key` for one pack in
  full, with each rule as a sentence. REST: `GET /api/v1/finance/recon/packs`.
- `finance_pack_apply`: installs a pack (`entity_id`, `pack_key`, `counterparties`, `currency`, `valid_from`). It
  answers with what it made, upgraded or linked, and what is still pending. REST: `POST /api/v1/finance/recon/packs`.
  OAuth scope `finance:write`.

The console's **Install** button runs `finance_pack_apply` as you.
