diff --git a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala
index 6fc155673..8fc3ff61b 100644
--- a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala
+++ b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -410,6 +410,7 @@ class Boot extends MdcLoggable {
enableVersionIfAllowed(ApiVersion.v3_1_0)
enableVersionIfAllowed(ApiVersion.v4_0_0)
enableVersionIfAllowed(ApiVersion.v5_0_0)
+ enableVersionIfAllowed(ApiVersion.v5_1_0)
enableVersionIfAllowed(ApiVersion.b1)
enableVersionIfAllowed(ApiVersion.`dynamic-endpoint`)
enableVersionIfAllowed(ApiVersion.`dynamic-entity`)
diff --git a/obp-api/src/main/scala/code/api/OBPRestHelper.scala b/obp-api/src/main/scala/code/api/OBPRestHelper.scala
index 91b22cbe9..7f6ba17d1 100644
--- a/obp-api/src/main/scala/code/api/OBPRestHelper.scala
+++ b/obp-api/src/main/scala/code/api/OBPRestHelper.scala
@@ -38,6 +38,7 @@ import code.api.v3_0_0.APIMethods300
import code.api.v3_1_0.APIMethods310
import code.api.v4_0_0.{APIMethods400, OBPAPI4_0_0}
import code.api.v5_0_0.OBPAPI5_0_0
+import code.api.v5_1_0.OBPAPI5_1_0
import code.loginattempts.LoginAttempt
import code.model.dataAccess.AuthUser
import code.util.Helper.MdcLoggable
@@ -666,7 +667,7 @@ trait OBPRestHelper extends RestHelper with MdcLoggable {
autoValidateAll: Boolean = false): Unit = {
def isAutoValidate(doc: ResourceDoc): Boolean = { //note: only support v5.0.0 and v4.0.0 at the moment.
- doc.isValidateEnabled || (autoValidateAll && !doc.isValidateDisabled && List(OBPAPI5_0_0.version,OBPAPI4_0_0.version).contains(doc.implementedInApiVersion))
+ doc.isValidateEnabled || (autoValidateAll && !doc.isValidateDisabled && List(OBPAPI5_1_0.version,OBPAPI5_0_0.version,OBPAPI4_0_0.version).contains(doc.implementedInApiVersion))
}
for(route <- routes) {
diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala
index 0b19efea4..70eb34b50 100644
--- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala
+++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala
@@ -38,6 +38,7 @@ import net.liftweb.util.Props
import java.util.concurrent.ConcurrentHashMap
import code.api.util.NewStyle.HttpCode
import code.api.v5_0_0.OBPAPI5_0_0
+import code.api.v5_1_0.OBPAPI5_1_0
import code.util.Helper
import scala.collection.immutable.{List, Nil}
@@ -120,6 +121,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth
val resourceDocs = requestedApiVersion match {
case ApiVersion.`b1` => OBP_APIBuilder.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
case ApiVersion.v3_1_0 => OBPAPI3_1_0.allResourceDocs
@@ -138,6 +140,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth
val versionRoutes = requestedApiVersion match {
case ApiVersion.`b1` => OBP_APIBuilder.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
case ApiVersion.v3_1_0 => OBPAPI3_1_0.routes
diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala
index 9e4140855..baa806c7f 100644
--- a/obp-api/src/main/scala/code/api/util/APIUtil.scala
+++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala
@@ -2488,6 +2488,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
case ApiVersion.v3_1_0 => LiftRules.statelessDispatch.append(v3_1_0.OBPAPI3_1_0)
case ApiVersion.v4_0_0 => LiftRules.statelessDispatch.append(v4_0_0.OBPAPI4_0_0)
case ApiVersion.v5_0_0 => LiftRules.statelessDispatch.append(v5_0_0.OBPAPI5_0_0)
+ case ApiVersion.v5_1_0 => LiftRules.statelessDispatch.append(v5_1_0.OBPAPI5_1_0)
case ApiVersion.`dynamic-endpoint` => LiftRules.statelessDispatch.append(OBPAPIDynamicEndpoint)
case ApiVersion.`dynamic-entity` => LiftRules.statelessDispatch.append(OBPAPIDynamicEntity)
case ApiVersion.`b1` => LiftRules.statelessDispatch.append(OBP_APIBuilder)
diff --git a/obp-api/src/main/scala/code/api/util/ApiVersionUtils.scala b/obp-api/src/main/scala/code/api/util/ApiVersionUtils.scala
index 428f78606..873678eed 100644
--- a/obp-api/src/main/scala/code/api/util/ApiVersionUtils.scala
+++ b/obp-api/src/main/scala/code/api/util/ApiVersionUtils.scala
@@ -17,6 +17,7 @@ object ApiVersionUtils {
v3_1_0 ::
v4_0_0 ::
v5_0_0 ::
+ v5_1_0 ::
`dynamic-endpoint` ::
`dynamic-entity` ::
b1::
@@ -38,6 +39,7 @@ object ApiVersionUtils {
case v3_1_0.fullyQualifiedVersion | v3_1_0.apiShortVersion => v3_1_0
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 `dynamic-endpoint`.fullyQualifiedVersion | `dynamic-endpoint`.apiShortVersion => `dynamic-endpoint`
case `dynamic-entity`.fullyQualifiedVersion | `dynamic-entity`.apiShortVersion => `dynamic-entity`
case b1.fullyQualifiedVersion | b1.apiShortVersion => b1
diff --git a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
new file mode 100644
index 000000000..4ad574fb5
--- /dev/null
+++ b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
@@ -0,0 +1,38 @@
+package code.api.v5_1_0
+
+
+import code.api.util.APIUtil._
+
+import code.transactionrequests.TransactionRequests.TransactionRequestTypes.{apply => _}
+import com.github.dwickern.macros.NameOf.nameOf
+import com.openbankproject.commons.model.BankId
+import com.openbankproject.commons.util.ApiVersion
+import net.liftweb.http.rest.RestHelper
+import com.openbankproject.commons.ExecutionContext.Implicits.global
+import scala.collection.mutable.ArrayBuffer
+
+
+trait APIMethods510 {
+ self: RestHelper =>
+
+ val Implementations5_1_0 = new Implementations510()
+
+ class Implementations510 {
+
+ val implementedInApiVersion = ApiVersion.v5_1_0
+
+ private val staticResourceDocs = ArrayBuffer[ResourceDoc]()
+ def resourceDocs = staticResourceDocs
+
+ val apiRelations = ArrayBuffer[ApiRelation]()
+ val codeContext = CodeContext(staticResourceDocs, apiRelations)
+
+ }
+}
+
+object APIMethods510 extends RestHelper with APIMethods510 {
+ lazy val newStyleEndpoints: List[(String, String)] = Implementations5_1_0.resourceDocs.map {
+ rd => (rd.partialFunctionName, rd.implementedInApiVersion.toString())
+ }.toList
+}
+
diff --git a/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala b/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala
new file mode 100644
index 000000000..e90c13a75
--- /dev/null
+++ b/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala
@@ -0,0 +1,34 @@
+/**
+ * Open Bank Project - API
+ * Copyright (C) 2011-2019, TESOBE GmbH
+ * *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ * *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ * *
+ * Email: contact@tesobe.com
+ * TESOBE GmbH
+ * Osloerstrasse 16/17
+ * Berlin 13359, Germany
+ * *
+ * This product includes software developed at
+ * TESOBE (http://www.tesobe.com/)
+ *
+ */
+package code.api.v5_1_0
+
+
+object JSONFactory510 {
+
+
+}
+
diff --git a/obp-api/src/main/scala/code/api/v5_1_0/OBPAPI5_1_0.scala b/obp-api/src/main/scala/code/api/v5_1_0/OBPAPI5_1_0.scala
new file mode 100644
index 000000000..ec7acd432
--- /dev/null
+++ b/obp-api/src/main/scala/code/api/v5_1_0/OBPAPI5_1_0.scala
@@ -0,0 +1,109 @@
+/**
+Open Bank Project - API
+Copyright (C) 2011-2019, TESOBE GmbH.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+
+Email: contact@tesobe.com
+TESOBE GmbH.
+Osloer Strasse 16/17
+Berlin 13359, Germany
+
+This product includes software developed at
+TESOBE (http://www.tesobe.com/)
+
+ */
+package code.api.v5_1_0
+
+import code.api.OBPRestHelper
+import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
+import code.api.util.{APIUtil, VersionedOBPApis}
+import code.api.v1_3_0.APIMethods130
+import code.api.v1_4_0.APIMethods140
+import code.api.v2_0_0.APIMethods200
+import code.api.v2_1_0.APIMethods210
+import code.api.v2_2_0.APIMethods220
+import code.api.v3_0_0.APIMethods300
+import code.api.v3_0_0.custom.CustomAPIMethods300
+import code.api.v3_1_0.{APIMethods310}
+import code.api.v4_0_0.{APIMethods400}
+import code.api.v5_0_0.{APIMethods500, OBPAPI5_0_0}
+import code.util.Helper.MdcLoggable
+import com.openbankproject.commons.util.ApiVersion
+import net.liftweb.common.{Box, Full}
+import net.liftweb.http.{LiftResponse, PlainTextResponse}
+import org.apache.http.HttpStatus
+
+/*
+This file defines which endpoints from all the versions are available in v5.0.0
+ */
+object OBPAPI5_1_0 extends OBPRestHelper
+ with APIMethods130
+ with APIMethods140
+ with APIMethods200
+ with APIMethods210
+ with APIMethods220
+ with APIMethods300
+ with CustomAPIMethods300
+ with APIMethods310
+ with APIMethods400
+ with APIMethods500
+ with APIMethods510
+ with MdcLoggable
+ with VersionedOBPApis{
+
+ val version : ApiVersion = ApiVersion.v5_1_0
+
+ val versionStatus = "BLEEDING-EDGE" // TODO this should be a property of ApiVersion.
+
+ // Possible Endpoints from 5.1.0, exclude one endpoint use - method,exclude multiple endpoints use -- method,
+ // e.g getEndpoints(Implementations5_0_0) -- List(Implementations5_0_0.genericEndpoint, Implementations5_0_0.root)
+ val endpointsOf5_1_0 = getEndpoints(Implementations5_1_0)
+
+ // if old version ResourceDoc objects have the same name endpoint with new version, omit old version ResourceDoc.
+ def allResourceDocs = collectResourceDocs(
+ OBPAPI5_0_0.allResourceDocs,
+ Implementations5_1_0.resourceDocs
+ )
+
+ // all endpoints
+ private val endpoints: List[OBPEndpoint] = OBPAPI5_0_0.routes ++ endpointsOf5_1_0
+
+ // Filter the possible endpoints by the disabled / enabled Props settings and add them together
+ val routes : List[OBPEndpoint] = getAllowedEndpoints(endpoints, allResourceDocs)
+
+ // register v5.1.0 apis first, Make them available for use!
+ registerRoutes(routes, allResourceDocs, apiPrefix, true)
+
+
+ logger.info(s"version $version has been run! There are ${routes.length} routes, ${allResourceDocs.length} allResourceDocs.")
+
+ // specified response for OPTIONS request.
+ private val corsResponse: Box[LiftResponse] = Full{
+ val corsHeaders = List(
+ "Access-Control-Allow-Origin" -> "*",
+ "Access-Control-Allow-Methods" -> "GET, POST, OPTIONS, PUT, PATCH, DELETE",
+ "Access-Control-Allow-Headers" -> "*",
+ "Access-Control-Allow-Credentials" -> "true",
+ "Access-Control-Max-Age" -> "1728000" //Tell client that this pre-flight info is valid for 20 days
+ )
+ PlainTextResponse("", corsHeaders, HttpStatus.SC_NO_CONTENT)
+ }
+ /*
+ * process OPTIONS http request, just return no content and status is 204
+ */
+ this.serve({
+ case req if req.requestType.method == "OPTIONS" => corsResponse
+ })
+}
diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/util/ApiVersion.scala b/obp-commons/src/main/scala/com/openbankproject/commons/util/ApiVersion.scala
index 3e78ea0fb..33fd9d5d9 100644
--- a/obp-commons/src/main/scala/com/openbankproject/commons/util/ApiVersion.scala
+++ b/obp-commons/src/main/scala/com/openbankproject/commons/util/ApiVersion.scala
@@ -23,6 +23,7 @@ object ApiShortVersions extends Enumeration {
val `v3.1.0` = Value("v3.1.0")
val `v4.0.0` = Value("v4.0.0")
val `v5.0.0` = Value("v5.0.0")
+ val `v5.1.0` = Value("v5.1.0")
val b1 = Value
val `dynamic-endpoint` = Value("dynamic-endpoint")
val `dynamic-entity` = Value("dynamic-entity")
@@ -108,6 +109,7 @@ object ApiVersion {
val v3_1_0 = ScannedApiVersion(urlPrefix,ApiStandards.obp.toString,ApiShortVersions.`v3.1.0`.toString)
val v4_0_0 = ScannedApiVersion(urlPrefix,ApiStandards.obp.toString,ApiShortVersions.`v4.0.0`.toString)
val v5_0_0 = ScannedApiVersion(urlPrefix,ApiStandards.obp.toString,ApiShortVersions.`v5.0.0`.toString)
+ val v5_1_0 = ScannedApiVersion(urlPrefix,ApiStandards.obp.toString,ApiShortVersions.`v5.1.0`.toString)
val `dynamic-endpoint` = ScannedApiVersion(urlPrefix,ApiStandards.obp.toString,ApiShortVersions.`dynamic-endpoint`.toString)
val `dynamic-entity` = ScannedApiVersion(urlPrefix,ApiStandards.obp.toString,ApiShortVersions.`dynamic-entity`.toString)
@@ -126,6 +128,7 @@ object ApiVersion {
v3_1_0 ::
v4_0_0 ::
v5_0_0 ::
+ v5_1_0 ::
b1 ::
`dynamic-endpoint` ::
`dynamic-entity`::