Fraud Prevention problem solution in Scala