feat(orders): add Uber Eats and Uber Rides support, fare parsing, and category resolution

This commit is contained in:
2026-07-26 19:00:59 +10:00
parent bbb90238e4
commit 775e5cc08f
2 changed files with 77 additions and 28 deletions
@@ -56,4 +56,22 @@ describe("Order Ingestion - Unit Tests", () => {
expect(validRatings.includes("again")).toBe(true);
expect(validRatings.includes(invalidRating)).toBe(false);
});
it("8. Uber Eats receipt => platform 'ubereats', line_items [] (Diff 1), Uber Cash mapped", () => {
const html = `<div>Your Friday evening order with Uber Eats</div><div>Paid with Uber Cash $43.46</div><div>Total Charged $43.46</div>`;
const parsed = parseOrderHTML(html);
expect(parsed.platform).toBe("ubereats");
expect(parsed.payment.credits_amount).toBe(43.46);
expect(parsed.line_items).toEqual([]);
});
it("9. Uber Ride receipt => platform 'uber', category 'transport' (Diff 2)", () => {
const html = `<div>Your Trip fare $84.14 · Booking Fee $1.35</div><div>Uber Cash $85.49</div><div>Total $85.49</div>`;
const parsed = parseOrderHTML(html);
expect(parsed.platform).toBe("uber");
expect(parsed.payment.credits_amount).toBe(85.49);
const resolved = resolveMerchantCategory(parsed.merchant_name, parsed.platform);
expect(resolved.category).toBe("transport");
});
});