diff --git a/obp-api/pom.xml b/obp-api/pom.xml index 07f1460ce..127648da7 100644 --- a/obp-api/pom.xml +++ b/obp-api/pom.xml @@ -8,7 +8,7 @@ com.tesobe obp-parent ../pom.xml - 1.5.7 + 1.5.8 obp-api war diff --git a/obp-api/src/main/resources/props/sample.props.template b/obp-api/src/main/resources/props/sample.props.template index aedbb67eb..a3aebeb87 100644 --- a/obp-api/src/main/resources/props/sample.props.template +++ b/obp-api/src/main/resources/props/sample.props.template @@ -441,6 +441,8 @@ webui_agree_terms_url = # URL to load (alternative) get started content (this replaces the normal content in index.html #webui_get_started_content_url = http://127.0.0.1:8080/plain.html +# URL to load (alternative) header content (this replaces the id ="table-header" content in default.html +#webui_header_content_url = http://127.0.0.1:8080/plain.html # If we want to gather more information about an Application / Startup fill this url and text diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala index df3e97907..71cf3c949 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala @@ -41,7 +41,7 @@ object APIMethods_AccountInformationServiceAISApi extends RestHelper { deleteConsent :: getAccountList :: getBalances :: - getCardAccount :: + getCardAccounts :: getCardAccountBalances :: getCardAccountTransactionList :: getConsentAuthorisation :: @@ -324,9 +324,9 @@ The account-id is constant at least throughout the lifecycle of a given consent. } resourceDocs += ResourceDoc( - getCardAccount, + getCardAccounts, apiVersion, - nameOf(getCardAccount), + nameOf(getCardAccounts), "GET", "/card-accounts", "Reads a list of card accounts", @@ -338,97 +338,71 @@ respectively the OAuth2 access token. """, json.parse(""""""), json.parse("""{ - "cardAccounts" : [ { - "balances" : "", - "product" : "product", - "resourceId" : "resourceId", - "maskedPan" : "123456xxxxxx1234", - "_links" : { - "balances" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "transactions" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983" - }, - "usage" : "PRIV", - "name" : "name", - "creditLimit" : { - "amount" : "123", - "currency" : "EUR" - }, - "currency" : "EUR", - "details" : "details", - "status" : { } - }, { - "balances" : "", - "product" : "product", - "resourceId" : "resourceId", - "maskedPan" : "123456xxxxxx1234", - "_links" : { - "balances" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "transactions" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983" - }, - "usage" : "PRIV", - "name" : "name", - "creditLimit" : { - "amount" : "123", - "currency" : "EUR" - }, - "currency" : "EUR", - "details" : "details", - "status" : { } - } ] + "cardAccounts": [ + { + "resourceId": "3d9a81b3-a47d-4130-8765-a9c0ff861b99", + "maskedPan": "525412******3241", + "currency": "EUR", + "name": "Main", + "product": "Basic Credit", + "status": "enabled", + "creditLimit": { + "currency": "EUR", + "amount": 15000 + }, + "balances": [ + { + "balanceType": "interimBooked", + "balanceAmount": { + "currency": "EUR", + "amount": 14355.78 + } + }, + { + "balanceType": "nonBilled", + "balanceAmount": { + "currency": "EUR", + "amount": 4175.86 + } + } + ], + "_links": { + "transactions": { + "href": "/v1/card-accounts/3d9a81b3-a47d-4130-8765-a9c0ff861b99/transactions" + } + } + } + ] }"""), List(UserNotLoggedIn, UnknownError), Catalogs(notCore, notPSD2, notOBWG), ApiTag("Account Information Service (AIS)") :: apiTagMockedData :: Nil ) - lazy val getCardAccount : OBPEndpoint = { + lazy val getCardAccounts : OBPEndpoint = { case "card-accounts" :: Nil JsonGet _ => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "cardAccounts" : [ { - "balances" : "", - "product" : "product", - "resourceId" : "resourceId", - "maskedPan" : "123456xxxxxx1234", - "_links" : { - "balances" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "transactions" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983" - }, - "usage" : "PRIV", - "name" : "name", - "creditLimit" : { - "amount" : "123", - "currency" : "EUR" - }, - "currency" : "EUR", - "details" : "details", - "status" : { } - }, { - "balances" : "", - "product" : "product", - "resourceId" : "resourceId", - "maskedPan" : "123456xxxxxx1234", - "_links" : { - "balances" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "transactions" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983" - }, - "usage" : "PRIV", - "name" : "name", - "creditLimit" : { - "amount" : "123", - "currency" : "EUR" - }, - "currency" : "EUR", - "details" : "details", - "status" : { } - } ] -}"""), callContext) + _ <- passesPsd2Aisp(callContext) + _ <- Helper.booleanToFuture(failMsg = DefaultBankIdNotSet) { + defaultBankId != "DEFAULT_BANK_ID_NOT_SET" + } + + bankId = BankId(defaultBankId) + + (_, callContext) <- NewStyle.function.getBank(bankId, callContext) + + availablePrivateAccounts <- Views.views.vend.getPrivateBankAccountsFuture(u, bankId) + + (accounts, callContext) <- NewStyle.function.getBankAccounts(availablePrivateAccounts, callContext) + + } yield { + (JSONFactory_BERLIN_GROUP_1_3.createCardAccountListJson(accounts, u), callContext) } - } } + } + resourceDocs += ResourceDoc( getCardAccountBalances, diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala index 5e5b22f7e..b59f3663a 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala @@ -55,6 +55,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { ) case class CoreAccountsJsonV13(accounts: List[CoreAccountJsonV13]) + case class CoreCardAccountsJsonV13(cardAccounts: List[CoreAccountJsonV13]) case class AccountDetailsLinksJsonV13( balances: LinkHrefJson, @@ -289,6 +290,35 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { } ) } + + def createCardAccountListJson(bankAccounts: List[BankAccount], user: User): CoreCardAccountsJsonV13 = { + CoreCardAccountsJsonV13(bankAccounts.map { + x => + val (iBan: String, bBan: String) = getIbanAndBban(x) + + val balance = + CoreAccountBalancesJson( + balanceAmount = AmountOfMoneyV13(x.currency,x.balance.toString()), + balanceType = APIUtil.stringOrNull(x.accountType), + lastChangeDateTime=APIUtil.DateWithDayFormat.format(x.lastUpdate), + referenceDate =APIUtil.DateWithMsRollback.format(x.lastUpdate), + lastCommittedTransaction = "String" + ) + CoreAccountJsonV13( + resourceId = x.accountId.value, + iban = iBan, + bban = bBan, + currency = x.currency, + name = x.name, + bic = getBicFromBankId(x.bankId.value), + cashAccountType = x.accountType, + product = x.accountType, + balances = balance, + _links = CoreAccountLinksJsonV13(LinkHrefJson(s"/${OBP_BERLIN_GROUP_1_3.version}/accounts/${x.accountId.value}/balances")) + ) + } + ) + } def createCardAccountDetailsJson(bankAccount: BankAccount, user: User): CardAccountDetailsJsonV13 = { val accountDetailsJsonV13 = createAccountDetailsJson(bankAccount: BankAccount, user: User) @@ -365,14 +395,14 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { val address = transaction.otherBankAccount.map(_.accountRoutingAddress).getOrElse(None).getOrElse("") val scheme: String = transaction.otherBankAccount.map(_.accountRoutingScheme).getOrElse(None).getOrElse("") - val (iban, bban, pan, maskedPan, currency) = extractAccountData(scheme, address) +// val (iban, bban, pan, maskedPan, currency) = extractAccountData(scheme, address) CardTransactionJsonV13( cardTransactionId = transaction.id.value, transactionAmount = AmountOfMoneyV13(APIUtil.stringOptionOrNull(transaction.currency), transaction.amount.get.toString()), transactionDate = transaction.finishDate.get, bookingDate = transaction.startDate.get, originalAmount = AmountOfMoneyV13(orignalCurrency, orignalBalnce), - maskedPan = maskedPan, + maskedPan = "", proprietaryBankTransactionCode = "", invoiced = true, transactionDetails = APIUtil.stringOptionOrNull(transaction.description) diff --git a/obp-api/src/main/scala/code/api/util/ExampleValue.scala b/obp-api/src/main/scala/code/api/util/ExampleValue.scala index b74041344..ebe8b253d 100644 --- a/obp-api/src/main/scala/code/api/util/ExampleValue.scala +++ b/obp-api/src/main/scala/code/api/util/ExampleValue.scala @@ -25,7 +25,7 @@ object ExampleValue { lazy val bankIdExample = ConnectorField("gh.29.uk", s"A string that MUST uniquely identify the bank on this OBP instance. It COULD be a UUID but is generally a short string that easily identifies the bank / brand it represents.") lazy val bank_idExample = bankIdExample - lazy val accountIdExample = ConnectorField("8ca8a7e4-6d02-40e3-a129-0b2bf89de9f0", s"A string that, in combination with the bankId MUST uniquely identify the account on this OBP instance. SHOULD be a UUID. MUST NOT be able to guess accountNumber from accountID. OBP-API or Adapter keeps a mapping between accountId and accountNumber. AccountId is a non reversible hash of the human readable account number.") + lazy val accountIdExample = ConnectorField("8ca8a7e4-6d02-40e3-a129-0b2bf89de9f0", s"A string that, in combination with the bankId MUST uniquely identify the account on this OBP instance. SHOULD be a UUID. MUST NOT be able to guess accountNumber from accountId. OBP-API or Adapter keeps a mapping between accountId and accountNumber. AccountId is a non reversible hash of the human readable account number.") lazy val account_idExample = accountIdExample diff --git a/obp-api/src/main/scala/code/api/util/NewStyle.scala b/obp-api/src/main/scala/code/api/util/NewStyle.scala index 57f878578..5317e3d53 100644 --- a/obp-api/src/main/scala/code/api/util/NewStyle.scala +++ b/obp-api/src/main/scala/code/api/util/NewStyle.scala @@ -251,8 +251,8 @@ object NewStyle { callContext: Option[CallContext]): Future[ModeratedOtherBankAccount] = Future(account.moderatedOtherBankAccount(counterpartyId, view, BankIdAccountId(account.bankId, account.accountId), user, callContext)) map { connectorEmptyResponse(_, callContext) } - def getTransactionsCore(bankId: BankId, accountID: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[List[TransactionCore]] = - Connector.connector.vend.getTransactionsCore(bankId: BankId, accountID: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]) map { i => + def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[List[TransactionCore]] = + Connector.connector.vend.getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]) map { i => (unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponseForGetTransactions", 400 ), i._2) } def checkOwnerViewAccessAndReturnOwnerView(user: User, bankAccountId: BankIdAccountId, callContext: Option[CallContext]) : Future[View] = { diff --git a/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala b/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala index ece1b9e04..d091b7ddd 100644 --- a/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala +++ b/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala @@ -892,7 +892,7 @@ trait APIMethods200 { case "my" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "account" :: Nil JsonGet req => { cc => - // TODO return specific error if bankId == "BANK_ID" or accountID == "ACCOUNT_ID" + // TODO return specific error if bankId == "BANK_ID" or accountId == "ACCOUNT_ID" // Should be a generic guard we can use for all calls (also for userId etc.) for { u <- cc.user ?~ UserNotLoggedIn diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index 4d57c897f..096287264 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -511,16 +511,16 @@ trait Connector extends MdcLoggable { //TODO, here is a problem for return value `List[Transaction]`, this is a normal class, not a trait. It is a big class, // it contains thisAccount(BankAccount object) and otherAccount(Counterparty object) - def getTransactionsLegacy(bankId: BankId, accountID: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam] = Nil): Box[(List[Transaction], Option[CallContext])]= Failure(setUnimplementedError) + def getTransactionsLegacy(bankId: BankId, accountId: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam] = Nil): Box[(List[Transaction], Option[CallContext])]= Failure(setUnimplementedError) def getTransactions(bankId: BankId, accountId: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam] = Nil): OBPReturnType[Box[List[Transaction]]] = { val result: Box[(List[Transaction], Option[CallContext])] = getTransactionsLegacy(bankId, accountId, callContext, queryParams) Future(result.map(_._1), result.map(_._2).getOrElse(callContext)) } - def getTransactionsCore(bankId: BankId, accountID: AccountId, queryParams: List[OBPQueryParam] = Nil, callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = Future{(Failure(setUnimplementedError), callContext)} + def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam] = Nil, callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = Future{(Failure(setUnimplementedError), callContext)} - def getTransactionLegacy(bankId: BankId, accountID : AccountId, transactionId : TransactionId, callContext: Option[CallContext] = None): Box[(Transaction, Option[CallContext])] = Failure(setUnimplementedError) - def getTransaction(bankId: BankId, accountID : AccountId, transactionId : TransactionId, callContext: Option[CallContext] = None): OBPReturnType[Box[Transaction]] = { - val result: Box[(Transaction, Option[CallContext])] = getTransactionLegacy(bankId, accountID, transactionId, callContext) + def getTransactionLegacy(bankId: BankId, accountId : AccountId, transactionId : TransactionId, callContext: Option[CallContext] = None): Box[(Transaction, Option[CallContext])] = Failure(setUnimplementedError) + def getTransaction(bankId: BankId, accountId : AccountId, transactionId : TransactionId, callContext: Option[CallContext] = None): OBPReturnType[Box[Transaction]] = { + val result: Box[(Transaction, Option[CallContext])] = getTransactionLegacy(bankId, accountId, transactionId, callContext) Future(result.map(_._1), result.map(_._2).getOrElse(callContext)) } diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index 11cb43448..1bf1f063f 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -3265,8 +3265,8 @@ object LocalMappedConnector extends Connector with MdcLoggable { } - override def getTransaction(bankId: BankId, accountID: AccountId, transactionId: TransactionId, callContext: Option[CallContext] = None): OBPReturnType[Box[Transaction]] = { - val result: Box[(Transaction, Option[CallContext])] = getTransactionLegacy(bankId, accountID, transactionId, callContext) + override def getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext] = None): OBPReturnType[Box[Transaction]] = { + val result: Box[(Transaction, Option[CallContext])] = getTransactionLegacy(bankId, accountId, transactionId, callContext) Future(result.map(_._1), result.map(_._2).getOrElse(callContext)) } @@ -4182,5 +4182,8 @@ object LocalMappedConnector extends Connector with MdcLoggable { CustomerAttributeX.customerAttributeProvider.vend.deleteCustomerAttribute(customerAttributeId) map { ( _, callContext) } } + //NOTE: this method is not for mapped connector, we put it here for the star default implementation. + // : we call that method only when we set external authentication and provider is not OBP-API + override def checkExternalUserCredentials(username: String, password: String, callContext: Option[CallContext]): Box[InboundExternalUser] = Failure("") } diff --git a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala index 43a2ba85a..a0f0e9520 100644 --- a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala +++ b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala @@ -946,7 +946,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { exampleOutboundMessage = ( OutBoundGetTransactionsCore(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, bankId=BankId(bankIdExample.value), - accountID=AccountId(accountIdExample.value), + accountId=AccountId(accountIdExample.value), limit=limitExample.value.toInt, offset=offsetExample.value.toInt, fromDate="string", @@ -996,9 +996,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def getTransactionsCore(bankId: BankId, accountID: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { + override def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { import com.openbankproject.commons.dto.{OutBoundGetTransactionsCore => OutBound, InBoundGetTransactionsCore => InBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountID, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) response.map(convertToTuple[List[TransactionCore]](callContext)) } diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index f43d2db07..5ee868643 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -2202,7 +2202,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable emailAddress=emailExample.value, name=usernameExample.value))))))))), bankId=BankId(bankIdExample.value), - accountID=AccountId(accountIdExample.value), + accountId=AccountId(accountIdExample.value), limit=limitExample.value.toInt, offset=offsetExample.value.toInt, fromDate="string", @@ -2261,10 +2261,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) // url example: /getTransactionsLegacy - override def getTransactionsLegacy(bankId: BankId, accountID: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]): Box[(List[Transaction], Option[CallContext])] = { + override def getTransactionsLegacy(bankId: BankId, accountId: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]): Box[(List[Transaction], Option[CallContext])] = { import com.openbankproject.commons.dto.{OutBoundGetTransactionsLegacy => OutBound, InBoundGetTransactionsLegacy => InBound} val url = getUrl(callContext, "getTransactionsLegacy") - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountID, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) val result: OBPReturnType[Box[List[Transaction]]] = sendRequest[InBound](url, HttpMethods.POST, req, callContext).map(convertToTuple(callContext)) result } @@ -2406,7 +2406,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable emailAddress=emailExample.value, name=usernameExample.value))))))))), bankId=BankId(bankIdExample.value), - accountID=AccountId(accountIdExample.value), + accountId=AccountId(accountIdExample.value), limit=limitExample.value.toInt, offset=offsetExample.value.toInt, fromDate="string", @@ -2463,10 +2463,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) // url example: /getTransactionsCore - override def getTransactionsCore(bankId: BankId, accountID: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { + override def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { import com.openbankproject.commons.dto.{OutBoundGetTransactionsCore => OutBound, InBoundGetTransactionsCore => InBound} val url = getUrl(callContext, "getTransactionsCore") - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountID, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) val result: OBPReturnType[Box[List[TransactionCore]]] = sendRequest[InBound](url, HttpMethods.POST, req, callContext).map(convertToTuple(callContext)) result } @@ -2506,7 +2506,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable emailAddress=emailExample.value, name=usernameExample.value))))))))), bankId=BankId(bankIdExample.value), - accountID=AccountId(accountIdExample.value), + accountId=AccountId(accountIdExample.value), transactionId=TransactionId(transactionIdExample.value)) ), exampleInboundMessage = ( @@ -2562,10 +2562,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) // url example: /getTransactionLegacy - override def getTransactionLegacy(bankId: BankId, accountID: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): Box[(Transaction, Option[CallContext])] = { + override def getTransactionLegacy(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): Box[(Transaction, Option[CallContext])] = { import com.openbankproject.commons.dto.{OutBoundGetTransactionLegacy => OutBound, InBoundGetTransactionLegacy => InBound} val url = getUrl(callContext, "getTransactionLegacy") - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountID, transactionId) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountId, transactionId) val result: OBPReturnType[Box[Transaction]] = sendRequest[InBound](url, HttpMethods.POST, req, callContext).map(convertToTuple(callContext)) result } @@ -2661,10 +2661,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) // url example: /getTransaction - override def getTransaction(bankId: BankId, accountID: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Transaction]] = { + override def getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Transaction]] = { import com.openbankproject.commons.dto.{OutBoundGetTransaction => OutBound, InBoundGetTransaction => InBound} val url = getUrl(callContext, "getTransaction") - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountID, transactionId) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , bankId, accountId, transactionId) val result: OBPReturnType[Box[Transaction]] = sendRequest[InBound](url, HttpMethods.POST, req, callContext).map(convertToTuple(callContext)) result } diff --git a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala index 6076beb33..f8c525432 100644 --- a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala @@ -1050,7 +1050,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { exampleOutboundMessage = ( OutBoundGetTransactionsCore(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, bankId=BankId(bankIdExample.value), - accountID=AccountId(accountIdExample.value), + accountId=AccountId(accountIdExample.value), limit=limitExample.value.toInt, offset=offsetExample.value.toInt, fromDate="string", @@ -1100,9 +1100,9 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def getTransactionsCore(bankId: BankId, accountID: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { + override def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { import com.openbankproject.commons.dto.{OutBoundGetTransactionsCore => OutBound, InBoundGetTransactionsCore => InBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountID, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_transactions_core", req, callContext) response.map(convertToTuple[List[TransactionCore]](callContext)) } @@ -1166,9 +1166,9 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def getTransaction(bankId: BankId, accountID: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Transaction]] = { + override def getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Transaction]] = { import com.openbankproject.commons.dto.{OutBoundGetTransaction => OutBound, InBoundGetTransaction => InBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountID, transactionId) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, transactionId) val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_transaction", req, callContext) response.map(convertToTuple[Transaction](callContext)) } 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 6d9324e89..8a4e03a45 100644 --- a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala +++ b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala @@ -317,6 +317,7 @@ import net.liftweb.util.Helpers._ val usernameLockedStateCode = Long.MaxValue val connector = APIUtil.getPropsValue("connector").openOrThrowException("no connector set") + val starConnectorSupportedTypes = APIUtil.getPropsValue("starConnector_supported_types","") override def emailFrom = APIUtil.getPropsValue("mail.users.userinfo.sender.address", "sender-not-set") @@ -617,8 +618,11 @@ import net.liftweb.util.Helpers._ case Full(user) if (user.getProvider() != APIUtil.getPropsValue("hostname","")) => connector match { - case Helper.matchAnyKafka() if ( APIUtil.getPropsAsBoolValue("kafka.user.authentication", false) && - ! LoginAttempt.userIsLocked(username) ) => + case Helper.matchAnyKafka() if ( + (starConnectorSupportedTypes contains("kafka")) + && APIUtil.getPropsAsBoolValue("kafka.user.authentication", false) + && ! LoginAttempt.userIsLocked(username) + ) => val userId = for { kafkaUser <- getUserFromConnector(username, password) kafkaUserId <- tryo{kafkaUser.user} } yield { LoginAttempt.resetBadLoginAttempts(username) @@ -630,8 +634,11 @@ import net.liftweb.util.Helpers._ LoginAttempt.incrementBadLoginAttempts(username) Empty } - case "obpjvm" if ( APIUtil.getPropsAsBoolValue("obpjvm.user.authentication", false) && - ! LoginAttempt.userIsLocked(username) ) => + case "obpjvm" if ( + (starConnectorSupportedTypes contains("obpjvm")) + && APIUtil.getPropsAsBoolValue("obpjvm.user.authentication", false) + && ! LoginAttempt.userIsLocked(username) + ) => val userId = for { obpjvmUser <- getUserFromConnector(username, password) obpjvmUserId <- tryo{obpjvmUser.user} } yield { LoginAttempt.resetBadLoginAttempts(username) @@ -643,7 +650,11 @@ import net.liftweb.util.Helpers._ LoginAttempt.incrementBadLoginAttempts(username) Empty } - case Helper.matchAnyStoredProcedure() if !LoginAttempt.userIsLocked(username) => + case Helper.matchAnyStoredProcedure() if ( + (starConnectorSupportedTypes contains("stored_procedure")) + && APIUtil.getPropsAsBoolValue("connector.user.authentication", false) + && !LoginAttempt.userIsLocked(username) + ) => val userId = for { authUser <- checkExternalUserViaConnector(username, password) diff --git a/obp-api/src/main/scala/code/snippet/WebUI.scala b/obp-api/src/main/scala/code/snippet/WebUI.scala index e063d2811..55d5a752c 100644 --- a/obp-api/src/main/scala/code/snippet/WebUI.scala +++ b/obp-api/src/main/scala/code/snippet/WebUI.scala @@ -339,6 +339,9 @@ class WebUI extends MdcLoggable{ contentLoader("webui_about_vendor_content_url", "about-vendor") } + def headerContentLoader: NodeSeq = { + contentLoader("webui_header_content_url", "table-header") + } // This load content directly into the div that calls it. def getStartedDirectContentLoader: NodeSeq = { diff --git a/obp-api/src/main/scala/code/util/Helper.scala b/obp-api/src/main/scala/code/util/Helper.scala index c934f43f5..9ecdf5456 100644 --- a/obp-api/src/main/scala/code/util/Helper.scala +++ b/obp-api/src/main/scala/code/util/Helper.scala @@ -239,9 +239,8 @@ object Helper{ /** * Used for version extraction from props string */ - val matchKafkaVersion = "kafka_v([0-9a-zA-Z_]+)".r - val matchAnyKafka = "^kafka.*$".r - val matchAnyStoredProcedure = "^stored_procedure.*$".r + val matchAnyKafka = "kafka.*|star".r + val matchAnyStoredProcedure = "stored_procedure.*|star".r /** * change the TimeZone to the current TimeZOne diff --git a/obp-api/src/main/webapp/templates-hidden/default.html b/obp-api/src/main/webapp/templates-hidden/default.html index 1d1a18e12..bf74f2003 100644 --- a/obp-api/src/main/webapp/templates-hidden/default.html +++ b/obp-api/src/main/webapp/templates-hidden/default.html @@ -78,7 +78,7 @@ Berlin 13359, Germany - +