Auto-calculate fees in scala