diff --git a/obp-api/src/main/scala/code/api/GatewayLogin.scala b/obp-api/src/main/scala/code/api/GatewayLogin.scala index 6527d106e..f1b1075bf 100755 --- a/obp-api/src/main/scala/code/api/GatewayLogin.scala +++ b/obp-api/src/main/scala/code/api/GatewayLogin.scala @@ -174,7 +174,7 @@ object GatewayLogin extends RestHelper with MdcLoggable { //if isFirst = true, we create new sessionId for CallContext val callContextNewSessionId = ApiSession.createSessionId(callContextForRequest) // Call CBS, Note, this is the first time to call Adapter in GatewayLogin process - val res = Connector.connector.vend.getBankAccounts(username, callContextNewSessionId) // Box[List[InboundAccountJune2017]]// + val res = Connector.connector.vend.getBankAccountsByUsername(username,callContextNewSessionId) // Box[List[InboundAccountJune2017]]// res match { case Full((l, callContextReturn))=> Full(compactRender(Extraction.decompose(l)),l, callContextReturn) // case class --> JValue --> Json string @@ -207,7 +207,7 @@ object GatewayLogin extends RestHelper with MdcLoggable { val callContextUpdatedSessionId = ApiSession.createSessionId(callContextForRequest) // Call CBS - val res = Connector.connector.vend.getBankAccountsFuture(username, callContextUpdatedSessionId) // Box[List[InboundAccountJune2017]]// + val res = Connector.connector.vend.getBankAccountsByUsernameFuture(username,callContextUpdatedSessionId) // Box[List[InboundAccountJune2017]]// res map { case Full((l, callContextReturn)) => Full(compactRender(Extraction.decompose(l)), l, callContextReturn) // case class --> JValue --> Json string diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index a77623023..a664dd1ef 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -236,7 +236,7 @@ trait Connector extends MdcLoggable{ * @param forceFresh call the MainFrame call, or only get the cache data. * @return all the accounts, get from Main Frame. */ - def getBankAccounts(username: String, callContext: Option[CallContext]) : Box[(List[InboundAccountCommon], Option[CallContext])] = Failure(NotImplemented + currentMethodName) + def getBankAccountsByUsername(username: String, callContext: Option[CallContext]) : Box[(List[InboundAccountCommon], Option[CallContext])] = Failure(NotImplemented + currentMethodName) /** * @@ -244,7 +244,7 @@ trait Connector extends MdcLoggable{ * @param forceFresh call the MainFrame call, or only get the cache data. * @return all the accounts, get from Main Frame. */ - def getBankAccountsFuture(username: String, callContext: Option[CallContext]) : Future[Box[(List[InboundAccountCommon], Option[CallContext])]] = Future { + def getBankAccountsByUsernameFuture(username: String, callContext: Option[CallContext]) : Future[Box[(List[InboundAccountCommon], Option[CallContext])]] = Future{ Failure(NotImplemented + currentMethodName) } diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index 988d30c27..af8595dd7 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -207,7 +207,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { } - override def getBankAccounts(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountCommon], Option[CallContext])]= { + override def getBankAccountsByUsername(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountCommon], Option[CallContext])]= { val bankIdAccountId = BankIdAccountId(BankId("obp-bank-x-gh"), AccountId("KOa4M8UfjUuWPIXwPXYPpy5FoFcTUwpfHgXC1qpSluc")) val bankIdAccountId2 = BankIdAccountId(BankId("obp-bank-x-gh"), AccountId("tKWSUBy6sha3Vhxc/vw9OK96a0RprtoxUuObMYR29TI")) Full( @@ -252,8 +252,8 @@ object LocalMappedConnector extends Connector with MdcLoggable { ) } - override def getBankAccountsFuture(username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountCommon], Option[CallContext])]] = Future { - getBankAccounts(username, callContext) + override def getBankAccountsByUsernameFuture(username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountCommon], Option[CallContext])]] = Future{ + getBankAccountsByUsername(username,callContext) } override def getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]) = { diff --git a/obp-api/src/main/scala/code/bankconnectors/vJune2017/KafkaMappedConnector_vJune2017.scala b/obp-api/src/main/scala/code/bankconnectors/vJune2017/KafkaMappedConnector_vJune2017.scala index 19a2ab469..262dd772e 100644 --- a/obp-api/src/main/scala/code/bankconnectors/vJune2017/KafkaMappedConnector_vJune2017.scala +++ b/obp-api/src/main/scala/code/bankconnectors/vJune2017/KafkaMappedConnector_vJune2017.scala @@ -454,7 +454,7 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc InboundGetAccounts(authInfoExample, statusExample, InboundAccountJune2017("", cbsToken ="cbsToken", bankId = "gh.29.uk", branchId = "222", accountId = "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0", accountNumber = "123", accountType = "AC", balanceAmount = "50", balanceCurrency = "EUR", owners = "Susan" :: " Frank" :: Nil, viewsToGenerate = "Public" :: "Accountant" :: "Auditor" :: Nil, bankRoutingScheme = "iban", bankRoutingAddress = "bankRoutingAddress", branchRoutingScheme = "branchRoutingScheme", branchRoutingAddress = " branchRoutingAddress", accountRoutingScheme = "accountRoutingScheme", accountRoutingAddress = "accountRoutingAddress", accountRouting = Nil, accountRules = Nil) :: Nil) ) ) - override def getBankAccounts(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountCommon], Option[CallContext])] = saveConnectorMetric { + override def getBankAccountsByUsername(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountCommon], Option[CallContext])] = saveConnectorMetric{ /** * Please noe that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" * is just a temporary value filed with UUID values in order to prevent any ambiguity. @@ -505,7 +505,7 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc } }("getBankAccounts") - override def getBankAccountsFuture(username: String, callContext: Option[CallContext]) = saveConnectorMetric { + override def getBankAccountsByUsernameFuture(username: String, callContext: Option[CallContext]) = saveConnectorMetric{ /** * Please noe that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" * is just a temporary value filed with UUID values in order to prevent any ambiguity. diff --git a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala b/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala index 8373f8414..9d392a7e9 100644 --- a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala +++ b/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala @@ -664,7 +664,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc ), adapterImplementation = Some(AdapterImplementation("Accounts", 5)) ) - override def getBankAccounts(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountCommon], Option[CallContext])] = saveConnectorMetric{ + override def getBankAccountsByUsername(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountCommon], Option[CallContext])] = saveConnectorMetric{ /** * Please noe that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" * is just a temporary value filed with UUID values in order to prevent any ambiguity. @@ -712,7 +712,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc } }("getBankAccounts") - override def getBankAccountsFuture(username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountSept2018], Option[CallContext])]] = saveConnectorMetric{ + override def getBankAccountsByUsernameFuture(username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountSept2018], Option[CallContext])]] = saveConnectorMetric{ /** * Please noe that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" * is just a temporary value filed with UUID values in order to prevent any ambiguity. diff --git a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala index 28347da0b..67672a227 100644 --- a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala +++ b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala @@ -838,7 +838,7 @@ def restoreSomeSessions(): Unit = { */ def updateUserAccountViews(user: User, callContext: Option[CallContext]): Unit = { //get all accounts from Kafka - val accounts = Connector.connector.vend.getBankAccounts(user.name, callContext).openOrThrowException(attemptedToOpenAnEmptyBox) + val accounts = Connector.connector.vend.getBankAccountsByUsername(user.name,callContext).openOrThrowException(attemptedToOpenAnEmptyBox) debug(s"-->AuthUser.updateUserAccountViews.accounts : ${accounts} ") updateUserAccountViews(user, accounts._1) diff --git a/obp-api/src/test/scala/code/connector/MockedJune2017Connector.scala b/obp-api/src/test/scala/code/connector/MockedJune2017Connector.scala index 52ed1591a..e08c129ca 100644 --- a/obp-api/src/test/scala/code/connector/MockedJune2017Connector.scala +++ b/obp-api/src/test/scala/code/connector/MockedJune2017Connector.scala @@ -28,15 +28,15 @@ object MockedJune2017Connector extends ServerSetup val bankIdAccountId = BankIdAccountId(BankId("obp-bank-x-gh"),AccountId("KOa4M8UfjUuWPIXwPXYPpy5FoFcTUwpfHgXC1qpSluc")) val bankIdAccountId2 = BankIdAccountId(BankId("obp-bank-x-gh"),AccountId("tKWSUBy6sha3Vhxc/vw9OK96a0RprtoxUuObMYR29TI")) - override def getBankAccounts(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountJune2017], Option[CallContext])] = { + override def getBankAccountsByUsername(username: String, callContext: Option[CallContext]): Box[(List[InboundAccountJune2017], Option[CallContext])] = { Full( InboundAccountJune2017("", cbsToken = "cbsToken", bankId = bankIdAccountId.bankId.value, branchId = "222", accountId = bankIdAccountId.accountId.value, accountNumber = "123", accountType = "AC", balanceAmount = "50", balanceCurrency = "EUR", owners = Nil, viewsToGenerate = "Owner" :: "Public" :: "Accountant" :: "Auditor" :: Nil, bankRoutingScheme = "iban", bankRoutingAddress = "bankRoutingAddress", branchRoutingScheme = "branchRoutingScheme", branchRoutingAddress = " branchRoutingAddress", accountRoutingScheme = "accountRoutingScheme", accountRoutingAddress = "accountRoutingAddress", accountRouting = Nil, accountRules = Nil) :: InboundAccountJune2017("", cbsToken = "cbsToken", bankId = bankIdAccountId2.bankId.value, branchId = "222", accountId = bankIdAccountId2.accountId.value, accountNumber = "123", accountType = "AC", balanceAmount = "50", balanceCurrency = "EUR", owners = Nil, viewsToGenerate = "Owner" :: "Public" :: "Accountant" :: "Auditor" :: Nil, bankRoutingScheme = "iban", bankRoutingAddress = "bankRoutingAddress", branchRoutingScheme = "branchRoutingScheme", branchRoutingAddress = " branchRoutingAddress", accountRoutingScheme = "accountRoutingScheme", accountRoutingAddress = "accountRoutingAddress", accountRouting = Nil, accountRules = Nil) :: Nil, callContext ) } - override def getBankAccountsFuture(username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountJune2017], Option[CallContext])]] = Future { - getBankAccounts(username, callContext) + override def getBankAccountsByUsernameFuture(username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountJune2017], Option[CallContext])]] = Future{ + getBankAccountsByUsername(username,callContext) } } diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/dto/rest/JsonsTransfer.scala b/obp-commons/src/main/scala/com/openbankproject/commons/dto/rest/JsonsTransfer.scala index a7306691e..64004e8a9 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/dto/rest/JsonsTransfer.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/dto/rest/JsonsTransfer.scala @@ -77,10 +77,9 @@ case class InBoundGetBankFuture (authInfo: AuthInfoBasic, data: BankCommons) case class OutBoundGetBanksFuture (authInfo: AuthInfoBasic) case class InBoundGetBanksFuture (authInfo: AuthInfoBasic, data: List[BankCommons]) -//TODO FIXME, there are two method in connector have the same name of "getBankAccountsFuture", rename it and fix the follow two class name -//case class OutBoundGetBankAccountsFuture (authInfo: AuthInfoBasic, -// username: String) -//case class InBoundGetBankAccountsFuture (authInfo: AuthInfoBasic, data: List[InboundAccountCommonCommons]) +case class OutBoundGetBankAccountsByUsernameFuture (authInfo: AuthInfoBasic, + username: String) +case class InBoundGetBankAccountsByUsernameFuture (authInfo: AuthInfoBasic, data: List[InboundAccountCommonCommons]) case class OutBoundGetBankAccountFuture (authInfo: AuthInfoBasic,