diff --git a/obp-api/src/main/scala/code/api/GatewayLogin.scala b/obp-api/src/main/scala/code/api/GatewayLogin.scala index 508776a10..4603bce01 100755 --- a/obp-api/src/main/scala/code/api/GatewayLogin.scala +++ b/obp-api/src/main/scala/code/api/GatewayLogin.scala @@ -185,7 +185,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.getBankAccountsForUserLegacy(provider = gateway, username,callContextNewSessionId) // Box[List[InboundAccountJune2017]]// + val res = Connector.connector.vend.getBankAccountsForUserLegacy(provider = gateway, username,callContextNewSessionId) res match { case Full((l, callContextReturn))=> Full(compactRender(Extraction.decompose(l)),l, callContextReturn) // case class --> JValue --> Json string diff --git a/obp-api/src/test/scala/code/api/gateWayloginTest.scala b/obp-api/src/test/scala/code/api/gateWayloginTest.scala index 180c8ae22..eb8e953ef 100644 --- a/obp-api/src/test/scala/code/api/gateWayloginTest.scala +++ b/obp-api/src/test/scala/code/api/gateWayloginTest.scala @@ -16,47 +16,40 @@ import code.api.util.ErrorMessages._ class gateWayloginTest extends ServerSetup with BeforeAndAfter with DefaultUsers { //fake this: Connector.connector.vend.getBankAccounts(username) - val fakeResultFromAdapter = Full(InboundAccountJune2017( - errorCode = "", - cbsToken ="cbsToken1", - 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 - ) :: InboundAccountJune2017( - errorCode = "", - cbsToken ="cbsToken2", - 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) + val fakeResultFromAdapter1 = Full( + AuthInfo( + userId = "", + username = "", + cbsToken = "cbsToken1", + isFirst = true, + correlationId = "", + sessionId = "", + linkedCustomers = Nil, + userAuthContexts= Nil, + authViews= Nil):: AuthInfo( + userId = "", + username = "", + cbsToken = "cbsToken2", + isFirst = true, + correlationId = "", + sessionId = "", + linkedCustomers = Nil, + userAuthContexts= Nil, + authViews= Nil) ::Nil + ) + val fakeResultFromAdapter2 = Full( + InboundValidatedUser( + errorCode ="", + backendMessages = Nil, + email = "", + displayName = "" + ):: InboundValidatedUser( + errorCode ="", + backendMessages = Nil, + email = "", + displayName = "" + ) ::Nil + ) val accessControlOriginHeader = ("Access-Control-Allow-Origin", "*") @@ -173,12 +166,12 @@ class gateWayloginTest extends ServerSetup with BeforeAndAfter with DefaultUsers feature("Unit Tests for two getCbsToken and getErrors: ") { scenario("test the getErrors") { - val reply: List[String] = GatewayLogin.getErrors(json.compactRender(Extraction.decompose(fakeResultFromAdapter.openOrThrowException(attemptedToOpenAnEmptyBox)))) + val reply: List[String] = GatewayLogin.getErrors(json.compactRender(Extraction.decompose(fakeResultFromAdapter2.openOrThrowException(attemptedToOpenAnEmptyBox)))) reply.forall(_.equalsIgnoreCase("")) should equal(true) } scenario("test the getCbsToken") { - val reply: List[String] = GatewayLogin.getCbsTokens(json.compactRender(Extraction.decompose(fakeResultFromAdapter.openOrThrowException(attemptedToOpenAnEmptyBox)))) + val reply: List[String] = GatewayLogin.getCbsTokens(json.compactRender(Extraction.decompose(fakeResultFromAdapter1.openOrThrowException(attemptedToOpenAnEmptyBox)))) reply(0) should equal("cbsToken1") reply(1) should equal("cbsToken2") diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala index 25f4ae210..12e208057 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala @@ -1204,28 +1204,6 @@ case class InternalCustomer( lastOkDate: Date ) -case class InboundAccountJune2017( - errorCode: String, - cbsToken: String, //TODO, this maybe move to AuthInfo, but it is used in GatewayLogin - bankId: String, - branchId: String, - accountId: String, - accountNumber: String, - accountType: String, - balanceAmount: String, - balanceCurrency: String, - owners: List[String], - viewsToGenerate: List[String], - bankRoutingScheme: String, - bankRoutingAddress: String, - branchRoutingScheme: String, - branchRoutingAddress: String, - accountRoutingScheme: String, - accountRoutingAddress: String, - accountRouting: List[AccountRouting], - accountRules: List[AccountRule] -) extends InboundMessageBase with InboundAccount - case class Bank2(r: InboundBank) extends Bank { def fullName = r.name def shortName = r.name