Guest User

Untitled

a guest
Dec 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. def validateTsFlow[as: AS, mat: MAT, ec: EC](
  2. checkType: String,
  3. validationContext: ValidationContext,
  4. larSource: Source[LoanApplicationRegister, NotUsed],
  5. tsSource: Source[TransmittalSheet, NotUsed]) =
  6. for {
  7. lars <- runWithSeq(larSource)
  8. t <- runWithSeq(tsSource).map { ts =>
  9. val tsLar = TransmittalLar(ts.head, lars)
  10. val errors = checkType match {
  11. case "all" =>
  12. TsEngine.checkAll(tsLar,
  13. tsLar.ts.LEI,
  14. validationContext,
  15. TsValidationError)
  16. case "syntactical" =>
  17. TsEngine.checkSyntactical(tsLar,
  18. tsLar.ts.LEI,
  19. validationContext,
  20. TsValidationError)
  21. case "validity" =>
  22. TsEngine.checkValidity(tsLar,
  23. tsLar.ts.LEI,
  24. TsValidationError)
  25. }
  26. (ts, errors)
  27. }
  28. .map { x =>
  29. x._2
  30. .leftMap(xs => {
  31. addTsFieldInformation(x._1.head, xs.toList)
  32. })
  33. .toEither
  34. }
  35. } yield t
Add Comment
Please, Sign In to add comment