resolved conflict

This commit is contained in:
sorinmanole 2016-08-02 15:49:35 +02:00
commit 62bab8062c
2 changed files with 19 additions and 6 deletions

View File

@ -106,11 +106,17 @@ 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 EntitlementIsBankRole = "OBP-30204: This entitlement is a Bank Role. Please set bank_id to a valid bank id."
val EntitlementIsSystemRole = "OBP-30205: This entitlement is a System Role. Please set bank_id to empty string."
val EntitlementIsBankRole = "OBP-30205: This entitlement is a Bank Role. Please set bank_id to a valid bank id."
val EntitlementIsSystemRole = "OBP-30206: This entitlement is a System Role. Please set bank_id to empty string."
val InvalidGetTransactionsConnectorResponse = "OBP-30204: Connector did not return the set of transactions we requested."

View File

@ -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