extract STransactionDetail record and use pattern matching instead of if-statement