[fiscus-capture] Receipts: read from an OCR's words; payment.receipt_attached (v0.9.0) #11
Reference in New Issue
Block a user
Delete Branch "feature/receipts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 3 of PLAN-receipts-links.md (in the Fiscus workspace): the receipt parser and the ledger's receipt, pure and public. The OCR (Lector) runs in the app; the core gets its words.
Reading (
fiscus_capture::receipt::read)no_float.rsstill passes).Celkem; VAT, base, subtotal, rounding and change lines never count; split thousands; over 10 M refused whole), the date and time, the IČO with its check digit (or from a company DIČ), the DIČ, the shop's name above the IČO (Title Case, always to check).sureper field (every word ≥ 800/1000). Nothing found is an empty result, not an error. Bounded (600 lines, 120 words, 80 characters), control characters dropped.fixtures/receipts/waits for redacted samples (as OCR text, never the photo).Ledger
payment.receipt_attached { payment, receipt: { shop, ico, dic } }, checked; the payment keeps its merchant and key (rules stay); a later one replaces it; visible on either half of a confirmed pair.State::known_shop(ico)(your latest receipt with it) andState::receipt_match(total, date)(exactly one outflow of that amount within 3 days without a receipt, else none).Phone post:
"source": "receipt"with optionalico,dic; an IČO/DIČ without it, or another source, is refused.Tests: 157 pass (new: 10 reading incl. a proptest, 1 post, 4 ledger); clippy
-D warningsclean. Two bugs found by the tests and fixed: a web address taken as the shop; an amount over the limit read as its tail.Self-review:
ReceiptInfo::checkis the one validator for the post and the event;receipt_seqis the max of the pair's stamps, soknown_shoptakes the newest;#[serde(default)]on the newPaymentRecordfield.