fix(delivery): deliver orders with father-articles and no-payment orders

- Treat an article that has become a father (nIstVater=1) as a free
  position (kArtikel=0) with the name kept: VersandIntern.vBestellPosOffen
  joins tArtikel with nIstVater=0, so such positions could never be
  reserved and failed with "insufficient stock after POS shortage
  booking" (e.g. Becks 42000030).
- Recalculate tAuftragPositionEckdaten before deliverOrder so orders
  without payments get their positions reserved too (previously only
  insertPayment triggered the recalculation).

Also adds debug logging across the delivery pipeline (reserve, commit,
deliver, session, stock-shortage, create-order).
This commit is contained in:
seb
2026-08-13 13:19:47 +02:00
parent 538ecf7a80
commit 5951e10ea5
14 changed files with 211 additions and 10 deletions

32
API.md
View File

@@ -79,6 +79,38 @@ Discovers the server and completes pairing with a 6-digit code.
---
## `GET /v1/newpin` — Generate a pairing code
Creates a fresh, usable 6-digit pairing code on demand. Useful when the static `PAIRING_CODE` has already been consumed by a previous pair.
### Enabling
Disabled by default for security. Enable it by setting `NEWPIN_ENABLED=true` in the environment (`.env`). When disabled, the endpoint returns `403`.
### Response (200)
```json
{
"pin": "482913",
"name": "JTL-POS",
"serverTimestamp": "2026-08-13 12:00:00"
}
```
| Field | Meaning |
|---|---|
| `pin` | Fresh 6-digit code; valid until consumed by `GET /v1/client` pairing |
| `name` | Device name registered on pair (fixed `JTL-POS`) |
| `serverTimestamp` | Server time at generation |
### Errors
| Status | When |
|---|---|
| 403 | `NEWPIN_ENABLED` is not `true` |
---
## `GET /v1/init` — Sync status
Returns how many entities changed since each cursor. Poll this; only fetch list endpoints when the matching `*_count` is greater than `"0"`.