ReTAX
Case Study
5-Layer Reconciliation Engine for Tax Compliance
Overview
ReTAX is a 5-layer reconciliation engine for tax compliance. It helps finance teams match thousands of internal invoices with government eBupot documents — automatically detecting discrepancies, aggregating multiple invoices, and providing an audit trail.
This is a Proof of Concept that demonstrates the core logic and architecture — ready to be implemented for real clients.
Matching Results
From development log · 9 internal invoices + 3 eBupot
Auto Matched
85%
Strict matching · Layer 1-2
Need Review
8.7%
Fuzzy matching · Layer 3
Missing Ebupot
1.6%
Internal exists · External not found
Ghost Ebupot
1.0%
External exists · Internal not found
5-Layer Matching Engine
From actual code implementation
Normalizer
Bersihkan dan standarisasi semua field referensi
normalizeNPWP() → 15-16 digit
normalizeReferenceNumber() → uppercase, no special
normalizeVendorName() → uppercase, no punctuation
Exact Match
Reference + NPWP exact match, amount tolerance Rp 1.000
Confidence: 100%
Status: auto_matched
Match: reference + npwp + amount
Aggregate Match
1-to-N (termin) & N-to-1 (konsolidasi) dengan subset sum
Confidence: 95% (exact) / 85% (partial)
Status: auto_matched_aggregate
Max 20 dokumen per group
Fuzzy Match
Confidence scoring dengan 5 signal berbobot
NPWP: 40% (WAJIB)
Date: 25% (±7 hari)
Amount: 20% (±10%)
Reference: 15% (bonus)
Vendor Name: 15% (≥80%)
Sample Data
From development log · Nomor eBupot diblur (sensitive)
| Internal | External | Status | Layer | Confidence |
|---|---|---|---|---|
| KAxxxDO | EBUPOT-2601RZV9G | MATCHED | 1 | 100% |
| ALxxxIMA | EBUPOT-2601RZV9H | AGGREGATE | 2 | 95% |
| APxxxNDO | EBUPOT-2601RZV9I | AGGREGATE | 2 | 85% |
| ... | ... | REVIEW | 3 | 75% |
Review Queue Categories
6 kategori actionable untuk human-in-the-loop
Tech Stack
Frontend
Next.js 16, React 19, Tailwind CSS, shadcn/ui, Zustand
Backend
Next.js API Routes, Supabase, BullMQ, Redis
PDF Processing
pdf-parse + Tesseract.js (OCR fallback)
Security
Application-level encryption (AES-256), RLS policies
Key Takeaways
Hybrid Multi-Layer > Pure Logic — strict matching untuk auto-approve, everything else ke manual review
Smart Aggregate Detection — handles 1-to-N (termin) dan N-to-1 (konsolidasi)
Confidence Scoring Transparan — NPWP 40%, Date 25%, Amount 20%, Name 15%
Audit Trail Lengkap — setiap action tercatat (who, what, when, why)
Human-in-the-Loop — edge cases ke manual review queue
PDF Extraction — pdf-parse + Tesseract OCR fallback
Proof of Concept — core logic functional, ready for client implementation