# Phase 2 rollout (POS Checkout + Finance)

## Firebase `siteSettings` keys

Configure under `clients/{clientId}/siteSettings`:

### `posTax`

```json
{
  "enabled": true,
  "defaultMode": "exclusive",
  "defaultRate": 15
}
```

- `defaultMode`: `inclusive` (price includes VAT) or `exclusive` (VAT added at checkout).
- `defaultRate`: percent (0–100).

### `posReceipt`

```json
{
  "legalName": "Your Shop Legal Name",
  "binVat": "123456789",
  "footerText": "Thank you for shopping.",
  "returnPolicyText": "Returns within 7 days with receipt."
}
```

## Product overrides (`products/{id}`)

Optional fields:

- `taxExempt`: `true` — no VAT on this SKU.
- `taxModeOverride`: `"inclusive"` | `"exclusive"` — overrides site default mode.
- `taxRateOverride`: number — overrides site default rate.

## Orders (Phase 2 snapshot)

New POS orders may include:

- `amountSchemaVersion`: `2`
- `amount.tax`, `amount.taxableBase`, `amount.netBeforeTax`, `amount.taxLines`, `amount.taxModeSnapshot`
- `paymentLedger`: array of `{ kind: 'capture' | 'refund', ... }`

Legacy orders without these fields still work: POS and analytics use fallbacks.

## Parallel reconciliation (soft launch)

1. Enable `posTax` with a test rate on a staging tenant or off-peak hour.
2. Compare printed receipt totals vs manual calculator for mixed carts (inclusive + exclusive overrides + exempt).
3. Run day-close: verify `expectedByMethod` vs drawer counts for cash/card/mobile.
4. Process a partial refund: confirm `paymentLedger` gains a `refund` entry and expected tenders drop on the next close.

## Rollback

- Set `posTax.enabled` to `false` in `siteSettings` — POS falls back to pre-tax totals (payable = discounted line subtotal).
- Old `posDailyCloses` documents without `schemaVersion: 2` remain valid; new saves add method breakdown.
