feat(orders): wire the real parser in, defer card reconciliation
Ingestion now runs on the rebuilt parser. Three substantive changes. Deferred card reconciliation. A 'MasterCard 8032 and/or credits' receipt never states the split, but the card leg lands on the statement — Subway's $29.08 order shows $13.06 on 8032, so $16.02 was credits. For a live order that statement is weeks away, so the split cannot be settled at ingest time. Such orders are now parked with provenance and no transaction, and reconcilePendingOrders() resolves them once the statement arrives. Backfill takes the same path and resolves immediately. Migration 0019 adds the columns that make an order resumable; applied to personal_test only, prod untouched. Payment detection bug, found by the new tests: the old regex delimited the 'Paid with' line on a double space, which whitespace collapsing removes. Every card and mixed receipt fell through to the credits branch — the Woolworths receipt booked $60.93 of credits spend that never happened. Category resolution reversed deliberately. Correction 1 said never default to dining; the implementation of that sent everything unrecognised to 'other', and knowing six merchants meant Carl's Jr, Taco Bell, Chilli India, Oporto, Schnitz and Souvlaki GR all landed there. Grocers are an enumerable set and restaurants are not, so match groceries explicitly and let the residual be dining. Tests rebuilt on real captured receipts; the synthetic fixtures are deleted. 60 unit + 41 integration green on three consecutive runs.
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>Paid with MasterCard Ending in 8032</div>
|
||||
<div>Guzman y Gomez</div>
|
||||
<div>Total: $32.50</div>
|
||||
<div>For: [Redacted User]</div>
|
||||
<div>1x Burrito Bowl $18.50</div>
|
||||
<table>
|
||||
<tr><td>Subtotal</td><td>$32.50</td></tr>
|
||||
<tr><td>Total Charged</td><td>$32.50</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>Paid with credits</div>
|
||||
<div>Woolworths</div>
|
||||
<div>Total: $45.20</div>
|
||||
<div>For: [Redacted User]</div>
|
||||
<div>1x Full Cream Milk 2L $3.50</div>
|
||||
<div>2x Apples 1kg $8.00</div>
|
||||
<table>
|
||||
<tr><td>Subtotal</td><td>$45.20</td></tr>
|
||||
<tr><td>Total Charged</td><td>$45.20</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>Paid with credits</div>
|
||||
<div>Mad Mex</div>
|
||||
<div>Total: $14.64</div>
|
||||
<div>For: [Redacted User]</div>
|
||||
<div>1x Burrito (Mains) • Slow Cooked Beef (GF) • Fresh Guacamole (GF, VG) • Spicy Salsa • No Beans (GF,V) $22.10</div>
|
||||
<table>
|
||||
<tr><td>Subtotal</td><td>$22.10</td></tr>
|
||||
<tr><td>Taxes</td><td>$0.00</td></tr>
|
||||
<tr><td>Delivery Fee</td><td>$0.00</td></tr>
|
||||
<tr><td>Service Fee</td><td>$1.99</td></tr>
|
||||
<tr><td>Tip</td><td>$0.00</td></tr>
|
||||
<tr><td>Discounts</td><td>-$9.45</td></tr>
|
||||
<tr><td>Total Charged</td><td>$14.64</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>Paid with credits $15.00, MasterCard Ending in 8032 $20.00</div>
|
||||
<div>Grill'd</div>
|
||||
<div>Total: $35.00</div>
|
||||
<div>For: [Redacted User]</div>
|
||||
<div>1x Simply Grilled Burger $15.00</div>
|
||||
<table>
|
||||
<tr><td>Subtotal</td><td>$35.00</td></tr>
|
||||
<tr><td>Total Charged</td><td>$35.00</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>Paid with credits</div>
|
||||
<div>Mad Mex</div>
|
||||
<div>Date: 2025-11-15</div>
|
||||
<div>Total: $20.00</div>
|
||||
<div>For: [Redacted User]</div>
|
||||
<table>
|
||||
<tr><td>Subtotal</td><td>$20.00</td></tr>
|
||||
<tr><td>Total Charged</td><td>$20.00</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user