🚖Taxi Driver

Technical Dive into a

flexible & international Tax Engine Microservice

 

github.com/benoror/taxi-driver

🤔 Product Requirements

  1. Calculate VAT taxes in Cirrus ERP/HIS
    • Initially: 🇲🇽Mexico, 🇸🇦Saudi Arabia, 🇦🇷Argentina
    • Integrate with current Tax implementation for 🇲🇽MX
  2. Configurable rules: Exotic tax regulation often changing
    • Ex. Monthly in ARG, due to currency inflation

📐Constraints

  • Easy enough for non-programmers (a.k.a. Accountants) to use
  • Existing technical debt in financial module of big/old Java monolith
  • Time sensitive: Tax season in MX in <3 months

As-is Architecture

Pros Cons
Option A:
Refactor Java Module
- Existing dedicated team & know-how
 
- Time frame too tight (3-4mos)
- Big scope due to tech debt & MX law
- Scalability: Non-SaaS economies of scale
Option B:
Tax Engine Microservice
- Cheap to prototype
- Easy to integrate to
- Independent lifecycle
- Risk of resource waste
 

🚧 Revised Tech Specs

  1. Arch: SOA/Bounded-Context => Microservice/ Lambda
  2. Simple DSL JSON-based configuration
  3. In-memory/Hardcoded data store for config​ 
  4. Memoization
  5. TDD/BDD for fast iteration

🚫 Non-goals (for MVP)

  1. Avoid refactoring Java module, stick to HTTP interface
  2. Configurable interface/UI (*PoC)
  3. Full blown DB
  4. No cache
  5. No pre-defined rules format

To-be Architecture

🛠Technical Dive

  • Zeit Micro framework / monorepo
    • Flexibility between MS or ƛs
  • LowDB: NoSQL-like lightweight ORM
  • Jest: For Unit Testing
  • CI/CD server for continuous adjustements
  • Don't re-invent the wheel:
    • Currency.js: Decimals & rounding
    • hot-formula-parser: Excel-like formulas
    • moment.js: Dealing with Time(zones)
    • Standard.js: Syntax not worth discussing
    • lodash: For everything else

 

Lessons learned

  • Out-of-the-box thinking is great way to move forward both culturally and technically
  • Working under constraints is always good to get the best out of your team.
  • There's always fun and interesting ways to make legacy and newer tech work together.
  • It's all about empowering people, not the technology itself.

taxi-driver

By Benjamin Orozco (benoror)