mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:06:50 +00:00
refactor/removed InboundAccountJune2017 case class
This commit is contained in:
parent
a7ec44067b
commit
42c04f6f48
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user