mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:47:01 +00:00
Merge branch 'develop' of https://github.com/OpenBankProject/OBP-API into develop
This commit is contained in:
commit
0d579a8ee3
@ -106,9 +106,12 @@ object ErrorMessages {
|
||||
val InvalidAccountType = "OBP-30108: Invalid Account Type."
|
||||
val InitialBalanceMustBeZero = "OBP-30109: Initial Balance of Account must be Zero (0)."
|
||||
|
||||
|
||||
val ConnectorEmptyResponse = "OBP-30200: Connector cannot return the data we requested."
|
||||
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."
|
||||
|
||||
|
||||
|
||||
|
||||
@ -223,10 +223,14 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
|
||||
"transactionId" -> transactionId.toString )
|
||||
// Since result is single account, we need only first list entry
|
||||
implicit val formats = net.liftweb.json.DefaultFormats
|
||||
val r = process(reqId, "getTransaction", argList).extract[KafkaInboundTransaction]
|
||||
// Check does the response data match the requested data
|
||||
if (transactionId.value != r.id) throw new Exception(ErrorMessages.InvalidGetTransactionConnectorResponse)
|
||||
createNewTransaction(r)
|
||||
val r = process(reqId, "getTransaction", argList).extractOpt[KafkaInboundTransaction]
|
||||
r match {
|
||||
// Check does the response data match the requested data
|
||||
case Some(x) if transactionId.value != x.id => Failure(ErrorMessages.InvalidGetTransactionConnectorResponse, Empty, Empty)
|
||||
case Some(x) if transactionId.value == x.id => createNewTransaction(x)
|
||||
case _ => Failure(ErrorMessages.ConnectorEmptyResponse, Empty, Empty)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override def getTransactions(bankId: BankId, accountID: AccountId, queryParams: OBPQueryParam*): Box[List[Transaction]] = {
|
||||
@ -252,6 +256,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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user