rename getBankAccounts to getBankAccountsByUsername

This commit is contained in:
hongwei 2019-04-03 11:49:26 +02:00
parent 213fb89584
commit c84cdb952f
8 changed files with 18 additions and 19 deletions

View File

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

View File

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

View File

@ -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]) = {

View File

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

View File

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

View File

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

View File

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

View File

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