Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 199 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
ThisBuild / version := "1.10.1"
ThisBuild / scalaVersion := "2.12.20"
ThisBuild / organization := "com.tesobe"

// Java version compatibility
ThisBuild / javacOptions ++= Seq("-source", "11", "-target", "11")
ThisBuild / scalacOptions ++= Seq(
"-unchecked",
"-explaintypes",
"-target:jvm-1.8",
"-Yrangepos"
)

// Enable SemanticDB for Metals
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := "4.13.9"

// Fix dependency conflicts
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always

lazy val liftVersion = "3.5.0"
lazy val akkaVersion = "2.5.32"
lazy val jettyVersion = "9.4.50.v20221201"
lazy val avroVersion = "1.8.2"

lazy val commonSettings = Seq(
resolvers ++= Seq(
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Artima Maven Repository" at "https://repo.artima.com/releases",
"OpenBankProject M2 Repository" at "https://raw.githubusercontent.com/OpenBankProject/OBP-M2-REPO/master",
"jitpack.io" at "https://jitpack.io"
)
)

lazy val obpCommons = (project in file("obp-commons"))
.settings(
commonSettings,
name := "obp-commons",
libraryDependencies ++= Seq(
"net.liftweb" %% "lift-common" % liftVersion,
"net.liftweb" %% "lift-util" % liftVersion,
"net.liftweb" %% "lift-mapper" % liftVersion,
"org.scala-lang" % "scala-reflect" % "2.12.20",
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
"org.scalactic" %% "scalactic" % "3.2.15",
"net.liftweb" %% "lift-json" % liftVersion,
"com.alibaba" % "transmittable-thread-local" % "2.11.5",
"org.apache.commons" % "commons-lang3" % "3.12.0",
"org.apache.commons" % "commons-text" % "1.10.0",
"com.google.guava" % "guava" % "32.0.0-jre"
)
)

lazy val obpApi = (project in file("obp-api"))
.dependsOn(obpCommons)
.settings(
commonSettings,
name := "obp-api",
libraryDependencies ++= Seq(
// Core dependencies
"net.liftweb" %% "lift-mapper" % liftVersion,
"net.databinder.dispatch" %% "dispatch-lift-json" % "0.13.1",
"ch.qos.logback" % "logback-classic" % "1.2.13",
"org.slf4j" % "log4j-over-slf4j" % "1.7.26",
"org.slf4j" % "slf4j-ext" % "1.7.26",

// Security
"org.bouncycastle" % "bcpg-jdk15on" % "1.70",
"org.bouncycastle" % "bcpkix-jdk15on" % "1.70",
"com.nimbusds" % "nimbus-jose-jwt" % "9.37.2",
"com.nimbusds" % "oauth2-oidc-sdk" % "9.27",

// Commons
"org.apache.commons" % "commons-lang3" % "3.12.0",
"org.apache.commons" % "commons-text" % "1.10.0",
"org.apache.commons" % "commons-email" % "1.5",
"org.apache.commons" % "commons-compress" % "1.26.0",
"org.apache.commons" % "commons-pool2" % "2.11.1",

// Database
"org.postgresql" % "postgresql" % "42.4.4",
"com.h2database" % "h2" % "2.2.220" % Runtime,
"mysql" % "mysql-connector-java" % "8.0.30",
"com.microsoft.sqlserver" % "mssql-jdbc" % "11.2.0.jre11",

// Web
"javax.servlet" % "javax.servlet-api" % "3.1.0" % Provided,
"org.eclipse.jetty" % "jetty-server" % jettyVersion % Test,
"org.eclipse.jetty" % "jetty-webapp" % jettyVersion % Test,
"org.eclipse.jetty" % "jetty-util" % jettyVersion,

// Akka
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-http-core" % "10.1.6",

// Avro
"com.sksamuel.avro4s" %% "avro4s-core" % avroVersion,

// Twitter
"com.twitter" %% "chill-akka" % "0.9.1",
"com.twitter" %% "chill-bijection" % "0.9.1",

// Cache
"com.github.cb372" %% "scalacache-redis" % "0.9.3",
"com.github.cb372" %% "scalacache-guava" % "0.9.3",

// Utilities
"com.github.dwickern" %% "scala-nameof" % "1.0.3",
"org.javassist" % "javassist" % "3.25.0-GA",
"com.alibaba" % "transmittable-thread-local" % "2.14.2",
"org.clapper" %% "classutil" % "1.4.0",
"com.github.grumlimited" % "geocalc" % "0.5.7",
"com.github.OpenBankProject" % "scala-macros" % "v1.0.0-alpha.3",
"org.scalameta" %% "scalameta" % "3.7.4",

// Akka Adapter - exclude transitive dependency on obp-commons to use local module
"com.github.OpenBankProject.OBP-Adapter-Akka-SpringBoot" % "adapter-akka-commons" % "v1.1.0" exclude("com.github.OpenBankProject.OBP-API", "obp-commons"),

// JSON Schema
"com.github.everit-org.json-schema" % "org.everit.json.schema" % "1.6.1",
"com.networknt" % "json-schema-validator" % "1.0.87",

// Swagger
"io.swagger.parser.v3" % "swagger-parser" % "2.0.13",

// Text processing
"org.atteo" % "evo-inflector" % "1.2.2",

// Payment
"com.stripe" % "stripe-java" % "12.1.0",
"com.twilio.sdk" % "twilio" % "9.2.0",

// gRPC
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % "0.8.4",
"io.grpc" % "grpc-all" % "1.48.1",
"io.netty" % "netty-tcnative-boringssl-static" % "2.0.27.Final",
"org.asynchttpclient" % "async-http-client" % "2.10.4",

// Database utilities
"org.scalikejdbc" %% "scalikejdbc" % "3.4.0",

// XML
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",

// IBAN
"org.iban4j" % "iban4j" % "3.2.7-RELEASE",

// JavaScript
"org.graalvm.js" % "js" % "22.0.0.2",
"org.graalvm.js" % "js-scriptengine" % "22.0.0.2",
"ch.obermuhlner" % "java-scriptengine" % "2.0.0",

// Hydra
"sh.ory.hydra" % "hydra-client" % "1.7.0",

// HTTP
"com.squareup.okhttp3" % "okhttp" % "4.12.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.12.0",
"org.apache.httpcomponents" % "httpclient" % "4.5.13",

// RabbitMQ
"com.rabbitmq" % "amqp-client" % "5.22.0",
"net.liftmodules" %% "amqp_3.1" % "1.5.0",

// Elasticsearch
"org.elasticsearch" % "elasticsearch" % "8.14.0",
"com.sksamuel.elastic4s" %% "elastic4s-client-esjava" % "8.5.2",

// OAuth
"oauth.signpost" % "signpost-commonshttp4" % "1.2.1.2",

// Utilities
"cglib" % "cglib" % "3.3.0",
"com.sun.activation" % "jakarta.activation" % "1.2.2",
"com.nulab-inc" % "zxcvbn" % "1.9.0",

// Testing - temporarily disabled due to version incompatibility
// "org.scalatest" %% "scalatest" % "2.2.6" % Test,

// Jackson
"com.fasterxml.jackson.core" % "jackson-databind" % "2.12.7.1",

// Flexmark (markdown processing)
"com.vladsch.flexmark" % "flexmark-profile-pegdown" % "0.40.8",
"com.vladsch.flexmark" % "flexmark-util-options" % "0.64.0",

// Connection pool
"com.zaxxer" % "HikariCP" % "4.0.3",

// Test dependencies
"junit" % "junit" % "4.13.2" % Test,
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
"org.seleniumhq.selenium" % "htmlunit-driver" % "2.36.0" % Test,
"org.testcontainers" % "rabbitmq" % "1.20.3" % Test
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import code.api.util.FutureUtil.EndpointContext
import code.api.util.NewStyle.HttpCode
import code.api.v5_0_0.OBPAPI5_0_0
import code.api.v5_1_0.{OBPAPI5_1_0, UserAttributeJsonV510}
import code.api.v6_0_0.OBPAPI6_0_0
import code.util.Helper

import scala.collection.immutable.{List, Nil}
Expand Down Expand Up @@ -123,6 +124,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth
logger.debug(s"getResourceDocsList says requestedApiVersion is $requestedApiVersion")

val resourceDocs = requestedApiVersion match {
case ApiVersion.v6_0_0 => OBPAPI6_0_0.allResourceDocs
case ApiVersion.v5_1_0 => OBPAPI5_1_0.allResourceDocs
case ApiVersion.v5_0_0 => OBPAPI5_0_0.allResourceDocs
case ApiVersion.v4_0_0 => OBPAPI4_0_0.allResourceDocs
Expand All @@ -141,6 +143,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth
logger.debug(s"There are ${resourceDocs.length} resource docs available to $requestedApiVersion")

val versionRoutes = requestedApiVersion match {
case ApiVersion.v6_0_0 => OBPAPI6_0_0.routes
case ApiVersion.v5_1_0 => OBPAPI5_1_0.routes
case ApiVersion.v5_0_0 => OBPAPI5_0_0.routes
case ApiVersion.v4_0_0 => OBPAPI4_0_0.routes
Expand Down
2 changes: 2 additions & 0 deletions obp-api/src/main/scala/code/api/util/ApiVersionUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ object ApiVersionUtils {
v4_0_0 ::
v5_0_0 ::
v5_1_0 ::
v6_0_0 ::
`dynamic-endpoint` ::
`dynamic-entity` ::
scannedApis
Expand All @@ -39,6 +40,7 @@ object ApiVersionUtils {
case v4_0_0.fullyQualifiedVersion | v4_0_0.apiShortVersion => v4_0_0
case v5_0_0.fullyQualifiedVersion | v5_0_0.apiShortVersion => v5_0_0
case v5_1_0.fullyQualifiedVersion | v5_1_0.apiShortVersion => v5_1_0
case v6_0_0.fullyQualifiedVersion | v6_0_0.apiShortVersion => v6_0_0
case `dynamic-endpoint`.fullyQualifiedVersion | `dynamic-endpoint`.apiShortVersion => `dynamic-endpoint`
case `dynamic-entity`.fullyQualifiedVersion | `dynamic-entity`.apiShortVersion => `dynamic-entity`
case version if(scannedApis.map(_.fullyQualifiedVersion).contains(version))
Expand Down
1 change: 1 addition & 0 deletions obp-api/src/main/scala/code/api/util/JwsUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ object JwsUtil extends MdcLoggable {
"BGv1.3"->"berlin-group/v1.3",
"OBPv4.0.0"->"obp/v4.0.0",
"OBPv5.0.0"->"obp/v5.0.0",
"OBPv6.0.0"->"obp/v6.0.0",
"OBPv3.1.0"->"obp/v3.1.0",
"UKv1.3"->"open-banking/v3.1"
).withDefaultValue("{Not found any standard to match}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with


feature(s"test ${ApiEndpoint1.name} ") {
scenario(s"We will test ${ApiEndpoint1.name} Api -v6.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV6_0Request / "resource-docs" / "v6.0.0" / "obp").GET
val responseGetObp = makeGetRequest(requestGetObp)
And("We should get 200 and the response can be extract to case classes")
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
responseGetObp.code should equal(200)
//This should not throw any exceptions
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
}
scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv6.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV6_0Request / "resource-docs" / "OBPv6.0.0" / "obp").GET
val responseGetObp = makeGetRequest(requestGetObp)
And("We should get 200 and the response can be extract to case classes")
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
responseGetObp.code should equal(200)
//This should not throw any exceptions
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
}
scenario(s"We will test ${ApiEndpoint1.name} Api -v5.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v5.0.0" / "obp").GET
val responseGetObp = makeGetRequest(requestGetObp)
Expand Down Expand Up @@ -351,6 +369,24 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with
}

feature(s"test ${ApiEndpoint2.name} ") {
scenario(s"We will test ${ApiEndpoint2.name} Api -v6.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v6.0.0" / "obp").GET
val responseGetObp = makeGetRequest(requestGetObp)
And("We should get 200 and the response can be extract to case classes")
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
responseGetObp.code should equal(200)
//This should not throw any exceptions
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
}
scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv6.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv6.0.0" / "obp").GET
val responseGetObp = makeGetRequest(requestGetObp)
And("We should get 200 and the response can be extract to case classes")
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
responseGetObp.code should equal(200)
//This should not throw any exceptions
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
}
scenario(s"We will test ${ApiEndpoint2.name} Api -v5.0.0/v4.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v5.0.0" / "obp").GET
val responseGetObp = makeGetRequest(requestGetObp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ trait ResourceDocsV140ServerSetup extends ServerSetupWithTestData {
def ResourceDocsV4_0Request = baseRequest / "obp" / "v4.0.0"
def ResourceDocsV5_0Request = baseRequest / "obp" / "v5.0.0"
def ResourceDocsV5_1Request = baseRequest / "obp" / "v5.1.0"
def ResourceDocsV6_0Request = baseRequest / "obp" / "v6.0.0"

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import code.api.v3_1_0.OBPAPI3_1_0
import code.api.v4_0_0.OBPAPI4_0_0
import code.api.v5_0_0.OBPAPI5_0_0
import code.api.v5_1_0.OBPAPI5_1_0
import code.api.v6_0_0.OBPAPI6_0_0
import code.util.Helper.MdcLoggable

import scala.collection.mutable.ArrayBuffer
Expand Down Expand Up @@ -56,7 +57,8 @@ class SwaggerFactoryUnitTest extends V140ServerSetup with MdcLoggable {
feature("Test all V300, V220 and V210, exampleRequestBodies and successResponseBodies and all the case classes in SwaggerDefinitionsJSON") {
scenario("Test all the case classes") {
val resourceDocList: ArrayBuffer[ResourceDoc] = ArrayBuffer.empty
OBPAPI5_1_0.allResourceDocs// ++
OBPAPI6_0_0.allResourceDocs ++
OBPAPI5_1_0.allResourceDocs ++
OBPAPI5_0_0.allResourceDocs ++
OBPAPI4_0_0.allResourceDocs ++
OBPAPI3_1_0.allResourceDocs ++
Expand Down
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.8.2
8 changes: 8 additions & 0 deletions project/metals.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// format: off
// DO NOT EDIT! This file is auto-generated.

// This file enables sbt-bloop to create bloop config files.

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.12")

// format: on
10 changes: 10 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SBT plugins for OBP project
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")

// Scala compiler plugin for macros (equivalent to paradise plugin in Maven)
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)

// SemanticDB for Metals support
addCompilerPlugin("org.scalameta" % "semanticdb-scalac" % "4.13.9" cross CrossVersion.full)
Loading