Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Marko Milić 2022-12-19 08:56:25 +01:00
commit 9f6be401ca
38 changed files with 288 additions and 69 deletions

View File

@ -29,7 +29,6 @@ package bootstrap.liftweb
import java.io.{File, FileInputStream}
import java.util.stream.Collectors
import java.util.{Locale, TimeZone}
import code.CustomerDependants.MappedCustomerDependant
import code.DynamicData.DynamicData
import code.DynamicEndpoint.DynamicEndpoint
@ -39,7 +38,7 @@ import code.accountattribute.MappedAccountAttribute
import code.accountholders.MapperAccountHolders
import code.actorsystem.ObpActorSystem
import code.api.Constant._
import code.api.ResourceDocs1_4_0.ResourceDocs300.{ResourceDocs310, ResourceDocs400, ResourceDocs500}
import code.api.ResourceDocs1_4_0.ResourceDocs300.{ResourceDocs310, ResourceDocs400, ResourceDocs500, ResourceDocs510}
import code.api.ResourceDocs1_4_0._
import code.api._
import code.api.attributedefinition.AttributeDefinition
@ -133,6 +132,7 @@ import code.webuiprops.WebUiProps
import com.openbankproject.commons.model.{ErrorMessage, User}
import com.openbankproject.commons.util.Functions.Implicits._
import com.openbankproject.commons.util.{ApiVersion, Functions}
import javax.mail.{Authenticator, PasswordAuthentication}
import javax.mail.internet.MimeMessage
import net.liftweb.common._
@ -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`)
@ -468,6 +469,7 @@ class Boot extends MdcLoggable {
LiftRules.statelessDispatch.append(ResourceDocs310)
LiftRules.statelessDispatch.append(ResourceDocs400)
LiftRules.statelessDispatch.append(ResourceDocs500)
LiftRules.statelessDispatch.append(ResourceDocs510)
////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import scala.collection.mutable.ArrayBuffer
@ -48,7 +48,7 @@ This file defines which endpoints from all the versions are available in v1
object ApiCollector extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("cds-au", "AU", "v1.0.0")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =
APIMethods_AccountsApi.endpoints ++

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.{ScannedApis}
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import scala.collection.mutable.ArrayBuffer
@ -46,7 +46,7 @@ This file defines which endpoints from all the versions are available in v1
*/
object ApiCollector extends OBPRestHelper with MdcLoggable with ScannedApis {
override val apiVersion = ScannedApiVersion("BAHRAIN-OBF", "BAHRAIN-OBF", "v1.0.0")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =
APIMethods_DomesticFutureDatedPaymentConsentsApi.endpoints ++

View File

@ -4,7 +4,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -14,7 +14,7 @@ This file defines which endpoints from all the versions are available in v1
object CNBV9_1_0_0 extends OBPRestHelper with MdcLoggable with ScannedApis {
// CNBV9
override val apiVersion = ApiVersion.cnbv9
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints = APIMethods_AtmsApi.endpoints
override val allResourceDocs: ArrayBuffer[ResourceDoc] = APIMethods_AtmsApi.resourceDocs

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -46,7 +46,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_MXOF_1_0_0 extends OBPRestHelper with MdcLoggable with ScannedApis {
// mx-open-finance
override val apiVersion = ApiVersion.mxofV100
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints = APIMethods_AtmsApi.endpoints
override val allResourceDocs: ArrayBuffer[ResourceDoc] = APIMethods_AtmsApi.resourceDocs.map(

View File

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

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import scala.collection.mutable.ArrayBuffer
@ -48,7 +48,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_PAPI_2_1_1_1 extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("polish-api", "PAPI", "v2.1.1.1")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =
APIMethods_AISApi.endpoints ++

View File

@ -1,13 +1,13 @@
package code.api.ResourceDocs1_4_0
import code.api.OBPRestHelper
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.util.Helper.MdcLoggable
object ResourceDocs140 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version = ApiVersion.v1_4_0 // "1.4.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObp,
ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp,
@ -23,7 +23,7 @@ object ResourceDocs140 extends OBPRestHelper with ResourceDocsAPIMethods with Md
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs200 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version = ApiVersion.v2_0_0 // "2.0.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObp,
ImplementationsResourceDocs.getResourceDocsSwagger,
@ -39,7 +39,7 @@ object ResourceDocs200 extends OBPRestHelper with ResourceDocsAPIMethods with Md
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs210 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version: ApiVersion = ApiVersion.v2_1_0 // "2.1.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObp,
ImplementationsResourceDocs.getResourceDocsSwagger,
@ -54,7 +54,7 @@ object ResourceDocs210 extends OBPRestHelper with ResourceDocsAPIMethods with Md
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs220 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version: ApiVersion = ApiVersion.v2_2_0 // "2.2.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObp,
ImplementationsResourceDocs.getResourceDocsSwagger,
@ -69,7 +69,7 @@ object ResourceDocs220 extends OBPRestHelper with ResourceDocsAPIMethods with Md
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version : ApiVersion = ApiVersion.v3_0_0 // = "3.0.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObp,
ImplementationsResourceDocs.getResourceDocsSwagger,
@ -83,7 +83,7 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs310 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version: ApiVersion = ApiVersion.v3_1_0 // = "3.0.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObp,
ImplementationsResourceDocs.getResourceDocsSwagger,
@ -99,7 +99,7 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs400 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version: ApiVersion = ApiVersion.v4_0_0 // = "4.0.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "BLEEDING-EDGE"
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObpV400,
ImplementationsResourceDocs.getResourceDocsSwagger,
@ -114,8 +114,24 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md
}
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
object ResourceDocs500 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version: ApiVersion = ApiVersion.v5_0_0 // = "4.0.0" // We match other api versions so API explorer can easily use the path.
val versionStatus = "BLEEDING-EDGE"
val version: ApiVersion = ApiVersion.v5_0_0
val versionStatus = ApiVersionStatus.STABLE.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObpV400,
ImplementationsResourceDocs.getResourceDocsSwagger,
ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp,
// ImplementationsResourceDocs.getStaticResourceDocsObp
)
routes.foreach(route => {
oauthServe(apiPrefix {
route
})
})
}
object ResourceDocs510 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
val version: ApiVersion = ApiVersion.v5_1_0
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
val routes = List(
ImplementationsResourceDocs.getResourceDocsObpV400,
ImplementationsResourceDocs.getResourceDocsSwagger,

View File

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

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import scala.collection.mutable.ArrayBuffer
@ -48,7 +48,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_STET_1_4 extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("stet", "STET", "v1.4")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =
APIMethods_AISPApi.endpoints ++

View File

@ -33,7 +33,7 @@ import code.util.Helper.MdcLoggable
import scala.collection.immutable.Nil
import code.api.UKOpenBanking.v2_0_0.APIMethods_UKOpenBanking_200._
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
/*
@ -44,7 +44,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_UKOpenBanking_200 extends OBPRestHelper with MdcLoggable with ScannedApis{
override val apiVersion = ScannedApiVersion("open-banking", "UK", "v2.0")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
val allEndpoints =
getAccountList ::

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import scala.collection.mutable.ArrayBuffer
@ -48,7 +48,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_UKOpenBanking_310 extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("open-banking", "UK", "v3.1")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =
APIMethods_AccountAccessApi.endpoints ++

View File

@ -28,7 +28,7 @@ package code.api.berlin.group.v1
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import code.api.berlin.group.v1.APIMethods_BERLIN_GROUP_1._
@ -45,7 +45,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_BERLIN_GROUP_1 extends OBPRestHelper with MdcLoggable with ScannedApis{
override val apiVersion = ScannedApiVersion("berlin-group", "BG", "v1")
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
val allEndpoints =
getAccountList ::

View File

@ -40,7 +40,7 @@ import code.api.builder.SigningBasketsApi.APIMethods_SigningBasketsApi
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion,ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -53,7 +53,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_BERLIN_GROUP_1_3 extends OBPRestHelper with MdcLoggable with ScannedApis {
override val apiVersion = ApiVersion.berlinGroupV13
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
val endpoints =
APIMethods_AccountInformationServiceAISApi.endpoints ++

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, berlinGroupV13AliasPath, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ScannedApiVersion
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import scala.collection.mutable.ArrayBuffer
/*
@ -43,7 +43,7 @@ This file defines which endpoints from all the versions are available in v1
*/
object OBP_BERLIN_GROUP_1_3_Alias extends OBPRestHelper with MdcLoggable with ScannedApis {
override val apiVersion = ScannedApiVersion(berlinGroupV13AliasPath.head, berlinGroupV13AliasPath.head, berlinGroupV13AliasPath.last)
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
override val allResourceDocs: ArrayBuffer[ResourceDoc] = if(berlinGroupV13AliasPath.nonEmpty){
OBP_BERLIN_GROUP_1_3.allResourceDocs.map(resourceDoc => resourceDoc.copy(

View File

@ -2,13 +2,13 @@ package code.api.builder
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.util.Helper.MdcLoggable
object OBP_APIBuilder extends OBPRestHelper with APIMethods_APIBuilder with MdcLoggable {
val version = ApiVersion.b1
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
val endpoints = ImplementationsBuilderAPI.endpointsOfBuilderAPI

View File

@ -33,7 +33,7 @@ import code.api.util.APIUtil.OBPEndpoint
import code.api.util.{APIUtil, VersionedOBPApis}
import code.api.v5_0_0.OBPAPI5_0_0.{allResourceDocs, apiPrefix, registerRoutes, routes}
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import net.liftweb.common.{Box, Full}
import net.liftweb.http.{LiftResponse, PlainTextResponse}
import org.apache.http.HttpStatus
@ -45,7 +45,7 @@ object OBPAPIDynamicEndpoint extends OBPRestHelper with MdcLoggable with Version
val version : ApiVersion = ApiVersion.`dynamic-endpoint`
val versionStatus = "BLEEDING-EDGE" // TODO this should be a property of ApiVersion.
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
// if old version ResourceDoc objects have the same name endpoint with new version, omit old version ResourceDoc.
def allResourceDocs = collectResourceDocs(ImplementationsDynamicEndpoint.resourceDocs)

View File

@ -33,7 +33,7 @@ import code.api.util.APIUtil.OBPEndpoint
import code.api.util.{APIUtil, VersionedOBPApis}
import code.api.v5_0_0.OBPAPI5_0_0.{allResourceDocs, apiPrefix, registerRoutes, routes}
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import net.liftweb.common.{Box, Full}
import net.liftweb.http.{LiftResponse, PlainTextResponse}
import org.apache.http.HttpStatus
@ -45,7 +45,7 @@ object OBPAPIDynamicEntity extends OBPRestHelper with MdcLoggable with Versioned
val version : ApiVersion = ApiVersion.`dynamic-entity`
val versionStatus = "BLEEDING-EDGE" // TODO this should be a property of ApiVersion.
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
// if old version ResourceDoc objects have the same name endpoint with new version, omit old version ResourceDoc.
def allResourceDocs = collectResourceDocs(ImplementationsDynamicEntity.resourceDocs)

View File

@ -39,7 +39,7 @@ import code.token.{OpenIDConnectToken, TokensOpenIDConnect}
import code.users.Users
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.model.User
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import javax.net.ssl.HttpsURLConnection
import net.liftweb.common._
import net.liftweb.http._
@ -86,7 +86,7 @@ object OpenIdConnectConfig {
object OpenIdConnect extends OBPRestHelper with MdcLoggable {
val version = ApiVersion.openIdConnect1 // "1.0" // TODO: Should this be the lowest version supported or when introduced?
val versionStatus = "DRAFT"
val versionStatus = ApiVersionStatus.DRAFT.toString
val openIdConnect = "OpenID Connect"

View File

@ -2489,6 +2489,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)

View File

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

View File

@ -68,7 +68,7 @@ object Migration extends MdcLoggable {
generateAndPopulateMissingConsumersUUIDs(startedBeforeSchemifier)
populateTableRateLimiting()
updateTableViewDefinition()
bankAccountHoldersAndOwnerViewAccessInfo()
bankAccountHoldersAndOwnerViewAccessInfo(startedBeforeSchemifier)
alterTableMappedConsent()
alterColumnChallengeAtTableMappedConsent()
alterTableOpenIDConnectToken()
@ -183,10 +183,15 @@ object Migration extends MdcLoggable {
}
}
private def bankAccountHoldersAndOwnerViewAccessInfo(): Boolean = {
val name = nameOf(bankAccountHoldersAndOwnerViewAccessInfo)
runOnce(name) {
BankAccountHoldersAndOwnerViewAccess.saveInfoBankAccountHoldersAndOwnerViewAccessInfo(name)
private def bankAccountHoldersAndOwnerViewAccessInfo(startedBeforeSchemifier: Boolean): Boolean = {
if(startedBeforeSchemifier == true) {
logger.warn(s"Migration.database.bankAccountHoldersAndOwnerViewAccessInfo(true) cannot be run before Schemifier.")
true
} else {
val name = nameOf(bankAccountHoldersAndOwnerViewAccessInfo(startedBeforeSchemifier))
runOnce(name) {
BankAccountHoldersAndOwnerViewAccess.saveInfoBankAccountHoldersAndOwnerViewAccessInfo(name)
}
}
}
private def alterTableMappedConsent(): Boolean = {

View File

@ -28,7 +28,7 @@ package code.api.v1_2_1
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.api.util.VersionedOBPApis
import code.util.Helper.MdcLoggable
@ -38,7 +38,7 @@ object OBPAPI1_2_1 extends OBPRestHelper with APIMethods121 with MdcLoggable wit
val version : ApiVersion = ApiVersion.v1_2_1 // "1.2.1"
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
val endpointsOf1_2_1 = List(
Implementations1_2_1.root(version, versionStatus),

View File

@ -2,7 +2,7 @@ package code.api.v1_3_0
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.api.util.VersionedOBPApis
import code.api.v1_2_1.APIMethods121
import code.util.Helper.MdcLoggable
@ -15,7 +15,7 @@ import code.util.Helper.MdcLoggable
object OBPAPI1_3_0 extends OBPRestHelper with APIMethods130 with APIMethods121 with MdcLoggable with VersionedOBPApis{
val version : ApiVersion = ApiVersion.v1_3_0 // "1.3.0"
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
//TODO: check all these calls to see if they should really have the same behaviour as 1.2.1

View File

@ -2,7 +2,7 @@ package code.api.v1_4_0
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.api.util.VersionedOBPApis
import code.util.Helper.MdcLoggable
@ -10,7 +10,7 @@ import code.util.Helper.MdcLoggable
object OBPAPI1_4_0 extends OBPRestHelper with APIMethods140 with MdcLoggable with VersionedOBPApis{
val version : ApiVersion = ApiVersion.v1_4_0 //"1.4.0"
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
val endpointsOf1_2_1 = List(
Implementations1_2_1.root(version, versionStatus),

View File

@ -28,7 +28,7 @@ package code.api.v2_0_0
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.api.util.VersionedOBPApis
import code.api.v1_3_0.APIMethods130
import code.api.v1_4_0.APIMethods140
@ -38,7 +38,7 @@ object OBPAPI2_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
val version : ApiVersion = ApiVersion.v2_0_0 // "2.0.0"
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
// Note: Since we pattern match on these routes, if two implementations match a given url the first will match

View File

@ -33,7 +33,7 @@ import code.api.v1_3_0.APIMethods130
import code.api.v1_4_0.APIMethods140
import code.api.v2_0_0.APIMethods200
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import scala.collection.immutable.Nil
@ -44,7 +44,7 @@ object OBPAPI2_1_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
val version : ApiVersion = ApiVersion.v2_1_0 //"2.1.0"
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
// Possible Endpoints 1.2.1
val endpointsOf1_2_1 = Implementations1_2_1.addCommentForViewOnTransaction ::

View File

@ -9,14 +9,14 @@ import code.api.v1_4_0.APIMethods140
import code.api.v2_0_0.APIMethods200
import code.api.v2_1_0.APIMethods210
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import scala.collection.immutable.Nil
object OBPAPI2_2_0 extends OBPRestHelper with APIMethods130 with APIMethods140 with APIMethods200 with APIMethods210 with APIMethods220 with MdcLoggable with VersionedOBPApis{
val version : ApiVersion = ApiVersion.v2_2_0 // "2.2.0"
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
// Possible Endpoints from 1.2.1
val endpointsOf1_2_1 = Implementations1_2_1.addCommentForViewOnTransaction ::

View File

@ -28,7 +28,7 @@ package code.api.v3_0_0
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.api.util.VersionedOBPApis
import code.api.v1_3_0.APIMethods130
import code.api.v1_4_0.APIMethods140
@ -53,7 +53,7 @@ object OBPAPI3_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
val version : ApiVersion = ApiVersion.v3_0_0
val versionStatus = "STABLE" // TODO this should be a property of ApiVersion.
val versionStatus = ApiVersionStatus.STABLE.toString // TODO this should be a property of ApiVersion.
// Possible Endpoints from 1.2.1

View File

@ -28,7 +28,7 @@ package code.api.v3_1_0
import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import code.api.util.VersionedOBPApis
import code.api.v1_3_0.APIMethods130
import code.api.v1_4_0.APIMethods140
@ -52,7 +52,7 @@ object OBPAPI3_1_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
val version : ApiVersion = ApiVersion.v3_1_0
val versionStatus = "STABLE"
val versionStatus = ApiVersionStatus.STABLE.toString
// Possible Endpoints from 1.2.1

View File

@ -39,7 +39,7 @@ import code.api.v3_0_0.custom.CustomAPIMethods300
import code.api.v3_1_0.{APIMethods310, OBPAPI3_1_0}
import code.util.Helper.MdcLoggable
import com.github.dwickern.macros.NameOf.nameOf
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import net.liftweb.common.{Box, Full}
import net.liftweb.http.{LiftResponse, PlainTextResponse}
import org.apache.http.HttpStatus
@ -51,7 +51,7 @@ object OBPAPI4_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
val version : ApiVersion = ApiVersion.v4_0_0
val versionStatus = "DRAFT" // TODO this should be a property of ApiVersion.
val versionStatus = ApiVersionStatus.STABLE.toString
// Possible Endpoints from 4.0.0, exclude one endpoint use - method,exclude multiple endpoints use -- method,
// e.g getEndpoints(Implementations4_0_0) -- List(Implementations4_0_0.genericEndpoint, Implementations4_0_0.root)

View File

@ -41,7 +41,7 @@ import code.api.v4_0_0.{APIMethods400, OBPAPI4_0_0}
import code.api.v4_0_0.OBPAPI4_0_0.{Implementations4_0_0, endpointsOf4_0_0}
import code.util.Helper.MdcLoggable
import com.github.dwickern.macros.NameOf.nameOf
import com.openbankproject.commons.util.ApiVersion
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
import net.liftweb.common.{Box, Full}
import net.liftweb.http.{LiftResponse, PlainTextResponse}
import org.apache.http.HttpStatus
@ -65,7 +65,7 @@ object OBPAPI5_0_0 extends OBPRestHelper
val version : ApiVersion = ApiVersion.v5_0_0
val versionStatus = "BLEEDING-EDGE" // TODO this should be a property of ApiVersion.
val versionStatus = ApiVersionStatus.STABLE.toString
// Possible Endpoints from 5.0.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)

View File

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

View File

@ -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 <http://www.gnu.org/licenses/>.
* *
* 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 {
}

View File

@ -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 <http://www.gnu.org/licenses/>.
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, ApiVersionStatus}
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 = ApiVersionStatus.`BLEEDING-EDGE`.toString
// 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
})
}

View File

@ -20,6 +20,6 @@ class ApiVersionUtilsTest extends V400ServerSetup {
versions.map(version => ApiVersionUtils.valueOf(version.fullyQualifiedVersion))
//NOTE, when we added the new version, better fix this number manually. and also check the versions
versions.length shouldBe(24)
versions.length shouldBe(25)
}}
}

View File

@ -23,11 +23,17 @@ 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")
}
object ApiVersionStatus extends Enumeration {
type Status = Value
val STABLE, `BLEEDING-EDGE`,DRAFT = Value
}
sealed trait ApiVersion {
lazy val dottedApiVersion: String = this.toString.replace("_", ".").replace("v","")
lazy val vDottedApiVersion: String = this.toString.replace("_", ".")
@ -108,6 +114,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 +133,7 @@ object ApiVersion {
v3_1_0 ::
v4_0_0 ::
v5_0_0 ::
v5_1_0 ::
b1 ::
`dynamic-endpoint` ::
`dynamic-entity`::