Closes #109 - Need guard on internal (Kafka) getTransactions. should check the bankid/accountId is correct for all

This commit is contained in:
Marko Milic 2016-08-02 09:45:24 +02:00
parent aa8cde5ff4
commit 625c63212f
2 changed files with 4 additions and 0 deletions

View File

@ -109,6 +109,7 @@ object ErrorMessages {
val InvalidGetBankAccountsConnectorResponse = "OBP-30201: Connector did not return the set of accounts we requested."
val InvalidGetBankAccountConnectorResponse = "OBP-30202: Connector did not return the account we requested."
val InvalidGetTransactionConnectorResponse = "OBP-30203: Connector did not return the transaction we requested."
val InvalidGetTransactionsConnectorResponse = "OBP-30204: Connector did not return the set of transactions we requested."

View File

@ -252,6 +252,9 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
"queryParams" -> queryParams.toString )
implicit val formats = net.liftweb.json.DefaultFormats
val rList = process(reqId, "getTransactions", argList).extract[List[KafkaInboundTransaction]]
// Check does the response data match the requested data
val isCorrect = rList.forall(x=>x.this_account.id == accountID.value && x.this_account.bank == bankId.value)
if (!isCorrect) throw new Exception(ErrorMessages.InvalidGetTransactionsConnectorResponse)
// Populate fields and generate result
val res = for {
r <- rList