Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def validateTsFlow[as: AS, mat: MAT, ec: EC](
- checkType: String,
- validationContext: ValidationContext,
- larSource: Source[LoanApplicationRegister, NotUsed],
- tsSource: Source[TransmittalSheet, NotUsed]) =
- for {
- lars <- runWithSeq(larSource)
- t <- runWithSeq(tsSource).map { ts =>
- val tsLar = TransmittalLar(ts.head, lars)
- val errors = checkType match {
- case "all" =>
- TsEngine.checkAll(tsLar,
- tsLar.ts.LEI,
- validationContext,
- TsValidationError)
- case "syntactical" =>
- TsEngine.checkSyntactical(tsLar,
- tsLar.ts.LEI,
- validationContext,
- TsValidationError)
- case "validity" =>
- TsEngine.checkValidity(tsLar,
- tsLar.ts.LEI,
- TsValidationError)
- }
- (ts, errors)
- }
- .map { x =>
- x._2
- .leftMap(xs => {
- addTsFieldInformation(x._1.head, xs.toList)
- })
- .toEither
- }
- } yield t
Add Comment
Please, Sign In to add comment