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 d123c02b3d..9f30502b27 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
@@ -132,7 +132,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth
case ApiVersion.v3_0_0 => OBPAPI3_0_0.allResourceDocs
case ApiVersion.v2_2_0 => OBPAPI2_2_0.allResourceDocs
case ApiVersion.v2_1_0 => OBPAPI2_1_0.allResourceDocs
- case ApiVersion.v2_0_0 => Implementations2_0_0.resourceDocs ++ Implementations1_4_0.resourceDocs ++ Implementations1_3_0.resourceDocs ++ Implementations1_2_1.resourceDocs
+ case ApiVersion.v2_0_0 => OBPAPI2_0_0.allResourceDocs
case ApiVersion.v1_4_0 => Implementations1_4_0.resourceDocs ++ Implementations1_3_0.resourceDocs ++ Implementations1_2_1.resourceDocs
case ApiVersion.v1_3_0 => Implementations1_3_0.resourceDocs ++ Implementations1_2_1.resourceDocs
case ApiVersion.v1_2_1 => code.api.v1_2_1.Http4s121.resourceDocs
@@ -183,6 +183,9 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth
case ApiVersion.v4_0_0 => resourceDocs // fully on http4s — no Lift route filter
case ApiVersion.v3_1_0 => resourceDocs // fully on http4s — no Lift route filter
case ApiVersion.v3_0_0 => resourceDocs // fully on http4s — no Lift route filter
+ case ApiVersion.v2_2_0 => resourceDocs // fully on http4s — no Lift route filter
+ case ApiVersion.v2_1_0 => resourceDocs // fully on http4s — no Lift route filter
+ case ApiVersion.v2_0_0 => resourceDocs // fully on http4s — no Lift route filter
case _ => resourceDocs.filter(rd => versionRoutesClasses.contains(rd.partialFunction.getClass))
}
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 2270a84946..0110e58def 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
@@ -1,2175 +1,2185 @@
package code.api.v2_0_0
-import scala.language.reflectiveCalls
-import code.TransactionTypes.TransactionType
-import code.api.APIFailureNewStyle
-import code.api.Constant._
-import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
-import code.api.util.APIUtil._
-import code.api.util.ApiTag._
-import code.api.util.ErrorMessages.AuthenticatedUserIsRequired
-import code.api.util.FutureUtil.EndpointContext
-import code.api.util.NewStyle.HttpCode
-import code.api.util._
-import code.api.v1_2_1.OBPAPI1_2_1._
-import code.api.v1_2_1.{JSONFactory => JSONFactory121}
-import code.api.v1_4_0.JSONFactory1_4_0
-import code.api.v2_0_0.JSONFactory200.{privateBankAccountsListToJson, _}
-import code.customer.CustomerX
-import code.entitlement.Entitlement
-import code.fx.fx
-import code.model._
-import code.model.dataAccess.{AuthUser, BankAccountCreation}
-import code.search.{elasticsearchMetrics, elasticsearchWarehouse}
-import code.socialmedia.SocialMediaHandle
-import code.usercustomerlinks.UserCustomerLink
-import code.users.Users
-import code.util.Helper
-import code.util.Helper.{booleanToBox, booleanToFuture}
-import code.views.Views
-import com.openbankproject.commons.ExecutionContext.Implicits.global
-import com.openbankproject.commons.model._
-import com.openbankproject.commons.util.ApiVersion
-import net.liftweb.common._
-import net.liftweb.http.CurrentReq
import net.liftweb.http.rest.RestHelper
-import net.liftweb.json.JsonAST.JValue
-import net.liftweb.mapper.By
-import net.liftweb.util.Helpers.tryo
-import net.liftweb.util.StringHelpers
-
-import java.util.Date
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.Future
-// Makes JValue assignment to Nil work
-import code.api.util.ApiRole._
-import code.api.util.ErrorMessages._
-import com.openbankproject.commons.model.{AmountOfMoneyJsonV121 => AmountOfMoneyJSON121}
-import net.liftweb.json.Extraction
-
-trait APIMethods200 {
- //needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
- self: RestHelper =>
-
- // helper methods begin here
- private def privateBankAccountBasicListToJson(bankAccounts: List[BankAccount], privateViewsUserCanAccessAtOneBank : List[View]): JValue = {
- Extraction.decompose(privateBasicBankAccountList(bankAccounts, privateViewsUserCanAccessAtOneBank))
- }
- // shows a small representation of View
- private def publicBankAccountBasicListToJson(bankAccounts: List[BankAccount], publicViews : List[View]): JValue = {
- Extraction.decompose(publicBasicBankAccountList(bankAccounts, publicViews))
- }
- // shows a small representation of View
- private def publicBankAccountBasicList(bankAccounts: List[BankAccount], publicViews : List[View]): List[BasicAccountJSON] = {
- publicBasicBankAccountList(bankAccounts, publicViews)
- }
-
- // Shows accounts without view
- private def coreBankAccountListToJson(callerContext: CallerContext, codeContext: CodeContext, user: User, bankAccounts: List[BankAccount], privateViewsUserCanAccess : List[View], callContext: Option[CallContext]): JValue = {
- Extraction.decompose(coreBankAccountList(callerContext, codeContext, user, bankAccounts, privateViewsUserCanAccess, callContext))
- }
-
- private def privateBasicBankAccountList(bankAccounts: List[BankAccount], privateViewsUserCanAccessAtOneBank : List[View]): List[BasicAccountJSON] = {
- val accJson : List[BasicAccountJSON] = bankAccounts.map(account => {
- val viewsAvailable : List[BasicViewJson] =
- privateViewsUserCanAccessAtOneBank
- .filter(v =>v.bankId==account.bankId && v.accountId ==account.accountId && v.isPrivate)//filter the view for this account.
- .map(JSONFactory200.createBasicViewJSON(_))
- .distinct
- JSONFactory200.createBasicAccountJSON(account,viewsAvailable)
- })
- accJson
- }
-
- private def publicBasicBankAccountList(bankAccounts: List[BankAccount], publicViews: List[View]): List[BasicAccountJSON] = {
- val accJson : List[BasicAccountJSON] = bankAccounts.map(account => {
- val viewsAvailable : List[BasicViewJson] =
- publicViews
- .filter(v =>v.bankId==account.bankId && v.accountId ==account.accountId && v.isPublic)
- .map(v => JSONFactory200.createBasicViewJSON(v))
- .distinct
- JSONFactory200.createBasicAccountJSON(account,viewsAvailable)
- })
- accJson
- }
-
- private def coreBankAccountList(callerContext: CallerContext, codeContext: CodeContext, user: User, bankAccounts: List[BankAccount], privateViewsUserCanAccess : List[View], callContext: Option[CallContext]): List[CoreAccountJSON] = {
- val accJson : List[CoreAccountJSON] = bankAccounts.map(account => {
- val viewsAvailable : List[BasicViewJson] =
- privateViewsUserCanAccess
- .filter(v =>v.bankId==account.bankId && v.accountId ==account.accountId && v.isPrivate)//filter the view for this account.
- .map(JSONFactory200.createBasicViewJSON(_))
- .distinct
-
- val dataContext = DataContext(Full(user), Some(account.bankId), Some(account.accountId), Empty, Empty, Empty)
-
- val links = code.api.util.APIUtil.getHalLinks(callerContext, codeContext, dataContext, callContext)
-
- JSONFactory200.createCoreAccountJSON(account, links)
- })
- accJson
- }
-
-
-
- // helper methods end here
-
- val Implementations2_0_0 = new Object() {
-
- val resourceDocs = ArrayBuffer[ResourceDoc]()
- val apiRelations = ArrayBuffer[ApiRelation]()
-
-
- val apiVersion = ApiVersion.v2_0_0 // was String "2_0_0"
-
- val codeContext = CodeContext(resourceDocs, apiRelations)
-
-
-
- resourceDocs += ResourceDoc(
- root,
- apiVersion,
- "root",
- "GET",
- "/root",
- "Get API Info (root)",
- """Returns information about:
- |
- |* API version
- |* Hosted by information
- |* Git Commit""",
- EmptyBody,
- apiInfoJSON,
- List(UnknownError, MandatoryPropertyIsNotSet),
- apiTagApi :: Nil)
-
- lazy val root : OBPEndpoint = {
- case (Nil | "root" :: Nil) JsonGet _ => {
- cc =>
- implicit val ec = EndpointContext(Some(cc))
- for {
- _ <- Future(()) // Just start async call
- } yield {
- (JSONFactory121.getApiInfoJSON(OBPAPI2_0_0.version, OBPAPI2_0_0.versionStatus), HttpCode.`200`(cc.callContext))
- }
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- getPrivateAccountsAllBanks,
- apiVersion,
- "getPrivateAccountsAllBanks",
- "GET",
- "/accounts",
- "Get all Accounts at all Banks",
- s"""Get all accounts at all banks the User has access to.
- |Returns the list of accounts at that the user has access to at all banks.
- |For each account the API returns the account ID and the available views.
- |
- |${userAuthenticationMessage(true)}
- |
- |""".stripMargin,
- EmptyBody,
- basicAccountsJSON,
- List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagAccount, apiTagPrivateData, apiTagPublicData, apiTagOldStyle))
-
-
- lazy val getPrivateAccountsAllBanks : OBPEndpoint = {
- //get accounts for all banks (private + public)
- case "accounts" :: Nil JsonGet req => {
- cc =>
- for {
- u <- cc.user ?~ AuthenticatedUserIsRequired
- (privateViewsUserCanAccess, privateAccountAccess) <- Full(Views.views.vend.privateViewsUserCanAccess(u))
- privateAccounts <- Full(BankAccountX.privateAccounts(privateAccountAccess))
- } yield {
- successJsonResponse(privateBankAccountsListToJson(privateAccounts, privateViewsUserCanAccess ))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- corePrivateAccountsAllBanks,
- apiVersion,
- "corePrivateAccountsAllBanks",
- "GET",
- "/my/accounts",
- "Get Accounts at all Banks (Private)",
- s"""Get private accounts at all banks (Authenticated access)
- |Returns the list of accounts containing private views for the user at all banks.
- |For each account the API returns the ID and the available views.
- |
- |${userAuthenticationMessage(true)}
- |
- |""".stripMargin,
- EmptyBody,
- coreAccountsJSON,
- List(UnknownError),
- List(apiTagAccount, apiTagPrivateData, apiTagPsd2, apiTagOldStyle))
-
-
- apiRelations += ApiRelation(corePrivateAccountsAllBanks, getCoreAccountById, "detail")
- apiRelations += ApiRelation(corePrivateAccountsAllBanks, corePrivateAccountsAllBanks, "self")
-
-
-
- lazy val corePrivateAccountsAllBanks : OBPEndpoint = {
- //get private accounts for all banks
- case "my" :: "accounts" :: Nil JsonGet req => {
- cc =>
- for {
- u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
- (privateViewsUserCanAccess, privateAccountAccess) <- Full(Views.views.vend.privateViewsUserCanAccess(u))
- privateAccounts <- Full(BankAccountX.privateAccounts(privateAccountAccess))
- } yield {
- val coreBankAccountListJson = coreBankAccountListToJson(CallerContext(corePrivateAccountsAllBanks), codeContext, u, privateAccounts, privateViewsUserCanAccess, Some(cc))
- val response = successJsonResponse(coreBankAccountListJson)
- response
- }
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- publicAccountsAllBanks,
- apiVersion,
- "publicAccountsAllBanks",
- "GET",
- "/accounts/public",
- "Get Public Accounts at all Banks",
- s"""Get public accounts at all banks (Anonymous access).
- |Returns accounts that contain at least one public view (a view where is_public is true)
- |For each account the API returns the ID and the available views.
- |
- |${userAuthenticationMessage(false)}
- |
- |""".stripMargin,
- EmptyBody,
- basicAccountsJSON,
- List(AuthenticatedUserIsRequired, CannotGetAccounts, UnknownError),
- List(apiTagAccountPublic, apiTagAccount, apiTagPublicData)
- )
- lazy val publicAccountsAllBanks : OBPEndpoint = {
- //get public accounts for all banks
- case "accounts" :: "public" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (publicViews, publicAccountAccess) <- Future(Views.views.vend.publicViews)
- publicAccountsJson <- NewStyle.function.tryons(CannotGetAccounts, 400, Some(cc)){
- publicBankAccountBasicList(BankAccountX.publicAccounts(publicAccountAccess), publicViews)
- }
- } yield {
- (BasicAccountsJSON(publicAccountsJson), HttpCode.`200`(cc))
- }
- }
- }
-
-
-
-
- resourceDocs += ResourceDoc(
- getPrivateAccountsAtOneBank,
- apiVersion,
- "getPrivateAccountsAtOneBank",
- "GET",
- "/banks/BANK_ID/accounts",
- "Get Accounts at Bank",
- s"""
- |Returns the list of accounts at BANK_ID that the user has access to.
- |For each account the API returns the account ID and the views available to the user..
- |Each account must have at least one private View.
- |
- |${userAuthenticationMessage(true)}
- """.stripMargin,
- EmptyBody,
- basicAccountsJSON,
- List(BankNotFound, UnknownError),
- List(apiTagAccount, apiTagPrivateData, apiTagPublicData)
- )
-
- def processAccounts(privateViewsUserCanAccessAtOneBank: List[View], availablePrivateAccounts: List[BankAccount]) = {
- privateBankAccountBasicListToJson(availablePrivateAccounts, privateViewsUserCanAccessAtOneBank)
- }
- lazy val getPrivateAccountsAtOneBank : OBPEndpoint = {
-
- case "banks" :: BankId(bankId) :: "accounts" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for{
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
- (availablePrivateAccounts, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
- } yield {
- (processAccounts(privateViewsUserCanAccessAtOneBank, availablePrivateAccounts), HttpCode.`200`(callContext))
- }
- }
- }
-
- def corePrivateAccountsAtOneBankResult (callerContext: CallerContext, codeContext: CodeContext, user: User, privateAccounts: List[BankAccount], privateViewsUserCanAccess : List[View], callContext: Option[CallContext]) ={
- successJsonResponse(coreBankAccountListToJson(callerContext, codeContext, user: User, privateAccounts, privateViewsUserCanAccess, callContext))
- }
-
- resourceDocs += ResourceDoc(
- corePrivateAccountsAtOneBank,
- apiVersion,
- "corePrivateAccountsAtOneBank",
- "GET",
- "/my/banks/BANK_ID/accounts",
- "Get Accounts at Bank (Private)",
- s"""Get private accounts at one bank (Authenticated access).
- |Returns the list of accounts containing private views for the user at BANK_ID.
- |For each account the API returns the ID and label. To also see the list of Views, see privateAccountsAtOneBank
- |
- |
- |This call MAY have an alias /bank/accounts but ONLY if defaultBank is set in Props
- |
- |${userAuthenticationMessage(true)}
- |
- |""".stripMargin,
- EmptyBody,
- coreAccountsJSON,
- List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagAccount, apiTagPrivateData, apiTagPsd2))
-
- apiRelations += ApiRelation(corePrivateAccountsAtOneBank, createAccount, "new")
- apiRelations += ApiRelation(corePrivateAccountsAtOneBank, corePrivateAccountsAtOneBank, "self")
-
-
- // This contains an approach to surface a resource via different end points in case of a default bank.
- // The second path is experimental
- lazy val corePrivateAccountsAtOneBank : OBPEndpoint = {
- // get private accounts for a single bank
- case "my" :: "banks" :: BankId(bankId) :: "accounts" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
- (privateAccountsForOneBank, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
- } yield {
- val result = corePrivateAccountsAtOneBankResult(CallerContext(corePrivateAccountsAtOneBank), codeContext, u, privateAccountsForOneBank, privateViewsUserCanAccessAtOneBank, callContext)
- (result, HttpCode.`200`(callContext))
- }
- }
- // Also we support accounts/private to maintain compatibility with 1.4.0
- case "my" :: "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
- (privateAccountsForOneBank, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
- } yield {
- val result = corePrivateAccountsAtOneBankResult(CallerContext(corePrivateAccountsAtOneBank), codeContext, u, privateAccountsForOneBank, privateViewsUserCanAccessAtOneBank, callContext)
- (result, HttpCode.`200`(callContext))
- }
- }
- // Supports idea of default bank
- case "bank" :: "accounts" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext)
- (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, BankId(defaultBankId))
- (availablePrivateAccounts, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
- } yield {
- val result = corePrivateAccountsAtOneBankResult(CallerContext(corePrivateAccountsAtOneBank), codeContext, u, availablePrivateAccounts, privateViewsUserCanAccessAtOneBank, callContext)
- (result, HttpCode.`200`(callContext))
- }
- }
-
- }
-
-
- resourceDocs += ResourceDoc(
- privateAccountsAtOneBank,
- apiVersion,
- "privateAccountsAtOneBank",
- "GET",
- "/banks/BANK_ID/accounts/private",
- "Get private accounts at one bank",
- s"""Returns the list of private accounts at BANK_ID that the user has access to.
- |For each account the API returns the ID and the available views.
- |
- |If you want to see more information on the Views, use the Account Detail call.
- |If you want less information about the account, use the /my accounts call
- |
- |
- |${userAuthenticationMessage(true)}
- |
- |""".stripMargin,
- EmptyBody,
- basicAccountsJSON,
- List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagAccount, apiTagPsd2)
- )
-
- lazy val privateAccountsAtOneBank : OBPEndpoint = {
- //get private accounts for a single bank
- case "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
- (availablePrivateAccounts, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
- } yield {
- (privateBankAccountsListToJson(availablePrivateAccounts, privateViewsUserCanAccessAtOneBank), HttpCode.`200`(callContext))
- }
- }
- }
-
-
-
-
-
-
- resourceDocs += ResourceDoc(
- publicAccountsAtOneBank,
- apiVersion,
- "publicAccountsAtOneBank",
- "GET",
- "/banks/BANK_ID/accounts/public",
- "Get Public Accounts at Bank",
- s"""Returns a list of the public accounts (Anonymous access) at BANK_ID. For each account the API returns the ID and the available views.
- |
- |${userAuthenticationMessage(false)}
- |
- |""".stripMargin,
- EmptyBody,
- basicAccountsJSON,
- List(UnknownError),
- List(apiTagAccountPublic, apiTagAccount, apiTagPublicData))
-
- lazy val publicAccountsAtOneBank : OBPEndpoint = {
- //get public accounts for a single bank
- case "banks" :: BankId(bankId) :: "accounts" :: "public" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (_, callContext) <- anonymousAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- } yield {
- val (publicViewsForBank, publicAccountAccess) = Views.views.vend.publicViewsForBank(bank.bankId)
- val publicAccountsJson = publicBankAccountBasicListToJson(bank.publicAccounts(publicAccountAccess), publicViewsForBank)
- (publicAccountsJson, HttpCode.`200`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getKycDocuments,
- apiVersion,
- "getKycDocuments",
- "GET",
- "/customers/CUSTOMER_ID/kyc_documents",
- "Get Customer KYC Documents",
- s"""Get KYC (know your customer) documents for a customer specified by CUSTOMER_ID
- |Get a list of documents that affirm the identity of the customer
- |Passport, driving licence etc.
- |${userAuthenticationMessage(false)}""".stripMargin,
- EmptyBody,
- kycDocumentsJSON,
- List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canGetAnyKycDocuments))
- )
-
- // TODO Add Role
-
- lazy val getKycDocuments : OBPEndpoint = {
- case "customers" :: customerId :: "kyc_documents" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycDocuments, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- (kycDocuments, callContxt) <- NewStyle.function.getKycDocuments(customerId, callContext)
- } yield {
- val json = JSONFactory200.createKycDocumentsJSON(kycDocuments)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getKycMedia,
- apiVersion,
- "getKycMedia",
- "GET",
- "/customers/CUSTOMER_ID/kyc_media",
- "Get KYC Media for a customer",
- s"""Get KYC media (scans, pictures, videos) that affirms the identity of the customer.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody,
- kycMediasJSON,
- List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canGetAnyKycMedia)))
-
- lazy val getKycMedia : OBPEndpoint = {
- case "customers" :: customerId :: "kyc_media" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycMedia, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- (kycMedias, callContxt) <- NewStyle.function.getKycMedias(customerId, callContext)
- } yield {
- val json = JSONFactory200.createKycMediasJSON(kycMedias)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getKycChecks,
- apiVersion,
- "getKycChecks",
- "GET",
- "/customers/CUSTOMER_ID/kyc_checks",
- "Get Customer KYC Checks",
- s"""Get KYC checks for the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody,
- kycChecksJSON,
- List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canGetAnyKycChecks))
- )
-
- lazy val getKycChecks : OBPEndpoint = {
- case "customers" :: customerId :: "kyc_checks" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycChecks, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- (kycChecks, callContxt) <- NewStyle.function.getKycChecks(customerId, callContext)
- } yield {
- val json = JSONFactory200.createKycChecksJSON(kycChecks)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- }
- resourceDocs += ResourceDoc(
- getKycStatuses,
- apiVersion,
- "getKycStatuses",
- "GET",
- "/customers/CUSTOMER_ID/kyc_statuses",
- "Get Customer KYC statuses",
- s"""Get the KYC statuses for a customer specified by CUSTOMER_ID over time.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody,
- kycStatusesJSON,
- List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canGetAnyKycStatuses))
- )
-
- lazy val getKycStatuses : OBPEndpoint = {
- case "customers" :: customerId :: "kyc_statuses" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycStatuses, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- (kycStatuses, callContxt) <- NewStyle.function.getKycStatuses(customerId, callContext)
- } yield {
- val json = JSONFactory200.createKycStatusesJSON(kycStatuses)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getSocialMediaHandles,
- apiVersion,
- "getSocialMediaHandles",
- "GET",
- "/banks/BANK_ID/customers/CUSTOMER_ID/social_media_handles",
- "Get Customer Social Media Handles",
- s"""Get social media handles for a customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody,
- socialMediasJSON,
- List(AuthenticatedUserIsRequired, UserHasMissingRoles, CustomerNotFoundByCustomerId, UnknownError),
- List(apiTagCustomer),
- Some(List(canGetSocialMediaHandles)))
-
- lazy val getSocialMediaHandles : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: customerId :: "social_media_handles" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext ) <- NewStyle.function.getBank(bankId, callContext)
- _ <- NewStyle.function.hasEntitlement(bank.bankId.value, u.userId, canGetSocialMediaHandles, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- } yield {
- val kycSocialMedias = SocialMediaHandle.socialMediaHandleProvider.vend.getSocialMedias(customer.number)
- val json = JSONFactory200.createSocialMediasJSON(kycSocialMedias)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- }
-
-
-
-
- resourceDocs += ResourceDoc(
- addKycDocument,
- apiVersion,
- "addKycDocument",
- "PUT",
- "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_documents/KYC_DOCUMENT_ID",
- "Add KYC Document",
- "Add a KYC document for the customer specified by CUSTOMER_ID. KYC Documents contain the document type (e.g. passport), place of issue, expiry etc. ",
- postKycDocumentJSON,
- kycDocumentJSON,
- List(AuthenticatedUserIsRequired, InvalidJsonFormat, BankNotFound, CustomerNotFoundByCustomerId,"Server error: could not add KycDocument", UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canAddKycDocument))
- )
-
- // TODO customerNumber should be in the url but not also in the postedData
-
- lazy val addKycDocument : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_documents" :: documentId :: Nil JsonPut json -> _ => {
- // customerNumber is duplicated in postedData. remove from that?
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycDocument, callContext)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycDocumentJSON "
- postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[PostKycDocumentJSON]
- }
-
- (kycDocumentCreated, callContext) <-
- NewStyle.function.createOrUpdateKycDocument(
- bankId.value,
- customerId,
- documentId,
- postedData.customer_number,
- postedData.`type`,
- postedData.number,
- postedData.issue_date,
- postedData.issue_place,
- postedData.expiry_date,
- callContext)
- } yield {
- val json = JSONFactory200.createKycDocumentJSON(kycDocumentCreated)
- (json, HttpCode.`201`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- addKycMedia,
- apiVersion,
- "addKycMedia",
- "PUT",
- "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_media/KYC_MEDIA_ID",
- "Add KYC Media",
- "Add some KYC media for the customer specified by CUSTOMER_ID. KYC Media resources relate to KYC Documents and KYC Checks and contain media urls for scans of passports, utility bills etc",
- postKycMediaJSON,
- kycMediaJSON,
- List(AuthenticatedUserIsRequired, InvalidJsonFormat, CustomerNotFoundByCustomerId, ServerAddDataError, UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canAddKycMedia))
- )
-
- lazy val addKycMedia : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_media" :: mediaId :: Nil JsonPut json -> _ => {
- // customerNumber is in url and duplicated in postedData. remove from that?
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycMedia, callContext)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycMediaJSON "
- postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[PostKycMediaJSON]
- }
-
- (kycMediaCreated, callContext) <- NewStyle.function.createOrUpdateKycMedia(
- bankId.value,
- customerId,
- mediaId,
- postedData.customer_number,
- postedData.`type`,
- postedData.url,
- postedData.date,
- postedData.relates_to_kyc_document_id,
- postedData.relates_to_kyc_check_id,
- callContext
- )
- } yield {
- val json = JSONFactory200.createKycMediaJSON(kycMediaCreated)
- (json, HttpCode.`201`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- addKycCheck,
- apiVersion,
- "addKycCheck",
- "PUT",
- "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_check/KYC_CHECK_ID",
- "Add KYC Check",
- "Add a KYC check for the customer specified by CUSTOMER_ID. KYC Checks store details of checks on a customer made by the KYC team, their comments and a satisfied status",
- postKycCheckJSON,
- kycCheckJSON,
- List(AuthenticatedUserIsRequired, InvalidJsonFormat, BankNotFound, CustomerNotFoundByCustomerId, ServerAddDataError, UnknownError),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canAddKycCheck))
- )
-
- lazy val addKycCheck : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_check" :: checkId :: Nil JsonPut json -> _ => {
- // customerNumber is in url and duplicated in postedData. remove from that?
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycCheck, callContext)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycCheckJSON "
- postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[PostKycCheckJSON]
- }
-
- (kycCheck, callContext) <- NewStyle.function.createOrUpdateKycCheck(
- bankId.value,
- customerId,
- checkId,
- postedData.customer_number,
- postedData.date,
- postedData.how,
- postedData.staff_user_id,
- postedData.staff_name,
- postedData.satisfied,
- postedData.comments,
- callContext
- )
- } yield {
- val json = JSONFactory200.createKycCheckJSON(kycCheck)
- (json, HttpCode.`201`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- addKycStatus,
- apiVersion,
- "addKycStatus",
- "PUT",
- "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_statuses",
- "Add KYC Status",
- "Add a kyc_status for the customer specified by CUSTOMER_ID. KYC Status is a timeline of the KYC status of the customer",
- postKycStatusJSON,
- kycStatusJSON,
- List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidBankIdFormat,UnknownError, BankNotFound ,ServerAddDataError ,CustomerNotFoundByCustomerId),
- List(apiTagKyc, apiTagCustomer),
- Some(List(canAddKycStatus))
- )
-
- lazy val addKycStatus : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_statuses" :: Nil JsonPut json -> _ => {
- // customerNumber is in url and duplicated in postedData. remove from that?
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycStatus, callContext)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycStatusJSON "
- postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[PostKycStatusJSON]
- }
-
- (kycStatus, callContext) <- NewStyle.function.createOrUpdateKycStatus(
- bankId.value,
- customerId,
- postedData.customer_number,
- postedData.ok,
- postedData.date, callContext)
- } yield {
- val json = JSONFactory200.createKycStatusJSON(kycStatus)
- (json, HttpCode.`201`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- addSocialMediaHandle,
- apiVersion,
- "addSocialMediaHandle",
- "POST",
- "/banks/BANK_ID/customers/CUSTOMER_ID/social_media_handles",
- "Create Customer Social Media Handle",
- "Create a customer social media handle for the customer specified by CUSTOMER_ID",
- socialMediaJSON,
- successMessage,
- List(
- AuthenticatedUserIsRequired,
- InvalidJsonFormat,
- InvalidBankIdFormat,
- UserHasMissingRoles,
- CustomerNotFoundByCustomerId,
- UnknownError),
- List(apiTagCustomer),
- Some(List(canAddSocialMediaHandle))
- )
-
- lazy val addSocialMediaHandle : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: customerId :: "social_media_handles" :: Nil JsonPost json -> _ => {
- // customerNumber is in url and duplicated in postedData. remove from that?
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- postedData <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, callContext) {
- json.extract[SocialMediaJSON]
- }
- _ <- Helper.booleanToFuture(ErrorMessages.InvalidBankIdFormat, 400, callContext){
- isValidID(bankId.value)
- }
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- _ <- NewStyle.function.hasEntitlement(bank.bankId.value, u.userId, canAddSocialMediaHandle, cc.callContext)
- (_, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
- _ <- Helper.booleanToFuture("Server error: could not add", 400, callContext){
- SocialMediaHandle.socialMediaHandleProvider.vend.addSocialMedias(
- postedData.customer_number,
- postedData.`type`,
- postedData.handle,
- postedData.date_added,
- postedData.date_activated
- )
- }
- } yield {
- (successMessage, HttpCode.`201`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getCoreAccountById,
- apiVersion,
- "getCoreAccountById",
- "GET",
- "/my/banks/BANK_ID/accounts/ACCOUNT_ID/account",
- "Get Account by Id (Core)",
- s"""Information returned about the account specified by ACCOUNT_ID:
- |
- |* Number
- |* Owners
- |* Type
- |* Balance
- |* IBAN
- |
- |This call returns the owner view and requires access to that view.
- |
- |
- |${userAuthenticationMessage(true)}
- |
- |""".stripMargin,
- EmptyBody,
- moderatedCoreAccountJSON,
- List(BankAccountNotFound,UnknownError),
- apiTagAccount :: apiTagPsd2 :: apiTagOldStyle :: Nil)
-
- lazy val getCoreAccountById : OBPEndpoint = {
- //get account by id (assume owner view requested)
- 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"
- // Should be a generic guard we can use for all calls (also for userId etc.)
- for {
- u <- cc.user ?~ AuthenticatedUserIsRequired
- account <- BankAccountX(bankId, accountId) ?~ BankAccountNotFound
- // Assume owner view was requested
- view <- u.checkOwnerViewAccessAndReturnOwnerView(BankIdAccountId(account.bankId, account.accountId), Some(cc))
- moderatedAccount <- account.moderatedBankAccount(view, BankIdAccountId(bankId, accountId), cc.user, Some(cc))
- } yield {
- val moderatedAccountJson = JSONFactory200.createCoreBankAccountJSON(moderatedAccount)
- val response = successJsonResponse(Extraction.decompose(moderatedAccountJson))
- response
- }
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- getCoreTransactionsForBankAccount,
- apiVersion,
- "getCoreTransactionsForBankAccount",
- "GET",
- "/my/banks/BANK_ID/accounts/ACCOUNT_ID/transactions",
- "Get Transactions for Account (Core)",
- s"""Returns transactions list (Core info) of the account specified by ACCOUNT_ID.
- |
- |Authentication is required.
- |
- |${urlParametersDocument(true, true)}
- |
- |""",
- EmptyBody,
- coreTransactionsJSON,
- List(BankAccountNotFound, UnknownError),
- List(apiTagTransaction, apiTagAccount, apiTagPsd2, apiTagOldStyle))
-
- //Note: we already have the method: getTransactionsForBankAccount in V121.
- //The only difference here is "Core implies 'owner' view"
- lazy val getCoreTransactionsForBankAccount : OBPEndpoint = {
- //get transactions
- case "my" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "transactions" :: Nil JsonGet req => {
- cc =>
- for {
- u <- cc.user ?~ AuthenticatedUserIsRequired
- params <- createQueriesByHttpParams(req.request.headers)
- (bank, callContext) <- BankX(bankId, Some(cc)) ?~ BankNotFound
- bankAccount <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound
- view <- u.checkOwnerViewAccessAndReturnOwnerView(BankIdAccountId(bankAccount.bankId,bankAccount.accountId), Some(cc))
- (transactions, callContext) <- bankAccount.getModeratedTransactions(bank, cc.user, view, BankIdAccountId(bankId, accountId), None, params)
- } yield {
- val json = JSONFactory200.createCoreTransactionsJSON(transactions)
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
-
- // Copied from 1.2.1 and modified
-
- resourceDocs += ResourceDoc(
- accountById,
- apiVersion,
- "accountById",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/account",
- "Get Account by Id (Full)",
- s"""Information returned about an account specified by ACCOUNT_ID as moderated by the view (VIEW_ID):
- |
- |* Number
- |* Owners
- |* Type
- |* Balance
- |* IBAN
- |* Available views (sorted by short_name)
- |
- |More details about the data moderation by the view [here](#1_2_1-getViewsForBankAccount).
- |
- |PSD2 Context: PSD2 requires customers to have access to their account information via third party applications.
- |This call provides balance and other account information via delegated authentication using OAuth.
- |
- |${userAuthenticationMessage(true)} if the 'is_public' field in view (VIEW_ID) is not set to `true`.
- |
- |""".stripMargin,
- EmptyBody,
- moderatedAccountJSON,
- List(BankNotFound,AccountNotFound,ViewNotFound, UserNoPermissionAccessView, UnknownError),
- apiTagAccount :: apiTagOldStyle :: Nil)
-
- lazy val accountById : OBPEndpoint = {
- //get account by id
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "account" :: Nil JsonGet req => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired
- (bank, callContext) <- BankX(bankId, Some(cc)) ?~ BankNotFound // Check bank exists.
- account <- BankAccountX(bank.bankId, accountId) ?~ {ErrorMessages.AccountNotFound} // Check Account exists.
- availableViews <- Full(Views.views.vend.privateViewsUserCanAccessForAccount(u, BankIdAccountId(account.bankId, account.accountId)))
- view <- APIUtil.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
- moderatedAccount <- account.moderatedBankAccount(view, BankIdAccountId(bankId, accountId), cc.user, callContext)
- } yield {
- val viewsAvailable = availableViews.map(JSONFactory121.createViewJSON).sortBy(_.short_name)
- val moderatedAccountJson = JSONFactory121.createBankAccountJSON(moderatedAccount, viewsAvailable)
- successJsonResponse(Extraction.decompose(moderatedAccountJson))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getPermissionsForBankAccount,
- apiVersion,
- "getPermissionsForBankAccount",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/permissions",
- "Get access",
- s"""Returns the list of the permissions at BANK_ID for account ACCOUNT_ID, with each time a pair composed of the user and the views that he has access to.
- |
- |${userAuthenticationMessage(true)}
- |and the user needs to have access to the owner view.
- |
- |""",
- EmptyBody,
- permissionsJSON,
- List(AuthenticatedUserIsRequired, BankNotFound, AccountNotFound ,UnknownError),
- List(apiTagView, apiTagAccount, apiTagUser, apiTagEntitlement)
- )
-
- lazy val getPermissionsForBankAccount : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
- anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
- .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
- _ <- Helper.booleanToFuture(
- s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)}` permission on any your views",
- cc = callContext
- ) {
- anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission
- }
- permissions = Views.views.vend.permissions(BankIdAccountId(bankId, accountId))
- } yield {
- val permissionsJSON = JSONFactory121.createPermissionsJSON(permissions.sortBy(_.user.emailAddress))
- (permissionsJSON, HttpCode.`200`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getPermissionForUserForBankAccount,
- apiVersion,
- "getPermissionForUserForBankAccount",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/permissions/PROVIDER/PROVIDER_ID",
- "Get Account access for User",
- s"""Returns the list of the views at BANK_ID for account ACCOUNT_ID that a user identified by PROVIDER_ID at their provider PROVIDER has access to.
- |All url parameters must be [%-encoded](http://en.wikipedia.org/wiki/Percent-encoding), which is often especially relevant for USER_ID and PROVIDER.
- |
- |${userAuthenticationMessage(true)}
- |
- |The user needs to have access to the owner view.""",
- EmptyBody,
- viewsJSONV121,
- List(AuthenticatedUserIsRequired,BankNotFound, AccountNotFound,UnknownError),
- List(apiTagView, apiTagAccount, apiTagUser, apiTagOldStyle))
-
- lazy val getPermissionForUserForBankAccount : OBPEndpoint = {
- //get access for specific user
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: provider :: providerId :: Nil JsonGet req => {
- cc =>
- for {
- loggedInUser <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired // Check we have a user (rather than error or empty)
- (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound // Check bank exists.
- account <- BankAccountX(bank.bankId, accountId) ?~! {ErrorMessages.AccountNotFound} // Check Account exists.
- loggedInUserPermissionBox = Views.views.vend.permission(BankIdAccountId(bankId, accountId), loggedInUser)
- anyViewContainsCanSeePermissionForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists( _ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)))
- .getOrElse(Nil).find(_.==(true)).getOrElse(false)
-
- _ <- booleanToBox(
- anyViewContainsCanSeePermissionForOneUserPermission,
- s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views"
- )
- userFromURL <- UserX.findByProviderId(provider, providerId) ?~! UserNotFoundByProviderAndProvideId
- permission <- Views.views.vend.permission(BankIdAccountId(bankId, accountId), userFromURL)
- } yield {
- // TODO : Note this is using old createViewsJSON without can_add_counterparty etc.
- val views = JSONFactory121.createViewsJSON(permission.views.sortBy(_.viewId.value))
- successJsonResponse(Extraction.decompose(views))
- }
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- createAccount,
- apiVersion,
- "createAccount",
- "PUT",
- "/banks/BANK_ID/accounts/ACCOUNT_ID",
- "Create Account",
- """Create Account at bank specified by BANK_ID with Id specified by ACCOUNT_ID.
- |
- |
- |The User can create an Account for themself or an Account for another User if they have CanCreateAccount role.
- |
- |If USER_ID is not specified the account will be owned by the logged in User.
- |
- |ACCOUNT_ID SHOULD be a UUID. ACCOUNT_ID MUST NOT be the ACCOUNT_NUMBER.
- |
- |TYPE SHOULD be the PRODUCT_CODE from Product.
- |
- |Note: The Amount must be zero.""".stripMargin,
- CreateAccountJSON("A user_id","CURRENT", "Label", AmountOfMoneyJSON121("EUR", "0")),
- coreAccountJSON,
- List(
- AuthenticatedUserIsRequired,
- InvalidJsonFormat,
- InvalidUserId,
- InvalidAccountIdFormat,
- InvalidBankIdFormat,
- UserNotFoundById,
- InvalidAccountBalanceAmount,
- InvalidAccountType,
- InvalidAccountInitialBalance,
- InvalidAccountBalanceCurrency,
- UnknownError
- ),
- List(apiTagAccount, apiTagOldStyle),
- Some(List(canCreateAccount))
- )
-
- apiRelations += ApiRelation(createAccount, createAccount, "self")
- apiRelations += ApiRelation(createAccount, getCoreAccountById, "detail")
-
- // Note: This doesn't currently work (links only have access to same version resource docs). TODO fix me.
- apiRelations += ApiRelation(createAccount, Implementations1_2_1.updateAccountLabel, "update_label")
-
-
- lazy val createAccount : OBPEndpoint = {
- // Create a new account
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: Nil JsonPut json -> _ => {
- cc =>{
-
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- failMsg = s"$InvalidJsonFormat The Json body should be the $CreateAccountJSON "
- createAccountJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[CreateAccountJSON]
- }
-
- loggedInUserId = u.userId
- userIdAccountOwner = if (createAccountJson.user_id.nonEmpty) createAccountJson.user_id else loggedInUserId
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc = callContext) {
- isValidID(accountId.value)
- }
- _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc = callContext) {
- isValidID(accountId.value)
- }
-
- (postedOrLoggedInUser, callContext) <- NewStyle.function.findByUserId(userIdAccountOwner, callContext)
-
- // User can create account for self or an account for another user if they have CanCreateAccount role
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc = callContext) {
- isValidID(accountId.value)
- }
-
- _ <- if (userIdAccountOwner == loggedInUserId) Future.successful(Full(Unit))
- else NewStyle.function.hasEntitlement(bankId.value, loggedInUserId, canCreateAccount, callContext, s"${UserHasMissingRoles} $canCreateAccount or create account for self")
-
- initialBalanceAsString = createAccountJson.balance.amount
- accountType = createAccountJson.`type`
- accountLabel = createAccountJson.label
- initialBalanceAsNumber <- NewStyle.function.tryons(InvalidAccountInitialBalance, 400, callContext) {
- BigDecimal(initialBalanceAsString)
- }
-
- _ <- Helper.booleanToFuture(InitialBalanceMustBeZero, cc = callContext) {
- 0 == initialBalanceAsNumber
- }
-
- _ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc = callContext) {
- isValidCurrencyISOCode(createAccountJson.balance.currency)
- }
-
-
- currency = createAccountJson.balance.currency
-
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
-
- (bankAccount, callContext) <- NewStyle.function.createBankAccount(
- bankId,
- accountId,
- accountType,
- accountLabel,
- currency,
- initialBalanceAsNumber,
- postedOrLoggedInUser.name,
- "",
- List.empty,
- callContext
- )
- //1 Create or Update the `Owner` for the new account
- //2 Add permission to the user
- //3 Set the user as the account holder
- _ <- BankAccountCreation.setAccountHolderAndRefreshUserAccountAccess(bankId, accountId, postedOrLoggedInUser, callContext)
- dataContext = DataContext(cc.user, Some(bankAccount.bankId), Some(bankAccount.accountId), Empty, Empty, Empty)
- links = code.api.util.APIUtil.getHalLinks(CallerContext(createAccount), codeContext, dataContext, callContext)
- } yield {
- (JSONFactory200.createCoreAccountJSON(bankAccount, links), HttpCode.`200`(callContext))
- }
- }
- }
- }
-
-
-
- val getTransactionTypesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getTransactionTypesIsPublic", true)
-
-
- resourceDocs += ResourceDoc(
- getTransactionTypes,
- apiVersion,
- "getTransactionTypes",
- "GET",
- "/banks/BANK_ID/transaction-types",
- "Get Transaction Types at Bank",
- // TODO get the documentation of the parameters from the scala doc of the case class we return
- s"""Get Transaction Types for the bank specified by BANK_ID:
- |
- |Lists the possible Transaction Types available at the bank (as opposed to Transaction Request Types which are the possible ways Transactions can be created by this API Server).
- |
- | * id : Unique transaction type id across the API instance. SHOULD be a UUID. MUST be unique.
- | * bank_id : The bank that supports this TransactionType
- | * short_code : A short code (SHOULD have no-spaces) which MUST be unique across the bank. May be stored with Transactions to link here
- | * summary : A succinct summary
- | * description : A longer description
- | * charge : The charge to the customer for each one of these
- |
- |${userAuthenticationMessage(!getTransactionTypesIsPublic)}""".stripMargin,
- EmptyBody,
- transactionTypesJsonV200,
- List(BankNotFound, UnknownError),
- List(apiTagBank, apiTagPSD2AIS, apiTagPsd2)
- )
-
- lazy val getTransactionTypes : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "transaction-types" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- // Get Transaction Types from the active provider
- (_, callContext) <- getTransactionTypesIsPublic match {
- case false => authenticatedAccess(cc)
- case true => anonymousAccess(cc)
- }
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- transactionTypes <- Future(TransactionType.TransactionTypeProvider.vend.getTransactionTypesForBank(bank.bankId)) map { connectorEmptyResponse(_, callContext) } // ~> APIFailure("No transation types available. License may not be set.", 204)
- } yield {
- (JSONFactory200.createTransactionTypeJSON(transactionTypes), HttpCode.`200`(callContext))
- }
- }
- }
- }
-
-
- import net.liftweb.json.Extraction._
- import net.liftweb.json.JsonAST._
- val exchangeRates = prettyRender(decompose(fx.fallbackExchangeRates))
-
- resourceDocs += ResourceDoc(
- createUser,
- apiVersion,
- "createUser",
- "POST",
- "/users",
- "Create User",
- s"""Creates OBP user.
- | No authorisation required.
- |
- | Mimics current webform to Register.
- |
- | Requires username(email), password, first_name, last_name, and email.
- |
- | Validation checks performed:
- | - Password must meet strong password requirements (InvalidStrongPasswordFormat error if not)
- | - Username must be unique (409 error if username already exists)
- | - All required fields must be present in valid JSON format
- |
- | Email validation behavior:
- | - Controlled by property 'authUser.skipEmailValidation' (default: false)
- | - When false: User is created with validated=false and a validation email is sent to the user's email address
- | - When true: User is created with validated=true and no validation email is sent
- | - Default entitlements are granted immediately regardless of validation status
- |
- | Note: If email validation is required (skipEmailValidation=false), the user must click the validation link
- | in the email before they can log in, even though entitlements are already granted.
- |
- |""",
- createUserJson,
- userJsonV200,
- List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidStrongPasswordFormat, DuplicateUsername, ExternalUserCheckFailed, "Error occurred during user creation.", UnknownError),
- List(apiTagUser, apiTagOnboarding))
-
- lazy val createUser: OBPEndpoint = {
- case "users" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- postedData <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, cc.callContext) {
- json.extract[CreateUserJson]
- }
- _ <- Helper.booleanToFuture(ErrorMessages.InvalidStrongPasswordFormat, 400, cc.callContext) {
- fullPasswordValidation(postedData.password)
- }
- _ <- Helper.booleanToFuture(ErrorMessages.DuplicateUsername, 409, cc.callContext) {
- AuthUser.find(By(AuthUser.username, postedData.username)).isEmpty
- }
- userCreated <- Future {
- AuthUser.create
- .firstName(postedData.first_name)
- .lastName(postedData.last_name)
- .username(postedData.username)
- .email(postedData.email)
- .password(postedData.password)
- .validated(APIUtil.getPropsAsBoolValue("authUser.skipEmailValidation", defaultValue = false))
- }
- _ <- Helper.booleanToFuture(ErrorMessages.InvalidJsonFormat+userCreated.validate.map(_.msg).mkString(";"), 400, cc.callContext) {
- userCreated.validate.size == 0
- }
- savedUser <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, cc.callContext) {
- userCreated.saveMe()
- }
- _ <- Helper.booleanToFuture(s"$UnknownError Error occurred during user creation.", 400, cc.callContext) {
- userCreated.saved_?
- }
- } yield {
- // Send validation email if skipEmailValidation is false
- val skipEmailValidation = APIUtil.getPropsAsBoolValue("authUser.skipEmailValidation", defaultValue = false)
- if (!skipEmailValidation) {
- AuthUser.sendValidationEmail(savedUser)
- }
- // Grant default entitlements regardless of validation status
- AuthUser.grantDefaultEntitlementsToAuthUser(savedUser)
- val json = JSONFactory200.createUserJSONfromAuthUser(userCreated)
- (json, HttpCode.`201`(cc.callContext))
- }
- }
- }
-
+trait APIMethods200 { self: RestHelper => }
+object APIMethods200 extends RestHelper with APIMethods200 {
+ val Implementations2_0_0 = Http4s200.Implementations2_0_0
+}
+//
+//package code.api.v2_0_0
+//
+//import scala.language.reflectiveCalls
+//import code.TransactionTypes.TransactionType
+//import code.api.APIFailureNewStyle
+//import code.api.Constant._
+//import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
+//import code.api.util.APIUtil._
+//import code.api.util.ApiTag._
+//import code.api.util.ErrorMessages.AuthenticatedUserIsRequired
+//import code.api.util.FutureUtil.EndpointContext
+//import code.api.util.NewStyle.HttpCode
+//import code.api.util._
+//import code.api.v1_2_1.OBPAPI1_2_1._
+//import code.api.v1_2_1.{JSONFactory => JSONFactory121}
+//import code.api.v1_4_0.JSONFactory1_4_0
+//import code.api.v2_0_0.JSONFactory200.{privateBankAccountsListToJson, _}
+//import code.customer.CustomerX
+//import code.entitlement.Entitlement
+//import code.fx.fx
+//import code.model._
+//import code.model.dataAccess.{AuthUser, BankAccountCreation}
+//import code.search.{elasticsearchMetrics, elasticsearchWarehouse}
+//import code.socialmedia.SocialMediaHandle
+//import code.usercustomerlinks.UserCustomerLink
+//import code.users.Users
+//import code.util.Helper
+//import code.util.Helper.{booleanToBox, booleanToFuture}
+//import code.views.Views
+//import com.openbankproject.commons.ExecutionContext.Implicits.global
+//import com.openbankproject.commons.model._
+//import com.openbankproject.commons.util.ApiVersion
+//import net.liftweb.common._
+//import net.liftweb.http.CurrentReq
+//import net.liftweb.http.rest.RestHelper
+//import net.liftweb.json.JsonAST.JValue
+//import net.liftweb.mapper.By
+//import net.liftweb.util.Helpers.tryo
+//import net.liftweb.util.StringHelpers
+//
+//import java.util.Date
+//import scala.collection.mutable.ArrayBuffer
+//import scala.concurrent.Future
+//// Makes JValue assignment to Nil work
+//import code.api.util.ApiRole._
+//import code.api.util.ErrorMessages._
+//import com.openbankproject.commons.model.{AmountOfMoneyJsonV121 => AmountOfMoneyJSON121}
+//import net.liftweb.json.Extraction
+//
+//trait APIMethods200 {
+// //needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
+// self: RestHelper =>
+//
+// // helper methods begin here
+// private def privateBankAccountBasicListToJson(bankAccounts: List[BankAccount], privateViewsUserCanAccessAtOneBank : List[View]): JValue = {
+// Extraction.decompose(privateBasicBankAccountList(bankAccounts, privateViewsUserCanAccessAtOneBank))
+// }
+// // shows a small representation of View
+// private def publicBankAccountBasicListToJson(bankAccounts: List[BankAccount], publicViews : List[View]): JValue = {
+// Extraction.decompose(publicBasicBankAccountList(bankAccounts, publicViews))
+// }
+// // shows a small representation of View
+// private def publicBankAccountBasicList(bankAccounts: List[BankAccount], publicViews : List[View]): List[BasicAccountJSON] = {
+// publicBasicBankAccountList(bankAccounts, publicViews)
+// }
+//
+// // Shows accounts without view
+// private def coreBankAccountListToJson(callerContext: CallerContext, codeContext: CodeContext, user: User, bankAccounts: List[BankAccount], privateViewsUserCanAccess : List[View], callContext: Option[CallContext]): JValue = {
+// Extraction.decompose(coreBankAccountList(callerContext, codeContext, user, bankAccounts, privateViewsUserCanAccess, callContext))
+// }
+//
+// private def privateBasicBankAccountList(bankAccounts: List[BankAccount], privateViewsUserCanAccessAtOneBank : List[View]): List[BasicAccountJSON] = {
+// val accJson : List[BasicAccountJSON] = bankAccounts.map(account => {
+// val viewsAvailable : List[BasicViewJson] =
+// privateViewsUserCanAccessAtOneBank
+// .filter(v =>v.bankId==account.bankId && v.accountId ==account.accountId && v.isPrivate)//filter the view for this account.
+// .map(JSONFactory200.createBasicViewJSON(_))
+// .distinct
+// JSONFactory200.createBasicAccountJSON(account,viewsAvailable)
+// })
+// accJson
+// }
+//
+// private def publicBasicBankAccountList(bankAccounts: List[BankAccount], publicViews: List[View]): List[BasicAccountJSON] = {
+// val accJson : List[BasicAccountJSON] = bankAccounts.map(account => {
+// val viewsAvailable : List[BasicViewJson] =
+// publicViews
+// .filter(v =>v.bankId==account.bankId && v.accountId ==account.accountId && v.isPublic)
+// .map(v => JSONFactory200.createBasicViewJSON(v))
+// .distinct
+// JSONFactory200.createBasicAccountJSON(account,viewsAvailable)
+// })
+// accJson
+// }
+//
+// private def coreBankAccountList(callerContext: CallerContext, codeContext: CodeContext, user: User, bankAccounts: List[BankAccount], privateViewsUserCanAccess : List[View], callContext: Option[CallContext]): List[CoreAccountJSON] = {
+// val accJson : List[CoreAccountJSON] = bankAccounts.map(account => {
+// val viewsAvailable : List[BasicViewJson] =
+// privateViewsUserCanAccess
+// .filter(v =>v.bankId==account.bankId && v.accountId ==account.accountId && v.isPrivate)//filter the view for this account.
+// .map(JSONFactory200.createBasicViewJSON(_))
+// .distinct
+//
+// val dataContext = DataContext(Full(user), Some(account.bankId), Some(account.accountId), Empty, Empty, Empty)
+//
+// val links = code.api.util.APIUtil.getHalLinks(callerContext, codeContext, dataContext, callContext)
+//
+// JSONFactory200.createCoreAccountJSON(account, links)
+// })
+// accJson
+// }
+//
+//
+//
+// // helper methods end here
+//
+// val Implementations2_0_0 = new Object() {
+//
+// val resourceDocs = ArrayBuffer[ResourceDoc]()
+// val apiRelations = ArrayBuffer[ApiRelation]()
+//
+//
+// val apiVersion = ApiVersion.v2_0_0 // was String "2_0_0"
+//
+// val codeContext = CodeContext(resourceDocs, apiRelations)
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// root,
+// apiVersion,
+// "root",
+// "GET",
+// "/root",
+// "Get API Info (root)",
+// """Returns information about:
+// |
+// |* API version
+// |* Hosted by information
+// |* Git Commit""",
+// EmptyBody,
+// apiInfoJSON,
+// List(UnknownError, MandatoryPropertyIsNotSet),
+// apiTagApi :: Nil)
+//
+// lazy val root : OBPEndpoint = {
+// case (Nil | "root" :: Nil) JsonGet _ => {
+// cc =>
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// _ <- Future(()) // Just start async call
+// } yield {
+// (JSONFactory121.getApiInfoJSON(OBPAPI2_0_0.version, OBPAPI2_0_0.versionStatus), HttpCode.`200`(cc.callContext))
+// }
+// }
+// }
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// getPrivateAccountsAllBanks,
+// apiVersion,
+// "getPrivateAccountsAllBanks",
+// "GET",
+// "/accounts",
+// "Get all Accounts at all Banks",
+// s"""Get all accounts at all banks the User has access to.
+// |Returns the list of accounts at that the user has access to at all banks.
+// |For each account the API returns the account ID and the available views.
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// basicAccountsJSON,
+// List(AuthenticatedUserIsRequired, UnknownError),
+// List(apiTagAccount, apiTagPrivateData, apiTagPublicData, apiTagOldStyle))
+//
+//
+// lazy val getPrivateAccountsAllBanks : OBPEndpoint = {
+// //get accounts for all banks (private + public)
+// case "accounts" :: Nil JsonGet req => {
+// cc =>
+// for {
+// u <- cc.user ?~ AuthenticatedUserIsRequired
+// (privateViewsUserCanAccess, privateAccountAccess) <- Full(Views.views.vend.privateViewsUserCanAccess(u))
+// privateAccounts <- Full(BankAccountX.privateAccounts(privateAccountAccess))
+// } yield {
+// successJsonResponse(privateBankAccountsListToJson(privateAccounts, privateViewsUserCanAccess ))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// corePrivateAccountsAllBanks,
+// apiVersion,
+// "corePrivateAccountsAllBanks",
+// "GET",
+// "/my/accounts",
+// "Get Accounts at all Banks (Private)",
+// s"""Get private accounts at all banks (Authenticated access)
+// |Returns the list of accounts containing private views for the user at all banks.
+// |For each account the API returns the ID and the available views.
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// coreAccountsJSON,
+// List(UnknownError),
+// List(apiTagAccount, apiTagPrivateData, apiTagPsd2, apiTagOldStyle))
+//
+//
+// apiRelations += ApiRelation(corePrivateAccountsAllBanks, getCoreAccountById, "detail")
+// apiRelations += ApiRelation(corePrivateAccountsAllBanks, corePrivateAccountsAllBanks, "self")
+//
+//
+//
+// lazy val corePrivateAccountsAllBanks : OBPEndpoint = {
+// //get private accounts for all banks
+// case "my" :: "accounts" :: Nil JsonGet req => {
+// cc =>
+// for {
+// u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// (privateViewsUserCanAccess, privateAccountAccess) <- Full(Views.views.vend.privateViewsUserCanAccess(u))
+// privateAccounts <- Full(BankAccountX.privateAccounts(privateAccountAccess))
+// } yield {
+// val coreBankAccountListJson = coreBankAccountListToJson(CallerContext(corePrivateAccountsAllBanks), codeContext, u, privateAccounts, privateViewsUserCanAccess, Some(cc))
+// val response = successJsonResponse(coreBankAccountListJson)
+// response
+// }
+// }
+// }
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// publicAccountsAllBanks,
+// apiVersion,
+// "publicAccountsAllBanks",
+// "GET",
+// "/accounts/public",
+// "Get Public Accounts at all Banks",
+// s"""Get public accounts at all banks (Anonymous access).
+// |Returns accounts that contain at least one public view (a view where is_public is true)
+// |For each account the API returns the ID and the available views.
+// |
+// |${userAuthenticationMessage(false)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// basicAccountsJSON,
+// List(AuthenticatedUserIsRequired, CannotGetAccounts, UnknownError),
+// List(apiTagAccountPublic, apiTagAccount, apiTagPublicData)
+// )
+// lazy val publicAccountsAllBanks : OBPEndpoint = {
+// //get public accounts for all banks
+// case "accounts" :: "public" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (publicViews, publicAccountAccess) <- Future(Views.views.vend.publicViews)
+// publicAccountsJson <- NewStyle.function.tryons(CannotGetAccounts, 400, Some(cc)){
+// publicBankAccountBasicList(BankAccountX.publicAccounts(publicAccountAccess), publicViews)
+// }
+// } yield {
+// (BasicAccountsJSON(publicAccountsJson), HttpCode.`200`(cc))
+// }
+// }
+// }
+//
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// getPrivateAccountsAtOneBank,
+// apiVersion,
+// "getPrivateAccountsAtOneBank",
+// "GET",
+// "/banks/BANK_ID/accounts",
+// "Get Accounts at Bank",
+// s"""
+// |Returns the list of accounts at BANK_ID that the user has access to.
+// |For each account the API returns the account ID and the views available to the user..
+// |Each account must have at least one private View.
+// |
+// |${userAuthenticationMessage(true)}
+// """.stripMargin,
+// EmptyBody,
+// basicAccountsJSON,
+// List(BankNotFound, UnknownError),
+// List(apiTagAccount, apiTagPrivateData, apiTagPublicData)
+// )
+//
+// def processAccounts(privateViewsUserCanAccessAtOneBank: List[View], availablePrivateAccounts: List[BankAccount]) = {
+// privateBankAccountBasicListToJson(availablePrivateAccounts, privateViewsUserCanAccessAtOneBank)
+// }
+// lazy val getPrivateAccountsAtOneBank : OBPEndpoint = {
+//
+// case "banks" :: BankId(bankId) :: "accounts" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for{
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
+// (availablePrivateAccounts, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
+// } yield {
+// (processAccounts(privateViewsUserCanAccessAtOneBank, availablePrivateAccounts), HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+// def corePrivateAccountsAtOneBankResult (callerContext: CallerContext, codeContext: CodeContext, user: User, privateAccounts: List[BankAccount], privateViewsUserCanAccess : List[View], callContext: Option[CallContext]) ={
+// successJsonResponse(coreBankAccountListToJson(callerContext, codeContext, user: User, privateAccounts, privateViewsUserCanAccess, callContext))
+// }
+//
+// resourceDocs += ResourceDoc(
+// corePrivateAccountsAtOneBank,
+// apiVersion,
+// "corePrivateAccountsAtOneBank",
+// "GET",
+// "/my/banks/BANK_ID/accounts",
+// "Get Accounts at Bank (Private)",
+// s"""Get private accounts at one bank (Authenticated access).
+// |Returns the list of accounts containing private views for the user at BANK_ID.
+// |For each account the API returns the ID and label. To also see the list of Views, see privateAccountsAtOneBank
+// |
+// |
+// |This call MAY have an alias /bank/accounts but ONLY if defaultBank is set in Props
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// coreAccountsJSON,
+// List(AuthenticatedUserIsRequired, UnknownError),
+// List(apiTagAccount, apiTagPrivateData, apiTagPsd2))
+//
+// apiRelations += ApiRelation(corePrivateAccountsAtOneBank, createAccount, "new")
+// apiRelations += ApiRelation(corePrivateAccountsAtOneBank, corePrivateAccountsAtOneBank, "self")
+//
+//
+// // This contains an approach to surface a resource via different end points in case of a default bank.
+// // The second path is experimental
+// lazy val corePrivateAccountsAtOneBank : OBPEndpoint = {
+// // get private accounts for a single bank
+// case "my" :: "banks" :: BankId(bankId) :: "accounts" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
+// (privateAccountsForOneBank, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
+// } yield {
+// val result = corePrivateAccountsAtOneBankResult(CallerContext(corePrivateAccountsAtOneBank), codeContext, u, privateAccountsForOneBank, privateViewsUserCanAccessAtOneBank, callContext)
+// (result, HttpCode.`200`(callContext))
+// }
+// }
+// // Also we support accounts/private to maintain compatibility with 1.4.0
+// case "my" :: "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
+// (privateAccountsForOneBank, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
+// } yield {
+// val result = corePrivateAccountsAtOneBankResult(CallerContext(corePrivateAccountsAtOneBank), codeContext, u, privateAccountsForOneBank, privateViewsUserCanAccessAtOneBank, callContext)
+// (result, HttpCode.`200`(callContext))
+// }
+// }
+// // Supports idea of default bank
+// case "bank" :: "accounts" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext)
+// (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, BankId(defaultBankId))
+// (availablePrivateAccounts, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
+// } yield {
+// val result = corePrivateAccountsAtOneBankResult(CallerContext(corePrivateAccountsAtOneBank), codeContext, u, availablePrivateAccounts, privateViewsUserCanAccessAtOneBank, callContext)
+// (result, HttpCode.`200`(callContext))
+// }
+// }
+//
+// }
+//
+//
+// resourceDocs += ResourceDoc(
+// privateAccountsAtOneBank,
+// apiVersion,
+// "privateAccountsAtOneBank",
+// "GET",
+// "/banks/BANK_ID/accounts/private",
+// "Get private accounts at one bank",
+// s"""Returns the list of private accounts at BANK_ID that the user has access to.
+// |For each account the API returns the ID and the available views.
+// |
+// |If you want to see more information on the Views, use the Account Detail call.
+// |If you want less information about the account, use the /my accounts call
+// |
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// basicAccountsJSON,
+// List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
+// List(apiTagAccount, apiTagPsd2)
+// )
+//
+// lazy val privateAccountsAtOneBank : OBPEndpoint = {
+// //get private accounts for a single bank
+// case "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (privateViewsUserCanAccessAtOneBank, privateAccountAccess) = Views.views.vend.privateViewsUserCanAccessAtBank(u, bankId)
+// (availablePrivateAccounts, callContext) <- bank.privateAccountsFuture(privateAccountAccess, callContext)
+// } yield {
+// (privateBankAccountsListToJson(availablePrivateAccounts, privateViewsUserCanAccessAtOneBank), HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+//
+//
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// publicAccountsAtOneBank,
+// apiVersion,
+// "publicAccountsAtOneBank",
+// "GET",
+// "/banks/BANK_ID/accounts/public",
+// "Get Public Accounts at Bank",
+// s"""Returns a list of the public accounts (Anonymous access) at BANK_ID. For each account the API returns the ID and the available views.
+// |
+// |${userAuthenticationMessage(false)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// basicAccountsJSON,
+// List(UnknownError),
+// List(apiTagAccountPublic, apiTagAccount, apiTagPublicData))
+//
+// lazy val publicAccountsAtOneBank : OBPEndpoint = {
+// //get public accounts for a single bank
+// case "banks" :: BankId(bankId) :: "accounts" :: "public" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (_, callContext) <- anonymousAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// } yield {
+// val (publicViewsForBank, publicAccountAccess) = Views.views.vend.publicViewsForBank(bank.bankId)
+// val publicAccountsJson = publicBankAccountBasicListToJson(bank.publicAccounts(publicAccountAccess), publicViewsForBank)
+// (publicAccountsJson, HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getKycDocuments,
+// apiVersion,
+// "getKycDocuments",
+// "GET",
+// "/customers/CUSTOMER_ID/kyc_documents",
+// "Get Customer KYC Documents",
+// s"""Get KYC (know your customer) documents for a customer specified by CUSTOMER_ID
+// |Get a list of documents that affirm the identity of the customer
+// |Passport, driving licence etc.
+// |${userAuthenticationMessage(false)}""".stripMargin,
+// EmptyBody,
+// kycDocumentsJSON,
+// List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canGetAnyKycDocuments))
+// )
+//
+// // TODO Add Role
+//
+// lazy val getKycDocuments : OBPEndpoint = {
+// case "customers" :: customerId :: "kyc_documents" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycDocuments, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// (kycDocuments, callContxt) <- NewStyle.function.getKycDocuments(customerId, callContext)
+// } yield {
+// val json = JSONFactory200.createKycDocumentsJSON(kycDocuments)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+//
+// resourceDocs += ResourceDoc(
+// getKycMedia,
+// apiVersion,
+// "getKycMedia",
+// "GET",
+// "/customers/CUSTOMER_ID/kyc_media",
+// "Get KYC Media for a customer",
+// s"""Get KYC media (scans, pictures, videos) that affirms the identity of the customer.
+// |
+// |${userAuthenticationMessage(true)}""".stripMargin,
+// EmptyBody,
+// kycMediasJSON,
+// List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canGetAnyKycMedia)))
+//
+// lazy val getKycMedia : OBPEndpoint = {
+// case "customers" :: customerId :: "kyc_media" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycMedia, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// (kycMedias, callContxt) <- NewStyle.function.getKycMedias(customerId, callContext)
+// } yield {
+// val json = JSONFactory200.createKycMediasJSON(kycMedias)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getKycChecks,
+// apiVersion,
+// "getKycChecks",
+// "GET",
+// "/customers/CUSTOMER_ID/kyc_checks",
+// "Get Customer KYC Checks",
+// s"""Get KYC checks for the Customer specified by CUSTOMER_ID.
+// |
+// |${userAuthenticationMessage(true)}""".stripMargin,
+// EmptyBody,
+// kycChecksJSON,
+// List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canGetAnyKycChecks))
+// )
+//
+// lazy val getKycChecks : OBPEndpoint = {
+// case "customers" :: customerId :: "kyc_checks" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycChecks, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// (kycChecks, callContxt) <- NewStyle.function.getKycChecks(customerId, callContext)
+// } yield {
+// val json = JSONFactory200.createKycChecksJSON(kycChecks)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+// resourceDocs += ResourceDoc(
+// getKycStatuses,
+// apiVersion,
+// "getKycStatuses",
+// "GET",
+// "/customers/CUSTOMER_ID/kyc_statuses",
+// "Get Customer KYC statuses",
+// s"""Get the KYC statuses for a customer specified by CUSTOMER_ID over time.
+// |
+// |${userAuthenticationMessage(true)}""".stripMargin,
+// EmptyBody,
+// kycStatusesJSON,
+// List(AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canGetAnyKycStatuses))
+// )
+//
+// lazy val getKycStatuses : OBPEndpoint = {
+// case "customers" :: customerId :: "kyc_statuses" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyKycStatuses, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// (kycStatuses, callContxt) <- NewStyle.function.getKycStatuses(customerId, callContext)
+// } yield {
+// val json = JSONFactory200.createKycStatusesJSON(kycStatuses)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getSocialMediaHandles,
+// apiVersion,
+// "getSocialMediaHandles",
+// "GET",
+// "/banks/BANK_ID/customers/CUSTOMER_ID/social_media_handles",
+// "Get Customer Social Media Handles",
+// s"""Get social media handles for a customer specified by CUSTOMER_ID.
+// |
+// |${userAuthenticationMessage(true)}""".stripMargin,
+// EmptyBody,
+// socialMediasJSON,
+// List(AuthenticatedUserIsRequired, UserHasMissingRoles, CustomerNotFoundByCustomerId, UnknownError),
+// List(apiTagCustomer),
+// Some(List(canGetSocialMediaHandles)))
+//
+// lazy val getSocialMediaHandles : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: customerId :: "social_media_handles" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext ) <- NewStyle.function.getBank(bankId, callContext)
+// _ <- NewStyle.function.hasEntitlement(bank.bankId.value, u.userId, canGetSocialMediaHandles, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// } yield {
+// val kycSocialMedias = SocialMediaHandle.socialMediaHandleProvider.vend.getSocialMedias(customer.number)
+// val json = JSONFactory200.createSocialMediasJSON(kycSocialMedias)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// addKycDocument,
+// apiVersion,
+// "addKycDocument",
+// "PUT",
+// "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_documents/KYC_DOCUMENT_ID",
+// "Add KYC Document",
+// "Add a KYC document for the customer specified by CUSTOMER_ID. KYC Documents contain the document type (e.g. passport), place of issue, expiry etc. ",
+// postKycDocumentJSON,
+// kycDocumentJSON,
+// List(AuthenticatedUserIsRequired, InvalidJsonFormat, BankNotFound, CustomerNotFoundByCustomerId,"Server error: could not add KycDocument", UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canAddKycDocument))
+// )
+//
+// // TODO customerNumber should be in the url but not also in the postedData
+//
+// lazy val addKycDocument : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_documents" :: documentId :: Nil JsonPut json -> _ => {
+// // customerNumber is duplicated in postedData. remove from that?
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycDocument, callContext)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycDocumentJSON "
+// postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[PostKycDocumentJSON]
+// }
+//
+// (kycDocumentCreated, callContext) <-
+// NewStyle.function.createOrUpdateKycDocument(
+// bankId.value,
+// customerId,
+// documentId,
+// postedData.customer_number,
+// postedData.`type`,
+// postedData.number,
+// postedData.issue_date,
+// postedData.issue_place,
+// postedData.expiry_date,
+// callContext)
+// } yield {
+// val json = JSONFactory200.createKycDocumentJSON(kycDocumentCreated)
+// (json, HttpCode.`201`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// addKycMedia,
+// apiVersion,
+// "addKycMedia",
+// "PUT",
+// "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_media/KYC_MEDIA_ID",
+// "Add KYC Media",
+// "Add some KYC media for the customer specified by CUSTOMER_ID. KYC Media resources relate to KYC Documents and KYC Checks and contain media urls for scans of passports, utility bills etc",
+// postKycMediaJSON,
+// kycMediaJSON,
+// List(AuthenticatedUserIsRequired, InvalidJsonFormat, CustomerNotFoundByCustomerId, ServerAddDataError, UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canAddKycMedia))
+// )
+//
+// lazy val addKycMedia : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_media" :: mediaId :: Nil JsonPut json -> _ => {
+// // customerNumber is in url and duplicated in postedData. remove from that?
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycMedia, callContext)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycMediaJSON "
+// postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[PostKycMediaJSON]
+// }
+//
+// (kycMediaCreated, callContext) <- NewStyle.function.createOrUpdateKycMedia(
+// bankId.value,
+// customerId,
+// mediaId,
+// postedData.customer_number,
+// postedData.`type`,
+// postedData.url,
+// postedData.date,
+// postedData.relates_to_kyc_document_id,
+// postedData.relates_to_kyc_check_id,
+// callContext
+// )
+// } yield {
+// val json = JSONFactory200.createKycMediaJSON(kycMediaCreated)
+// (json, HttpCode.`201`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// addKycCheck,
+// apiVersion,
+// "addKycCheck",
+// "PUT",
+// "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_check/KYC_CHECK_ID",
+// "Add KYC Check",
+// "Add a KYC check for the customer specified by CUSTOMER_ID. KYC Checks store details of checks on a customer made by the KYC team, their comments and a satisfied status",
+// postKycCheckJSON,
+// kycCheckJSON,
+// List(AuthenticatedUserIsRequired, InvalidJsonFormat, BankNotFound, CustomerNotFoundByCustomerId, ServerAddDataError, UnknownError),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canAddKycCheck))
+// )
+//
+// lazy val addKycCheck : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_check" :: checkId :: Nil JsonPut json -> _ => {
+// // customerNumber is in url and duplicated in postedData. remove from that?
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycCheck, callContext)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycCheckJSON "
+// postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[PostKycCheckJSON]
+// }
+//
+// (kycCheck, callContext) <- NewStyle.function.createOrUpdateKycCheck(
+// bankId.value,
+// customerId,
+// checkId,
+// postedData.customer_number,
+// postedData.date,
+// postedData.how,
+// postedData.staff_user_id,
+// postedData.staff_name,
+// postedData.satisfied,
+// postedData.comments,
+// callContext
+// )
+// } yield {
+// val json = JSONFactory200.createKycCheckJSON(kycCheck)
+// (json, HttpCode.`201`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// addKycStatus,
+// apiVersion,
+// "addKycStatus",
+// "PUT",
+// "/banks/BANK_ID/customers/CUSTOMER_ID/kyc_statuses",
+// "Add KYC Status",
+// "Add a kyc_status for the customer specified by CUSTOMER_ID. KYC Status is a timeline of the KYC status of the customer",
+// postKycStatusJSON,
+// kycStatusJSON,
+// List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidBankIdFormat,UnknownError, BankNotFound ,ServerAddDataError ,CustomerNotFoundByCustomerId),
+// List(apiTagKyc, apiTagCustomer),
+// Some(List(canAddKycStatus))
+// )
+//
+// lazy val addKycStatus : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: customerId :: "kyc_statuses" :: Nil JsonPut json -> _ => {
+// // customerNumber is in url and duplicated in postedData. remove from that?
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canAddKycStatus, callContext)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $PostKycStatusJSON "
+// postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[PostKycStatusJSON]
+// }
+//
+// (kycStatus, callContext) <- NewStyle.function.createOrUpdateKycStatus(
+// bankId.value,
+// customerId,
+// postedData.customer_number,
+// postedData.ok,
+// postedData.date, callContext)
+// } yield {
+// val json = JSONFactory200.createKycStatusJSON(kycStatus)
+// (json, HttpCode.`201`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// addSocialMediaHandle,
+// apiVersion,
+// "addSocialMediaHandle",
+// "POST",
+// "/banks/BANK_ID/customers/CUSTOMER_ID/social_media_handles",
+// "Create Customer Social Media Handle",
+// "Create a customer social media handle for the customer specified by CUSTOMER_ID",
+// socialMediaJSON,
+// successMessage,
+// List(
+// AuthenticatedUserIsRequired,
+// InvalidJsonFormat,
+// InvalidBankIdFormat,
+// UserHasMissingRoles,
+// CustomerNotFoundByCustomerId,
+// UnknownError),
+// List(apiTagCustomer),
+// Some(List(canAddSocialMediaHandle))
+// )
+//
+// lazy val addSocialMediaHandle : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: customerId :: "social_media_handles" :: Nil JsonPost json -> _ => {
+// // customerNumber is in url and duplicated in postedData. remove from that?
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// postedData <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, callContext) {
+// json.extract[SocialMediaJSON]
+// }
+// _ <- Helper.booleanToFuture(ErrorMessages.InvalidBankIdFormat, 400, callContext){
+// isValidID(bankId.value)
+// }
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// _ <- NewStyle.function.hasEntitlement(bank.bankId.value, u.userId, canAddSocialMediaHandle, cc.callContext)
+// (_, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext)
+// _ <- Helper.booleanToFuture("Server error: could not add", 400, callContext){
+// SocialMediaHandle.socialMediaHandleProvider.vend.addSocialMedias(
+// postedData.customer_number,
+// postedData.`type`,
+// postedData.handle,
+// postedData.date_added,
+// postedData.date_activated
+// )
+// }
+// } yield {
+// (successMessage, HttpCode.`201`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getCoreAccountById,
+// apiVersion,
+// "getCoreAccountById",
+// "GET",
+// "/my/banks/BANK_ID/accounts/ACCOUNT_ID/account",
+// "Get Account by Id (Core)",
+// s"""Information returned about the account specified by ACCOUNT_ID:
+// |
+// |* Number
+// |* Owners
+// |* Type
+// |* Balance
+// |* IBAN
+// |
+// |This call returns the owner view and requires access to that view.
+// |
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |""".stripMargin,
+// EmptyBody,
+// moderatedCoreAccountJSON,
+// List(BankAccountNotFound,UnknownError),
+// apiTagAccount :: apiTagPsd2 :: apiTagOldStyle :: Nil)
+//
+// lazy val getCoreAccountById : OBPEndpoint = {
+// //get account by id (assume owner view requested)
+// 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"
+// // Should be a generic guard we can use for all calls (also for userId etc.)
+// for {
+// u <- cc.user ?~ AuthenticatedUserIsRequired
+// account <- BankAccountX(bankId, accountId) ?~ BankAccountNotFound
+// // Assume owner view was requested
+// view <- u.checkOwnerViewAccessAndReturnOwnerView(BankIdAccountId(account.bankId, account.accountId), Some(cc))
+// moderatedAccount <- account.moderatedBankAccount(view, BankIdAccountId(bankId, accountId), cc.user, Some(cc))
+// } yield {
+// val moderatedAccountJson = JSONFactory200.createCoreBankAccountJSON(moderatedAccount)
+// val response = successJsonResponse(Extraction.decompose(moderatedAccountJson))
+// response
+// }
+// }
+// }
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// getCoreTransactionsForBankAccount,
+// apiVersion,
+// "getCoreTransactionsForBankAccount",
+// "GET",
+// "/my/banks/BANK_ID/accounts/ACCOUNT_ID/transactions",
+// "Get Transactions for Account (Core)",
+// s"""Returns transactions list (Core info) of the account specified by ACCOUNT_ID.
+// |
+// |Authentication is required.
+// |
+// |${urlParametersDocument(true, true)}
+// |
+// |""",
+// EmptyBody,
+// coreTransactionsJSON,
+// List(BankAccountNotFound, UnknownError),
+// List(apiTagTransaction, apiTagAccount, apiTagPsd2, apiTagOldStyle))
+//
+// //Note: we already have the method: getTransactionsForBankAccount in V121.
+// //The only difference here is "Core implies 'owner' view"
+// lazy val getCoreTransactionsForBankAccount : OBPEndpoint = {
+// //get transactions
+// case "my" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "transactions" :: Nil JsonGet req => {
+// cc =>
+// for {
+// u <- cc.user ?~ AuthenticatedUserIsRequired
+// params <- createQueriesByHttpParams(req.request.headers)
+// (bank, callContext) <- BankX(bankId, Some(cc)) ?~ BankNotFound
+// bankAccount <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound
+// view <- u.checkOwnerViewAccessAndReturnOwnerView(BankIdAccountId(bankAccount.bankId,bankAccount.accountId), Some(cc))
+// (transactions, callContext) <- bankAccount.getModeratedTransactions(bank, cc.user, view, BankIdAccountId(bankId, accountId), None, params)
+// } yield {
+// val json = JSONFactory200.createCoreTransactionsJSON(transactions)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+//
+//
+// // Copied from 1.2.1 and modified
+//
+// resourceDocs += ResourceDoc(
+// accountById,
+// apiVersion,
+// "accountById",
+// "GET",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/account",
+// "Get Account by Id (Full)",
+// s"""Information returned about an account specified by ACCOUNT_ID as moderated by the view (VIEW_ID):
+// |
+// |* Number
+// |* Owners
+// |* Type
+// |* Balance
+// |* IBAN
+// |* Available views (sorted by short_name)
+// |
+// |More details about the data moderation by the view [here](#1_2_1-getViewsForBankAccount).
+// |
+// |PSD2 Context: PSD2 requires customers to have access to their account information via third party applications.
+// |This call provides balance and other account information via delegated authentication using OAuth.
+// |
+// |${userAuthenticationMessage(true)} if the 'is_public' field in view (VIEW_ID) is not set to `true`.
+// |
+// |""".stripMargin,
+// EmptyBody,
+// moderatedAccountJSON,
+// List(BankNotFound,AccountNotFound,ViewNotFound, UserNoPermissionAccessView, UnknownError),
+// apiTagAccount :: apiTagOldStyle :: Nil)
+//
+// lazy val accountById : OBPEndpoint = {
+// //get account by id
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "account" :: Nil JsonGet req => {
+// cc =>
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired
+// (bank, callContext) <- BankX(bankId, Some(cc)) ?~ BankNotFound // Check bank exists.
+// account <- BankAccountX(bank.bankId, accountId) ?~ {ErrorMessages.AccountNotFound} // Check Account exists.
+// availableViews <- Full(Views.views.vend.privateViewsUserCanAccessForAccount(u, BankIdAccountId(account.bankId, account.accountId)))
+// view <- APIUtil.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
+// moderatedAccount <- account.moderatedBankAccount(view, BankIdAccountId(bankId, accountId), cc.user, callContext)
+// } yield {
+// val viewsAvailable = availableViews.map(JSONFactory121.createViewJSON).sortBy(_.short_name)
+// val moderatedAccountJson = JSONFactory121.createBankAccountJSON(moderatedAccount, viewsAvailable)
+// successJsonResponse(Extraction.decompose(moderatedAccountJson))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getPermissionsForBankAccount,
+// apiVersion,
+// "getPermissionsForBankAccount",
+// "GET",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/permissions",
+// "Get access",
+// s"""Returns the list of the permissions at BANK_ID for account ACCOUNT_ID, with each time a pair composed of the user and the views that he has access to.
+// |
+// |${userAuthenticationMessage(true)}
+// |and the user needs to have access to the owner view.
+// |
+// |""",
+// EmptyBody,
+// permissionsJSON,
+// List(AuthenticatedUserIsRequired, BankNotFound, AccountNotFound ,UnknownError),
+// List(apiTagView, apiTagAccount, apiTagUser, apiTagEntitlement)
+// )
+//
+// lazy val getPermissionsForBankAccount : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: Nil JsonGet req => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
+// anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
+// .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
+// _ <- Helper.booleanToFuture(
+// s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)}` permission on any your views",
+// cc = callContext
+// ) {
+// anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission
+// }
+// permissions = Views.views.vend.permissions(BankIdAccountId(bankId, accountId))
+// } yield {
+// val permissionsJSON = JSONFactory121.createPermissionsJSON(permissions.sortBy(_.user.emailAddress))
+// (permissionsJSON, HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getPermissionForUserForBankAccount,
+// apiVersion,
+// "getPermissionForUserForBankAccount",
+// "GET",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/permissions/PROVIDER/PROVIDER_ID",
+// "Get Account access for User",
+// s"""Returns the list of the views at BANK_ID for account ACCOUNT_ID that a user identified by PROVIDER_ID at their provider PROVIDER has access to.
+// |All url parameters must be [%-encoded](http://en.wikipedia.org/wiki/Percent-encoding), which is often especially relevant for USER_ID and PROVIDER.
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |The user needs to have access to the owner view.""",
+// EmptyBody,
+// viewsJSONV121,
+// List(AuthenticatedUserIsRequired,BankNotFound, AccountNotFound,UnknownError),
+// List(apiTagView, apiTagAccount, apiTagUser, apiTagOldStyle))
+//
+// lazy val getPermissionForUserForBankAccount : OBPEndpoint = {
+// //get access for specific user
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: provider :: providerId :: Nil JsonGet req => {
+// cc =>
+// for {
+// loggedInUser <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired // Check we have a user (rather than error or empty)
+// (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound // Check bank exists.
+// account <- BankAccountX(bank.bankId, accountId) ?~! {ErrorMessages.AccountNotFound} // Check Account exists.
+// loggedInUserPermissionBox = Views.views.vend.permission(BankIdAccountId(bankId, accountId), loggedInUser)
+// anyViewContainsCanSeePermissionForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists( _ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)))
+// .getOrElse(Nil).find(_.==(true)).getOrElse(false)
+//
+// _ <- booleanToBox(
+// anyViewContainsCanSeePermissionForOneUserPermission,
+// s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views"
+// )
+// userFromURL <- UserX.findByProviderId(provider, providerId) ?~! UserNotFoundByProviderAndProvideId
+// permission <- Views.views.vend.permission(BankIdAccountId(bankId, accountId), userFromURL)
+// } yield {
+// // TODO : Note this is using old createViewsJSON without can_add_counterparty etc.
+// val views = JSONFactory121.createViewsJSON(permission.views.sortBy(_.viewId.value))
+// successJsonResponse(Extraction.decompose(views))
+// }
+// }
+// }
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// createAccount,
+// apiVersion,
+// "createAccount",
+// "PUT",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID",
+// "Create Account",
+// """Create Account at bank specified by BANK_ID with Id specified by ACCOUNT_ID.
+// |
+// |
+// |The User can create an Account for themself or an Account for another User if they have CanCreateAccount role.
+// |
+// |If USER_ID is not specified the account will be owned by the logged in User.
+// |
+// |ACCOUNT_ID SHOULD be a UUID. ACCOUNT_ID MUST NOT be the ACCOUNT_NUMBER.
+// |
+// |TYPE SHOULD be the PRODUCT_CODE from Product.
+// |
+// |Note: The Amount must be zero.""".stripMargin,
+// CreateAccountJSON("A user_id","CURRENT", "Label", AmountOfMoneyJSON121("EUR", "0")),
+// coreAccountJSON,
+// List(
+// AuthenticatedUserIsRequired,
+// InvalidJsonFormat,
+// InvalidUserId,
+// InvalidAccountIdFormat,
+// InvalidBankIdFormat,
+// UserNotFoundById,
+// InvalidAccountBalanceAmount,
+// InvalidAccountType,
+// InvalidAccountInitialBalance,
+// InvalidAccountBalanceCurrency,
+// UnknownError
+// ),
+// List(apiTagAccount, apiTagOldStyle),
+// Some(List(canCreateAccount))
+// )
+//
+// apiRelations += ApiRelation(createAccount, createAccount, "self")
+// apiRelations += ApiRelation(createAccount, getCoreAccountById, "detail")
+//
+// // Note: This doesn't currently work (links only have access to same version resource docs). TODO fix me.
+// apiRelations += ApiRelation(createAccount, Implementations1_2_1.updateAccountLabel, "update_label")
+//
+//
+// lazy val createAccount : OBPEndpoint = {
+// // Create a new account
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: Nil JsonPut json -> _ => {
+// cc =>{
+//
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $CreateAccountJSON "
+// createAccountJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[CreateAccountJSON]
+// }
+//
+// loggedInUserId = u.userId
+// userIdAccountOwner = if (createAccountJson.user_id.nonEmpty) createAccountJson.user_id else loggedInUserId
+// _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc = callContext) {
+// isValidID(accountId.value)
+// }
+// _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc = callContext) {
+// isValidID(accountId.value)
+// }
+//
+// (postedOrLoggedInUser, callContext) <- NewStyle.function.findByUserId(userIdAccountOwner, callContext)
+//
+// // User can create account for self or an account for another user if they have CanCreateAccount role
+// _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc = callContext) {
+// isValidID(accountId.value)
+// }
+//
+// _ <- if (userIdAccountOwner == loggedInUserId) Future.successful(Full(Unit))
+// else NewStyle.function.hasEntitlement(bankId.value, loggedInUserId, canCreateAccount, callContext, s"${UserHasMissingRoles} $canCreateAccount or create account for self")
+//
+// initialBalanceAsString = createAccountJson.balance.amount
+// accountType = createAccountJson.`type`
+// accountLabel = createAccountJson.label
+// initialBalanceAsNumber <- NewStyle.function.tryons(InvalidAccountInitialBalance, 400, callContext) {
+// BigDecimal(initialBalanceAsString)
+// }
+//
+// _ <- Helper.booleanToFuture(InitialBalanceMustBeZero, cc = callContext) {
+// 0 == initialBalanceAsNumber
+// }
+//
+// _ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc = callContext) {
+// isValidCurrencyISOCode(createAccountJson.balance.currency)
+// }
+//
+//
+// currency = createAccountJson.balance.currency
+//
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+//
+// (bankAccount, callContext) <- NewStyle.function.createBankAccount(
+// bankId,
+// accountId,
+// accountType,
+// accountLabel,
+// currency,
+// initialBalanceAsNumber,
+// postedOrLoggedInUser.name,
+// "",
+// List.empty,
+// callContext
+// )
+// //1 Create or Update the `Owner` for the new account
+// //2 Add permission to the user
+// //3 Set the user as the account holder
+// _ <- BankAccountCreation.setAccountHolderAndRefreshUserAccountAccess(bankId, accountId, postedOrLoggedInUser, callContext)
+// dataContext = DataContext(cc.user, Some(bankAccount.bankId), Some(bankAccount.accountId), Empty, Empty, Empty)
+// links = code.api.util.APIUtil.getHalLinks(CallerContext(createAccount), codeContext, dataContext, callContext)
+// } yield {
+// (JSONFactory200.createCoreAccountJSON(bankAccount, links), HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+//
+//
+// val getTransactionTypesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getTransactionTypesIsPublic", true)
+//
+//
+// resourceDocs += ResourceDoc(
+// getTransactionTypes,
+// apiVersion,
+// "getTransactionTypes",
+// "GET",
+// "/banks/BANK_ID/transaction-types",
+// "Get Transaction Types at Bank",
+// // TODO get the documentation of the parameters from the scala doc of the case class we return
+// s"""Get Transaction Types for the bank specified by BANK_ID:
+// |
+// |Lists the possible Transaction Types available at the bank (as opposed to Transaction Request Types which are the possible ways Transactions can be created by this API Server).
+// |
+// | * id : Unique transaction type id across the API instance. SHOULD be a UUID. MUST be unique.
+// | * bank_id : The bank that supports this TransactionType
+// | * short_code : A short code (SHOULD have no-spaces) which MUST be unique across the bank. May be stored with Transactions to link here
+// | * summary : A succinct summary
+// | * description : A longer description
+// | * charge : The charge to the customer for each one of these
+// |
+// |${userAuthenticationMessage(!getTransactionTypesIsPublic)}""".stripMargin,
+// EmptyBody,
+// transactionTypesJsonV200,
+// List(BankNotFound, UnknownError),
+// List(apiTagBank, apiTagPSD2AIS, apiTagPsd2)
+// )
+//
+// lazy val getTransactionTypes : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "transaction-types" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// // Get Transaction Types from the active provider
+// (_, callContext) <- getTransactionTypesIsPublic match {
+// case false => authenticatedAccess(cc)
+// case true => anonymousAccess(cc)
+// }
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// transactionTypes <- Future(TransactionType.TransactionTypeProvider.vend.getTransactionTypesForBank(bank.bankId)) map { connectorEmptyResponse(_, callContext) } // ~> APIFailure("No transation types available. License may not be set.", 204)
+// } yield {
+// (JSONFactory200.createTransactionTypeJSON(transactionTypes), HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+//
+// import net.liftweb.json.Extraction._
+// import net.liftweb.json.JsonAST._
+// val exchangeRates = prettyRender(decompose(fx.fallbackExchangeRates))
+//
+// resourceDocs += ResourceDoc(
+// createUser,
+// apiVersion,
+// "createUser",
+// "POST",
+// "/users",
+// "Create User",
+// s"""Creates OBP user.
+// | No authorisation required.
+// |
+// | Mimics current webform to Register.
+// |
+// | Requires username(email), password, first_name, last_name, and email.
+// |
+// | Validation checks performed:
+// | - Password must meet strong password requirements (InvalidStrongPasswordFormat error if not)
+// | - Username must be unique (409 error if username already exists)
+// | - All required fields must be present in valid JSON format
+// |
+// | Email validation behavior:
+// | - Controlled by property 'authUser.skipEmailValidation' (default: false)
+// | - When false: User is created with validated=false and a validation email is sent to the user's email address
+// | - When true: User is created with validated=true and no validation email is sent
+// | - Default entitlements are granted immediately regardless of validation status
+// |
+// | Note: If email validation is required (skipEmailValidation=false), the user must click the validation link
+// | in the email before they can log in, even though entitlements are already granted.
+// |
+// |""",
+// createUserJson,
+// userJsonV200,
+// List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidStrongPasswordFormat, DuplicateUsername, ExternalUserCheckFailed, "Error occurred during user creation.", UnknownError),
+// List(apiTagUser, apiTagOnboarding))
+//
+// lazy val createUser: OBPEndpoint = {
+// case "users" :: Nil JsonPost json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// postedData <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, cc.callContext) {
+// json.extract[CreateUserJson]
+// }
+// _ <- Helper.booleanToFuture(ErrorMessages.InvalidStrongPasswordFormat, 400, cc.callContext) {
+// fullPasswordValidation(postedData.password)
+// }
+// _ <- Helper.booleanToFuture(ErrorMessages.DuplicateUsername, 409, cc.callContext) {
+// AuthUser.find(By(AuthUser.username, postedData.username)).isEmpty
+// }
+// userCreated <- Future {
+// AuthUser.create
+// .firstName(postedData.first_name)
+// .lastName(postedData.last_name)
+// .username(postedData.username)
+// .email(postedData.email)
+// .password(postedData.password)
+// .validated(APIUtil.getPropsAsBoolValue("authUser.skipEmailValidation", defaultValue = false))
+// }
+// _ <- Helper.booleanToFuture(ErrorMessages.InvalidJsonFormat+userCreated.validate.map(_.msg).mkString(";"), 400, cc.callContext) {
+// userCreated.validate.size == 0
+// }
+// savedUser <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, cc.callContext) {
+// userCreated.saveMe()
+// }
+// _ <- Helper.booleanToFuture(s"$UnknownError Error occurred during user creation.", 400, cc.callContext) {
+// userCreated.saved_?
+// }
+// } yield {
+// // Send validation email if skipEmailValidation is false
+// val skipEmailValidation = APIUtil.getPropsAsBoolValue("authUser.skipEmailValidation", defaultValue = false)
+// if (!skipEmailValidation) {
+// AuthUser.sendValidationEmail(savedUser)
+// }
+// // Grant default entitlements regardless of validation status
+// AuthUser.grantDefaultEntitlementsToAuthUser(savedUser)
+// val json = JSONFactory200.createUserJSONfromAuthUser(userCreated)
+// (json, HttpCode.`201`(cc.callContext))
+// }
+// }
+// }
+//
+//
+//
+// // resourceDocs += ResourceDoc(
+// // createMeeting,
+// // apiVersion,
+// // "createMeeting",
+// // "POST",
+// // "/banks/BANK_ID/meetings",
+// // "Create Meeting (video conference/call)",
+// // """Create Meeting: Initiate a video conference/call with the bank.
+// // |
+// // |The Meetings resource contains meta data about video/other conference sessions, not the video/audio/chat itself.
+// // |
+// // |The actual conferencing is handled by external providers. Currently OBP supports tokbox video conferences (WIP).
+// // |
+// // |This is not a recomendation of tokbox per se.
+// // |
+// // |provider_id determines the provider of the meeting / video chat service. MUST be url friendly (no spaces).
+// // |
+// // |purpose_id explains the purpose of the chat. onboarding | mortgage | complaint etc. MUST be url friendly (no spaces).
+// // |
+// // |Login is required.
+// // |
+// // |This call is **experimental**. Currently staff_user_id is not set. Further calls will be needed to correctly set this.
+// // """.stripMargin,
+// // CreateMeetingJson("tokbox", "onboarding"),
+// // meetingJson,
+// // List(
+// // AuthenticatedUserIsRequired,
+// // MeetingApiKeyNotConfigured,
+// // MeetingApiSecretNotConfigured,
+// // InvalidBankIdFormat,
+// // BankNotFound,
+// // InvalidJsonFormat,
+// // MeetingsNotSupported,
+// // UnknownError
+// // ),
+// // List(apiTagMeeting, apiTagCustomer, apiTagExperimental))
+// //
+// //
+// // lazy val createMeeting: OBPEndpoint = {
+// // case "banks" :: BankId(bankId) :: "meetings" :: Nil JsonPost json -> _ => {
+// // cc =>
+// // if (APIUtil.getPropsAsBoolValue("meeting.tokbox_enabled", false)) {
+// // for {
+// // // TODO use these keys to get session and tokens from tokbox
+// // _ <- APIUtil.getPropsValue("meeting.tokbox_api_key") ~> APIFailure(MeetingApiKeyNotConfigured, 403)
+// // _ <- APIUtil.getPropsValue("meeting.tokbox_api_secret") ~> APIFailure(MeetingApiSecretNotConfigured, 403)
+// // u <- cc.user ?~! AuthenticatedUserIsRequired
+// // _ <- tryo(assert(isValidID(bankId.value)))?~! InvalidBankIdFormat
+// // (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound
+// // postedData <- tryo {json.extract[CreateMeetingJson]} ?~! InvalidJsonFormat
+// // now = Calendar.getInstance().getTime()
+// // sessionId <- tryo{code.opentok.OpenTokUtil.getSession.getSessionId()}
+// // customerToken <- tryo{code.opentok.OpenTokUtil.generateTokenForPublisher(60)}
+// // staffToken <- tryo{code.opentok.OpenTokUtil.generateTokenForModerator(60)}
+// // meeting <- Meetings.meetingProvider.vend.createMeeting(bank.bankId, u, u, postedData.provider_id, postedData.purpose_id, now, sessionId, customerToken, staffToken
+// // ,null,null)//These two are used from V310
+// // } yield {
+// // // Format the data as V2.0.0 json
+// // val json = JSONFactory200.createMeetingJSON(meeting)
+// // successJsonResponse(Extraction.decompose(json), 201)
+// // }
+// // } else {
+// // Full(errorJsonResponse(MeetingsNotSupported))
+// // }
+// // }
+// // }
+// //
+// //
+// // resourceDocs += ResourceDoc(
+// // getMeetings,
+// // apiVersion,
+// // "getMeetings",
+// // "GET",
+// // "/banks/BANK_ID/meetings",
+// // "Get Meetings",
+// // """Meetings contain meta data about, and are used to facilitate, video conferences / chats etc.
+// // |
+// // |The actual conference/chats are handled by external services.
+// // |
+// // |Login is required.
+// // |
+// // |This call is **experimental** and will require further authorisation in the future.
+// // """.stripMargin,
+// // EmptyBody,
+// // meetingsJson,
+// // List(
+// // AuthenticatedUserIsRequired,
+// // MeetingApiKeyNotConfigured,
+// // MeetingApiSecretNotConfigured,
+// // BankNotFound,
+// // MeetingsNotSupported,
+// // UnknownError),
+// // List(apiTagMeeting, apiTagCustomer, apiTagExperimental))
+// //
+// //
+// // lazy val getMeetings: OBPEndpoint = {
+// // case "banks" :: BankId(bankId) :: "meetings" :: Nil JsonGet _ => {
+// // cc =>
+// // if (APIUtil.getPropsAsBoolValue("meeting.tokbox_enabled", false)) {
+// // for {
+// // _ <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// // (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! BankNotFound
+// // _ <- APIUtil.getPropsValue("meeting.tokbox_api_key") ~> APIFailure(ErrorMessages.MeetingApiKeyNotConfigured, 403)
+// // _ <- APIUtil.getPropsValue("meeting.tokbox_api_secret") ~> APIFailure(ErrorMessages.MeetingApiSecretNotConfigured, 403)
+// // u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// // (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound
+// // // now = Calendar.getInstance().getTime()
+// // meetings <- Meetings.meetingProvider.vend.getMeetings(bank.bankId, u)
+// // }
+// // yield {
+// // // Format the data as V2.0.0 json
+// // val json = JSONFactory200.createMeetingJSONs(meetings)
+// // successJsonResponse(Extraction.decompose(json))
+// // }
+// // } else {
+// // Full(errorJsonResponse(MeetingsNotSupported))
+// // }
+// // }
+// // }
+// //
+// //
+// //
+// // resourceDocs += ResourceDoc(
+// // getMeeting,
+// // apiVersion,
+// // "getMeeting",
+// // "GET",
+// // "/banks/BANK_ID/meetings/MEETING_ID",
+// // "Get Meeting",
+// // """Get Meeting specified by BANK_ID / MEETING_ID
+// // |Meetings contain meta data about, and are used to facilitate, video conferences / chats etc.
+// // |
+// // |The actual conference/chats are handled by external services.
+// // |
+// // |Login is required.
+// // |
+// // |This call is **experimental** and will require further authorisation in the future.
+// // """.stripMargin,
+// // EmptyBody,
+// // meetingJson,
+// // List(
+// // AuthenticatedUserIsRequired,
+// // BankNotFound,
+// // MeetingApiKeyNotConfigured,
+// // MeetingApiSecretNotConfigured,
+// // MeetingNotFound,
+// // MeetingsNotSupported,
+// // UnknownError
+// // ),
+// // List(apiTagMeeting, apiTagKyc, apiTagCustomer, apiTagExperimental))
+// //
+// //
+// // lazy val getMeeting: OBPEndpoint = {
+// // case "banks" :: BankId(bankId) :: "meetings" :: meetingId :: Nil JsonGet _ => {
+// // cc =>
+// // if (APIUtil.getPropsAsBoolValue("meeting.tokbox_enabled", false)) {
+// // for {
+// // u <- cc.user ?~! AuthenticatedUserIsRequired
+// // (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! BankNotFound
+// // _ <- APIUtil.getPropsValue("meeting.tokbox_api_key") ~> APIFailure(ErrorMessages.MeetingApiKeyNotConfigured, 403)
+// // _ <- APIUtil.getPropsValue("meeting.tokbox_api_secret") ~> APIFailure(ErrorMessages.MeetingApiSecretNotConfigured, 403)
+// // (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound
+// // meeting <- Meetings.meetingProvider.vend.getMeeting(bank.bankId, u, meetingId) ?~! {ErrorMessages.MeetingNotFound}
+// // }
+// // yield {
+// // // Format the data as V2.0.0 json
+// // val json = JSONFactory200.createMeetingJSON(meeting)
+// // successJsonResponse(Extraction.decompose(json))
+// // }
+// // } else {
+// // Full(errorJsonResponse(ErrorMessages.MeetingsNotSupported))
+// // }
+// // }
+// // }
+//
+//
// resourceDocs += ResourceDoc(
-// createMeeting,
+// createCustomer,
// apiVersion,
-// "createMeeting",
+// "createCustomer",
// "POST",
-// "/banks/BANK_ID/meetings",
-// "Create Meeting (video conference/call)",
-// """Create Meeting: Initiate a video conference/call with the bank.
-// |
-// |The Meetings resource contains meta data about video/other conference sessions, not the video/audio/chat itself.
-// |
-// |The actual conferencing is handled by external providers. Currently OBP supports tokbox video conferences (WIP).
-// |
-// |This is not a recomendation of tokbox per se.
-// |
-// |provider_id determines the provider of the meeting / video chat service. MUST be url friendly (no spaces).
+// "/banks/BANK_ID/customers",
+// "Create Customer",
+// s"""Add a customer linked to the user specified by user_id
+// |The Customer resource stores the customer number, legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
+// |This call may require additional permissions/role in the future.
+// |For now the authenticated user can create at most one linked customer.
+// |Dates need to be in the format 2013-01-21T23:08:00Z
+// |${userAuthenticationMessage(true)}
+// |""",
+// createCustomerJson,
+// customerJsonV140,
+// List(
+// InvalidBankIdFormat,
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// CustomerNumberAlreadyExists,
+// UserHasMissingRoles,
+// UserNotFoundById,
+// CreateConsumerError,
+// CustomerAlreadyExistsForUser,
+// CreateUserCustomerLinksError,
+// UnknownError
+// ),
+// List(apiTagCustomer, apiTagPerson, apiTagOldStyle),
+// Some(List(canCreateCustomer,canCreateUserCustomerLink)))
+//
+//
+//
+// // TODO
+// // Separate customer creation (keep here) from customer linking (remove from here)
+// // Remove user_id from CreateCustomerJson
+// // Logged in user must have CanCreateCustomer (should no longer be able create customer for own user)
+// // Add ApiLink to createUserCustomerLink
+//
+// lazy val createCustomer : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: Nil JsonPost json -> _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired // TODO. CHECK user has role to create a customer / create a customer for another user id.
+// _ <- tryo(assert(isValidID(bankId.value)))?~! ErrorMessages.InvalidBankIdFormat
+// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! BankNotFound
+// postedData <- tryo{json.extract[CreateCustomerJson]} ?~! ErrorMessages.InvalidJsonFormat
+// _ <- Helper.booleanToBox(
+// !`checkIfContains::::` (postedData.customer_number), s"$InvalidJsonFormat customer_number can not contain `::::` characters")
+// requiredEntitlements = canCreateCustomer ::
+// canCreateUserCustomerLink ::
+// Nil
+// requiredEntitlementsTxt = requiredEntitlements.mkString(" and ")
+// _ <- NewStyle.function.hasAllEntitlements(bankId.value, u.userId, requiredEntitlements, callContext)
+// _ <- tryo(assert(CustomerX.customerProvider.vend.checkCustomerNumberAvailable(bankId, postedData.customer_number) == true)) ?~! ErrorMessages.CustomerNumberAlreadyExists
+// user_id <- tryo (if (postedData.user_id.nonEmpty) postedData.user_id else u.userId) ?~! s"Problem getting user_id"
+// _ <- UserX.findByUserId(user_id) ?~! ErrorMessages.UserNotFoundById
+// customer <- CustomerX.customerProvider.vend.addCustomer(bankId,
+// postedData.customer_number,
+// postedData.legal_name,
+// postedData.mobile_phone_number,
+// postedData.email,
+// CustomerFaceImage(postedData.face_image.date, postedData.face_image.url),
+// postedData.date_of_birth,
+// postedData.relationship_status,
+// postedData.dependants,
+// postedData.dob_of_dependants,
+// postedData.highest_education_attained,
+// postedData.employment_status,
+// postedData.kyc_status,
+// postedData.last_ok_date,
+// None,
+// None,
+// "",
+// "",
+// "") ?~! CreateConsumerError
+// _ <- booleanToBox(UserCustomerLink.userCustomerLink.vend.getUserCustomerLink(user_id, customer.customerId).isEmpty == true) ?~! ErrorMessages.CustomerAlreadyExistsForUser
+// _ <- UserCustomerLink.userCustomerLink.vend.createUserCustomerLink(user_id, customer.customerId, new Date(), true) ?~! CreateUserCustomerLinksError
+// } yield {
+// val json = JSONFactory1_4_0.createCustomerJson(customer)
+// val successJson = Extraction.decompose(json)
+// successJsonResponse(successJson, 201)
+// }
+// }
+// }
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// getCurrentUser,
+// apiVersion,
+// "getCurrentUser", // TODO can we get this string from the val two lines above?
+// "GET",
+// "/users/current",
+// "Get User (Current)",
+// """Get the logged in user
// |
-// |purpose_id explains the purpose of the chat. onboarding | mortgage | complaint etc. MUST be url friendly (no spaces).
+// |Login is required.
+// """.stripMargin,
+// EmptyBody,
+// userJsonV200,
+// List(AuthenticatedUserIsRequired, UnknownError),
+// List(apiTagUser, apiTagOldStyle))
+//
+//
+// lazy val getCurrentUser: OBPEndpoint = {
+// case "users" :: "current" :: Nil JsonGet _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// }
+// yield {
+// // Format the data as V2.0.0 json
+// val json = JSONFactory200.createUserJSON(u)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+//
+//
+// resourceDocs += ResourceDoc(
+// getUser,
+// apiVersion,
+// "getUser",
+// "GET",
+// "/users/USER_EMAIL",
+// "Get Users by Email Address",
+// """Get users by email address
// |
// |Login is required.
+// |CanGetAnyUser entitlement is required,
// |
-// |This call is **experimental**. Currently staff_user_id is not set. Further calls will be needed to correctly set this.
// """.stripMargin,
-// CreateMeetingJson("tokbox", "onboarding"),
-// meetingJson,
+// EmptyBody,
+// usersJsonV200,
+// List(AuthenticatedUserIsRequired, UserHasMissingRoles, UserNotFoundByEmail, UnknownError),
+// List(apiTagUser, apiTagOldStyle),
+// Some(List(canGetAnyUser)))
+//
+//
+// lazy val getUser: OBPEndpoint = {
+// case "users" :: userEmail :: Nil JsonGet _ => {
+// cc =>
+// for {
+// l <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// _ <- NewStyle.function.ownEntitlement("", l.userId, ApiRole.canGetAnyUser, cc.callContext)
+// // Workaround to get userEmail address directly from URI without needing to URL-encode it
+// users <- tryo{AuthUser.getResourceUsersByEmail(CurrentReq.value.uri.split("/").last)} ?~! {ErrorMessages.UserNotFoundByEmail}
+// }
+// yield {
+// // Format the data as V2.0.0 json
+// val json = JSONFactory200.createUserJSONs(users)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+//
+//
+//
+// // createUserCustomerLinks
+// val createUserCustomerLinksEntitlementsRequiredForSpecificBank = canCreateUserCustomerLink :: Nil
+// val createUserCustomerLinksEntitlementsRequiredForAnyBank = canCreateUserCustomerLinkAtAnyBank :: Nil
+// val createUserCustomerLinksrequiredEntitlementsText = createUserCustomerLinksEntitlementsRequiredForSpecificBank.mkString(" and ") + " OR " + createUserCustomerLinksEntitlementsRequiredForAnyBank.mkString(" and ") + " entitlements are required."
+//
+// resourceDocs += ResourceDoc(
+// createUserCustomerLinks,
+// apiVersion,
+// "createUserCustomerLinks",
+// "POST",
+// "/banks/BANK_ID/user_customer_links",
+// "Create User Customer Link",
+// s"""Link a User to a Customer
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |$createUserCustomerLinksrequiredEntitlementsText
+// |""",
+// createUserCustomerLinkJson,
+// userCustomerLinkJson,
// List(
// AuthenticatedUserIsRequired,
-// MeetingApiKeyNotConfigured,
-// MeetingApiSecretNotConfigured,
// InvalidBankIdFormat,
// BankNotFound,
// InvalidJsonFormat,
-// MeetingsNotSupported,
+// CustomerNotFoundByCustomerId,
+// UserHasMissingRoles,
+// CustomerAlreadyExistsForUser,
+// CreateUserCustomerLinksError,
// UnknownError
// ),
-// List(apiTagMeeting, apiTagCustomer, apiTagExperimental))
+// List(apiTagCustomer, apiTagUser, apiTagOldStyle),
+// Some(List(canCreateUserCustomerLink,canCreateUserCustomerLinkAtAnyBank)))
//
+// // TODO
+// // Allow multiple UserCustomerLinks per user (and bank)
//
-// lazy val createMeeting: OBPEndpoint = {
-// case "banks" :: BankId(bankId) :: "meetings" :: Nil JsonPost json -> _ => {
+// lazy val createUserCustomerLinks : OBPEndpoint = {
+// case "banks" :: BankId(bankId):: "user_customer_links" :: Nil JsonPost json -> _ => {
// cc =>
-// if (APIUtil.getPropsAsBoolValue("meeting.tokbox_enabled", false)) {
-// for {
-// // TODO use these keys to get session and tokens from tokbox
-// _ <- APIUtil.getPropsValue("meeting.tokbox_api_key") ~> APIFailure(MeetingApiKeyNotConfigured, 403)
-// _ <- APIUtil.getPropsValue("meeting.tokbox_api_secret") ~> APIFailure(MeetingApiSecretNotConfigured, 403)
-// u <- cc.user ?~! AuthenticatedUserIsRequired
-// _ <- tryo(assert(isValidID(bankId.value)))?~! InvalidBankIdFormat
-// (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound
-// postedData <- tryo {json.extract[CreateMeetingJson]} ?~! InvalidJsonFormat
-// now = Calendar.getInstance().getTime()
-// sessionId <- tryo{code.opentok.OpenTokUtil.getSession.getSessionId()}
-// customerToken <- tryo{code.opentok.OpenTokUtil.generateTokenForPublisher(60)}
-// staffToken <- tryo{code.opentok.OpenTokUtil.generateTokenForModerator(60)}
-// meeting <- Meetings.meetingProvider.vend.createMeeting(bank.bankId, u, u, postedData.provider_id, postedData.purpose_id, now, sessionId, customerToken, staffToken
-// ,null,null)//These two are used from V310
-// } yield {
-// // Format the data as V2.0.0 json
-// val json = JSONFactory200.createMeetingJSON(meeting)
-// successJsonResponse(Extraction.decompose(json), 201)
+// for {
+// _ <- NewStyle.function.tryons(s"$InvalidBankIdFormat", 400, cc.callContext) {
+// assert(isValidID(bankId.value))
// }
-// } else {
-// Full(errorJsonResponse(MeetingsNotSupported))
+// postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $CreateUserCustomerLinkJson ", 400, cc.callContext) {
+// json.extract[CreateUserCustomerLinkJson]
+// }
+// user <- Users.users.vend.getUserByUserIdFuture(postedData.user_id) map {
+// x => unboxFullOrFail(x, cc.callContext, UserNotFoundByUserId, 404)
+// }
+// _ <- booleanToFuture("Field customer_id is not defined in the posted json!", 400, cc.callContext) {
+// postedData.customer_id.nonEmpty
+// }
+// (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(postedData.customer_id, cc.callContext)
+// _ <- booleanToFuture(s"Bank of the customer specified by the CUSTOMER_ID(${customer.bankId}) has to matches BANK_ID(${bankId.value}) in URL", 400, callContext) {
+// customer.bankId == bankId.value
+// }
+// _ <- booleanToFuture(CustomerAlreadyExistsForUser, 400, callContext) {
+// UserCustomerLink.userCustomerLink.vend.getUserCustomerLink(postedData.user_id, postedData.customer_id).isEmpty == true
+// }
+// userCustomerLink <- Future {
+// UserCustomerLink.userCustomerLink.vend.createUserCustomerLink(postedData.user_id, postedData.customer_id, new Date(), true)
+// } map {
+// x => unboxFullOrFail(x, callContext, CreateUserCustomerLinksError, 400)
+// }
+//
+// _ <- AuthUser.refreshUser(user, callContext)
+//
+// } yield {
+// (JSONFactory200.createUserCustomerLinkJSON(userCustomerLink),HttpCode.`200`(callContext))
// }
// }
// }
//
-//
// resourceDocs += ResourceDoc(
-// getMeetings,
+// addEntitlement,
// apiVersion,
-// "getMeetings",
-// "GET",
-// "/banks/BANK_ID/meetings",
-// "Get Meetings",
-// """Meetings contain meta data about, and are used to facilitate, video conferences / chats etc.
+// "addEntitlement",
+// "POST",
+// "/users/USER_ID/entitlements",
+// "Add Entitlement for a User",
+// """Create Entitlement. Grant Role to User.
// |
-// |The actual conference/chats are handled by external services.
+// |Entitlements are used to grant System or Bank level roles to Users. (For Account level privileges, see Views)
// |
-// |Login is required.
+// |For a System level Role (.e.g CanGetAnyUser), set bank_id to an empty string i.e. "bank_id":""
// |
-// |This call is **experimental** and will require further authorisation in the future.
-// """.stripMargin,
-// EmptyBody,
-// meetingsJson,
+// |For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
+// |
+// |Authentication is required and the user needs to be a Super Admin. Super Admins are listed in the Props file.""",
+// code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createEntitlementJSON,
+// entitlementJSON,
// List(
// AuthenticatedUserIsRequired,
-// MeetingApiKeyNotConfigured,
-// MeetingApiSecretNotConfigured,
-// BankNotFound,
-// MeetingsNotSupported,
-// UnknownError),
-// List(apiTagMeeting, apiTagCustomer, apiTagExperimental))
+// UserNotFoundById,
+// UserNotSuperAdmin,
+// InvalidJsonFormat,
+// IncorrectRoleName,
+// EntitlementIsBankRole,
+// EntitlementIsSystemRole,
+// EntitlementAlreadyExists,
+// UnknownError
+// ),
+// List(apiTagRole, apiTagEntitlement, apiTagUser),
+// Some(List(canCreateEntitlementAtOneBank,canCreateEntitlementAtAnyBank)))
+//
+// lazy val addEntitlement : OBPEndpoint = {
+// //add access for specific user to a list of views
+// case "users" :: userId :: "entitlements" :: Nil JsonPost json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (_, callContext) <- NewStyle.function.findByUserId(userId, callContext)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $CreateEntitlementJSON "
+// postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[CreateEntitlementJSON]
+// }
+// role <- Future { tryo{valueOf(postedData.role_name)} } map {
+// val msg = IncorrectRoleName + postedData.role_name + ". Possible roles are " + ApiRole.availableRoles.sorted.mkString(", ")
+// x => unboxFullOrFail(x, callContext, msg)
+// }
+// _ <- Helper.booleanToFuture(failMsg = if (ApiRole.valueOf(postedData.role_name).requiresBankId) EntitlementIsBankRole else EntitlementIsSystemRole, cc=callContext) {
+// ApiRole.valueOf(postedData.role_name).requiresBankId == postedData.bank_id.nonEmpty
+// }
+// requiredEntitlements = canCreateEntitlementAtOneBank :: canCreateEntitlementAtAnyBank :: Nil
+// requiredEntitlementsTxt = UserNotSuperAdmin +" or" + UserHasMissingRoles + canCreateEntitlementAtOneBank + s" BankId(${postedData.bank_id})." + " or" + UserHasMissingRoles + canCreateEntitlementAtAnyBank
+// _ <- if(isSuperAdmin(u.userId)) Future.successful(Full(Unit))
+// else NewStyle.function.hasAtLeastOneEntitlement(requiredEntitlementsTxt)(postedData.bank_id, u.userId, requiredEntitlements, callContext)
+//
+// _ <- Helper.booleanToFuture(failMsg = BankNotFound, cc=callContext) {
+// postedData.bank_id.nonEmpty == false || BankX(BankId(postedData.bank_id), callContext).map(_._1).isEmpty == false
+// }
+// _ <- Helper.booleanToFuture(failMsg = EntitlementAlreadyExists, cc=callContext) {
+// hasEntitlement(postedData.bank_id, userId, role) == false
+// }
+// addedEntitlement <- Future(Entitlement.entitlement.vend.addEntitlement(postedData.bank_id, userId, postedData.role_name)) map { unboxFull(_) }
+// } yield {
+// (JSONFactory200.createEntitlementJSON(addedEntitlement), HttpCode.`201`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getEntitlements,
+// apiVersion,
+// "getEntitlements",
+// "GET",
+// "/users/USER_ID/entitlements",
+// "Get Entitlements for User",
+// s"""
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |
+// """.stripMargin,
+// EmptyBody,
+// entitlementJSONs,
+// List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
+// List(apiTagRole, apiTagEntitlement, apiTagUser, apiTagOldStyle),
+// Some(List(canGetEntitlementsForAnyUserAtAnyBank)))
//
//
-// lazy val getMeetings: OBPEndpoint = {
-// case "banks" :: BankId(bankId) :: "meetings" :: Nil JsonGet _ => {
+// lazy val getEntitlements: OBPEndpoint = {
+// case "users" :: userId :: "entitlements" :: Nil JsonGet _ => {
// cc =>
-// if (APIUtil.getPropsAsBoolValue("meeting.tokbox_enabled", false)) {
-// for {
-// _ <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
-// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! BankNotFound
-// _ <- APIUtil.getPropsValue("meeting.tokbox_api_key") ~> APIFailure(ErrorMessages.MeetingApiKeyNotConfigured, 403)
-// _ <- APIUtil.getPropsValue("meeting.tokbox_api_secret") ~> APIFailure(ErrorMessages.MeetingApiSecretNotConfigured, 403)
-// u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
-// (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound
-// // now = Calendar.getInstance().getTime()
-// meetings <- Meetings.meetingProvider.vend.getMeetings(bank.bankId, u)
+// for {
+// u <- cc.user ?~ ErrorMessages.AuthenticatedUserIsRequired
+// _ <- NewStyle.function.ownEntitlement("", u.userId, canGetEntitlementsForAnyUserAtAnyBank, cc.callContext)
+// entitlements <- Entitlement.entitlement.vend.getEntitlementsByUserId(userId)
+// }
+// yield {
+// // Add virtual entitlements for super_admin_user_ids or oidc_operator_user_ids
+// val json = if (isSuperAdmin(userId)) {
+// JSONFactory200.withVirtualEntitlements(entitlements, JSONFactory200.superAdminVirtualRoles)
+// } else if (isOidcOperator(userId)) {
+// JSONFactory200.withVirtualEntitlements(entitlements, JSONFactory200.oidcOperatorVirtualRoles)
+// } else {
+// JSONFactory200.createEntitlementJSONs(entitlements)
// }
-// yield {
-// // Format the data as V2.0.0 json
-// val json = JSONFactory200.createMeetingJSONs(meetings)
-// successJsonResponse(Extraction.decompose(json))
-// }
-// } else {
-// Full(errorJsonResponse(MeetingsNotSupported))
+// successJsonResponse(Extraction.decompose(json))
// }
// }
// }
//
+// resourceDocs += ResourceDoc(
+// deleteEntitlement,
+// apiVersion,
+// "deleteEntitlement",
+// "DELETE",
+// "/users/USER_ID/entitlement/ENTITLEMENT_ID",
+// "Delete Entitlement",
+// """Delete Entitlement specified by ENTITLEMENT_ID for an user specified by USER_ID
+// |
+// |Authentication is required and the user needs to be a Super Admin.
+// |Super Admins are listed in the Props file.
+// |
+// |
+// """.stripMargin,
+// EmptyBody,
+// EmptyBody,
+// List(AuthenticatedUserIsRequired, UserHasMissingRoles, EntitlementNotFound, UnknownError),
+// List(apiTagRole, apiTagUser, apiTagEntitlement),
+// Some(List(canDeleteEntitlementAtAnyBank)))
+//
+//
+// lazy val deleteEntitlement: OBPEndpoint = {
+// case "users" :: userId :: "entitlement" :: entitlementId :: Nil JsonDelete _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, canDeleteEntitlementAtAnyBank, cc.callContext)
+//
+// entitlement <- Future(Entitlement.entitlement.vend.getEntitlementById(entitlementId)) map {
+// x => fullBoxOrException(x ~> APIFailureNewStyle(EntitlementNotFound, 404, callContext.map(_.toLight)))
+// } map { unboxFull(_) }
+// _ <- Helper.booleanToFuture(UserDoesNotHaveEntitlement, cc=callContext) { entitlement.userId == userId }
+// deleted <- Future(Entitlement.entitlement.vend.deleteEntitlement(Some(entitlement))) map {
+// x => fullBoxOrException(x ~> APIFailureNewStyle(EntitlementCannotBeDeleted, 500, callContext.map(_.toLight)))
+// } map { unboxFull(_) }
+// } yield (deleted, HttpCode.`204`(cc.callContext))
+// }
+// }
//
//
// resourceDocs += ResourceDoc(
-// getMeeting,
+// getAllEntitlements,
// apiVersion,
-// "getMeeting",
+// "getAllEntitlements",
// "GET",
-// "/banks/BANK_ID/meetings/MEETING_ID",
-// "Get Meeting",
-// """Get Meeting specified by BANK_ID / MEETING_ID
-// |Meetings contain meta data about, and are used to facilitate, video conferences / chats etc.
-// |
-// |The actual conference/chats are handled by external services.
+// "/entitlements",
+// "Get all Entitlements",
+// """
// |
// |Login is required.
// |
-// |This call is **experimental** and will require further authorisation in the future.
+// |
// """.stripMargin,
// EmptyBody,
-// meetingJson,
-// List(
-// AuthenticatedUserIsRequired,
-// BankNotFound,
-// MeetingApiKeyNotConfigured,
-// MeetingApiSecretNotConfigured,
-// MeetingNotFound,
-// MeetingsNotSupported,
-// UnknownError
-// ),
-// List(apiTagMeeting, apiTagKyc, apiTagCustomer, apiTagExperimental))
+// entitlementJSONs,
+// List(AuthenticatedUserIsRequired, UnknownError),
+// List(apiTagRole, apiTagEntitlement),
+// Some(List(canGetEntitlementsForAnyUserAtAnyBank)))
//
//
-// lazy val getMeeting: OBPEndpoint = {
-// case "banks" :: BankId(bankId) :: "meetings" :: meetingId :: Nil JsonGet _ => {
-// cc =>
-// if (APIUtil.getPropsAsBoolValue("meeting.tokbox_enabled", false)) {
-// for {
-// u <- cc.user ?~! AuthenticatedUserIsRequired
-// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! BankNotFound
-// _ <- APIUtil.getPropsValue("meeting.tokbox_api_key") ~> APIFailure(ErrorMessages.MeetingApiKeyNotConfigured, 403)
-// _ <- APIUtil.getPropsValue("meeting.tokbox_api_secret") ~> APIFailure(ErrorMessages.MeetingApiSecretNotConfigured, 403)
-// (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound
-// meeting <- Meetings.meetingProvider.vend.getMeeting(bank.bankId, u, meetingId) ?~! {ErrorMessages.MeetingNotFound}
+// lazy val getAllEntitlements: OBPEndpoint = {
+// case "entitlements" :: Nil JsonGet _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, canGetEntitlementsForAnyUserAtAnyBank,callContext)
+//
+// entitlements <- Entitlement.entitlement.vend.getEntitlementsFuture() map {
+// connectorEmptyResponse(_, callContext)
// }
-// yield {
-// // Format the data as V2.0.0 json
-// val json = JSONFactory200.createMeetingJSON(meeting)
-// successJsonResponse(Extraction.decompose(json))
-// }
-// } else {
-// Full(errorJsonResponse(ErrorMessages.MeetingsNotSupported))
+// } yield {
+// (JSONFactory200.createEntitlementJSONs(entitlements), callContext)
// }
// }
// }
-
-
- resourceDocs += ResourceDoc(
- createCustomer,
- apiVersion,
- "createCustomer",
- "POST",
- "/banks/BANK_ID/customers",
- "Create Customer",
- s"""Add a customer linked to the user specified by user_id
- |The Customer resource stores the customer number, legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
- |This call may require additional permissions/role in the future.
- |For now the authenticated user can create at most one linked customer.
- |Dates need to be in the format 2013-01-21T23:08:00Z
- |${userAuthenticationMessage(true)}
- |""",
- createCustomerJson,
- customerJsonV140,
- List(
- InvalidBankIdFormat,
- AuthenticatedUserIsRequired,
- BankNotFound,
- CustomerNumberAlreadyExists,
- UserHasMissingRoles,
- UserNotFoundById,
- CreateConsumerError,
- CustomerAlreadyExistsForUser,
- CreateUserCustomerLinksError,
- UnknownError
- ),
- List(apiTagCustomer, apiTagPerson, apiTagOldStyle),
- Some(List(canCreateCustomer,canCreateUserCustomerLink)))
-
-
-
- // TODO
- // Separate customer creation (keep here) from customer linking (remove from here)
- // Remove user_id from CreateCustomerJson
- // Logged in user must have CanCreateCustomer (should no longer be able create customer for own user)
- // Add ApiLink to createUserCustomerLink
-
- lazy val createCustomer : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: Nil JsonPost json -> _ => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired // TODO. CHECK user has role to create a customer / create a customer for another user id.
- _ <- tryo(assert(isValidID(bankId.value)))?~! ErrorMessages.InvalidBankIdFormat
- (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! BankNotFound
- postedData <- tryo{json.extract[CreateCustomerJson]} ?~! ErrorMessages.InvalidJsonFormat
- _ <- Helper.booleanToBox(
- !`checkIfContains::::` (postedData.customer_number), s"$InvalidJsonFormat customer_number can not contain `::::` characters")
- requiredEntitlements = canCreateCustomer ::
- canCreateUserCustomerLink ::
- Nil
- requiredEntitlementsTxt = requiredEntitlements.mkString(" and ")
- _ <- NewStyle.function.hasAllEntitlements(bankId.value, u.userId, requiredEntitlements, callContext)
- _ <- tryo(assert(CustomerX.customerProvider.vend.checkCustomerNumberAvailable(bankId, postedData.customer_number) == true)) ?~! ErrorMessages.CustomerNumberAlreadyExists
- user_id <- tryo (if (postedData.user_id.nonEmpty) postedData.user_id else u.userId) ?~! s"Problem getting user_id"
- _ <- UserX.findByUserId(user_id) ?~! ErrorMessages.UserNotFoundById
- customer <- CustomerX.customerProvider.vend.addCustomer(bankId,
- postedData.customer_number,
- postedData.legal_name,
- postedData.mobile_phone_number,
- postedData.email,
- CustomerFaceImage(postedData.face_image.date, postedData.face_image.url),
- postedData.date_of_birth,
- postedData.relationship_status,
- postedData.dependants,
- postedData.dob_of_dependants,
- postedData.highest_education_attained,
- postedData.employment_status,
- postedData.kyc_status,
- postedData.last_ok_date,
- None,
- None,
- "",
- "",
- "") ?~! CreateConsumerError
- _ <- booleanToBox(UserCustomerLink.userCustomerLink.vend.getUserCustomerLink(user_id, customer.customerId).isEmpty == true) ?~! ErrorMessages.CustomerAlreadyExistsForUser
- _ <- UserCustomerLink.userCustomerLink.vend.createUserCustomerLink(user_id, customer.customerId, new Date(), true) ?~! CreateUserCustomerLinksError
- } yield {
- val json = JSONFactory1_4_0.createCustomerJson(customer)
- val successJson = Extraction.decompose(json)
- successJsonResponse(successJson, 201)
- }
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- getCurrentUser,
- apiVersion,
- "getCurrentUser", // TODO can we get this string from the val two lines above?
- "GET",
- "/users/current",
- "Get User (Current)",
- """Get the logged in user
- |
- |Login is required.
- """.stripMargin,
- EmptyBody,
- userJsonV200,
- List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagUser, apiTagOldStyle))
-
-
- lazy val getCurrentUser: OBPEndpoint = {
- case "users" :: "current" :: Nil JsonGet _ => {
- cc =>
- for {
- u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
- }
- yield {
- // Format the data as V2.0.0 json
- val json = JSONFactory200.createUserJSON(u)
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getUser,
- apiVersion,
- "getUser",
- "GET",
- "/users/USER_EMAIL",
- "Get Users by Email Address",
- """Get users by email address
- |
- |Login is required.
- |CanGetAnyUser entitlement is required,
- |
- """.stripMargin,
- EmptyBody,
- usersJsonV200,
- List(AuthenticatedUserIsRequired, UserHasMissingRoles, UserNotFoundByEmail, UnknownError),
- List(apiTagUser, apiTagOldStyle),
- Some(List(canGetAnyUser)))
-
-
- lazy val getUser: OBPEndpoint = {
- case "users" :: userEmail :: Nil JsonGet _ => {
- cc =>
- for {
- l <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
- _ <- NewStyle.function.ownEntitlement("", l.userId, ApiRole.canGetAnyUser, cc.callContext)
- // Workaround to get userEmail address directly from URI without needing to URL-encode it
- users <- tryo{AuthUser.getResourceUsersByEmail(CurrentReq.value.uri.split("/").last)} ?~! {ErrorMessages.UserNotFoundByEmail}
- }
- yield {
- // Format the data as V2.0.0 json
- val json = JSONFactory200.createUserJSONs(users)
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
-
-
- // createUserCustomerLinks
- val createUserCustomerLinksEntitlementsRequiredForSpecificBank = canCreateUserCustomerLink :: Nil
- val createUserCustomerLinksEntitlementsRequiredForAnyBank = canCreateUserCustomerLinkAtAnyBank :: Nil
- val createUserCustomerLinksrequiredEntitlementsText = createUserCustomerLinksEntitlementsRequiredForSpecificBank.mkString(" and ") + " OR " + createUserCustomerLinksEntitlementsRequiredForAnyBank.mkString(" and ") + " entitlements are required."
-
- resourceDocs += ResourceDoc(
- createUserCustomerLinks,
- apiVersion,
- "createUserCustomerLinks",
- "POST",
- "/banks/BANK_ID/user_customer_links",
- "Create User Customer Link",
- s"""Link a User to a Customer
- |
- |${userAuthenticationMessage(true)}
- |
- |$createUserCustomerLinksrequiredEntitlementsText
- |""",
- createUserCustomerLinkJson,
- userCustomerLinkJson,
- List(
- AuthenticatedUserIsRequired,
- InvalidBankIdFormat,
- BankNotFound,
- InvalidJsonFormat,
- CustomerNotFoundByCustomerId,
- UserHasMissingRoles,
- CustomerAlreadyExistsForUser,
- CreateUserCustomerLinksError,
- UnknownError
- ),
- List(apiTagCustomer, apiTagUser, apiTagOldStyle),
- Some(List(canCreateUserCustomerLink,canCreateUserCustomerLinkAtAnyBank)))
-
- // TODO
- // Allow multiple UserCustomerLinks per user (and bank)
-
- lazy val createUserCustomerLinks : OBPEndpoint = {
- case "banks" :: BankId(bankId):: "user_customer_links" :: Nil JsonPost json -> _ => {
- cc =>
- for {
- _ <- NewStyle.function.tryons(s"$InvalidBankIdFormat", 400, cc.callContext) {
- assert(isValidID(bankId.value))
- }
- postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $CreateUserCustomerLinkJson ", 400, cc.callContext) {
- json.extract[CreateUserCustomerLinkJson]
- }
- user <- Users.users.vend.getUserByUserIdFuture(postedData.user_id) map {
- x => unboxFullOrFail(x, cc.callContext, UserNotFoundByUserId, 404)
- }
- _ <- booleanToFuture("Field customer_id is not defined in the posted json!", 400, cc.callContext) {
- postedData.customer_id.nonEmpty
- }
- (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(postedData.customer_id, cc.callContext)
- _ <- booleanToFuture(s"Bank of the customer specified by the CUSTOMER_ID(${customer.bankId}) has to matches BANK_ID(${bankId.value}) in URL", 400, callContext) {
- customer.bankId == bankId.value
- }
- _ <- booleanToFuture(CustomerAlreadyExistsForUser, 400, callContext) {
- UserCustomerLink.userCustomerLink.vend.getUserCustomerLink(postedData.user_id, postedData.customer_id).isEmpty == true
- }
- userCustomerLink <- Future {
- UserCustomerLink.userCustomerLink.vend.createUserCustomerLink(postedData.user_id, postedData.customer_id, new Date(), true)
- } map {
- x => unboxFullOrFail(x, callContext, CreateUserCustomerLinksError, 400)
- }
-
- _ <- AuthUser.refreshUser(user, callContext)
-
- } yield {
- (JSONFactory200.createUserCustomerLinkJSON(userCustomerLink),HttpCode.`200`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- addEntitlement,
- apiVersion,
- "addEntitlement",
- "POST",
- "/users/USER_ID/entitlements",
- "Add Entitlement for a User",
- """Create Entitlement. Grant Role to User.
- |
- |Entitlements are used to grant System or Bank level roles to Users. (For Account level privileges, see Views)
- |
- |For a System level Role (.e.g CanGetAnyUser), set bank_id to an empty string i.e. "bank_id":""
- |
- |For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
- |
- |Authentication is required and the user needs to be a Super Admin. Super Admins are listed in the Props file.""",
- code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createEntitlementJSON,
- entitlementJSON,
- List(
- AuthenticatedUserIsRequired,
- UserNotFoundById,
- UserNotSuperAdmin,
- InvalidJsonFormat,
- IncorrectRoleName,
- EntitlementIsBankRole,
- EntitlementIsSystemRole,
- EntitlementAlreadyExists,
- UnknownError
- ),
- List(apiTagRole, apiTagEntitlement, apiTagUser),
- Some(List(canCreateEntitlementAtOneBank,canCreateEntitlementAtAnyBank)))
-
- lazy val addEntitlement : OBPEndpoint = {
- //add access for specific user to a list of views
- case "users" :: userId :: "entitlements" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (_, callContext) <- NewStyle.function.findByUserId(userId, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $CreateEntitlementJSON "
- postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[CreateEntitlementJSON]
- }
- role <- Future { tryo{valueOf(postedData.role_name)} } map {
- val msg = IncorrectRoleName + postedData.role_name + ". Possible roles are " + ApiRole.availableRoles.sorted.mkString(", ")
- x => unboxFullOrFail(x, callContext, msg)
- }
- _ <- Helper.booleanToFuture(failMsg = if (ApiRole.valueOf(postedData.role_name).requiresBankId) EntitlementIsBankRole else EntitlementIsSystemRole, cc=callContext) {
- ApiRole.valueOf(postedData.role_name).requiresBankId == postedData.bank_id.nonEmpty
- }
- requiredEntitlements = canCreateEntitlementAtOneBank :: canCreateEntitlementAtAnyBank :: Nil
- requiredEntitlementsTxt = UserNotSuperAdmin +" or" + UserHasMissingRoles + canCreateEntitlementAtOneBank + s" BankId(${postedData.bank_id})." + " or" + UserHasMissingRoles + canCreateEntitlementAtAnyBank
- _ <- if(isSuperAdmin(u.userId)) Future.successful(Full(Unit))
- else NewStyle.function.hasAtLeastOneEntitlement(requiredEntitlementsTxt)(postedData.bank_id, u.userId, requiredEntitlements, callContext)
-
- _ <- Helper.booleanToFuture(failMsg = BankNotFound, cc=callContext) {
- postedData.bank_id.nonEmpty == false || BankX(BankId(postedData.bank_id), callContext).map(_._1).isEmpty == false
- }
- _ <- Helper.booleanToFuture(failMsg = EntitlementAlreadyExists, cc=callContext) {
- hasEntitlement(postedData.bank_id, userId, role) == false
- }
- addedEntitlement <- Future(Entitlement.entitlement.vend.addEntitlement(postedData.bank_id, userId, postedData.role_name)) map { unboxFull(_) }
- } yield {
- (JSONFactory200.createEntitlementJSON(addedEntitlement), HttpCode.`201`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getEntitlements,
- apiVersion,
- "getEntitlements",
- "GET",
- "/users/USER_ID/entitlements",
- "Get Entitlements for User",
- s"""
- |
- |${userAuthenticationMessage(true)}
- |
- |
- """.stripMargin,
- EmptyBody,
- entitlementJSONs,
- List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagRole, apiTagEntitlement, apiTagUser, apiTagOldStyle),
- Some(List(canGetEntitlementsForAnyUserAtAnyBank)))
-
-
- lazy val getEntitlements: OBPEndpoint = {
- case "users" :: userId :: "entitlements" :: Nil JsonGet _ => {
- cc =>
- for {
- u <- cc.user ?~ ErrorMessages.AuthenticatedUserIsRequired
- _ <- NewStyle.function.ownEntitlement("", u.userId, canGetEntitlementsForAnyUserAtAnyBank, cc.callContext)
- entitlements <- Entitlement.entitlement.vend.getEntitlementsByUserId(userId)
- }
- yield {
- // Add virtual entitlements for super_admin_user_ids or oidc_operator_user_ids
- val json = if (isSuperAdmin(userId)) {
- JSONFactory200.withVirtualEntitlements(entitlements, JSONFactory200.superAdminVirtualRoles)
- } else if (isOidcOperator(userId)) {
- JSONFactory200.withVirtualEntitlements(entitlements, JSONFactory200.oidcOperatorVirtualRoles)
- } else {
- JSONFactory200.createEntitlementJSONs(entitlements)
- }
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- deleteEntitlement,
- apiVersion,
- "deleteEntitlement",
- "DELETE",
- "/users/USER_ID/entitlement/ENTITLEMENT_ID",
- "Delete Entitlement",
- """Delete Entitlement specified by ENTITLEMENT_ID for an user specified by USER_ID
- |
- |Authentication is required and the user needs to be a Super Admin.
- |Super Admins are listed in the Props file.
- |
- |
- """.stripMargin,
- EmptyBody,
- EmptyBody,
- List(AuthenticatedUserIsRequired, UserHasMissingRoles, EntitlementNotFound, UnknownError),
- List(apiTagRole, apiTagUser, apiTagEntitlement),
- Some(List(canDeleteEntitlementAtAnyBank)))
-
-
- lazy val deleteEntitlement: OBPEndpoint = {
- case "users" :: userId :: "entitlement" :: entitlementId :: Nil JsonDelete _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, canDeleteEntitlementAtAnyBank, cc.callContext)
-
- entitlement <- Future(Entitlement.entitlement.vend.getEntitlementById(entitlementId)) map {
- x => fullBoxOrException(x ~> APIFailureNewStyle(EntitlementNotFound, 404, callContext.map(_.toLight)))
- } map { unboxFull(_) }
- _ <- Helper.booleanToFuture(UserDoesNotHaveEntitlement, cc=callContext) { entitlement.userId == userId }
- deleted <- Future(Entitlement.entitlement.vend.deleteEntitlement(Some(entitlement))) map {
- x => fullBoxOrException(x ~> APIFailureNewStyle(EntitlementCannotBeDeleted, 500, callContext.map(_.toLight)))
- } map { unboxFull(_) }
- } yield (deleted, HttpCode.`204`(cc.callContext))
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getAllEntitlements,
- apiVersion,
- "getAllEntitlements",
- "GET",
- "/entitlements",
- "Get all Entitlements",
- """
- |
- |Login is required.
- |
- |
- """.stripMargin,
- EmptyBody,
- entitlementJSONs,
- List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagRole, apiTagEntitlement),
- Some(List(canGetEntitlementsForAnyUserAtAnyBank)))
-
-
- lazy val getAllEntitlements: OBPEndpoint = {
- case "entitlements" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, canGetEntitlementsForAnyUserAtAnyBank,callContext)
-
- entitlements <- Entitlement.entitlement.vend.getEntitlementsFuture() map {
- connectorEmptyResponse(_, callContext)
- }
- } yield {
- (JSONFactory200.createEntitlementJSONs(entitlements), callContext)
- }
- }
- }
-
- // TODO Put message into doc below if not enabled (but continue to show API Doc)
- resourceDocs += ResourceDoc(
- elasticSearchWarehouse,
- apiVersion,
- "elasticSearchWarehouse",
- "GET",
- "/search/warehouse",
- "Search Warehouse Data Via Elasticsearch",
- """
- |Search warehouse data via Elastic Search.
- |
- |Login is required.
- |
- |CanSearchWarehouse entitlement is required to search warehouse data!
- |
- |Send your email, name, project name and user_id to the admins to get access.
- |
- |Elastic (search) is used in the background. See links below for syntax.
- |
- |
- |parameters:
- |
- | esType - elasticsearch type
- |
- | simple query:
- |
- | q - plain_text_query
- |
- | df - default field to search
- |
- | sort - field to sort on
- |
- | size - number of hits returned, default 10
- |
- | from - show hits starting from
- |
- | json query:
- |
- | source - JSON_query_(URL-escaped)
- |
- |
- |Example usage:
- |
- |GET /search/warehouse/q=findThis
- |
- |or:
- |
- |GET /search/warehouse/source={"query":{"query_string":{"query":"findThis"}}}
- |
- |
- |Note!!
- |
- |The whole JSON query string MUST be URL-encoded:
- |
- |* For { use %7B
- |* For } use %7D
- |* For : use %3A
- |* For " use %22
- |
- |etc..
- |
- |
- |
- |Only q, source and esType are passed to Elastic
- |
- |Elastic simple query: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html
- |
- |Elastic JSON query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html
- |
- |You can specify the esType thus: /search/warehouse/esType=type&q=a
- |
- """,
- EmptyBody,
- emptyElasticSearch, //TODO what is output here?
- List(AuthenticatedUserIsRequired, BankNotFound, UserHasMissingRoles, UnknownError),
- List(apiTagSearchWarehouse, apiTagOldStyle),
- Some(List(canSearchWarehouse)))
-
- val esw = new elasticsearchWarehouse
- lazy val elasticSearchWarehouse: OBPEndpoint = {
- case "search" :: "warehouse" :: queryString :: Nil JsonGet _ => {
- cc =>
- for {
- u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
- _ <- Entitlement.entitlement.vend.getEntitlement("", u.userId, ApiRole.CanSearchWarehouse.toString) ?~! {UserHasMissingRoles + CanSearchWarehouse}
- } yield {
- successJsonResponse(Extraction.decompose(esw.searchProxy(u.userId, queryString)))
- }
- }
- }
-
- // TODO Put message into doc below if not enabled (but continue to show API Doc)
- resourceDocs += ResourceDoc(
- elasticSearchMetrics,
- apiVersion,
- "elasticSearchMetrics",
- "GET",
- "/search/metrics",
- "Search API Metrics via Elasticsearch",
- """
- |Search the API calls made to this API instance via Elastic Search.
- |
- |Login is required.
- |
- |CanSearchMetrics entitlement is required to search metrics data.
- |
- |
- |parameters:
- |
- | esType - elasticsearch type
- |
- | simple query:
- |
- | q - plain_text_query
- |
- | df - default field to search
- |
- | sort - field to sort on
- |
- | size - number of hits returned, default 10
- |
- | from - show hits starting from
- |
- | json query:
- |
- | source - JSON_query_(URL-escaped)
- |
- |
- |example usage:
- |
- | /search/metrics/q=findThis
- |
- |or:
- |
- | /search/metrics/source={"query":{"query_string":{"query":"findThis"}}}
- |
- |
- |Note!!
- |
- |The whole JSON query string MUST be URL-encoded:
- |
- |* For { use %7B
- |* For } use %7D
- |* For : use %3A
- |* For " use %22
- |
- |etc..
- |
- |
- |
- |Only q, source and esType are passed to Elastic
- |
- |Elastic simple query: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html
- |
- |Elastic JSON query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html
- |
- |
- """,
- EmptyBody,
- emptyElasticSearch,
- List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagMetric, apiTagApi, apiTagOldStyle),
- Some(List(canSearchMetrics)))
-
- val esm = new elasticsearchMetrics
- lazy val elasticSearchMetrics: OBPEndpoint = {
- case "search" :: "metrics" :: queryString :: Nil JsonGet _ => {
- cc =>
- for {
- u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
- _ <- Entitlement.entitlement.vend.getEntitlement("", u.userId, ApiRole.CanSearchMetrics.toString) ?~! {UserHasMissingRoles + CanSearchMetrics}
- } yield {
- successJsonResponse(Extraction.decompose(esm.searchProxy(u.userId, queryString)))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getCustomers,
- apiVersion,
- "getCustomers",
- "GET",
- "/users/current/customers",
- "Get all customers for logged in user",
- """Information about the currently authenticated user.
- |
- |Authentication via OAuth is required.""",
- EmptyBody,
- customersJsonV140,
- List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
- List(apiTagPerson, apiTagCustomer, apiTagOldStyle))
-
- lazy val getCustomers : OBPEndpoint = {
- case "users" :: "current" :: "customers" :: Nil JsonGet _ => {
- cc => {
- for {
- u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
- //(bank, callContext) <- Bank(bankId, Some(cc)) ?~! BankNotFound
- customers <- tryo{CustomerX.customerProvider.vend.getCustomersByUserId(u.userId)} ?~! UserCustomerLinksNotFoundForUser
- } yield {
- val json = JSONFactory1_4_0.createCustomersJson(customers)
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
- }
- }
-}
+//
+// // TODO Put message into doc below if not enabled (but continue to show API Doc)
+// resourceDocs += ResourceDoc(
+// elasticSearchWarehouse,
+// apiVersion,
+// "elasticSearchWarehouse",
+// "GET",
+// "/search/warehouse",
+// "Search Warehouse Data Via Elasticsearch",
+// """
+// |Search warehouse data via Elastic Search.
+// |
+// |Login is required.
+// |
+// |CanSearchWarehouse entitlement is required to search warehouse data!
+// |
+// |Send your email, name, project name and user_id to the admins to get access.
+// |
+// |Elastic (search) is used in the background. See links below for syntax.
+// |
+// |
+// |parameters:
+// |
+// | esType - elasticsearch type
+// |
+// | simple query:
+// |
+// | q - plain_text_query
+// |
+// | df - default field to search
+// |
+// | sort - field to sort on
+// |
+// | size - number of hits returned, default 10
+// |
+// | from - show hits starting from
+// |
+// | json query:
+// |
+// | source - JSON_query_(URL-escaped)
+// |
+// |
+// |Example usage:
+// |
+// |GET /search/warehouse/q=findThis
+// |
+// |or:
+// |
+// |GET /search/warehouse/source={"query":{"query_string":{"query":"findThis"}}}
+// |
+// |
+// |Note!!
+// |
+// |The whole JSON query string MUST be URL-encoded:
+// |
+// |* For { use %7B
+// |* For } use %7D
+// |* For : use %3A
+// |* For " use %22
+// |
+// |etc..
+// |
+// |
+// |
+// |Only q, source and esType are passed to Elastic
+// |
+// |Elastic simple query: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html
+// |
+// |Elastic JSON query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html
+// |
+// |You can specify the esType thus: /search/warehouse/esType=type&q=a
+// |
+// """,
+// EmptyBody,
+// emptyElasticSearch, //TODO what is output here?
+// List(AuthenticatedUserIsRequired, BankNotFound, UserHasMissingRoles, UnknownError),
+// List(apiTagSearchWarehouse, apiTagOldStyle),
+// Some(List(canSearchWarehouse)))
+//
+// val esw = new elasticsearchWarehouse
+// lazy val elasticSearchWarehouse: OBPEndpoint = {
+// case "search" :: "warehouse" :: queryString :: Nil JsonGet _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// _ <- Entitlement.entitlement.vend.getEntitlement("", u.userId, ApiRole.CanSearchWarehouse.toString) ?~! {UserHasMissingRoles + CanSearchWarehouse}
+// } yield {
+// successJsonResponse(Extraction.decompose(esw.searchProxy(u.userId, queryString)))
+// }
+// }
+// }
+//
+// // TODO Put message into doc below if not enabled (but continue to show API Doc)
+// resourceDocs += ResourceDoc(
+// elasticSearchMetrics,
+// apiVersion,
+// "elasticSearchMetrics",
+// "GET",
+// "/search/metrics",
+// "Search API Metrics via Elasticsearch",
+// """
+// |Search the API calls made to this API instance via Elastic Search.
+// |
+// |Login is required.
+// |
+// |CanSearchMetrics entitlement is required to search metrics data.
+// |
+// |
+// |parameters:
+// |
+// | esType - elasticsearch type
+// |
+// | simple query:
+// |
+// | q - plain_text_query
+// |
+// | df - default field to search
+// |
+// | sort - field to sort on
+// |
+// | size - number of hits returned, default 10
+// |
+// | from - show hits starting from
+// |
+// | json query:
+// |
+// | source - JSON_query_(URL-escaped)
+// |
+// |
+// |example usage:
+// |
+// | /search/metrics/q=findThis
+// |
+// |or:
+// |
+// | /search/metrics/source={"query":{"query_string":{"query":"findThis"}}}
+// |
+// |
+// |Note!!
+// |
+// |The whole JSON query string MUST be URL-encoded:
+// |
+// |* For { use %7B
+// |* For } use %7D
+// |* For : use %3A
+// |* For " use %22
+// |
+// |etc..
+// |
+// |
+// |
+// |Only q, source and esType are passed to Elastic
+// |
+// |Elastic simple query: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html
+// |
+// |Elastic JSON query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html
+// |
+// |
+// """,
+// EmptyBody,
+// emptyElasticSearch,
+// List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
+// List(apiTagMetric, apiTagApi, apiTagOldStyle),
+// Some(List(canSearchMetrics)))
+//
+// val esm = new elasticsearchMetrics
+// lazy val elasticSearchMetrics: OBPEndpoint = {
+// case "search" :: "metrics" :: queryString :: Nil JsonGet _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// _ <- Entitlement.entitlement.vend.getEntitlement("", u.userId, ApiRole.CanSearchMetrics.toString) ?~! {UserHasMissingRoles + CanSearchMetrics}
+// } yield {
+// successJsonResponse(Extraction.decompose(esm.searchProxy(u.userId, queryString)))
+// }
+// }
+// }
+//
+//
+// resourceDocs += ResourceDoc(
+// getCustomers,
+// apiVersion,
+// "getCustomers",
+// "GET",
+// "/users/current/customers",
+// "Get all customers for logged in user",
+// """Information about the currently authenticated user.
+// |
+// |Authentication via OAuth is required.""",
+// EmptyBody,
+// customersJsonV140,
+// List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
+// List(apiTagPerson, apiTagCustomer, apiTagOldStyle))
+//
+// lazy val getCustomers : OBPEndpoint = {
+// case "users" :: "current" :: "customers" :: Nil JsonGet _ => {
+// cc => {
+// for {
+// u <- cc.user ?~! ErrorMessages.AuthenticatedUserIsRequired
+// //(bank, callContext) <- Bank(bankId, Some(cc)) ?~! BankNotFound
+// customers <- tryo{CustomerX.customerProvider.vend.getCustomersByUserId(u.userId)} ?~! UserCustomerLinksNotFoundForUser
+// } yield {
+// val json = JSONFactory1_4_0.createCustomersJson(customers)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+// }
+// }
+//}
diff --git a/obp-api/src/main/scala/code/api/v2_0_0/Http4s200.scala b/obp-api/src/main/scala/code/api/v2_0_0/Http4s200.scala
index c6910826ae..231e472728 100644
--- a/obp-api/src/main/scala/code/api/v2_0_0/Http4s200.scala
+++ b/obp-api/src/main/scala/code/api/v2_0_0/Http4s200.scala
@@ -167,6 +167,19 @@ object Http4s200 {
List(apiTagAccountPublic, apiTagAccount, apiTagPublicData), None,
http4sPartialFunction = Some(publicAccountsAllBanks))
+ def processAccounts(privateViews: List[com.openbankproject.commons.model.View],
+ accounts: List[com.openbankproject.commons.model.BankAccount]
+ ): net.liftweb.json.JsonAST.JValue = {
+ val accJson = accounts.map { account =>
+ val viewsAvailable = privateViews
+ .filter(v => v.bankId == account.bankId && v.accountId == account.accountId && v.isPrivate)
+ .map(createBasicViewJSON)
+ .distinct
+ createBasicAccountJSON(account, viewsAvailable)
+ }
+ net.liftweb.json.Extraction.decompose(accJson)
+ }
+
// ─── getPrivateAccountsAtOneBank ──────────────────────────────────────────
val getPrivateAccountsAtOneBank: HttpRoutes[IO] = HttpRoutes.of[IO] {
diff --git a/obp-api/src/main/scala/code/api/v2_0_0/OBPAPI2_0_0.scala b/obp-api/src/main/scala/code/api/v2_0_0/OBPAPI2_0_0.scala
index c642e154a2..e23410ca49 100644
--- a/obp-api/src/main/scala/code/api/v2_0_0/OBPAPI2_0_0.scala
+++ b/obp-api/src/main/scala/code/api/v2_0_0/OBPAPI2_0_0.scala
@@ -1,205 +1,30 @@
-/**
-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.v2_0_0
import scala.language.reflectiveCalls
import code.api.OBPRestHelper
-import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints}
-import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
+import code.api.util.APIUtil.OBPEndpoint
import code.api.util.VersionedOBPApis
-import code.api.v1_3_0.APIMethods130
-import code.api.v1_4_0.APIMethods140
+import code.api.v1_4_0.OBPAPI1_4_0
import code.util.Helper.MdcLoggable
+import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
-object OBPAPI2_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 with APIMethods200 with MdcLoggable with VersionedOBPApis{
-
+/*
+This file defines which endpoints from all the versions are available in v2.0.0.
+All v2.0.0 endpoints have been migrated to Http4s200 — this object is retained
+only for resource-doc aggregation and the Lift dispatch registry.
+ */
+object OBPAPI2_0_0 extends OBPRestHelper with MdcLoggable with VersionedOBPApis {
- val version : ApiVersion = ApiVersion.v2_0_0 // "2.0.0"
+ val version: ApiVersion = ApiVersion.v2_0_0
val versionStatus = ApiVersionStatus.DEPRECATED.toString
+ val Implementations2_0_0 = Http4s200.Implementations2_0_0
- // Note: Since we pattern match on these routes, if two implementations match a given url the first will match
-
- lazy val endpointsOf1_2_1 = List(
- Implementations1_2_1.getBanks,
- Implementations1_2_1.bankById,
- // Now in 2_0_0
-// Implementations1_2_1.allAccountsAllBanks,
-// Implementations1_2_1.privateAccountsAllBanks,
-// Implementations1_2_1.publicAccountsAllBanks,
-// Implementations1_2_1.allAccountsAtOneBank,
-// Implementations1_2_1.privateAccountsAtOneBank,
-// Implementations1_2_1.publicAccountsAtOneBank,
-// Implementations1_2_1.accountById,
- Implementations1_2_1.updateAccountLabel,
- Implementations1_2_1.getViewsForBankAccount,
- Implementations1_2_1.createViewForBankAccount,
- Implementations1_2_1.updateViewForBankAccount,
- Implementations1_2_1.deleteViewForBankAccount,
-// Implementations1_2_1.getPermissionsForBankAccount,
-// Implementations1_2_1.getPermissionForUserForBankAccount,
- Implementations1_2_1.addPermissionForUserForBankAccountForMultipleViews,
- Implementations1_2_1.addPermissionForUserForBankAccountForOneView,
- Implementations1_2_1.removePermissionForUserForBankAccountForOneView,
- Implementations1_2_1.removePermissionForUserForBankAccountForAllViews,
- Implementations1_2_1.getOtherAccountsForBankAccount,
- Implementations1_2_1.getOtherAccountByIdForBankAccount,
- Implementations1_2_1.getOtherAccountMetadata,
- Implementations1_2_1.getCounterpartyPublicAlias,
- Implementations1_2_1.addCounterpartyPublicAlias,
- Implementations1_2_1.updateCounterpartyPublicAlias,
- Implementations1_2_1.deleteCounterpartyPublicAlias,
- Implementations1_2_1.getOtherAccountPrivateAlias,
- Implementations1_2_1.addOtherAccountPrivateAlias,
- Implementations1_2_1.updateCounterpartyPrivateAlias,
- Implementations1_2_1.deleteCounterpartyPrivateAlias,
- Implementations1_2_1.addCounterpartyMoreInfo,
- Implementations1_2_1.updateCounterpartyMoreInfo,
- Implementations1_2_1.deleteCounterpartyMoreInfo,
- Implementations1_2_1.addCounterpartyUrl,
- Implementations1_2_1.updateCounterpartyUrl,
- Implementations1_2_1.deleteCounterpartyUrl,
- Implementations1_2_1.addCounterpartyImageUrl,
- Implementations1_2_1.updateCounterpartyImageUrl,
- Implementations1_2_1.deleteCounterpartyImageUrl,
- Implementations1_2_1.addCounterpartyOpenCorporatesUrl,
- Implementations1_2_1.updateCounterpartyOpenCorporatesUrl,
- Implementations1_2_1.deleteCounterpartyOpenCorporatesUrl,
- Implementations1_2_1.addCounterpartyCorporateLocation,
- Implementations1_2_1.updateCounterpartyCorporateLocation,
- Implementations1_2_1.deleteCounterpartyCorporateLocation,
- Implementations1_2_1.addCounterpartyPhysicalLocation,
- Implementations1_2_1.updateCounterpartyPhysicalLocation,
- Implementations1_2_1.deleteCounterpartyPhysicalLocation,
- Implementations1_2_1.getTransactionsForBankAccount,
- Implementations1_2_1.getTransactionByIdForBankAccount,
- Implementations1_2_1.getTransactionNarrative,
- Implementations1_2_1.addTransactionNarrative,
- Implementations1_2_1.updateTransactionNarrative,
- Implementations1_2_1.deleteTransactionNarrative,
- Implementations1_2_1.getCommentsForViewOnTransaction,
- Implementations1_2_1.addCommentForViewOnTransaction,
- Implementations1_2_1.deleteCommentForViewOnTransaction,
- Implementations1_2_1.getTagsForViewOnTransaction,
- Implementations1_2_1.addTagForViewOnTransaction,
- Implementations1_2_1.deleteTagForViewOnTransaction,
- Implementations1_2_1.getImagesForViewOnTransaction,
- Implementations1_2_1.addImageForViewOnTransaction,
- Implementations1_2_1.deleteImageForViewOnTransaction,
- Implementations1_2_1.getWhereTagForViewOnTransaction,
- Implementations1_2_1.addWhereTagForViewOnTransaction,
- Implementations1_2_1.updateWhereTagForViewOnTransaction,
- Implementations1_2_1.deleteWhereTagForViewOnTransaction,
- Implementations1_2_1.getOtherAccountForTransaction
- //Implementations1_2_1.makePayment
- )
-
- // New in 1.3.0
- val endpointsOf1_3_0 = Implementations1_3_0.getCards ::
- Implementations1_3_0.getCardsForBank::
- Nil
-
- // New in 1.4.0
- // Possible Endpoints 2.0.0 (less info about the views)
- val endpointsOf1_4_0 = List( Implementations1_4_0.getCustomer,
- // Now in 2.0.0 Implementations1_4_0.addCustomer,
- Implementations1_4_0.getCustomersMessages,
- Implementations1_4_0.addCustomerMessage,
- Implementations1_4_0.getBranches,
- Implementations1_4_0.getAtms,
- Implementations1_4_0.getProducts,
- Implementations1_4_0.getCrmEvents,
- Implementations1_4_0.getTransactionRequestTypes)
-
- // Updated in 2.0.0 (less info about the views)
- val endpointsOf2_0_0 = List(
- Implementations2_0_0.root,
- Implementations2_0_0.getPrivateAccountsAllBanks,
- Implementations2_0_0.corePrivateAccountsAllBanks,
- Implementations2_0_0.publicAccountsAllBanks,
- Implementations2_0_0.getPrivateAccountsAtOneBank,
- Implementations2_0_0.corePrivateAccountsAtOneBank, // this is /my accounts
- Implementations2_0_0.privateAccountsAtOneBank, // This was missing for a while from v2.0.0
- Implementations2_0_0.publicAccountsAtOneBank,
- // Updated in 2.0.0 (added sorting and better guards / error messages)
- Implementations2_0_0.accountById,
- Implementations2_0_0.getPermissionsForBankAccount,
- Implementations2_0_0.getPermissionForUserForBankAccount,
- // New in 2.0.0
- Implementations2_0_0.getKycDocuments,
- Implementations2_0_0.getKycMedia,
- Implementations2_0_0.getKycStatuses,
- Implementations2_0_0.getKycChecks,
- Implementations2_0_0.getSocialMediaHandles,
- Implementations2_0_0.addKycDocument,
- Implementations2_0_0.addKycMedia,
- Implementations2_0_0.addKycStatus,
- Implementations2_0_0.addKycCheck,
- Implementations2_0_0.addSocialMediaHandle,
- Implementations2_0_0.getCoreAccountById,
- Implementations2_0_0.getCoreTransactionsForBankAccount,
- Implementations2_0_0.createAccount,
- Implementations2_0_0.getTransactionTypes,
- Implementations2_0_0.createUser,
-// Implementations2_0_0.createMeeting,
-// Implementations2_0_0.getMeetings,
-// Implementations2_0_0.getMeeting,
- Implementations2_0_0.createCustomer,
- Implementations2_0_0.getCurrentUser,
- Implementations2_0_0.getUser,
- Implementations2_0_0.createUserCustomerLinks,
- Implementations2_0_0.addEntitlement,
- Implementations2_0_0.getEntitlements,
- Implementations2_0_0.deleteEntitlement,
- Implementations2_0_0.getAllEntitlements,
- Implementations2_0_0.elasticSearchWarehouse,
- Implementations2_0_0.elasticSearchMetrics,
- Implementations2_0_0.getCustomers
- )
-
-
- val allResourceDocs =
- Implementations2_0_0.resourceDocs ++
- Implementations1_4_0.resourceDocs ++
- Implementations1_3_0.resourceDocs ++
- Implementations1_2_1.resourceDocs
-
- // Filter the possible endpoints by the disabled / enabled Props settings and add them together
- val routes : List[OBPEndpoint] =
- getAllowedEndpoints(endpointsOf1_2_1, Implementations1_2_1.resourceDocs) :::
- getAllowedEndpoints(endpointsOf1_3_0, Implementations1_3_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf1_4_0, Implementations1_4_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf2_0_0, Implementations2_0_0.resourceDocs)
-
-
-
- registerRoutes(routes, allResourceDocs, apiPrefix)
+ def allResourceDocs = collectResourceDocs(OBPAPI1_4_0.allResourceDocs, Http4s200.resourceDocs)
- logger.info(s"version $version has been run! There are ${routes.length} routes.")
+ val routes: List[OBPEndpoint] = Nil
+ registerRoutes(routes, allResourceDocs, apiPrefix, true)
+ logger.info(s"version $version has been run! There are ${routes.length} routes, ${allResourceDocs.length} allResourceDocs.")
}
diff --git a/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala b/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala
index 19d3f55a9a..0dcf255693 100644
--- a/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala
+++ b/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala
@@ -1,1744 +1,1754 @@
package code.api.v2_1_0
-import scala.language.reflectiveCalls
-import code.TransactionTypes.TransactionType
-import code.api.Constant.CAN_SEE_TRANSACTION_REQUESTS
-import code.api.util.ApiTag._
-import code.api.util.ErrorMessages.TransactionDisabled
-import code.api.util.FutureUtil.EndpointContext
-import code.api.util.NewStyle.HttpCode
-import code.api.util.{APIUtil, ApiRole, ErrorMessages, NewStyle}
-import code.api.v1_2_1.JSONFactory
-import code.api.v1_3_0._
-import code.api.v1_4_0.JSONFactory1_4_0
-import code.api.v1_4_0.JSONFactory1_4_0._
-import code.api.v2_0_0._
-import code.api.v2_1_0.JSONFactory210._
-import code.atms.Atms
-import code.bankconnectors._
-import code.branches.Branches
-import code.consumer.Consumers
-import code.customer.CustomerX
-import code.fx.fx
-import code.metrics.APIMetrics
-import code.model.{BankAccountX, BankX, Consumer, UserX}
-import code.sandbox.SandboxData
-import code.usercustomerlinks.UserCustomerLink
-import code.users.Users
-import code.util.Helper.booleanToBox
-import com.openbankproject.commons.dto.GetProductsParam
-import com.openbankproject.commons.model._
-import com.openbankproject.commons.model.enums.TransactionRequestTypes._
-import com.openbankproject.commons.model.enums.{ChallengeType, SuppliedAnswerType, TransactionRequestTypes}
-import com.openbankproject.commons.util.ApiVersion
-import net.liftweb.json.Extraction
-import net.liftweb.util.Helpers.tryo
-import net.liftweb.util.StringHelpers
-
-import java.util.Date
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.Future
-// Makes JValue assignment to Nil work
-import code.api.ChargePolicy
-import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
-import code.api.util.APIUtil._
-import code.api.util.ApiRole._
-import code.api.util.ErrorMessages._
-import code.sandbox.{OBPDataImport, SandboxDataImport}
-import code.util.Helper
-import com.openbankproject.commons.ExecutionContext.Implicits.global
-import net.liftweb.common.{Box, Full}
import net.liftweb.http.rest.RestHelper
-import net.liftweb.json.Serialization.write
-import net.liftweb.json._
-
-trait APIMethods210 {
- //needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
- self: RestHelper =>
-
- // helper methods begin here
- // helper methods end here
-
- val Implementations2_1_0 = new Object() {
-
- val resourceDocs = ArrayBuffer[ResourceDoc]()
- val apiRelations = ArrayBuffer[ApiRelation]()
-
-
- val apiVersion = ApiVersion.v2_1_0 // was String "2_1_0"
-
- val codeContext = CodeContext(resourceDocs, apiRelations)
-
-
- resourceDocs += ResourceDoc(
- root,
- apiVersion,
- "root",
- "GET",
- "/root",
- "Get API Info (root)",
- """Returns information about:
- |
- |* API version
- |* Hosted by information
- |* Git Commit""",
- EmptyBody,
- apiInfoJSON,
- List(UnknownError, MandatoryPropertyIsNotSet),
- apiTagApi :: Nil)
-
- lazy val root : OBPEndpoint = {
- case (Nil | "root" :: Nil) JsonGet _ => {
- cc =>
- implicit val ec = EndpointContext(Some(cc))
- for {
- _ <- Future(()) // Just start async call
- } yield {
- (JSONFactory.getApiInfoJSON(OBPAPI2_1_0.version, OBPAPI2_1_0.versionStatus), HttpCode.`200`(cc.callContext))
- }
- }
- }
-
-
- // TODO Add example body below
-
- resourceDocs += ResourceDoc(
- sandboxDataImport,
- apiVersion,
- "sandboxDataImport",
- "POST",
- "/sandbox/data-import",
- "Create sandbox",
- s"""Import bulk data into the sandbox (Authenticated access).
- |
- |This call can be used to create banks, users, accounts and transactions which are stored in the local RDBMS.
- |
- |The user needs to have CanCreateSandbox entitlement.
- |
- |Note: This is a monolithic call. You could also use a combination of endpoints including create bank, create user, create account and create transaction request to create similar data.
- |
- |An example of an import set of data (json) can be found [here](https://raw.githubusercontent.com/OpenBankProject/OBP-API/develop/obp-api/src/main/scala/code/api/sandbox/example_data/2016-04-28/example_import.json)
- |${userAuthenticationMessage(true)}
- |""",
- SandboxData.importJson,
- successMessage,
- List(
- AuthenticatedUserIsRequired,
- InvalidJsonFormat,
- DataImportDisabled,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagSandbox),
- Some(List(canCreateSandbox)))
-
-
- lazy val sandboxDataImport: OBPEndpoint = {
- // Import data into the sandbox
- case "sandbox" :: "data-import" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- importData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $SandboxDataImport ", 400, cc.callContext) {
- json.extract[SandboxDataImport]
- }
- _ <- Helper.booleanToFuture(s"$DataImportDisabled", 403, callContext) {
- APIUtil.getPropsAsBoolValue("allow_sandbox_data_import", defaultValue = false)
- }
- _ <- NewStyle.function.hasEntitlement("", u.userId, canCreateSandbox, cc.callContext)
- _ <- Helper.booleanToFuture(s"Cannot import the sandbox data", 400, callContext) {
- OBPDataImport.importer.vend.importData(importData).isDefined
- }
- } yield {
- (successMessage, HttpCode.`201`(callContext))
- }
- }
- }
-
-
- val getTransactionRequestTypesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getTransactionRequestTypesIsPublic", true)
-
- resourceDocs += ResourceDoc(
- getTransactionRequestTypesSupportedByBank,
- apiVersion,
- "getTransactionRequestTypesSupportedByBank",
- "GET",
- "/banks/BANK_ID/transaction-request-types",
- "Get Transaction Request Types at Bank",
- s"""Get the list of the Transaction Request Types supported by the bank.
- |
- |${userAuthenticationMessage(!getTransactionRequestTypesIsPublic)}
- |""",
- EmptyBody,
- transactionRequestTypesJSON,
- List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagTransactionRequest, apiTagBank))
-
-
- lazy val getTransactionRequestTypesSupportedByBank: OBPEndpoint = {
- // Get transaction request types supported by the bank
- case "banks" :: BankId(bankId) :: "transaction-request-types" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (_, callContext) <- getTransactionRequestTypesIsPublic match {
- case false => authenticatedAccess(cc)
- case true => anonymousAccess(cc)
- }
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- // Get Transaction Request Types from Props "transactionRequests_supported_types". Default is empty string
- transactionRequestTypes <- Future {
- APIUtil.getPropsValue("transactionRequests_supported_types", "")
- }
- } yield {
- // Format the data as json
- val json = JSONFactory210.createTransactionRequestTypeJSON(transactionRequestTypes.split(",").toList)
- // Return
- (json, HttpCode.`200`(callContext))
- }
- }
- }
-
-
- import net.liftweb.json.Extraction._
- import net.liftweb.json.JsonAST._
- val exchangeRates = prettyRender(decompose(fx.fallbackExchangeRates))
-
-
- // This text is used in the various Create Transaction Request resource docs
- val transactionRequestGeneralText =
- s"""Initiate a Payment via creating a Transaction Request.
- |
- |In OBP, a `transaction request` may or may not result in a `transaction`. However, a `transaction` only has one possible state: completed.
- |
- |A `Transaction Request` can have one of several states.
- |
- |`Transactions` are modeled on items in a bank statement that represent the movement of money.
- |
- |`Transaction Requests` are requests to move money which may or may not succeeed and thus result in a `Transaction`.
- |
- |A `Transaction Request` might create a security challenge that needs to be answered before the `Transaction Request` proceeds.
- |
- |Transaction Requests contain charge information giving the client the opportunity to proceed or not (as long as the challenge level is appropriate).
- |
- |Transaction Requests can have one of several Transaction Request Types which expect different bodies. The escaped body is returned in the details key of the GET response.
- |This provides some commonality and one URL for many different payment or transfer types with enough flexibility to validate them differently.
- |
- |The payer is set in the URL. Money comes out of the BANK_ID and ACCOUNT_ID specified in the URL.
- |
- |In sandbox mode, TRANSACTION_REQUEST_TYPE is commonly set to SANDBOX_TAN. See getTransactionRequestTypesSupportedByBank for all supported types.
- |
- |In sandbox mode, if the amount is less than 1000 EUR (any currency, unless it is set differently on this server), the transaction request will create a transaction without a challenge, else the Transaction Request will be set to INITIALISED and a challenge will need to be answered.
- |
- |If a challenge is created you must answer it using Answer Transaction Request Challenge before the Transaction is created.
- |
- |You can transfer between different currency accounts. (new in 2.0.0). The currency in body must match the sending account.
- |
- |The following static FX rates are available in sandbox mode:
- |
- |${exchangeRates}
- |
- |
- |Transaction Requests satisfy PSD2 requirements thus:
- |
- |1) A transaction can be initiated by a third party application.
- |
- |2) The customer is informed of the charge that will incurred.
- |
- |3) The call supports delegated authentication (OAuth)
- |
- |See [this python code](https://github.com/OpenBankProject/Hello-OBP-DirectLogin-Python/blob/master/hello_payments.py) for a complete example of this flow.
- |
- |There is further documentation [here](https://github.com/OpenBankProject/OBP-API/wiki/Transaction-Requests)
- |
- |${userAuthenticationMessage(true)}
- |
- |"""
-
-
-
-
- // SANDBOX_TAN. (we no longer create a resource doc for the general case)
- resourceDocs += ResourceDoc(
- createTransactionRequestSandboxTan,
- apiVersion,
- "createTransactionRequestSandboxTan",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/SANDBOX_TAN/transaction-requests",
- "Create Transaction Request (SANDBOX_TAN)",
- s"""When using SANDBOX_TAN, the payee is set in the request body.
- |
- |Money goes into the BANK_ID and ACCOUNT_ID specified in the request body.
- |
- |$transactionRequestGeneralText
- |
- """.stripMargin,
- transactionRequestBodyJsonV200,
- transactionRequestWithChargeJSON210,
- List(
- AuthenticatedUserIsRequired,
- AuthenticatedUserIsRequired,
- InvalidBankIdFormat,
- InvalidAccountIdFormat,
- InvalidJsonFormat,
- BankNotFound,
- AccountNotFound,
- ViewNotFound,
- InsufficientAuthorisationToCreateTransactionRequest,
- UserNoPermissionAccessView,
- InvalidTransactionRequestType,
- InvalidJsonFormat,
- InvalidNumber,
- NotPositiveAmount,
- InvalidTransactionRequestCurrency,
- TransactionDisabled,
- UnknownError
- ),
- List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
-
- // COUNTERPARTY
- resourceDocs += ResourceDoc(
- createTransactionRequestCounterparty,
- apiVersion,
- "createTransactionRequestCounterparty",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/COUNTERPARTY/transaction-requests",
- "Create Transaction Request (COUNTERPARTY)",
- s"""
- |Special instructions for COUNTERPARTY:
- |
- |When using a COUNTERPARTY to create a Transaction Request, specificy the counterparty_id in the body of the request.
- |The routing details of the counterparty will be forwarded for the transfer.
- |
- |$transactionRequestGeneralText
- |
- """.stripMargin,
- transactionRequestBodyCounterpartyJSON,
- transactionRequestWithChargeJSON210,
- List(
- AuthenticatedUserIsRequired,
- AuthenticatedUserIsRequired,
- InvalidBankIdFormat,
- InvalidAccountIdFormat,
- InvalidJsonFormat,
- BankNotFound,
- AccountNotFound,
- ViewNotFound,
- InsufficientAuthorisationToCreateTransactionRequest,
- UserNoPermissionAccessView,
- InvalidTransactionRequestType,
- InvalidJsonFormat,
- InvalidNumber,
- NotPositiveAmount,
- InvalidTransactionRequestCurrency,
- TransactionDisabled,
- UnknownError
- ),
- List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
-
-
- val lowAmount = AmountOfMoneyJsonV121("EUR", "12.50")
- val sharedChargePolicy = ChargePolicy.withName("SHARED")
-
- // Transaction Request (SEPA)
- resourceDocs += ResourceDoc(
- createTransactionRequestSepa,
- apiVersion,
- "createTransactionRequestSepa",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/SEPA/transaction-requests",
- "Create Transaction Request (SEPA)",
- s"""
- |Special instructions for SEPA:
- |
- |When using a SEPA Transaction Request, you specify the IBAN of a Counterparty in the body of the request.
- |The routing details (IBAN) of the counterparty will be forwarded to the core banking system for the transfer.
- |
- |$transactionRequestGeneralText
- |
- """.stripMargin,
- transactionRequestBodySEPAJSON,
- transactionRequestWithChargeJSON210,
- List(
- AuthenticatedUserIsRequired,
- AuthenticatedUserIsRequired,
- InvalidBankIdFormat,
- InvalidAccountIdFormat,
- InvalidJsonFormat,
- BankNotFound,
- AccountNotFound,
- ViewNotFound,
- InsufficientAuthorisationToCreateTransactionRequest,
- UserNoPermissionAccessView,
- InvalidTransactionRequestType,
- InvalidJsonFormat,
- InvalidNumber,
- NotPositiveAmount,
- InvalidTransactionRequestCurrency,
- TransactionDisabled,
- UnknownError
- ),
- List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
-
-
- // FREE_FORM.
- resourceDocs += ResourceDoc(
- createTransactionRequestFreeForm,
- apiVersion,
- "createTransactionRequestFreeForm",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/FREE_FORM/transaction-requests",
- "Create Transaction Request (FREE_FORM).",
- s"""$transactionRequestGeneralText
- |
- """.stripMargin,
- transactionRequestBodyFreeFormJSON,
- transactionRequestWithChargeJSON210,
- List(
- AuthenticatedUserIsRequired,
- AuthenticatedUserIsRequired,
- InvalidBankIdFormat,
- InvalidAccountIdFormat,
- InvalidJsonFormat,
- BankNotFound,
- AccountNotFound,
- ViewNotFound,
- InsufficientAuthorisationToCreateTransactionRequest,
- UserNoPermissionAccessView,
- InvalidTransactionRequestType,
- InvalidJsonFormat,
- InvalidNumber,
- NotPositiveAmount,
- InvalidTransactionRequestCurrency,
- TransactionDisabled,
- UnknownError
- ),
- List(apiTagTransactionRequest, apiTagPSD2PIS),
- Some(List(canCreateAnyTransactionRequest)))
-
-
-
-
- // Different Transaction Request approaches:
- lazy val createTransactionRequestSandboxTan = createTransactionRequest
- lazy val createTransactionRequestSepa = createTransactionRequest
- lazy val createTransactionRequestCounterparty = createTransactionRequest
- lazy val createTransactionRequestFreeForm = createTransactionRequest
-
- // This handles the above cases
- lazy val createTransactionRequest: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-request-types" ::
- TransactionRequestType(transactionRequestType) :: "transaction-requests" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.isEnabledTransactionRequests(callContext)
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext) {isValidID(accountId.value)}
- _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext) {isValidID(bankId.value)}
- _ <- Helper.booleanToFuture(s"${InvalidTransactionRequestType}: '${transactionRequestType.value}'", cc=callContext) {
- APIUtil.getPropsValue("transactionRequests_supported_types", "").split(",").contains(transactionRequestType.value)
- }
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
-
- account = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
- _ <- NewStyle.function.checkAuthorisationToCreateTransactionRequest(viewId, account, u, callContext)
- // Check the input JSON format, here is just check the common parts of all four types
- transDetailsJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $TransactionRequestBodyCommonJSON ", 400, callContext) {
- json.extract[TransactionRequestBodyCommonJSON]
- }
-
- isValidAmountNumber <- NewStyle.function.tryons(s"$InvalidNumber Current input is ${transDetailsJson.value.amount} ", 400, callContext) {
- BigDecimal(transDetailsJson.value.amount)
- }
-
- _ <- Helper.booleanToFuture(s"${NotPositiveAmount} Current input is: '${isValidAmountNumber}'", cc=callContext) {
- isValidAmountNumber > BigDecimal("0")
- }
-
- _ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${transDetailsJson.value.currency}'", cc=callContext) {
- isValidCurrencyISOCode(transDetailsJson.value.currency)
- }
-
- // Prevent default value for transaction request type (at least).
- _ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${transDetailsJson.value.currency}'", cc=callContext) {
- isValidCurrencyISOCode(transDetailsJson.value.currency)
- }
-
- // Prevent default value for transaction request type (at least).
- _ <- Helper.booleanToFuture(s"$InvalidTransactionRequestCurrency From Account Currency is ${fromAccount.currency}, but Requested Transaction Currency is: ${transDetailsJson.value.currency}", cc=callContext) {
- transDetailsJson.value.currency == fromAccount.currency
- }
-
-
- amountOfMoneyJSON = AmountOfMoneyJsonV121(transDetailsJson.value.currency, transDetailsJson.value.amount)
-
- (createdTransactionRequest,callContext) <- TransactionRequestTypes.withName(transactionRequestType.value) match {
- case SANDBOX_TAN => {
- for {
- transactionRequestBodySandboxTan <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $SANDBOX_TAN json format", 400, callContext) {
- json.extract[TransactionRequestBodySandBoxTanJSON]
- }
-
- toBankId = BankId(transactionRequestBodySandboxTan.to.bank_id)
- toAccountId = AccountId(transactionRequestBodySandboxTan.to.account_id)
- (toAccount, callContext) <- NewStyle.function.checkBankAccountExists(toBankId, toAccountId, callContext)
-
- transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transactionRequestBodySandboxTan)(Serialization.formats(NoTypeHints))}
-
- (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
- viewId,
- fromAccount,
- toAccount,
- transactionRequestType,
- transactionRequestBodySandboxTan,
- transDetailsSerialized,
- sharedChargePolicy.toString,
- None,
- None,
- callContext) //in SANDBOX_TAN, ChargePolicy set default "SHARED"
- } yield (createdTransactionRequest, callContext)
- }
- case COUNTERPARTY => {
- for {
- //For COUNTERPARTY, Use the counterpartyId to find the toCounterparty and set up the toAccount
- transactionRequestBodyCounterparty <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $COUNTERPARTY json format", 400, callContext) {
- json.extract[TransactionRequestBodyCounterpartyJSON]
- }
- toCounterpartyId = transactionRequestBodyCounterparty.to.counterparty_id
- (toCounterparty, callContext) <- NewStyle.function.getCounterpartyByCounterpartyId(CounterpartyId(toCounterpartyId), callContext)
- (toAccount, callContext) <- NewStyle.function.getBankAccountFromCounterparty(toCounterparty, true, callContext)
- // Check we can send money to it.
- _ <- Helper.booleanToFuture(s"$CounterpartyBeneficiaryPermit", cc=callContext) {
- toCounterparty.isBeneficiary == true
- }
- chargePolicy = transactionRequestBodyCounterparty.charge_policy
- _ <- Helper.booleanToFuture(s"$InvalidChargePolicy", cc=callContext) {
- ChargePolicy.values.contains(ChargePolicy.withName(chargePolicy))
- }
- transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transactionRequestBodyCounterparty)(Serialization.formats(NoTypeHints))}
- (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
- viewId,
- fromAccount,
- toAccount,
- transactionRequestType,
- transactionRequestBodyCounterparty,
- transDetailsSerialized,
- chargePolicy,
- None,
- None,
- callContext)
- } yield (createdTransactionRequest, callContext)
-
- }
- case SEPA => {
- for {
- //For SEPA, Use the iban to find the toCounterparty and set up the toAccount
- transDetailsSEPAJson <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $SEPA json format", 400, callContext) {
- json.extract[TransactionRequestBodySEPAJSON]
- }
- toIban = transDetailsSEPAJson.to.iban
- (toCounterparty, callContext) <- NewStyle.function.getCounterpartyByIban(toIban, callContext)
- (toAccount, callContext) <- NewStyle.function.getBankAccountFromCounterparty(toCounterparty, true, callContext)
- _ <- Helper.booleanToFuture(s"$CounterpartyBeneficiaryPermit", cc=callContext) {
- toCounterparty.isBeneficiary == true
- }
- chargePolicy = transDetailsSEPAJson.charge_policy
- _ <- Helper.booleanToFuture(s"$InvalidChargePolicy", cc=callContext) {
- ChargePolicy.values.contains(ChargePolicy.withName(chargePolicy))
- }
- transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transDetailsSEPAJson)(Serialization.formats(NoTypeHints))}
- (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
- viewId,
- fromAccount,
- toAccount,
- transactionRequestType,
- transDetailsSEPAJson,
- transDetailsSerialized,
- chargePolicy,
- None,
- None,
- callContext)
- } yield (createdTransactionRequest, callContext)
- }
- case FREE_FORM => {
- for {
- transactionRequestBodyFreeForm <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $FREE_FORM json format", 400, callContext) {
- json.extract[TransactionRequestBodyFreeFormJSON]
- }
- // Following lines: just transfer the details body, add Bank_Id and Account_Id in the Detail part. This is for persistence and 'answerTransactionRequestChallenge'
- transactionRequestAccountJSON = TransactionRequestAccountJsonV140(fromAccount.bankId.value, fromAccount.accountId.value)
- transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transactionRequestBodyFreeForm)(Serialization.formats(NoTypeHints))}
- (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
- viewId,
- fromAccount,
- fromAccount,
- transactionRequestType,
- transactionRequestBodyFreeForm,
- transDetailsSerialized,
- sharedChargePolicy.toString,
- None,
- None,
- callContext)
- } yield
- (createdTransactionRequest, callContext)
- }
- }
- } yield {
- (JSONFactory210.createTransactionRequestWithChargeJSON(createdTransactionRequest), HttpCode.`201`(callContext))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- answerTransactionRequestChallenge,
- apiVersion,
- "answerTransactionRequestChallenge",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/TRANSACTION_REQUEST_TYPE/transaction-requests/TRANSACTION_REQUEST_ID/challenge",
- "Answer Transaction Request Challenge",
- """In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.
- |
- |This endpoint expects the following data as provided in the createTransactionRequest response body:
- |
- |1)`TRANSACTION_REQUEST_TYPE` : as per the selected createTransactionRequest type, part of the request URL.
- |
- |2)`TRANSACTION_REQUEST_ID` : the value of the `id` field of the createTransactionRequest response body.
- |
- |3) `id` : the value of `challenge.id` in the createTransactionRequest response body.
- |
- |4) `answer` : Defaults to `123`, if running in sandbox mode. In production mode, the value will be sent via the configured SCA method.
- |
- """.stripMargin,
- challengeAnswerJSON,
- transactionRequestWithChargeJson,
- List(
- AuthenticatedUserIsRequired,
- InvalidBankIdFormat,
- InvalidAccountIdFormat,
- InvalidJsonFormat,
- BankNotFound,
- UserNoPermissionAccessView,
- TransactionRequestStatusNotInitiated,
- TransactionRequestTypeHasChanged,
- InvalidTransactionRequestChallengeId,
- AllowedAttemptsUsedUp,
- TransactionDisabled,
- UnknownError
- ),
- List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
-
- lazy val answerTransactionRequestChallenge: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-request-types" ::
- TransactionRequestType(transactionRequestType) :: "transaction-requests" :: TransactionRequestId(transReqId) :: "challenge" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- // Check we have a User
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.isEnabledTransactionRequests(callContext)
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext) {isValidID(accountId.value)}
- _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext) {isValidID(bankId.value)}
- challengeAnswerJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $ChallengeAnswerJSON ", 400, callContext) {
- json.extract[ChallengeAnswerJSON]
- }
-
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
-
- account = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
- _ <- NewStyle.function.checkAuthorisationToCreateTransactionRequest(viewId, account, u, callContext)
-
-
- // Check transReqId is valid
- (existingTransactionRequest, callContext) <- NewStyle.function.getTransactionRequestImpl(transReqId, callContext)
-
- // Check the Transaction Request is still INITIATED
- _ <- Helper.booleanToFuture(TransactionRequestStatusNotInitiated, cc=callContext) {
- existingTransactionRequest.status.equals("INITIATED")
- }
-
- // Check the input transactionRequestType is the same as when the user created the TransactionRequest
- existingTransactionRequestType = existingTransactionRequest.`type`
- _ <- Helper.booleanToFuture(s"${TransactionRequestTypeHasChanged} It should be :'$existingTransactionRequestType', but current value (${transactionRequestType.value}) ", cc=callContext) {
- existingTransactionRequestType.equals(transactionRequestType.value)
- }
-
- // Check the challengeId is valid for this existingTransactionRequest
- _ <- Helper.booleanToFuture(s"${InvalidTransactionRequestChallengeId}", cc=callContext) {
- existingTransactionRequest.challenge.id.equals(challengeAnswerJson.id)
- }
-
- //Check the challenge type, Note: not support yet, the default value is SANDBOX_TAN
- _ <- Helper.booleanToFuture(s"${InvalidChallengeType} ", cc=callContext) {
- existingTransactionRequest.challenge.challenge_type == ChallengeType.OBP_TRANSACTION_REQUEST_CHALLENGE.toString
- }
-
- (isChallengeAnswerValidated, callContext) <- NewStyle.function.validateChallengeAnswer(challengeAnswerJson.id, challengeAnswerJson.answer, SuppliedAnswerType.PLAIN_TEXT_VALUE, callContext)
-
- _ <- Helper.booleanToFuture(s"${InvalidChallengeAnswer
- .replace("answer may be expired.", s"answer may be expired (${transactionRequestChallengeTtl} seconds).")
- .replace("up your allowed attempts.", s"up your allowed attempts (${allowedAnswerTransactionRequestChallengeAttempts} times).")
- } ", cc = callContext) {
- (isChallengeAnswerValidated == true)
- }
-
- // All Good, proceed with the Transaction creation...
- (transactionRequest, callContext) <- TransactionRequestTypes.withName(transactionRequestType.value) match {
- case TRANSFER_TO_PHONE | TRANSFER_TO_ATM | TRANSFER_TO_ACCOUNT=>
- NewStyle.function.createTransactionAfterChallengeV300(u, fromAccount, transReqId, transactionRequestType, callContext)
- case _ =>
- NewStyle.function.createTransactionAfterChallengeV210(fromAccount, existingTransactionRequest, callContext)
- }
- } yield {
-
- (JSONFactory210.createTransactionRequestWithChargeJSON(transactionRequest), HttpCode.`202`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getTransactionRequests,
- apiVersion,
- "getTransactionRequests",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-requests",
- "Get Transaction Requests." ,
- """Returns transaction requests for account specified by ACCOUNT_ID at bank specified by BANK_ID.
- |
- |The VIEW_ID specified must be 'owner' and the user must have access to this view.
- |
- |Version 2.0.0 now returns charge information.
- |
- |Transaction Requests serve to initiate transactions that may or may not proceed. They contain information including:
- |
- |* Transaction Request Id
- |* Type
- |* Status (INITIATED, COMPLETED)
- |* Challenge (in order to confirm the request)
- |* From Bank / Account
- |* Details including Currency, Value, Description and other initiation information specific to each type. (Could potentialy include a list of future transactions.)
- |* Related Transactions
- |
- |PSD2 Context: PSD2 requires transparency of charges to the customer.
- |This endpoint provides the charge that would be applied if the Transaction Request proceeds - and a record of that charge there after.
- |The customer can proceed with the Transaction by answering the security challenge.
- |
- """.stripMargin,
- EmptyBody,
- transactionRequestWithChargeJSONs210,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- AccountNotFound,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagTransactionRequest, apiTagPsd2, apiTagOldStyle))
-
- lazy val getTransactionRequests: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-requests" :: Nil JsonGet _ => {
- cc =>
- if (APIUtil.getPropsAsBoolValue("transactionRequests_enabled", false)) {
- for {
- u <- cc.user ?~ AuthenticatedUserIsRequired
- (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
- (fromAccount, callContext) <- BankAccountX(bankId, accountId, Some(cc)) ?~! {AccountNotFound}
- view <- APIUtil.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
- _ <- Helper.booleanToBox(view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_REQUESTS),
- s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUESTS)}` permission on the View(${viewId.value} )")
- (transactionRequests,callContext) <- Connector.connector.vend.getTransactionRequests210(u, fromAccount, callContext)
- }
- yield {
- // Format the data as V2.0.0 json
- val json = JSONFactory210.createTransactionRequestJSONs(transactionRequests)
- successJsonResponse(Extraction.decompose(json))
- }
- } else {
- Full(errorJsonResponse(TransactionRequestsNotEnabled))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getRoles,
- apiVersion,
- "getRoles",
- "GET",
- "/roles",
- "Get Roles",
- s"""Returns all available roles
- |
- |${userAuthenticationMessage(true)}
- """.stripMargin,
- EmptyBody,
- availableRolesJSON,
- List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagRole))
-
- lazy val getRoles: OBPEndpoint = {
- case "roles" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- _ <- authenticatedAccess(cc)
- }
- yield {
- // Format the data as V2.1.0 json
- val json = JSONFactory210.createAvailableRolesJSON(ApiRole.availableRoles.sorted)
- (json, HttpCode.`200`(cc))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getEntitlementsByBankAndUser,
- apiVersion,
- "getEntitlementsByBankAndUser",
- "GET",
- "/banks/BANK_ID/users/USER_ID/entitlements",
- "Get Entitlements for User at Bank",
- s"""
- |
- |Get Entitlements specified by BANK_ID and USER_ID
- |
- |${userAuthenticationMessage(true)}
- |
- |
- """.stripMargin,
- EmptyBody,
- entitlementJSONs,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagRole, apiTagEntitlement, apiTagUser),
- Some(List(canGetEntitlementsForAnyUserAtOneBank, canGetEntitlementsForAnyUserAtAnyBank)))
-
-
- lazy val getEntitlementsByBankAndUser: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "users" :: userId :: "entitlements" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(loggedInUser), callContext) <- authenticatedAccess(cc)
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (_, callContext) <- NewStyle.function.findByUserId(userId, callContext)
- allowedEntitlements = canGetEntitlementsForAnyUserAtOneBank ::
- canGetEntitlementsForAnyUserAtAnyBank::
- Nil
- allowedEntitlementsTxt = UserHasMissingRoles + allowedEntitlements.mkString(" or ")
- _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = allowedEntitlementsTxt)(bankId.value, loggedInUser.userId, allowedEntitlements, callContext)
- entitlements <- NewStyle.function.getEntitlementsByUserId(userId, callContext)
- }
- yield {
- val filteredEntitlements = entitlements.filter(_.bankId == bankId.value)
- // Add virtual entitlements for super_admin_user_ids or oidc_operator_user_ids
- val json = if (isSuperAdmin(userId)) {
- JSONFactory200.withVirtualEntitlements(filteredEntitlements, JSONFactory200.superAdminVirtualRoles)
- } else if (isOidcOperator(userId)) {
- JSONFactory200.withVirtualEntitlements(filteredEntitlements, JSONFactory200.oidcOperatorVirtualRoles)
- } else {
- JSONFactory200.createEntitlementJSONs(filteredEntitlements)
- }
- (json, HttpCode.`200`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getConsumer,
- apiVersion,
- "getConsumer",
- "GET",
- "/management/consumers/CONSUMER_ID",
- "Get Consumer",
- s"""Get the Consumer specified by CONSUMER_ID.
- |
- |""",
- EmptyBody,
- consumerJSON,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- InvalidConsumerId,
- UnknownError
- ),
- List(apiTagConsumer, apiTagOldStyle),
- Some(List(canGetConsumers)))
-
-
- lazy val getConsumer: OBPEndpoint = {
- case "management" :: "consumers" :: consumerId :: Nil JsonGet _ => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired
- _ <- NewStyle.function.ownEntitlement("", u.userId, ApiRole.canGetConsumers, cc.callContext)
-
- consumerIdToLong <- tryo{consumerId.toLong} ?~! InvalidConsumerId
- consumer <- Consumers.consumers.vend.getConsumerByPrimaryId(consumerIdToLong)
- } yield {
- val json = createConsumerJSON(consumer)
- // Return
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getConsumers,
- apiVersion,
- "getConsumers",
- "GET",
- "/management/consumers",
- "Get Consumers",
- s"""Get the all Consumers.
- |
- |""",
- EmptyBody,
- consumersJson,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagConsumer, apiTagOldStyle),
- Some(List(canGetConsumers)))
-
-
- lazy val getConsumers: OBPEndpoint = {
- case "management" :: "consumers" :: Nil JsonGet _ => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired
- _ <- NewStyle.function.ownEntitlement("", u.userId, ApiRole.canGetConsumers, cc.callContext)
- consumers <- Some(Consumer.findAll())
- } yield {
- // Format the data as json
- val json = createConsumerJSONs(consumers.sortWith(_.id.get < _.id.get))
- // Return
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- enableDisableConsumers,
- apiVersion,
- "enableDisableConsumers",
- "PUT",
- "/management/consumers/CONSUMER_ID",
- "Enable or Disable Consumers",
- s"""Enable/Disable a Consumer specified by CONSUMER_ID.
- |
- |""",
- putEnabledJSON,
- putEnabledJSON,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagConsumer, apiTagOldStyle),
- Some(List(canEnableConsumers,canDisableConsumers)))
-
-
- lazy val enableDisableConsumers: OBPEndpoint = {
- case "management" :: "consumers" :: consumerId :: Nil JsonPut json -> _ => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired
- putData <- tryo{json.extract[PutEnabledJSON]} ?~! InvalidJsonFormat
- _ <- putData.enabled match {
- case true => NewStyle.function.ownEntitlement("", u.userId, ApiRole.canEnableConsumers, cc.callContext)
- case false => NewStyle.function.ownEntitlement("", u.userId, ApiRole.canDisableConsumers, cc.callContext)
- }
- consumer <- Consumers.consumers.vend.getConsumerByPrimaryId(consumerId.toLong)
- updatedConsumer <- Consumers.consumers.vend.updateConsumer(consumer.id.get, None, None, Some(putData.enabled), None, None, None, None, None, None, None, None) ?~! "Cannot update Consumer"
- } yield {
- // Format the data as json
- val json = PutEnabledJSON(updatedConsumer.isActive.get)
- // Return
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- addCardForBank,
- apiVersion,
- "addCardsForBank",
- "POST",
- "/banks/BANK_ID/cards",
- "Create Card",
- s"""Create Card at bank specified by BANK_ID .
- |
- |${userAuthenticationMessage(true)}
- |""",
- postPhysicalCardJSON,
- physicalCardJSON,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- AllowedValuesAre,
- UnknownError
- ),
- List(apiTagCard),
- Some(List(canCreateCardsForBank)))
-
-
- lazy val addCardForBank: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "cards" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canCreateCardsForBank, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $PostPhysicalCardJSON "
- postJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[PostPhysicalCardJSON]
- }
-
- _<-Helper.booleanToFuture(s"${maximumLimitExceeded.replace("10000", "10")} Current issue_number is ${postJson.issue_number}", cc=callContext)(postJson.issue_number.length<= 10)
-
- _ <- postJson.allows match {
- case List() => Future {true}
- case _ => Helper.booleanToFuture(AllowedValuesAre + CardAction.availableValues.mkString(", "), cc=callContext)(postJson.allows.forall(a => CardAction.availableValues.contains(a)))
- }
-
- failMsg = AllowedValuesAre + CardReplacementReason.availableValues.mkString(", ")
- replacementReasionRequest <- NewStyle.function.tryons(failMsg, 400, callContext) {
- CardReplacementReason.valueOf(postJson.replacement.reason_requested)
- }
-
- (_, callContext)<- NewStyle.function.getBankAccount(bankId, AccountId(postJson.account_id), callContext)
-
- (card, callContext) <- NewStyle.function.createPhysicalCard(
- bankCardNumber=postJson.bank_card_number,
- nameOnCard=postJson.name_on_card,
- cardType = "",// this field is introduced from V310
- issueNumber=postJson.issue_number,
- serialNumber=postJson.serial_number,
- validFrom=postJson.valid_from_date,
- expires=postJson.expires_date,
- enabled=postJson.enabled,
- cancelled=false,
- onHotList=false,
- technology=postJson.technology,
- networks= postJson.networks,
- allows= postJson.allows,
- accountId= postJson.account_id,
- bankId=bankId.value,
- replacement= Some(CardReplacementInfo(requestedDate = postJson.replacement.requested_date, replacementReasionRequest)),
- pinResets= postJson.pin_reset.map(e => PinResetInfo(e.requested_date, PinResetReason.valueOf(e.reason_requested.toUpperCase))),
- collected= Option(CardCollectionInfo(postJson.collected)),
- posted= Option(CardPostedInfo(postJson.posted)),
- customerId = "",// this field is introduced from V310
- cvv = "",// this field is introduced from V500
- brand = "",// this field is introduced from V500
- callContext
- )
-
- } yield {
- (JSONFactory1_3_0.createPhysicalCardJSON(card, u), HttpCode.`201`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getUsers,
- apiVersion,
- "getUsers",
- "GET",
- "/users",
- "Get all Users",
- s"""Get all users
- |
- |Login is required.
- |CanGetAnyUser entitlement is required,
- |
- |${urlParametersDocument(false, false)}
- |* locked_status (if null ignore)
- |
- """.stripMargin,
- EmptyBody,
- usersJsonV200,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagUser),
- Some(List(canGetAnyUser)))
-
-
- lazy val getUsers: OBPEndpoint = {
- case "users" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyUser, callContext)
- queryParams <- unboxFullAndWrapIntoFuture{ createQueriesByHttpParams(callContext.get.requestHeaders) }
- users <- Users.users.vend.getAllUsersF(queryParams)
- } yield {
- (JSONFactory210.createUserJSONs (users), callContext)
- }
- }
- }
-
- val getTransactionTypesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getTransactionTypesIsPublic", true)
-
- resourceDocs += ResourceDoc(
- createTransactionType,
- apiVersion,
- "createTransactionType",
- "PUT",
- "/banks/BANK_ID/transaction-types",
- "Create Transaction Type at bank",
- // TODO get the documentation of the parameters from the scala doc of the case class we return
- s"""Create Transaction Types for the bank specified by BANK_ID:
- |
- | * id : Unique transaction type id across the API instance. SHOULD be a UUID. MUST be unique.
- | * bank_id : The bank that supports this TransactionType
- | * short_code : A short code (SHOULD have no-spaces) which MUST be unique across the bank. May be stored with Transactions to link here
- | * summary : A succinct summary
- | * description : A longer description
- | * charge : The charge to the customer for each one of these
- |
- |${userAuthenticationMessage(getTransactionTypesIsPublic)}""".stripMargin,
- transactionTypeJsonV200,
- transactionType,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- InvalidJsonFormat,
- InsufficientAuthorisationToCreateTransactionType,
- UnknownError
- ),
- List(apiTagBank),
- Some(List(canCreateTransactionType))
- )
-
-
-
- lazy val createTransactionType: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "transaction-types" :: Nil JsonPut json -> _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- postedData <- NewStyle.function.tryons(failMsg=InvalidJsonFormat, callContext=callContext) {json.extract[TransactionTypeJsonV200]}
- _ <- Future (NewStyle.function.ownEntitlement(bankId.value, u.userId, canCreateTransactionType, callContext, InsufficientAuthorisationToCreateTransactionType))map { fullBoxOrException(_)} map { unboxFull(_) }
- returnTranscationType <- Future(TransactionType.TransactionTypeProvider.vend.createOrUpdateTransactionType(postedData)) map { fullBoxOrException(_)} map { unboxFull(_) }
- } yield {
- (returnTranscationType, HttpCode.`200`(callContext))
- }
- }
- }
- }
-
-
- val getAtmsIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getAtmsIsPublic", true)
-
- resourceDocs += ResourceDoc(
- getAtm,
- apiVersion,
- "getAtm",
- "GET",
- "/banks/BANK_ID/atms/ATM_ID",
- "Get Bank ATM",
- s"""Returns information about ATM for a single bank specified by BANK_ID and ATM_ID including:
- |
- |* Address
- |* Geo Location
- |* License the data under this endpoint is released under
- |
- |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
- EmptyBody,
- atmJson,
- List(AuthenticatedUserIsRequired, BankNotFound, AtmNotFoundByAtmId, UnknownError),
- List(apiTagATM, apiTagOldStyle)
- )
-
- lazy val getAtm: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "atms" :: AtmId(atmId) :: Nil JsonGet _ => {
- cc =>{
- for {
- // Get atm from the active provider
- _ <- if (getAtmsIsPublic)
- Box(Some(1))
- else
- cc.user ?~! AuthenticatedUserIsRequired
- (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
- atm <- Box(Atms.atmsProvider.vend.getAtm(bankId, atmId)) ?~! {AtmNotFoundByAtmId}
- } yield {
- // Format the data as json
- val json = JSONFactory1_4_0.createAtmJson(atm)
- // Return
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
- }
-
- val getBranchesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getBranchesIsPublic", true)
-
- resourceDocs += ResourceDoc(
- getBranch,
- apiVersion,
- "getBranch",
- "GET",
- "/banks/BANK_ID/branches/BRANCH_ID",
- "Get Bank Branch",
- s"""Returns information about branches for a single bank specified by BANK_ID and BRANCH_ID including:
- | meta.license.id and eta.license.name fields must not be empty.
- |
- |* Name
- |* Address
- |* Geo Location
- |* License the data under this endpoint is released under
- |
- |${userAuthenticationMessage(!getBranchesIsPublic)}""".stripMargin,
- EmptyBody,
- branchJson,
- List(
- AuthenticatedUserIsRequired,
- BranchNotFoundByBranchId,
- UnknownError
- ),
- List(apiTagBranch, apiTagOldStyle)
- )
-
- lazy val getBranch: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "branches" :: BranchId(branchId) :: Nil JsonGet _ => {
- cc =>{
- for {
- _ <- if (getBranchesIsPublic)
- Box(Some(1))
- else
- cc.user ?~! AuthenticatedUserIsRequired
- (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
- branch <- Box(Branches.branchesProvider.vend.getBranch(bankId, branchId)) ?~! BranchNotFoundByBranchId
- } yield {
- // Format the data as json
- val json = JSONFactory1_4_0.createBranchJson(branch)
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
- }
-
- val getProductsIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getProductsIsPublic", true)
-
-
- resourceDocs += ResourceDoc(
- getProduct,
- apiVersion,
- "getProduct",
- "GET",
- "/banks/BANK_ID/products/PRODUCT_CODE",
- "Get Bank Product",
- s"""Returns information about the financial products offered by a bank specified by BANK_ID and PRODUCT_CODE including:
- |
- |* Name
- |* Code
- |* Category
- |* Family
- |* Super Family
- |* More info URL
- |* Description
- |* Terms and Conditions
- |* License the data under this endpoint is released under
- |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
- EmptyBody,
- productJsonV210,
- List(
- AuthenticatedUserIsRequired,
- ProductNotFoundByProductCode,
- UnknownError
- ),
- List(apiTagProduct)
- )
-
- lazy val getProduct: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "products" :: ProductCode(productCode) :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (_, callContext) <- getProductsIsPublic match {
- case false => authenticatedAccess(cc)
- case true => anonymousAccess(cc)
- }
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (product, callContext) <- NewStyle.function.getProduct(bankId, productCode, callContext)
- } yield {
- (JSONFactory210.createProductJson(product), HttpCode.`200`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getProducts,
- apiVersion,
- "getProducts",
- "GET",
- "/banks/BANK_ID/products",
- "Get Bank Products",
- s"""Returns information about the financial products offered by a bank specified by BANK_ID including:
- |
- |* Name
- |* Code
- |* Category
- |* Family
- |* Super Family
- |* More info URL
- |* Description
- |* Terms and Conditions
- |* License the data under this endpoint is released under
- |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
- EmptyBody,
- productsJsonV210,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- ProductNotFoundByProductCode,
- UnknownError
- ),
- List(apiTagProduct)
- )
-
- lazy val getProducts : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "products" :: Nil JsonGet req => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (_, callContext) <- getProductsIsPublic match {
- case false => authenticatedAccess(cc)
- case true => anonymousAccess(cc)
- }
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- params = req.params.toList.map(kv => GetProductsParam(kv._1, kv._2))
- (products,callContext) <- NewStyle.function.getProducts(bankId, params, callContext)
- } yield {
- (JSONFactory210.createProductsJson(products), HttpCode.`200`(callContext))
- }
- }
- }
- }
-
- val createCustomerEntitlementsRequiredForSpecificBank = canCreateCustomer ::
- canCreateUserCustomerLink ::
- Nil
- val createCustomerEntitlementsRequiredForAnyBank = canCreateCustomerAtAnyBank ::
- canCreateUserCustomerLinkAtAnyBank ::
- Nil
- val createCustomeEntitlementsRequiredText = createCustomerEntitlementsRequiredForSpecificBank.mkString(" and ") + " OR " + createCustomerEntitlementsRequiredForAnyBank.mkString(" and ")
-
- resourceDocs += ResourceDoc(
- createCustomer,
- apiVersion,
- "createCustomer",
- "POST",
- "/banks/BANK_ID/customers",
- "Create Customer",
- s"""Add a customer linked to the user specified by user_id
- |The Customer resource stores the customer number, legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
- |Dates need to be in the format 2013-01-21T23:08:00Z
- |
- |${userAuthenticationMessage(true)}
- |
- |$createCustomeEntitlementsRequiredText
- |""",
- postCustomerJsonV210,
- customerJsonV210,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- InvalidJsonFormat,
- CustomerNumberAlreadyExists,
- UserNotFoundById,
- CustomerAlreadyExistsForUser,
- CreateConsumerError,
- UnknownError
- ),
- List(apiTagCustomer, apiTagPerson, apiTagOldStyle),
- Some(List(canCreateCustomer,canCreateUserCustomerLink,canCreateCustomerAtAnyBank,canCreateUserCustomerLinkAtAnyBank)))
-
- // TODO in next version?
- // Separate customer creation (keep here) from customer linking (remove from here)
- // Remove user_id from CreateCustomerJson
-
- // Note: Logged in user can no longer create a customer for himself
-
-
- lazy val createCustomer : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: Nil JsonPost json -> _ => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired // TODO. CHECK user has role to create a customer / create a customer for another user id.
- _ <- tryo(assert(isValidID(bankId.value)))?~! InvalidBankIdFormat
- (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
- postedData <- tryo{json.extract[PostCustomerJsonV210]} ?~! InvalidJsonFormat
- _ <- Helper.booleanToBox(
- !`checkIfContains::::` (postedData.customer_number), s"$InvalidJsonFormat customer_number can not contain `::::` characters")
- _ <- NewStyle.function.hasAllEntitlements(bankId.value, u.userId, createCustomerEntitlementsRequiredForSpecificBank, createCustomerEntitlementsRequiredForAnyBank, callContext)
- _ <- tryo(assert(CustomerX.customerProvider.vend.checkCustomerNumberAvailable(bankId, postedData.customer_number) == true)) ?~! CustomerNumberAlreadyExists
- user_id <- tryo (if (postedData.user_id.nonEmpty) postedData.user_id else u.userId) ?~! s"Problem getting user_id"
- customer_user <- UserX.findByUserId(user_id) ?~! UserNotFoundById
- customer <- CustomerX.customerProvider.vend.addCustomer(bankId,
- postedData.customer_number,
- postedData.legal_name,
- postedData.mobile_phone_number,
- postedData.email,
- CustomerFaceImage(postedData.face_image.date, postedData.face_image.url),
- postedData.date_of_birth,
- postedData.relationship_status,
- postedData.dependants,
- postedData.dob_of_dependants,
- postedData.highest_education_attained,
- postedData.employment_status,
- postedData.kyc_status,
- postedData.last_ok_date,
- Option(CreditRating(postedData.credit_rating.rating, postedData.credit_rating.source)),
- Option(CreditLimit(postedData.credit_limit.currency, postedData.credit_limit.amount)),
- "",
- "",
- "") ?~! CreateConsumerError
- _ <- booleanToBox(UserCustomerLink.userCustomerLink.vend.getUserCustomerLink(user_id, customer.customerId).isEmpty == true) ?~! CustomerAlreadyExistsForUser
- _ <- UserCustomerLink.userCustomerLink.vend.createUserCustomerLink(user_id, customer.customerId, new Date(), true) ?~! CreateUserCustomerLinksError
-
- } yield {
- val json = JSONFactory210.createCustomerJson(customer)
- val successJson = Extraction.decompose(json)
- successJsonResponse(successJson, 201)
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getCustomersForUser,
- apiVersion,
- "getCustomersForUser",
- "GET",
- "/users/current/customers",
- "Get Customers for Current User",
- """Gets all Customers that are linked to a User.
- |
- |Authentication via OAuth is required.""",
- EmptyBody,
- customerJsonV210,
- List(
- AuthenticatedUserIsRequired,
- UserCustomerLinksNotFoundForUser,
- UnknownError
- ),
- List(apiTagCustomer, apiTagUser, apiTagOldStyle))
-
- lazy val getCustomersForUser : OBPEndpoint = {
- case "users" :: "current" :: "customers" :: Nil JsonGet _ => {
- cc => {
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired
- customers <- tryo{CustomerX.customerProvider.vend.getCustomersByUserId(u.userId)} ?~! UserCustomerLinksNotFoundForUser
- } yield {
- val json = JSONFactory210.createCustomersJson(customers)
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getCustomersForCurrentUserAtBank,
- apiVersion,
- "getCustomersForCurrentUserAtBank",
- "GET",
- "/banks/BANK_ID/customers",
- "Get Customers for current User at Bank",
- s"""Returns a list of Customers at the Bank that are linked to the currently authenticated User.
- |
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody,
- customerJSONs,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- UserCustomerLinksNotFoundForUser,
- UserCustomerLinksNotFoundForUser,
- CustomerNotFoundByCustomerId,
- UnknownError
- ),
- List(apiTagCustomer)
- )
-
- lazy val getCustomersForCurrentUserAtBank : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "customers" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- (customers, callContext) <- Connector.connector.vend.getCustomersByUserId(u.userId, callContext) map {
- connectorEmptyResponse(_, callContext)
- }
- } yield {
- // Filter so we only see the ones for the bank in question
- val bankCustomers = customers.filter(_.bankId==bankId.value)
- val json = JSONFactory210.createCustomersJson(bankCustomers)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- updateBranch,
- apiVersion,
- "updateBranch",
- "PUT",
- "/banks/BANK_ID/branches/BRANCH_ID",
- "Update Branch",
- s"""Update an existing branch for a bank account (Authenticated access).
- |${userAuthenticationMessage(true)}
- |""",
- branchJsonPut,
- branchJson,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- InvalidJsonFormat,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagBranch),
- Some(List(canUpdateBranch)))
-
-
- lazy val updateBranch: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "branches" :: BranchId(branchId):: Nil JsonPut json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- branchJsonPutV210 <- NewStyle.function.tryons(failMsg = InvalidJsonFormat + " BranchJsonPutV210", 400, callContext) {
- json.extract[BranchJsonPutV210]
- }
- _ <- Helper.booleanToFuture(failMsg = s"$InvalidJsonValue BANK_ID has to be the same in the URL and Body", 400, callContext) {
- branchJsonPutV210.bank_id == bank.bankId.value
- }
- _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canUpdateBranch, callContext)
- branch <- NewStyle.function.tryons(CouldNotTransformJsonToInternalModel + " Branch", 400, callContext) {
- transformToBranch(branchId, branchJsonPutV210).head
- }
- (success, callContext) <- NewStyle.function.createOrUpdateBranch(branch, callContext)
- } yield {
- val json = JSONFactory1_4_0.createBranchJson(success)
- (json, HttpCode.`201`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- createBranch,
- apiVersion,
- "createBranch",
- "POST",
- "/banks/BANK_ID/branches",
- "Create Branch",
- s"""Create branch for the bank (Authenticated access).
- |${userAuthenticationMessage(true)}
- |""",
- branchJsonPost,
- branchJson,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- InvalidJsonFormat,
- InsufficientAuthorisationToCreateBranch,
- UnknownError
- ),
- List(apiTagBranch, apiTagOpenData),
- Some(List(canCreateBranch, canCreateBranchAtAnyBank)))
-
- lazy val createBranch: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "branches" :: Nil JsonPost json -> _ =>
- {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- branchJsonPostV210 <- NewStyle.function.tryons(failMsg = InvalidJsonFormat + " BranchJsonPostV210", 400, callContext) {
- json.extract[BranchJsonPostV210]
- }
- _ <- Helper.booleanToFuture(failMsg = s"$InvalidJsonValue BANK_ID has to be the same in the URL and Body", 400, callContext) {
- branchJsonPostV210.bank_id == bank.bankId.value
- }
- _ <- Future(
- NewStyle.function.hasAllEntitlements(bank.bankId.value, u.userId, canCreateBranch::Nil, canCreateBranchAtAnyBank::Nil, cc.callContext)
- )
- branch <- NewStyle.function.tryons(CouldNotTransformJsonToInternalModel + " Branch", 400, cc.callContext) {
- transformToBranch(branchJsonPostV210).head
- }
- (success, callContext) <- NewStyle.function.createOrUpdateBranch(branch, callContext)
- } yield {
- val json = JSONFactory1_4_0.createBranchJson(success)
- (json, HttpCode.`201`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- updateConsumerRedirectUrl,
- apiVersion,
- "updateConsumerRedirectUrl",
- "PUT",
- "/management/consumers/CONSUMER_ID/consumer/redirect_url",
- "Update Consumer RedirectUrl",
- s"""Update an existing redirectUrl for a Consumer specified by CONSUMER_ID.
- |
- | CONSUMER_ID can be obtained after you register the application.
- |
- | Or use the endpoint 'Get Consumers' to get it
- |
- """.stripMargin,
- consumerRedirectUrlJSON,
- consumerJSON,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagConsumer),
- Some(List(canUpdateConsumerRedirectUrl))
- )
-
- lazy val updateConsumerRedirectUrl: OBPEndpoint = {
- case "management" :: "consumers" :: consumerId :: "consumer" :: "redirect_url" :: Nil JsonPut json -> _ => {
- cc =>
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- APIUtil.getPropsAsBoolValue("consumers_enabled_by_default", false) match {
- case true => Future(Full(Unit))
- case false => NewStyle.function.hasEntitlement("", u.userId, ApiRole.canUpdateConsumerRedirectUrl, callContext)
- }
- postJson <- NewStyle.function.tryons(InvalidJsonFormat, 400, callContext) {
- json.extract[ConsumerRedirectUrlJSON]
- }
- consumerIdToLong <- NewStyle.function.tryons(InvalidConsumerId, 400, callContext) {
- consumerId.toLong
- }
- consumer <- NewStyle.function.getConsumerByPrimaryId(consumerIdToLong, callContext)
- //only the developer that created the Consumer should be able to edit it
- _ <- Helper.booleanToFuture(UserNoPermissionUpdateConsumer, 400, callContext) {
- consumer.createdByUserId.equals(u.userId)
- }
- //update the redirectURL and isactive (set to false when change redirectUrl) field in consumer table
- updatedConsumer <- NewStyle.function.updateConsumer(
- id = consumer.id.get,
- isActive = Some(APIUtil.getPropsAsBoolValue("consumers_enabled_by_default", false)),
- redirectURL = Some(postJson.redirect_url),
- callContext = callContext
- )
- } yield {
- val json = JSONFactory210.createConsumerJSON(updatedConsumer)
- (json, HttpCode.`200`(callContext))
- }
- }
- }
- resourceDocs += ResourceDoc(
- getMetrics,
- apiVersion,
- "getMetrics",
- "GET",
- "/management/metrics",
- "Get Metrics",
- s"""Get the all metrics
- |
- |require CanReadMetrics role
- |
- |Filters Part 1.*filtering* (no wilde cards etc.) parameters to GET /management/metrics
- |
- |Should be able to filter on the following metrics fields
- |
- |eg: /management/metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&limit=50&offset=2
- |
- |1 from_date (defaults to one week before current date): eg:from_date=$DateWithMsExampleString
- |
- |2 to_date (defaults to current date) eg:to_date=$DateWithMsExampleString
- |
- |3 limit (for pagination: defaults to 50) eg:limit=200
- |
- |4 offset (for pagination: zero index, defaults to 0) eg: offset=10
- |
- |5 sort_by (defaults to date field) eg: sort_by=date
- | possible values:
- | "url",
- | "date",
- | "username" (or "user_name" for backward compatibility),
- | "app_name",
- | "developer_email",
- | "implemented_by_partial_function",
- | "implemented_in_version",
- | "consumer_id",
- | "verb"
- |
- |6 direction (defaults to date desc) eg: direction=desc
- |
- |eg: /management/metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&limit=10000&offset=0&anon=false&app_name=TeatApp&implemented_in_version=v2.1.0&verb=POST&user_id=c7b6cb47-cb96-4441-8801-35b57456753a&username=susan.uk.29@example.com&consumer_id=78
- |
- |Other filters:
- |
- |7 consumer_id (if null ignore)
- |
- |8 user_id (if null ignore)
- |
- |9 anon (if null ignore) only support two value : true (return where user_id is null.) or false (return where user_id is not null.)
- |
- |10 url (if null ignore), note: can not contain '&'.
- |
- |11 app_name (if null ignore)
- |
- |12 implemented_by_partial_function (if null ignore),
- |
- |13 implemented_in_version (if null ignore)
- |
- |14 verb (if null ignore)
- |
- |15 correlation_id (if null ignore)
- |
- |16 duration (if null ignore) non digit chars will be silently omitted
- |
- """.stripMargin,
- EmptyBody,
- metricsJson,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagMetric, apiTagApi),
- Some(List(canReadMetrics)))
+trait APIMethods210 { self: RestHelper => }
- lazy val getMetrics : OBPEndpoint = {
- case "management" :: "metrics" :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canReadMetrics, callContext)
- httpParams <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
- (obpQueryParams, callContext) <- createQueriesByHttpParamsFuture(httpParams, callContext)
- metrics <- Future(APIMetrics.apiMetrics.vend.getAllMetrics(obpQueryParams))
- } yield {
- (JSONFactory210.createMetricsJson(metrics), HttpCode.`200`(callContext))
- }
- }
- }
- }
- }
+object APIMethods210 extends RestHelper with APIMethods210 {
+ val Implementations2_1_0 = Http4s210.Implementations2_1_0
}
+//
+//package code.api.v2_1_0
+//
+//import scala.language.reflectiveCalls
+//import code.TransactionTypes.TransactionType
+//import code.api.Constant.CAN_SEE_TRANSACTION_REQUESTS
+//import code.api.util.ApiTag._
+//import code.api.util.ErrorMessages.TransactionDisabled
+//import code.api.util.FutureUtil.EndpointContext
+//import code.api.util.NewStyle.HttpCode
+//import code.api.util.{APIUtil, ApiRole, ErrorMessages, NewStyle}
+//import code.api.v1_2_1.JSONFactory
+//import code.api.v1_3_0._
+//import code.api.v1_4_0.JSONFactory1_4_0
+//import code.api.v1_4_0.JSONFactory1_4_0._
+//import code.api.v2_0_0._
+//import code.api.v2_1_0.JSONFactory210._
+//import code.atms.Atms
+//import code.bankconnectors._
+//import code.branches.Branches
+//import code.consumer.Consumers
+//import code.customer.CustomerX
+//import code.fx.fx
+//import code.metrics.APIMetrics
+//import code.model.{BankAccountX, BankX, Consumer, UserX}
+//import code.sandbox.SandboxData
+//import code.usercustomerlinks.UserCustomerLink
+//import code.users.Users
+//import code.util.Helper.booleanToBox
+//import com.openbankproject.commons.dto.GetProductsParam
+//import com.openbankproject.commons.model._
+//import com.openbankproject.commons.model.enums.TransactionRequestTypes._
+//import com.openbankproject.commons.model.enums.{ChallengeType, SuppliedAnswerType, TransactionRequestTypes}
+//import com.openbankproject.commons.util.ApiVersion
+//import net.liftweb.json.Extraction
+//import net.liftweb.util.Helpers.tryo
+//import net.liftweb.util.StringHelpers
+//
+//import java.util.Date
+//import scala.collection.mutable.ArrayBuffer
+//import scala.concurrent.Future
+//// Makes JValue assignment to Nil work
+//import code.api.ChargePolicy
+//import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
+//import code.api.util.APIUtil._
+//import code.api.util.ApiRole._
+//import code.api.util.ErrorMessages._
+//import code.sandbox.{OBPDataImport, SandboxDataImport}
+//import code.util.Helper
+//import com.openbankproject.commons.ExecutionContext.Implicits.global
+//import net.liftweb.common.{Box, Full}
+//import net.liftweb.http.rest.RestHelper
+//import net.liftweb.json.Serialization.write
+//import net.liftweb.json._
+//
+//trait APIMethods210 {
+// //needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
+// self: RestHelper =>
+//
+// // helper methods begin here
+// // helper methods end here
+//
+// val Implementations2_1_0 = new Object() {
+//
+// val resourceDocs = ArrayBuffer[ResourceDoc]()
+// val apiRelations = ArrayBuffer[ApiRelation]()
+//
+//
+// val apiVersion = ApiVersion.v2_1_0 // was String "2_1_0"
+//
+// val codeContext = CodeContext(resourceDocs, apiRelations)
+//
+//
+// resourceDocs += ResourceDoc(
+// root,
+// apiVersion,
+// "root",
+// "GET",
+// "/root",
+// "Get API Info (root)",
+// """Returns information about:
+// |
+// |* API version
+// |* Hosted by information
+// |* Git Commit""",
+// EmptyBody,
+// apiInfoJSON,
+// List(UnknownError, MandatoryPropertyIsNotSet),
+// apiTagApi :: Nil)
+//
+// lazy val root : OBPEndpoint = {
+// case (Nil | "root" :: Nil) JsonGet _ => {
+// cc =>
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// _ <- Future(()) // Just start async call
+// } yield {
+// (JSONFactory.getApiInfoJSON(OBPAPI2_1_0.version, OBPAPI2_1_0.versionStatus), HttpCode.`200`(cc.callContext))
+// }
+// }
+// }
+//
+//
+// // TODO Add example body below
+//
+// resourceDocs += ResourceDoc(
+// sandboxDataImport,
+// apiVersion,
+// "sandboxDataImport",
+// "POST",
+// "/sandbox/data-import",
+// "Create sandbox",
+// s"""Import bulk data into the sandbox (Authenticated access).
+// |
+// |This call can be used to create banks, users, accounts and transactions which are stored in the local RDBMS.
+// |
+// |The user needs to have CanCreateSandbox entitlement.
+// |
+// |Note: This is a monolithic call. You could also use a combination of endpoints including create bank, create user, create account and create transaction request to create similar data.
+// |
+// |An example of an import set of data (json) can be found [here](https://raw.githubusercontent.com/OpenBankProject/OBP-API/develop/obp-api/src/main/scala/code/api/sandbox/example_data/2016-04-28/example_import.json)
+// |${userAuthenticationMessage(true)}
+// |""",
+// SandboxData.importJson,
+// successMessage,
+// List(
+// AuthenticatedUserIsRequired,
+// InvalidJsonFormat,
+// DataImportDisabled,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagSandbox),
+// Some(List(canCreateSandbox)))
+//
+//
+// lazy val sandboxDataImport: OBPEndpoint = {
+// // Import data into the sandbox
+// case "sandbox" :: "data-import" :: Nil JsonPost json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// importData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $SandboxDataImport ", 400, cc.callContext) {
+// json.extract[SandboxDataImport]
+// }
+// _ <- Helper.booleanToFuture(s"$DataImportDisabled", 403, callContext) {
+// APIUtil.getPropsAsBoolValue("allow_sandbox_data_import", defaultValue = false)
+// }
+// _ <- NewStyle.function.hasEntitlement("", u.userId, canCreateSandbox, cc.callContext)
+// _ <- Helper.booleanToFuture(s"Cannot import the sandbox data", 400, callContext) {
+// OBPDataImport.importer.vend.importData(importData).isDefined
+// }
+// } yield {
+// (successMessage, HttpCode.`201`(callContext))
+// }
+// }
+// }
+//
+//
+// val getTransactionRequestTypesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getTransactionRequestTypesIsPublic", true)
+//
+// resourceDocs += ResourceDoc(
+// getTransactionRequestTypesSupportedByBank,
+// apiVersion,
+// "getTransactionRequestTypesSupportedByBank",
+// "GET",
+// "/banks/BANK_ID/transaction-request-types",
+// "Get Transaction Request Types at Bank",
+// s"""Get the list of the Transaction Request Types supported by the bank.
+// |
+// |${userAuthenticationMessage(!getTransactionRequestTypesIsPublic)}
+// |""",
+// EmptyBody,
+// transactionRequestTypesJSON,
+// List(AuthenticatedUserIsRequired, UnknownError),
+// List(apiTagTransactionRequest, apiTagBank))
+//
+//
+// lazy val getTransactionRequestTypesSupportedByBank: OBPEndpoint = {
+// // Get transaction request types supported by the bank
+// case "banks" :: BankId(bankId) :: "transaction-request-types" :: Nil JsonGet _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (_, callContext) <- getTransactionRequestTypesIsPublic match {
+// case false => authenticatedAccess(cc)
+// case true => anonymousAccess(cc)
+// }
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// // Get Transaction Request Types from Props "transactionRequests_supported_types". Default is empty string
+// transactionRequestTypes <- Future {
+// APIUtil.getPropsValue("transactionRequests_supported_types", "")
+// }
+// } yield {
+// // Format the data as json
+// val json = JSONFactory210.createTransactionRequestTypeJSON(transactionRequestTypes.split(",").toList)
+// // Return
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+//
+// import net.liftweb.json.Extraction._
+// import net.liftweb.json.JsonAST._
+// val exchangeRates = prettyRender(decompose(fx.fallbackExchangeRates))
+//
+//
+// // This text is used in the various Create Transaction Request resource docs
+// val transactionRequestGeneralText =
+// s"""Initiate a Payment via creating a Transaction Request.
+// |
+// |In OBP, a `transaction request` may or may not result in a `transaction`. However, a `transaction` only has one possible state: completed.
+// |
+// |A `Transaction Request` can have one of several states.
+// |
+// |`Transactions` are modeled on items in a bank statement that represent the movement of money.
+// |
+// |`Transaction Requests` are requests to move money which may or may not succeeed and thus result in a `Transaction`.
+// |
+// |A `Transaction Request` might create a security challenge that needs to be answered before the `Transaction Request` proceeds.
+// |
+// |Transaction Requests contain charge information giving the client the opportunity to proceed or not (as long as the challenge level is appropriate).
+// |
+// |Transaction Requests can have one of several Transaction Request Types which expect different bodies. The escaped body is returned in the details key of the GET response.
+// |This provides some commonality and one URL for many different payment or transfer types with enough flexibility to validate them differently.
+// |
+// |The payer is set in the URL. Money comes out of the BANK_ID and ACCOUNT_ID specified in the URL.
+// |
+// |In sandbox mode, TRANSACTION_REQUEST_TYPE is commonly set to SANDBOX_TAN. See getTransactionRequestTypesSupportedByBank for all supported types.
+// |
+// |In sandbox mode, if the amount is less than 1000 EUR (any currency, unless it is set differently on this server), the transaction request will create a transaction without a challenge, else the Transaction Request will be set to INITIALISED and a challenge will need to be answered.
+// |
+// |If a challenge is created you must answer it using Answer Transaction Request Challenge before the Transaction is created.
+// |
+// |You can transfer between different currency accounts. (new in 2.0.0). The currency in body must match the sending account.
+// |
+// |The following static FX rates are available in sandbox mode:
+// |
+// |${exchangeRates}
+// |
+// |
+// |Transaction Requests satisfy PSD2 requirements thus:
+// |
+// |1) A transaction can be initiated by a third party application.
+// |
+// |2) The customer is informed of the charge that will incurred.
+// |
+// |3) The call supports delegated authentication (OAuth)
+// |
+// |See [this python code](https://github.com/OpenBankProject/Hello-OBP-DirectLogin-Python/blob/master/hello_payments.py) for a complete example of this flow.
+// |
+// |There is further documentation [here](https://github.com/OpenBankProject/OBP-API/wiki/Transaction-Requests)
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |"""
+//
+//
+//
+//
+// // SANDBOX_TAN. (we no longer create a resource doc for the general case)
+// resourceDocs += ResourceDoc(
+// createTransactionRequestSandboxTan,
+// apiVersion,
+// "createTransactionRequestSandboxTan",
+// "POST",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/SANDBOX_TAN/transaction-requests",
+// "Create Transaction Request (SANDBOX_TAN)",
+// s"""When using SANDBOX_TAN, the payee is set in the request body.
+// |
+// |Money goes into the BANK_ID and ACCOUNT_ID specified in the request body.
+// |
+// |$transactionRequestGeneralText
+// |
+// """.stripMargin,
+// transactionRequestBodyJsonV200,
+// transactionRequestWithChargeJSON210,
+// List(
+// AuthenticatedUserIsRequired,
+// AuthenticatedUserIsRequired,
+// InvalidBankIdFormat,
+// InvalidAccountIdFormat,
+// InvalidJsonFormat,
+// BankNotFound,
+// AccountNotFound,
+// ViewNotFound,
+// InsufficientAuthorisationToCreateTransactionRequest,
+// UserNoPermissionAccessView,
+// InvalidTransactionRequestType,
+// InvalidJsonFormat,
+// InvalidNumber,
+// NotPositiveAmount,
+// InvalidTransactionRequestCurrency,
+// TransactionDisabled,
+// UnknownError
+// ),
+// List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
+//
+// // COUNTERPARTY
+// resourceDocs += ResourceDoc(
+// createTransactionRequestCounterparty,
+// apiVersion,
+// "createTransactionRequestCounterparty",
+// "POST",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/COUNTERPARTY/transaction-requests",
+// "Create Transaction Request (COUNTERPARTY)",
+// s"""
+// |Special instructions for COUNTERPARTY:
+// |
+// |When using a COUNTERPARTY to create a Transaction Request, specificy the counterparty_id in the body of the request.
+// |The routing details of the counterparty will be forwarded for the transfer.
+// |
+// |$transactionRequestGeneralText
+// |
+// """.stripMargin,
+// transactionRequestBodyCounterpartyJSON,
+// transactionRequestWithChargeJSON210,
+// List(
+// AuthenticatedUserIsRequired,
+// AuthenticatedUserIsRequired,
+// InvalidBankIdFormat,
+// InvalidAccountIdFormat,
+// InvalidJsonFormat,
+// BankNotFound,
+// AccountNotFound,
+// ViewNotFound,
+// InsufficientAuthorisationToCreateTransactionRequest,
+// UserNoPermissionAccessView,
+// InvalidTransactionRequestType,
+// InvalidJsonFormat,
+// InvalidNumber,
+// NotPositiveAmount,
+// InvalidTransactionRequestCurrency,
+// TransactionDisabled,
+// UnknownError
+// ),
+// List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
+//
+//
+// val lowAmount = AmountOfMoneyJsonV121("EUR", "12.50")
+// val sharedChargePolicy = ChargePolicy.withName("SHARED")
+//
+// // Transaction Request (SEPA)
+// resourceDocs += ResourceDoc(
+// createTransactionRequestSepa,
+// apiVersion,
+// "createTransactionRequestSepa",
+// "POST",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/SEPA/transaction-requests",
+// "Create Transaction Request (SEPA)",
+// s"""
+// |Special instructions for SEPA:
+// |
+// |When using a SEPA Transaction Request, you specify the IBAN of a Counterparty in the body of the request.
+// |The routing details (IBAN) of the counterparty will be forwarded to the core banking system for the transfer.
+// |
+// |$transactionRequestGeneralText
+// |
+// """.stripMargin,
+// transactionRequestBodySEPAJSON,
+// transactionRequestWithChargeJSON210,
+// List(
+// AuthenticatedUserIsRequired,
+// AuthenticatedUserIsRequired,
+// InvalidBankIdFormat,
+// InvalidAccountIdFormat,
+// InvalidJsonFormat,
+// BankNotFound,
+// AccountNotFound,
+// ViewNotFound,
+// InsufficientAuthorisationToCreateTransactionRequest,
+// UserNoPermissionAccessView,
+// InvalidTransactionRequestType,
+// InvalidJsonFormat,
+// InvalidNumber,
+// NotPositiveAmount,
+// InvalidTransactionRequestCurrency,
+// TransactionDisabled,
+// UnknownError
+// ),
+// List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
+//
+//
+// // FREE_FORM.
+// resourceDocs += ResourceDoc(
+// createTransactionRequestFreeForm,
+// apiVersion,
+// "createTransactionRequestFreeForm",
+// "POST",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/FREE_FORM/transaction-requests",
+// "Create Transaction Request (FREE_FORM).",
+// s"""$transactionRequestGeneralText
+// |
+// """.stripMargin,
+// transactionRequestBodyFreeFormJSON,
+// transactionRequestWithChargeJSON210,
+// List(
+// AuthenticatedUserIsRequired,
+// AuthenticatedUserIsRequired,
+// InvalidBankIdFormat,
+// InvalidAccountIdFormat,
+// InvalidJsonFormat,
+// BankNotFound,
+// AccountNotFound,
+// ViewNotFound,
+// InsufficientAuthorisationToCreateTransactionRequest,
+// UserNoPermissionAccessView,
+// InvalidTransactionRequestType,
+// InvalidJsonFormat,
+// InvalidNumber,
+// NotPositiveAmount,
+// InvalidTransactionRequestCurrency,
+// TransactionDisabled,
+// UnknownError
+// ),
+// List(apiTagTransactionRequest, apiTagPSD2PIS),
+// Some(List(canCreateAnyTransactionRequest)))
+//
+//
+//
+//
+// // Different Transaction Request approaches:
+// lazy val createTransactionRequestSandboxTan = createTransactionRequest
+// lazy val createTransactionRequestSepa = createTransactionRequest
+// lazy val createTransactionRequestCounterparty = createTransactionRequest
+// lazy val createTransactionRequestFreeForm = createTransactionRequest
+//
+// // This handles the above cases
+// lazy val createTransactionRequest: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-request-types" ::
+// TransactionRequestType(transactionRequestType) :: "transaction-requests" :: Nil JsonPost json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.isEnabledTransactionRequests(callContext)
+// _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext) {isValidID(accountId.value)}
+// _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext) {isValidID(bankId.value)}
+// _ <- Helper.booleanToFuture(s"${InvalidTransactionRequestType}: '${transactionRequestType.value}'", cc=callContext) {
+// APIUtil.getPropsValue("transactionRequests_supported_types", "").split(",").contains(transactionRequestType.value)
+// }
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
+//
+// account = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
+// _ <- NewStyle.function.checkAuthorisationToCreateTransactionRequest(viewId, account, u, callContext)
+// // Check the input JSON format, here is just check the common parts of all four types
+// transDetailsJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $TransactionRequestBodyCommonJSON ", 400, callContext) {
+// json.extract[TransactionRequestBodyCommonJSON]
+// }
+//
+// isValidAmountNumber <- NewStyle.function.tryons(s"$InvalidNumber Current input is ${transDetailsJson.value.amount} ", 400, callContext) {
+// BigDecimal(transDetailsJson.value.amount)
+// }
+//
+// _ <- Helper.booleanToFuture(s"${NotPositiveAmount} Current input is: '${isValidAmountNumber}'", cc=callContext) {
+// isValidAmountNumber > BigDecimal("0")
+// }
+//
+// _ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${transDetailsJson.value.currency}'", cc=callContext) {
+// isValidCurrencyISOCode(transDetailsJson.value.currency)
+// }
+//
+// // Prevent default value for transaction request type (at least).
+// _ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${transDetailsJson.value.currency}'", cc=callContext) {
+// isValidCurrencyISOCode(transDetailsJson.value.currency)
+// }
+//
+// // Prevent default value for transaction request type (at least).
+// _ <- Helper.booleanToFuture(s"$InvalidTransactionRequestCurrency From Account Currency is ${fromAccount.currency}, but Requested Transaction Currency is: ${transDetailsJson.value.currency}", cc=callContext) {
+// transDetailsJson.value.currency == fromAccount.currency
+// }
+//
+//
+// amountOfMoneyJSON = AmountOfMoneyJsonV121(transDetailsJson.value.currency, transDetailsJson.value.amount)
+//
+// (createdTransactionRequest,callContext) <- TransactionRequestTypes.withName(transactionRequestType.value) match {
+// case SANDBOX_TAN => {
+// for {
+// transactionRequestBodySandboxTan <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $SANDBOX_TAN json format", 400, callContext) {
+// json.extract[TransactionRequestBodySandBoxTanJSON]
+// }
+//
+// toBankId = BankId(transactionRequestBodySandboxTan.to.bank_id)
+// toAccountId = AccountId(transactionRequestBodySandboxTan.to.account_id)
+// (toAccount, callContext) <- NewStyle.function.checkBankAccountExists(toBankId, toAccountId, callContext)
+//
+// transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transactionRequestBodySandboxTan)(Serialization.formats(NoTypeHints))}
+//
+// (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
+// viewId,
+// fromAccount,
+// toAccount,
+// transactionRequestType,
+// transactionRequestBodySandboxTan,
+// transDetailsSerialized,
+// sharedChargePolicy.toString,
+// None,
+// None,
+// callContext) //in SANDBOX_TAN, ChargePolicy set default "SHARED"
+// } yield (createdTransactionRequest, callContext)
+// }
+// case COUNTERPARTY => {
+// for {
+// //For COUNTERPARTY, Use the counterpartyId to find the toCounterparty and set up the toAccount
+// transactionRequestBodyCounterparty <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $COUNTERPARTY json format", 400, callContext) {
+// json.extract[TransactionRequestBodyCounterpartyJSON]
+// }
+// toCounterpartyId = transactionRequestBodyCounterparty.to.counterparty_id
+// (toCounterparty, callContext) <- NewStyle.function.getCounterpartyByCounterpartyId(CounterpartyId(toCounterpartyId), callContext)
+// (toAccount, callContext) <- NewStyle.function.getBankAccountFromCounterparty(toCounterparty, true, callContext)
+// // Check we can send money to it.
+// _ <- Helper.booleanToFuture(s"$CounterpartyBeneficiaryPermit", cc=callContext) {
+// toCounterparty.isBeneficiary == true
+// }
+// chargePolicy = transactionRequestBodyCounterparty.charge_policy
+// _ <- Helper.booleanToFuture(s"$InvalidChargePolicy", cc=callContext) {
+// ChargePolicy.values.contains(ChargePolicy.withName(chargePolicy))
+// }
+// transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transactionRequestBodyCounterparty)(Serialization.formats(NoTypeHints))}
+// (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
+// viewId,
+// fromAccount,
+// toAccount,
+// transactionRequestType,
+// transactionRequestBodyCounterparty,
+// transDetailsSerialized,
+// chargePolicy,
+// None,
+// None,
+// callContext)
+// } yield (createdTransactionRequest, callContext)
+//
+// }
+// case SEPA => {
+// for {
+// //For SEPA, Use the iban to find the toCounterparty and set up the toAccount
+// transDetailsSEPAJson <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $SEPA json format", 400, callContext) {
+// json.extract[TransactionRequestBodySEPAJSON]
+// }
+// toIban = transDetailsSEPAJson.to.iban
+// (toCounterparty, callContext) <- NewStyle.function.getCounterpartyByIban(toIban, callContext)
+// (toAccount, callContext) <- NewStyle.function.getBankAccountFromCounterparty(toCounterparty, true, callContext)
+// _ <- Helper.booleanToFuture(s"$CounterpartyBeneficiaryPermit", cc=callContext) {
+// toCounterparty.isBeneficiary == true
+// }
+// chargePolicy = transDetailsSEPAJson.charge_policy
+// _ <- Helper.booleanToFuture(s"$InvalidChargePolicy", cc=callContext) {
+// ChargePolicy.values.contains(ChargePolicy.withName(chargePolicy))
+// }
+// transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transDetailsSEPAJson)(Serialization.formats(NoTypeHints))}
+// (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
+// viewId,
+// fromAccount,
+// toAccount,
+// transactionRequestType,
+// transDetailsSEPAJson,
+// transDetailsSerialized,
+// chargePolicy,
+// None,
+// None,
+// callContext)
+// } yield (createdTransactionRequest, callContext)
+// }
+// case FREE_FORM => {
+// for {
+// transactionRequestBodyFreeForm <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $FREE_FORM json format", 400, callContext) {
+// json.extract[TransactionRequestBodyFreeFormJSON]
+// }
+// // Following lines: just transfer the details body, add Bank_Id and Account_Id in the Detail part. This is for persistence and 'answerTransactionRequestChallenge'
+// transactionRequestAccountJSON = TransactionRequestAccountJsonV140(fromAccount.bankId.value, fromAccount.accountId.value)
+// transDetailsSerialized <- NewStyle.function.tryons (UnknownError, 400, callContext){write(transactionRequestBodyFreeForm)(Serialization.formats(NoTypeHints))}
+// (createdTransactionRequest, callContext) <- NewStyle.function.createTransactionRequestv210(u,
+// viewId,
+// fromAccount,
+// fromAccount,
+// transactionRequestType,
+// transactionRequestBodyFreeForm,
+// transDetailsSerialized,
+// sharedChargePolicy.toString,
+// None,
+// None,
+// callContext)
+// } yield
+// (createdTransactionRequest, callContext)
+// }
+// }
+// } yield {
+// (JSONFactory210.createTransactionRequestWithChargeJSON(createdTransactionRequest), HttpCode.`201`(callContext))
+// }
+// }
+// }
+//
+//
+// resourceDocs += ResourceDoc(
+// answerTransactionRequestChallenge,
+// apiVersion,
+// "answerTransactionRequestChallenge",
+// "POST",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/TRANSACTION_REQUEST_TYPE/transaction-requests/TRANSACTION_REQUEST_ID/challenge",
+// "Answer Transaction Request Challenge",
+// """In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.
+// |
+// |This endpoint expects the following data as provided in the createTransactionRequest response body:
+// |
+// |1)`TRANSACTION_REQUEST_TYPE` : as per the selected createTransactionRequest type, part of the request URL.
+// |
+// |2)`TRANSACTION_REQUEST_ID` : the value of the `id` field of the createTransactionRequest response body.
+// |
+// |3) `id` : the value of `challenge.id` in the createTransactionRequest response body.
+// |
+// |4) `answer` : Defaults to `123`, if running in sandbox mode. In production mode, the value will be sent via the configured SCA method.
+// |
+// """.stripMargin,
+// challengeAnswerJSON,
+// transactionRequestWithChargeJson,
+// List(
+// AuthenticatedUserIsRequired,
+// InvalidBankIdFormat,
+// InvalidAccountIdFormat,
+// InvalidJsonFormat,
+// BankNotFound,
+// UserNoPermissionAccessView,
+// TransactionRequestStatusNotInitiated,
+// TransactionRequestTypeHasChanged,
+// InvalidTransactionRequestChallengeId,
+// AllowedAttemptsUsedUp,
+// TransactionDisabled,
+// UnknownError
+// ),
+// List(apiTagTransactionRequest, apiTagPSD2PIS, apiTagPsd2))
+//
+// lazy val answerTransactionRequestChallenge: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-request-types" ::
+// TransactionRequestType(transactionRequestType) :: "transaction-requests" :: TransactionRequestId(transReqId) :: "challenge" :: Nil JsonPost json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// // Check we have a User
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.isEnabledTransactionRequests(callContext)
+// _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext) {isValidID(accountId.value)}
+// _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext) {isValidID(bankId.value)}
+// challengeAnswerJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $ChallengeAnswerJSON ", 400, callContext) {
+// json.extract[ChallengeAnswerJSON]
+// }
+//
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
+//
+// account = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
+// _ <- NewStyle.function.checkAuthorisationToCreateTransactionRequest(viewId, account, u, callContext)
+//
+//
+// // Check transReqId is valid
+// (existingTransactionRequest, callContext) <- NewStyle.function.getTransactionRequestImpl(transReqId, callContext)
+//
+// // Check the Transaction Request is still INITIATED
+// _ <- Helper.booleanToFuture(TransactionRequestStatusNotInitiated, cc=callContext) {
+// existingTransactionRequest.status.equals("INITIATED")
+// }
+//
+// // Check the input transactionRequestType is the same as when the user created the TransactionRequest
+// existingTransactionRequestType = existingTransactionRequest.`type`
+// _ <- Helper.booleanToFuture(s"${TransactionRequestTypeHasChanged} It should be :'$existingTransactionRequestType', but current value (${transactionRequestType.value}) ", cc=callContext) {
+// existingTransactionRequestType.equals(transactionRequestType.value)
+// }
+//
+// // Check the challengeId is valid for this existingTransactionRequest
+// _ <- Helper.booleanToFuture(s"${InvalidTransactionRequestChallengeId}", cc=callContext) {
+// existingTransactionRequest.challenge.id.equals(challengeAnswerJson.id)
+// }
+//
+// //Check the challenge type, Note: not support yet, the default value is SANDBOX_TAN
+// _ <- Helper.booleanToFuture(s"${InvalidChallengeType} ", cc=callContext) {
+// existingTransactionRequest.challenge.challenge_type == ChallengeType.OBP_TRANSACTION_REQUEST_CHALLENGE.toString
+// }
+//
+// (isChallengeAnswerValidated, callContext) <- NewStyle.function.validateChallengeAnswer(challengeAnswerJson.id, challengeAnswerJson.answer, SuppliedAnswerType.PLAIN_TEXT_VALUE, callContext)
+//
+// _ <- Helper.booleanToFuture(s"${InvalidChallengeAnswer
+// .replace("answer may be expired.", s"answer may be expired (${transactionRequestChallengeTtl} seconds).")
+// .replace("up your allowed attempts.", s"up your allowed attempts (${allowedAnswerTransactionRequestChallengeAttempts} times).")
+// } ", cc = callContext) {
+// (isChallengeAnswerValidated == true)
+// }
+//
+// // All Good, proceed with the Transaction creation...
+// (transactionRequest, callContext) <- TransactionRequestTypes.withName(transactionRequestType.value) match {
+// case TRANSFER_TO_PHONE | TRANSFER_TO_ATM | TRANSFER_TO_ACCOUNT=>
+// NewStyle.function.createTransactionAfterChallengeV300(u, fromAccount, transReqId, transactionRequestType, callContext)
+// case _ =>
+// NewStyle.function.createTransactionAfterChallengeV210(fromAccount, existingTransactionRequest, callContext)
+// }
+// } yield {
+//
+// (JSONFactory210.createTransactionRequestWithChargeJSON(transactionRequest), HttpCode.`202`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getTransactionRequests,
+// apiVersion,
+// "getTransactionRequests",
+// "GET",
+// "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-requests",
+// "Get Transaction Requests." ,
+// """Returns transaction requests for account specified by ACCOUNT_ID at bank specified by BANK_ID.
+// |
+// |The VIEW_ID specified must be 'owner' and the user must have access to this view.
+// |
+// |Version 2.0.0 now returns charge information.
+// |
+// |Transaction Requests serve to initiate transactions that may or may not proceed. They contain information including:
+// |
+// |* Transaction Request Id
+// |* Type
+// |* Status (INITIATED, COMPLETED)
+// |* Challenge (in order to confirm the request)
+// |* From Bank / Account
+// |* Details including Currency, Value, Description and other initiation information specific to each type. (Could potentialy include a list of future transactions.)
+// |* Related Transactions
+// |
+// |PSD2 Context: PSD2 requires transparency of charges to the customer.
+// |This endpoint provides the charge that would be applied if the Transaction Request proceeds - and a record of that charge there after.
+// |The customer can proceed with the Transaction by answering the security challenge.
+// |
+// """.stripMargin,
+// EmptyBody,
+// transactionRequestWithChargeJSONs210,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// AccountNotFound,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagTransactionRequest, apiTagPsd2, apiTagOldStyle))
+//
+// lazy val getTransactionRequests: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-requests" :: Nil JsonGet _ => {
+// cc =>
+// if (APIUtil.getPropsAsBoolValue("transactionRequests_enabled", false)) {
+// for {
+// u <- cc.user ?~ AuthenticatedUserIsRequired
+// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
+// (fromAccount, callContext) <- BankAccountX(bankId, accountId, Some(cc)) ?~! {AccountNotFound}
+// view <- APIUtil.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
+// _ <- Helper.booleanToBox(view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_REQUESTS),
+// s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUESTS)}` permission on the View(${viewId.value} )")
+// (transactionRequests,callContext) <- Connector.connector.vend.getTransactionRequests210(u, fromAccount, callContext)
+// }
+// yield {
+// // Format the data as V2.0.0 json
+// val json = JSONFactory210.createTransactionRequestJSONs(transactionRequests)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// } else {
+// Full(errorJsonResponse(TransactionRequestsNotEnabled))
+// }
+// }
+// }
+//
+//
+// resourceDocs += ResourceDoc(
+// getRoles,
+// apiVersion,
+// "getRoles",
+// "GET",
+// "/roles",
+// "Get Roles",
+// s"""Returns all available roles
+// |
+// |${userAuthenticationMessage(true)}
+// """.stripMargin,
+// EmptyBody,
+// availableRolesJSON,
+// List(AuthenticatedUserIsRequired, UnknownError),
+// List(apiTagRole))
+//
+// lazy val getRoles: OBPEndpoint = {
+// case "roles" :: Nil JsonGet _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// _ <- authenticatedAccess(cc)
+// }
+// yield {
+// // Format the data as V2.1.0 json
+// val json = JSONFactory210.createAvailableRolesJSON(ApiRole.availableRoles.sorted)
+// (json, HttpCode.`200`(cc))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getEntitlementsByBankAndUser,
+// apiVersion,
+// "getEntitlementsByBankAndUser",
+// "GET",
+// "/banks/BANK_ID/users/USER_ID/entitlements",
+// "Get Entitlements for User at Bank",
+// s"""
+// |
+// |Get Entitlements specified by BANK_ID and USER_ID
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |
+// """.stripMargin,
+// EmptyBody,
+// entitlementJSONs,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagRole, apiTagEntitlement, apiTagUser),
+// Some(List(canGetEntitlementsForAnyUserAtOneBank, canGetEntitlementsForAnyUserAtAnyBank)))
+//
+//
+// lazy val getEntitlementsByBankAndUser: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "users" :: userId :: "entitlements" :: Nil JsonGet _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(loggedInUser), callContext) <- authenticatedAccess(cc)
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (_, callContext) <- NewStyle.function.findByUserId(userId, callContext)
+// allowedEntitlements = canGetEntitlementsForAnyUserAtOneBank ::
+// canGetEntitlementsForAnyUserAtAnyBank::
+// Nil
+// allowedEntitlementsTxt = UserHasMissingRoles + allowedEntitlements.mkString(" or ")
+// _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = allowedEntitlementsTxt)(bankId.value, loggedInUser.userId, allowedEntitlements, callContext)
+// entitlements <- NewStyle.function.getEntitlementsByUserId(userId, callContext)
+// }
+// yield {
+// val filteredEntitlements = entitlements.filter(_.bankId == bankId.value)
+// // Add virtual entitlements for super_admin_user_ids or oidc_operator_user_ids
+// val json = if (isSuperAdmin(userId)) {
+// JSONFactory200.withVirtualEntitlements(filteredEntitlements, JSONFactory200.superAdminVirtualRoles)
+// } else if (isOidcOperator(userId)) {
+// JSONFactory200.withVirtualEntitlements(filteredEntitlements, JSONFactory200.oidcOperatorVirtualRoles)
+// } else {
+// JSONFactory200.createEntitlementJSONs(filteredEntitlements)
+// }
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getConsumer,
+// apiVersion,
+// "getConsumer",
+// "GET",
+// "/management/consumers/CONSUMER_ID",
+// "Get Consumer",
+// s"""Get the Consumer specified by CONSUMER_ID.
+// |
+// |""",
+// EmptyBody,
+// consumerJSON,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// InvalidConsumerId,
+// UnknownError
+// ),
+// List(apiTagConsumer, apiTagOldStyle),
+// Some(List(canGetConsumers)))
+//
+//
+// lazy val getConsumer: OBPEndpoint = {
+// case "management" :: "consumers" :: consumerId :: Nil JsonGet _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired
+// _ <- NewStyle.function.ownEntitlement("", u.userId, ApiRole.canGetConsumers, cc.callContext)
+//
+// consumerIdToLong <- tryo{consumerId.toLong} ?~! InvalidConsumerId
+// consumer <- Consumers.consumers.vend.getConsumerByPrimaryId(consumerIdToLong)
+// } yield {
+// val json = createConsumerJSON(consumer)
+// // Return
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getConsumers,
+// apiVersion,
+// "getConsumers",
+// "GET",
+// "/management/consumers",
+// "Get Consumers",
+// s"""Get the all Consumers.
+// |
+// |""",
+// EmptyBody,
+// consumersJson,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagConsumer, apiTagOldStyle),
+// Some(List(canGetConsumers)))
+//
+//
+// lazy val getConsumers: OBPEndpoint = {
+// case "management" :: "consumers" :: Nil JsonGet _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired
+// _ <- NewStyle.function.ownEntitlement("", u.userId, ApiRole.canGetConsumers, cc.callContext)
+// consumers <- Some(Consumer.findAll())
+// } yield {
+// // Format the data as json
+// val json = createConsumerJSONs(consumers.sortWith(_.id.get < _.id.get))
+// // Return
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// enableDisableConsumers,
+// apiVersion,
+// "enableDisableConsumers",
+// "PUT",
+// "/management/consumers/CONSUMER_ID",
+// "Enable or Disable Consumers",
+// s"""Enable/Disable a Consumer specified by CONSUMER_ID.
+// |
+// |""",
+// putEnabledJSON,
+// putEnabledJSON,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagConsumer, apiTagOldStyle),
+// Some(List(canEnableConsumers,canDisableConsumers)))
+//
+//
+// lazy val enableDisableConsumers: OBPEndpoint = {
+// case "management" :: "consumers" :: consumerId :: Nil JsonPut json -> _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired
+// putData <- tryo{json.extract[PutEnabledJSON]} ?~! InvalidJsonFormat
+// _ <- putData.enabled match {
+// case true => NewStyle.function.ownEntitlement("", u.userId, ApiRole.canEnableConsumers, cc.callContext)
+// case false => NewStyle.function.ownEntitlement("", u.userId, ApiRole.canDisableConsumers, cc.callContext)
+// }
+// consumer <- Consumers.consumers.vend.getConsumerByPrimaryId(consumerId.toLong)
+// updatedConsumer <- Consumers.consumers.vend.updateConsumer(consumer.id.get, None, None, Some(putData.enabled), None, None, None, None, None, None, None, None) ?~! "Cannot update Consumer"
+// } yield {
+// // Format the data as json
+// val json = PutEnabledJSON(updatedConsumer.isActive.get)
+// // Return
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+//
+//
+//
+// resourceDocs += ResourceDoc(
+// addCardForBank,
+// apiVersion,
+// "addCardsForBank",
+// "POST",
+// "/banks/BANK_ID/cards",
+// "Create Card",
+// s"""Create Card at bank specified by BANK_ID .
+// |
+// |${userAuthenticationMessage(true)}
+// |""",
+// postPhysicalCardJSON,
+// physicalCardJSON,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// AllowedValuesAre,
+// UnknownError
+// ),
+// List(apiTagCard),
+// Some(List(canCreateCardsForBank)))
+//
+//
+// lazy val addCardForBank: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "cards" :: Nil JsonPost json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canCreateCardsForBank, callContext)
+// failMsg = s"$InvalidJsonFormat The Json body should be the $PostPhysicalCardJSON "
+// postJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// json.extract[PostPhysicalCardJSON]
+// }
+//
+// _<-Helper.booleanToFuture(s"${maximumLimitExceeded.replace("10000", "10")} Current issue_number is ${postJson.issue_number}", cc=callContext)(postJson.issue_number.length<= 10)
+//
+// _ <- postJson.allows match {
+// case List() => Future {true}
+// case _ => Helper.booleanToFuture(AllowedValuesAre + CardAction.availableValues.mkString(", "), cc=callContext)(postJson.allows.forall(a => CardAction.availableValues.contains(a)))
+// }
+//
+// failMsg = AllowedValuesAre + CardReplacementReason.availableValues.mkString(", ")
+// replacementReasionRequest <- NewStyle.function.tryons(failMsg, 400, callContext) {
+// CardReplacementReason.valueOf(postJson.replacement.reason_requested)
+// }
+//
+// (_, callContext)<- NewStyle.function.getBankAccount(bankId, AccountId(postJson.account_id), callContext)
+//
+// (card, callContext) <- NewStyle.function.createPhysicalCard(
+// bankCardNumber=postJson.bank_card_number,
+// nameOnCard=postJson.name_on_card,
+// cardType = "",// this field is introduced from V310
+// issueNumber=postJson.issue_number,
+// serialNumber=postJson.serial_number,
+// validFrom=postJson.valid_from_date,
+// expires=postJson.expires_date,
+// enabled=postJson.enabled,
+// cancelled=false,
+// onHotList=false,
+// technology=postJson.technology,
+// networks= postJson.networks,
+// allows= postJson.allows,
+// accountId= postJson.account_id,
+// bankId=bankId.value,
+// replacement= Some(CardReplacementInfo(requestedDate = postJson.replacement.requested_date, replacementReasionRequest)),
+// pinResets= postJson.pin_reset.map(e => PinResetInfo(e.requested_date, PinResetReason.valueOf(e.reason_requested.toUpperCase))),
+// collected= Option(CardCollectionInfo(postJson.collected)),
+// posted= Option(CardPostedInfo(postJson.posted)),
+// customerId = "",// this field is introduced from V310
+// cvv = "",// this field is introduced from V500
+// brand = "",// this field is introduced from V500
+// callContext
+// )
+//
+// } yield {
+// (JSONFactory1_3_0.createPhysicalCardJSON(card, u), HttpCode.`201`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getUsers,
+// apiVersion,
+// "getUsers",
+// "GET",
+// "/users",
+// "Get all Users",
+// s"""Get all users
+// |
+// |Login is required.
+// |CanGetAnyUser entitlement is required,
+// |
+// |${urlParametersDocument(false, false)}
+// |* locked_status (if null ignore)
+// |
+// """.stripMargin,
+// EmptyBody,
+// usersJsonV200,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagUser),
+// Some(List(canGetAnyUser)))
+//
+//
+// lazy val getUsers: OBPEndpoint = {
+// case "users" :: Nil JsonGet _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetAnyUser, callContext)
+// queryParams <- unboxFullAndWrapIntoFuture{ createQueriesByHttpParams(callContext.get.requestHeaders) }
+// users <- Users.users.vend.getAllUsersF(queryParams)
+// } yield {
+// (JSONFactory210.createUserJSONs (users), callContext)
+// }
+// }
+// }
+//
+// val getTransactionTypesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getTransactionTypesIsPublic", true)
+//
+// resourceDocs += ResourceDoc(
+// createTransactionType,
+// apiVersion,
+// "createTransactionType",
+// "PUT",
+// "/banks/BANK_ID/transaction-types",
+// "Create Transaction Type at bank",
+// // TODO get the documentation of the parameters from the scala doc of the case class we return
+// s"""Create Transaction Types for the bank specified by BANK_ID:
+// |
+// | * id : Unique transaction type id across the API instance. SHOULD be a UUID. MUST be unique.
+// | * bank_id : The bank that supports this TransactionType
+// | * short_code : A short code (SHOULD have no-spaces) which MUST be unique across the bank. May be stored with Transactions to link here
+// | * summary : A succinct summary
+// | * description : A longer description
+// | * charge : The charge to the customer for each one of these
+// |
+// |${userAuthenticationMessage(getTransactionTypesIsPublic)}""".stripMargin,
+// transactionTypeJsonV200,
+// transactionType,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// InvalidJsonFormat,
+// InsufficientAuthorisationToCreateTransactionType,
+// UnknownError
+// ),
+// List(apiTagBank),
+// Some(List(canCreateTransactionType))
+// )
+//
+//
+//
+// lazy val createTransactionType: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "transaction-types" :: Nil JsonPut json -> _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// postedData <- NewStyle.function.tryons(failMsg=InvalidJsonFormat, callContext=callContext) {json.extract[TransactionTypeJsonV200]}
+// _ <- Future (NewStyle.function.ownEntitlement(bankId.value, u.userId, canCreateTransactionType, callContext, InsufficientAuthorisationToCreateTransactionType))map { fullBoxOrException(_)} map { unboxFull(_) }
+// returnTranscationType <- Future(TransactionType.TransactionTypeProvider.vend.createOrUpdateTransactionType(postedData)) map { fullBoxOrException(_)} map { unboxFull(_) }
+// } yield {
+// (returnTranscationType, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+//
+// val getAtmsIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getAtmsIsPublic", true)
+//
+// resourceDocs += ResourceDoc(
+// getAtm,
+// apiVersion,
+// "getAtm",
+// "GET",
+// "/banks/BANK_ID/atms/ATM_ID",
+// "Get Bank ATM",
+// s"""Returns information about ATM for a single bank specified by BANK_ID and ATM_ID including:
+// |
+// |* Address
+// |* Geo Location
+// |* License the data under this endpoint is released under
+// |
+// |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
+// EmptyBody,
+// atmJson,
+// List(AuthenticatedUserIsRequired, BankNotFound, AtmNotFoundByAtmId, UnknownError),
+// List(apiTagATM, apiTagOldStyle)
+// )
+//
+// lazy val getAtm: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "atms" :: AtmId(atmId) :: Nil JsonGet _ => {
+// cc =>{
+// for {
+// // Get atm from the active provider
+// _ <- if (getAtmsIsPublic)
+// Box(Some(1))
+// else
+// cc.user ?~! AuthenticatedUserIsRequired
+// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
+// atm <- Box(Atms.atmsProvider.vend.getAtm(bankId, atmId)) ?~! {AtmNotFoundByAtmId}
+// } yield {
+// // Format the data as json
+// val json = JSONFactory1_4_0.createAtmJson(atm)
+// // Return
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+// }
+//
+// val getBranchesIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getBranchesIsPublic", true)
+//
+// resourceDocs += ResourceDoc(
+// getBranch,
+// apiVersion,
+// "getBranch",
+// "GET",
+// "/banks/BANK_ID/branches/BRANCH_ID",
+// "Get Bank Branch",
+// s"""Returns information about branches for a single bank specified by BANK_ID and BRANCH_ID including:
+// | meta.license.id and eta.license.name fields must not be empty.
+// |
+// |* Name
+// |* Address
+// |* Geo Location
+// |* License the data under this endpoint is released under
+// |
+// |${userAuthenticationMessage(!getBranchesIsPublic)}""".stripMargin,
+// EmptyBody,
+// branchJson,
+// List(
+// AuthenticatedUserIsRequired,
+// BranchNotFoundByBranchId,
+// UnknownError
+// ),
+// List(apiTagBranch, apiTagOldStyle)
+// )
+//
+// lazy val getBranch: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "branches" :: BranchId(branchId) :: Nil JsonGet _ => {
+// cc =>{
+// for {
+// _ <- if (getBranchesIsPublic)
+// Box(Some(1))
+// else
+// cc.user ?~! AuthenticatedUserIsRequired
+// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
+// branch <- Box(Branches.branchesProvider.vend.getBranch(bankId, branchId)) ?~! BranchNotFoundByBranchId
+// } yield {
+// // Format the data as json
+// val json = JSONFactory1_4_0.createBranchJson(branch)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+// }
+//
+// val getProductsIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getProductsIsPublic", true)
+//
+//
+// resourceDocs += ResourceDoc(
+// getProduct,
+// apiVersion,
+// "getProduct",
+// "GET",
+// "/banks/BANK_ID/products/PRODUCT_CODE",
+// "Get Bank Product",
+// s"""Returns information about the financial products offered by a bank specified by BANK_ID and PRODUCT_CODE including:
+// |
+// |* Name
+// |* Code
+// |* Category
+// |* Family
+// |* Super Family
+// |* More info URL
+// |* Description
+// |* Terms and Conditions
+// |* License the data under this endpoint is released under
+// |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
+// EmptyBody,
+// productJsonV210,
+// List(
+// AuthenticatedUserIsRequired,
+// ProductNotFoundByProductCode,
+// UnknownError
+// ),
+// List(apiTagProduct)
+// )
+//
+// lazy val getProduct: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "products" :: ProductCode(productCode) :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (_, callContext) <- getProductsIsPublic match {
+// case false => authenticatedAccess(cc)
+// case true => anonymousAccess(cc)
+// }
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (product, callContext) <- NewStyle.function.getProduct(bankId, productCode, callContext)
+// } yield {
+// (JSONFactory210.createProductJson(product), HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getProducts,
+// apiVersion,
+// "getProducts",
+// "GET",
+// "/banks/BANK_ID/products",
+// "Get Bank Products",
+// s"""Returns information about the financial products offered by a bank specified by BANK_ID including:
+// |
+// |* Name
+// |* Code
+// |* Category
+// |* Family
+// |* Super Family
+// |* More info URL
+// |* Description
+// |* Terms and Conditions
+// |* License the data under this endpoint is released under
+// |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
+// EmptyBody,
+// productsJsonV210,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// ProductNotFoundByProductCode,
+// UnknownError
+// ),
+// List(apiTagProduct)
+// )
+//
+// lazy val getProducts : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "products" :: Nil JsonGet req => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (_, callContext) <- getProductsIsPublic match {
+// case false => authenticatedAccess(cc)
+// case true => anonymousAccess(cc)
+// }
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// params = req.params.toList.map(kv => GetProductsParam(kv._1, kv._2))
+// (products,callContext) <- NewStyle.function.getProducts(bankId, params, callContext)
+// } yield {
+// (JSONFactory210.createProductsJson(products), HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+// val createCustomerEntitlementsRequiredForSpecificBank = canCreateCustomer ::
+// canCreateUserCustomerLink ::
+// Nil
+// val createCustomerEntitlementsRequiredForAnyBank = canCreateCustomerAtAnyBank ::
+// canCreateUserCustomerLinkAtAnyBank ::
+// Nil
+// val createCustomeEntitlementsRequiredText = createCustomerEntitlementsRequiredForSpecificBank.mkString(" and ") + " OR " + createCustomerEntitlementsRequiredForAnyBank.mkString(" and ")
+//
+// resourceDocs += ResourceDoc(
+// createCustomer,
+// apiVersion,
+// "createCustomer",
+// "POST",
+// "/banks/BANK_ID/customers",
+// "Create Customer",
+// s"""Add a customer linked to the user specified by user_id
+// |The Customer resource stores the customer number, legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
+// |Dates need to be in the format 2013-01-21T23:08:00Z
+// |
+// |${userAuthenticationMessage(true)}
+// |
+// |$createCustomeEntitlementsRequiredText
+// |""",
+// postCustomerJsonV210,
+// customerJsonV210,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// InvalidJsonFormat,
+// CustomerNumberAlreadyExists,
+// UserNotFoundById,
+// CustomerAlreadyExistsForUser,
+// CreateConsumerError,
+// UnknownError
+// ),
+// List(apiTagCustomer, apiTagPerson, apiTagOldStyle),
+// Some(List(canCreateCustomer,canCreateUserCustomerLink,canCreateCustomerAtAnyBank,canCreateUserCustomerLinkAtAnyBank)))
+//
+// // TODO in next version?
+// // Separate customer creation (keep here) from customer linking (remove from here)
+// // Remove user_id from CreateCustomerJson
+//
+// // Note: Logged in user can no longer create a customer for himself
+//
+//
+// lazy val createCustomer : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: Nil JsonPost json -> _ => {
+// cc =>
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired // TODO. CHECK user has role to create a customer / create a customer for another user id.
+// _ <- tryo(assert(isValidID(bankId.value)))?~! InvalidBankIdFormat
+// (bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
+// postedData <- tryo{json.extract[PostCustomerJsonV210]} ?~! InvalidJsonFormat
+// _ <- Helper.booleanToBox(
+// !`checkIfContains::::` (postedData.customer_number), s"$InvalidJsonFormat customer_number can not contain `::::` characters")
+// _ <- NewStyle.function.hasAllEntitlements(bankId.value, u.userId, createCustomerEntitlementsRequiredForSpecificBank, createCustomerEntitlementsRequiredForAnyBank, callContext)
+// _ <- tryo(assert(CustomerX.customerProvider.vend.checkCustomerNumberAvailable(bankId, postedData.customer_number) == true)) ?~! CustomerNumberAlreadyExists
+// user_id <- tryo (if (postedData.user_id.nonEmpty) postedData.user_id else u.userId) ?~! s"Problem getting user_id"
+// customer_user <- UserX.findByUserId(user_id) ?~! UserNotFoundById
+// customer <- CustomerX.customerProvider.vend.addCustomer(bankId,
+// postedData.customer_number,
+// postedData.legal_name,
+// postedData.mobile_phone_number,
+// postedData.email,
+// CustomerFaceImage(postedData.face_image.date, postedData.face_image.url),
+// postedData.date_of_birth,
+// postedData.relationship_status,
+// postedData.dependants,
+// postedData.dob_of_dependants,
+// postedData.highest_education_attained,
+// postedData.employment_status,
+// postedData.kyc_status,
+// postedData.last_ok_date,
+// Option(CreditRating(postedData.credit_rating.rating, postedData.credit_rating.source)),
+// Option(CreditLimit(postedData.credit_limit.currency, postedData.credit_limit.amount)),
+// "",
+// "",
+// "") ?~! CreateConsumerError
+// _ <- booleanToBox(UserCustomerLink.userCustomerLink.vend.getUserCustomerLink(user_id, customer.customerId).isEmpty == true) ?~! CustomerAlreadyExistsForUser
+// _ <- UserCustomerLink.userCustomerLink.vend.createUserCustomerLink(user_id, customer.customerId, new Date(), true) ?~! CreateUserCustomerLinksError
+//
+// } yield {
+// val json = JSONFactory210.createCustomerJson(customer)
+// val successJson = Extraction.decompose(json)
+// successJsonResponse(successJson, 201)
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getCustomersForUser,
+// apiVersion,
+// "getCustomersForUser",
+// "GET",
+// "/users/current/customers",
+// "Get Customers for Current User",
+// """Gets all Customers that are linked to a User.
+// |
+// |Authentication via OAuth is required.""",
+// EmptyBody,
+// customerJsonV210,
+// List(
+// AuthenticatedUserIsRequired,
+// UserCustomerLinksNotFoundForUser,
+// UnknownError
+// ),
+// List(apiTagCustomer, apiTagUser, apiTagOldStyle))
+//
+// lazy val getCustomersForUser : OBPEndpoint = {
+// case "users" :: "current" :: "customers" :: Nil JsonGet _ => {
+// cc => {
+// for {
+// u <- cc.user ?~! AuthenticatedUserIsRequired
+// customers <- tryo{CustomerX.customerProvider.vend.getCustomersByUserId(u.userId)} ?~! UserCustomerLinksNotFoundForUser
+// } yield {
+// val json = JSONFactory210.createCustomersJson(customers)
+// successJsonResponse(Extraction.decompose(json))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getCustomersForCurrentUserAtBank,
+// apiVersion,
+// "getCustomersForCurrentUserAtBank",
+// "GET",
+// "/banks/BANK_ID/customers",
+// "Get Customers for current User at Bank",
+// s"""Returns a list of Customers at the Bank that are linked to the currently authenticated User.
+// |
+// |
+// |${userAuthenticationMessage(true)}""".stripMargin,
+// EmptyBody,
+// customerJSONs,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// UserCustomerLinksNotFoundForUser,
+// UserCustomerLinksNotFoundForUser,
+// CustomerNotFoundByCustomerId,
+// UnknownError
+// ),
+// List(apiTagCustomer)
+// )
+//
+// lazy val getCustomersForCurrentUserAtBank : OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "customers" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// (customers, callContext) <- Connector.connector.vend.getCustomersByUserId(u.userId, callContext) map {
+// connectorEmptyResponse(_, callContext)
+// }
+// } yield {
+// // Filter so we only see the ones for the bank in question
+// val bankCustomers = customers.filter(_.bankId==bankId.value)
+// val json = JSONFactory210.createCustomersJson(bankCustomers)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// updateBranch,
+// apiVersion,
+// "updateBranch",
+// "PUT",
+// "/banks/BANK_ID/branches/BRANCH_ID",
+// "Update Branch",
+// s"""Update an existing branch for a bank account (Authenticated access).
+// |${userAuthenticationMessage(true)}
+// |""",
+// branchJsonPut,
+// branchJson,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// InvalidJsonFormat,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagBranch),
+// Some(List(canUpdateBranch)))
+//
+//
+// lazy val updateBranch: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "branches" :: BranchId(branchId):: Nil JsonPut json -> _ => {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// branchJsonPutV210 <- NewStyle.function.tryons(failMsg = InvalidJsonFormat + " BranchJsonPutV210", 400, callContext) {
+// json.extract[BranchJsonPutV210]
+// }
+// _ <- Helper.booleanToFuture(failMsg = s"$InvalidJsonValue BANK_ID has to be the same in the URL and Body", 400, callContext) {
+// branchJsonPutV210.bank_id == bank.bankId.value
+// }
+// _ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, ApiRole.canUpdateBranch, callContext)
+// branch <- NewStyle.function.tryons(CouldNotTransformJsonToInternalModel + " Branch", 400, callContext) {
+// transformToBranch(branchId, branchJsonPutV210).head
+// }
+// (success, callContext) <- NewStyle.function.createOrUpdateBranch(branch, callContext)
+// } yield {
+// val json = JSONFactory1_4_0.createBranchJson(success)
+// (json, HttpCode.`201`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// createBranch,
+// apiVersion,
+// "createBranch",
+// "POST",
+// "/banks/BANK_ID/branches",
+// "Create Branch",
+// s"""Create branch for the bank (Authenticated access).
+// |${userAuthenticationMessage(true)}
+// |""",
+// branchJsonPost,
+// branchJson,
+// List(
+// AuthenticatedUserIsRequired,
+// BankNotFound,
+// InvalidJsonFormat,
+// InsufficientAuthorisationToCreateBranch,
+// UnknownError
+// ),
+// List(apiTagBranch, apiTagOpenData),
+// Some(List(canCreateBranch, canCreateBranchAtAnyBank)))
+//
+// lazy val createBranch: OBPEndpoint = {
+// case "banks" :: BankId(bankId) :: "branches" :: Nil JsonPost json -> _ =>
+// {
+// cc => implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
+// branchJsonPostV210 <- NewStyle.function.tryons(failMsg = InvalidJsonFormat + " BranchJsonPostV210", 400, callContext) {
+// json.extract[BranchJsonPostV210]
+// }
+// _ <- Helper.booleanToFuture(failMsg = s"$InvalidJsonValue BANK_ID has to be the same in the URL and Body", 400, callContext) {
+// branchJsonPostV210.bank_id == bank.bankId.value
+// }
+// _ <- Future(
+// NewStyle.function.hasAllEntitlements(bank.bankId.value, u.userId, canCreateBranch::Nil, canCreateBranchAtAnyBank::Nil, cc.callContext)
+// )
+// branch <- NewStyle.function.tryons(CouldNotTransformJsonToInternalModel + " Branch", 400, cc.callContext) {
+// transformToBranch(branchJsonPostV210).head
+// }
+// (success, callContext) <- NewStyle.function.createOrUpdateBranch(branch, callContext)
+// } yield {
+// val json = JSONFactory1_4_0.createBranchJson(success)
+// (json, HttpCode.`201`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// updateConsumerRedirectUrl,
+// apiVersion,
+// "updateConsumerRedirectUrl",
+// "PUT",
+// "/management/consumers/CONSUMER_ID/consumer/redirect_url",
+// "Update Consumer RedirectUrl",
+// s"""Update an existing redirectUrl for a Consumer specified by CONSUMER_ID.
+// |
+// | CONSUMER_ID can be obtained after you register the application.
+// |
+// | Or use the endpoint 'Get Consumers' to get it
+// |
+// """.stripMargin,
+// consumerRedirectUrlJSON,
+// consumerJSON,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagConsumer),
+// Some(List(canUpdateConsumerRedirectUrl))
+// )
+//
+// lazy val updateConsumerRedirectUrl: OBPEndpoint = {
+// case "management" :: "consumers" :: consumerId :: "consumer" :: "redirect_url" :: Nil JsonPut json -> _ => {
+// cc =>
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- APIUtil.getPropsAsBoolValue("consumers_enabled_by_default", false) match {
+// case true => Future(Full(Unit))
+// case false => NewStyle.function.hasEntitlement("", u.userId, ApiRole.canUpdateConsumerRedirectUrl, callContext)
+// }
+// postJson <- NewStyle.function.tryons(InvalidJsonFormat, 400, callContext) {
+// json.extract[ConsumerRedirectUrlJSON]
+// }
+// consumerIdToLong <- NewStyle.function.tryons(InvalidConsumerId, 400, callContext) {
+// consumerId.toLong
+// }
+// consumer <- NewStyle.function.getConsumerByPrimaryId(consumerIdToLong, callContext)
+// //only the developer that created the Consumer should be able to edit it
+// _ <- Helper.booleanToFuture(UserNoPermissionUpdateConsumer, 400, callContext) {
+// consumer.createdByUserId.equals(u.userId)
+// }
+// //update the redirectURL and isactive (set to false when change redirectUrl) field in consumer table
+// updatedConsumer <- NewStyle.function.updateConsumer(
+// id = consumer.id.get,
+// isActive = Some(APIUtil.getPropsAsBoolValue("consumers_enabled_by_default", false)),
+// redirectURL = Some(postJson.redirect_url),
+// callContext = callContext
+// )
+// } yield {
+// val json = JSONFactory210.createConsumerJSON(updatedConsumer)
+// (json, HttpCode.`200`(callContext))
+// }
+// }
+// }
+//
+// resourceDocs += ResourceDoc(
+// getMetrics,
+// apiVersion,
+// "getMetrics",
+// "GET",
+// "/management/metrics",
+// "Get Metrics",
+// s"""Get the all metrics
+// |
+// |require CanReadMetrics role
+// |
+// |Filters Part 1.*filtering* (no wilde cards etc.) parameters to GET /management/metrics
+// |
+// |Should be able to filter on the following metrics fields
+// |
+// |eg: /management/metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&limit=50&offset=2
+// |
+// |1 from_date (defaults to one week before current date): eg:from_date=$DateWithMsExampleString
+// |
+// |2 to_date (defaults to current date) eg:to_date=$DateWithMsExampleString
+// |
+// |3 limit (for pagination: defaults to 50) eg:limit=200
+// |
+// |4 offset (for pagination: zero index, defaults to 0) eg: offset=10
+// |
+// |5 sort_by (defaults to date field) eg: sort_by=date
+// | possible values:
+// | "url",
+// | "date",
+// | "username" (or "user_name" for backward compatibility),
+// | "app_name",
+// | "developer_email",
+// | "implemented_by_partial_function",
+// | "implemented_in_version",
+// | "consumer_id",
+// | "verb"
+// |
+// |6 direction (defaults to date desc) eg: direction=desc
+// |
+// |eg: /management/metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&limit=10000&offset=0&anon=false&app_name=TeatApp&implemented_in_version=v2.1.0&verb=POST&user_id=c7b6cb47-cb96-4441-8801-35b57456753a&username=susan.uk.29@example.com&consumer_id=78
+// |
+// |Other filters:
+// |
+// |7 consumer_id (if null ignore)
+// |
+// |8 user_id (if null ignore)
+// |
+// |9 anon (if null ignore) only support two value : true (return where user_id is null.) or false (return where user_id is not null.)
+// |
+// |10 url (if null ignore), note: can not contain '&'.
+// |
+// |11 app_name (if null ignore)
+// |
+// |12 implemented_by_partial_function (if null ignore),
+// |
+// |13 implemented_in_version (if null ignore)
+// |
+// |14 verb (if null ignore)
+// |
+// |15 correlation_id (if null ignore)
+// |
+// |16 duration (if null ignore) non digit chars will be silently omitted
+// |
+// """.stripMargin,
+// EmptyBody,
+// metricsJson,
+// List(
+// AuthenticatedUserIsRequired,
+// UserHasMissingRoles,
+// UnknownError
+// ),
+// List(apiTagMetric, apiTagApi),
+// Some(List(canReadMetrics)))
+//
+// lazy val getMetrics : OBPEndpoint = {
+// case "management" :: "metrics" :: Nil JsonGet _ => {
+// cc => {
+// implicit val ec = EndpointContext(Some(cc))
+// for {
+// (Full(u), callContext) <- authenticatedAccess(cc)
+// _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canReadMetrics, callContext)
+// httpParams <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
+// (obpQueryParams, callContext) <- createQueriesByHttpParamsFuture(httpParams, callContext)
+// metrics <- Future(APIMetrics.apiMetrics.vend.getAllMetrics(obpQueryParams))
+// } yield {
+// (JSONFactory210.createMetricsJson(metrics), HttpCode.`200`(callContext))
+// }
+// }
+// }
+// }
+// }
+//}
diff --git a/obp-api/src/main/scala/code/api/v2_1_0/Http4s210.scala b/obp-api/src/main/scala/code/api/v2_1_0/Http4s210.scala
index 4e2f31d65b..64495cc76f 100644
--- a/obp-api/src/main/scala/code/api/v2_1_0/Http4s210.scala
+++ b/obp-api/src/main/scala/code/api/v2_1_0/Http4s210.scala
@@ -164,18 +164,21 @@ object Http4s210 {
// The 4 transaction request types this version knows how to handle. v4.0.0 adds more
// (ACCOUNT, ACCOUNT_OTP, REFUND, SIMPLE, AGENT_CASH_WITHDRAWAL, CARD); the route guard
- // below keeps unsupported types out of v2.1.0's handler so they fall through the
- // bridge cascade to the v4 Lift endpoint that knows the type.
private val v210SupportedTransactionRequestTypes: Set[String] =
Set("SANDBOX_TAN", "COUNTERPARTY", "SEPA", "FREE_FORM")
val createTransactionRequest: HttpRoutes[IO] = HttpRoutes.of[IO] {
- case req @ POST -> `prefixPath` / "banks" / _ / "accounts" / _ / viewIdStr / "transaction-request-types" / transactionRequestTypeStr / "transaction-requests"
- if v210SupportedTransactionRequestTypes.contains(transactionRequestTypeStr) =>
+ case req @ POST -> `prefixPath` / "banks" / _ / "accounts" / _ / viewIdStr / "transaction-request-types" / transactionRequestTypeStr / "transaction-requests" =>
implicit val cc: CallContext = req.callContext
// Use cc.httpBody (cached by ResourceDocMiddleware via cachedBodyKey) instead of re-reading
// req.bodyText, which is empty after the bridge cascade has already consumed the stream.
(for {
+ // Check type validity before requiring middleware-resolved entities: for an invalid
+ // type the middleware finds no matching ResourceDoc and skips bankAccount resolution,
+ // so cc.bankAccount is None — checking the type first avoids a misleading AccountNotFound.
+ _ <- if (v210SupportedTransactionRequestTypes.contains(transactionRequestTypeStr)) IO.unit
+ else IO.raiseError(new RuntimeException(liftWrite(code.api.APIFailureNewStyle(
+ s"$InvalidTransactionRequestType: '$transactionRequestTypeStr'", 400, Some(cc.toLight)))))
jsonBody <- IO.pure(cc.httpBody.getOrElse(""))
user <- IO.fromOption(cc.user.toOption)(new RuntimeException(AuthenticatedUserIsRequired))
account <- IO.fromOption(cc.bankAccount)(new RuntimeException(AccountNotFound))
diff --git a/obp-api/src/main/scala/code/api/v2_1_0/OBPAPI2_1_0.scala b/obp-api/src/main/scala/code/api/v2_1_0/OBPAPI2_1_0.scala
index eaab7b2d05..7ce814507a 100644
--- a/obp-api/src/main/scala/code/api/v2_1_0/OBPAPI2_1_0.scala
+++ b/obp-api/src/main/scala/code/api/v2_1_0/OBPAPI2_1_0.scala
@@ -1,221 +1,30 @@
-/**
-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.v2_1_0
import scala.language.reflectiveCalls
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.util.APIUtil.OBPEndpoint
+import code.api.util.VersionedOBPApis
+import code.api.v2_0_0.OBPAPI2_0_0
import code.util.Helper.MdcLoggable
-import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
-
-import scala.collection.immutable.Nil
-
-object OBPAPI2_1_0 extends OBPRestHelper with APIMethods130 with APIMethods140 with APIMethods200 with APIMethods210 with MdcLoggable with VersionedOBPApis{
-
-
-
+import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
- val version : ApiVersion = ApiVersion.v2_1_0 //"2.1.0"
+/*
+This file defines which endpoints from all the versions are available in v2.1.0.
+All v2.1.0 endpoints have been migrated to Http4s210 — this object is retained
+only for resource-doc aggregation and the Lift dispatch registry.
+ */
+object OBPAPI2_1_0 extends OBPRestHelper with MdcLoggable with VersionedOBPApis {
+ val version: ApiVersion = ApiVersion.v2_1_0
val versionStatus = ApiVersionStatus.STABLE.toString
- // Possible Endpoints 1.2.1
- lazy val endpointsOf1_2_1 = Implementations1_2_1.addCommentForViewOnTransaction ::
- Implementations1_2_1.addCounterpartyCorporateLocation::
- Implementations1_2_1.addCounterpartyImageUrl ::
- Implementations1_2_1.addCounterpartyMoreInfo ::
- Implementations1_2_1.addCounterpartyOpenCorporatesUrl ::
- Implementations1_2_1.addCounterpartyPhysicalLocation ::
- Implementations1_2_1.addOtherAccountPrivateAlias ::
- Implementations1_2_1.addCounterpartyPublicAlias ::
- Implementations1_2_1.addCounterpartyUrl ::
- Implementations1_2_1.addImageForViewOnTransaction ::
- Implementations1_2_1.addPermissionForUserForBankAccountForMultipleViews ::
- Implementations1_2_1.addPermissionForUserForBankAccountForOneView ::
- Implementations1_2_1.addTagForViewOnTransaction ::
- Implementations1_2_1.addTransactionNarrative ::
- Implementations1_2_1.addWhereTagForViewOnTransaction ::
- // Now in 2.0.0 "allAccountsAllBanks"::
- Implementations1_2_1.bankById ::
- Implementations1_2_1.createViewForBankAccount ::
- Implementations1_2_1.deleteCommentForViewOnTransaction ::
- Implementations1_2_1.deleteCommentForViewOnTransaction ::
- Implementations1_2_1.deleteCounterpartyCorporateLocation ::
- Implementations1_2_1.deleteCounterpartyImageUrl ::
- Implementations1_2_1.deleteCounterpartyMoreInfo ::
- Implementations1_2_1.deleteCounterpartyOpenCorporatesUrl ::
- Implementations1_2_1.deleteCounterpartyPhysicalLocation ::
- Implementations1_2_1.deleteCounterpartyPrivateAlias ::
- Implementations1_2_1.deleteCounterpartyPublicAlias ::
- Implementations1_2_1.deleteCounterpartyUrl ::
- Implementations1_2_1.deleteImageForViewOnTransaction ::
- Implementations1_2_1.deleteTagForViewOnTransaction ::
- Implementations1_2_1.deleteTransactionNarrative ::
- Implementations1_2_1.deleteViewForBankAccount::
- Implementations1_2_1.deleteWhereTagForViewOnTransaction ::
- Implementations1_2_1.getBanks ::
- Implementations1_2_1.getCommentsForViewOnTransaction ::
- Implementations1_2_1.getOtherAccountsForBankAccount ::
- Implementations1_2_1.getOtherAccountByIdForBankAccount ::
- Implementations1_2_1.getOtherAccountForTransaction ::
- Implementations1_2_1.getOtherAccountMetadata ::
- Implementations1_2_1.getOtherAccountPrivateAlias ::
- Implementations1_2_1.getCounterpartyPublicAlias ::
- Implementations1_2_1.getImagesForViewOnTransaction ::
- Implementations1_2_1.getTagsForViewOnTransaction ::
- Implementations1_2_1.getTransactionByIdForBankAccount ::
- Implementations1_2_1.getTransactionNarrative ::
- Implementations1_2_1.getTransactionsForBankAccount ::
- Implementations1_2_1.getViewsForBankAccount ::
- Implementations1_2_1.getWhereTagForViewOnTransaction ::
- Implementations1_2_1.removePermissionForUserForBankAccountForAllViews ::
- Implementations1_2_1.removePermissionForUserForBankAccountForOneView ::
- Implementations1_2_1.updateAccountLabel ::
- Implementations1_2_1.updateCounterpartyCorporateLocation ::
- Implementations1_2_1.updateCounterpartyImageUrl ::
- Implementations1_2_1.updateCounterpartyMoreInfo ::
- Implementations1_2_1.updateCounterpartyOpenCorporatesUrl ::
- Implementations1_2_1.updateCounterpartyPhysicalLocation ::
- Implementations1_2_1.updateCounterpartyPrivateAlias ::
- Implementations1_2_1.updateCounterpartyPublicAlias ::
- Implementations1_2_1.updateCounterpartyUrl ::
- Implementations1_2_1.updateTransactionNarrative ::
- Implementations1_2_1.updateViewForBankAccount ::
- Implementations1_2_1.updateWhereTagForViewOnTransaction ::
- Nil
-
-
- // Possible Endpoints 1.3.0
- val endpointsOf1_3_0 = Implementations1_3_0.getCards ::
- Implementations1_3_0.getCardsForBank ::
- Nil
-
-
-
- // Possible Endpoints 1.4.0
- val endpointsOf1_4_0 = Implementations1_4_0.getCustomersMessages ::
- Implementations1_4_0.addCustomerMessage ::
- Implementations1_4_0.getBranches ::
- Implementations1_4_0.getAtms ::
- Implementations1_4_0.getCrmEvents ::
- Implementations1_4_0.getTransactionRequestTypes ::
- Nil
-
-
- // Possible Endpoints 2.0.0
- val endpointsOf2_0_0 = Implementations2_0_0.getPrivateAccountsAllBanks ::
- Implementations2_0_0.accountById ::
- Implementations2_0_0.addEntitlement ::
- Implementations2_0_0.addKycCheck ::
- Implementations2_0_0.addKycDocument ::
- Implementations2_0_0.addKycMedia ::
- Implementations2_0_0.addKycStatus ::
- Implementations2_0_0.addSocialMediaHandle ::
- Implementations2_0_0.getPrivateAccountsAtOneBank ::
- Implementations2_0_0.createAccount ::
-// Implementations2_0_0.createMeeting ::
- Implementations2_0_0.createUser ::
- Implementations2_0_0.createUserCustomerLinks ::
- Implementations2_0_0.deleteEntitlement ::
- Implementations2_0_0.elasticSearchMetrics ::
- Implementations2_0_0.elasticSearchWarehouse ::
- Implementations2_0_0.getAllEntitlements ::
- Implementations2_0_0.getCoreAccountById ::
- Implementations2_0_0.getCoreTransactionsForBankAccount ::
- Implementations2_0_0.getCurrentUser ::
- Implementations2_0_0.getEntitlements ::
- Implementations2_0_0.getKycChecks ::
- Implementations2_0_0.getKycDocuments ::
- Implementations2_0_0.getKycMedia ::
- Implementations2_0_0.getKycStatuses ::
-// Implementations2_0_0.getMeeting ::
-// Implementations2_0_0.getMeetings ::
- Implementations2_0_0.getPermissionForUserForBankAccount ::
- Implementations2_0_0.getPermissionsForBankAccount ::
- Implementations2_0_0.getSocialMediaHandles ::
- Implementations2_0_0.getTransactionTypes ::
- Implementations2_0_0.getUser ::
- Implementations2_0_0.corePrivateAccountsAllBanks ::
- Implementations2_0_0.privateAccountsAtOneBank ::
- Implementations2_0_0.publicAccountsAllBanks ::
- Implementations2_0_0.publicAccountsAtOneBank ::
- Nil
-
-
-
-
- // Possible Endpoints 2.1.0
- val endpointsOf2_1_0 = Implementations2_1_0.sandboxDataImport ::
- Implementations2_1_0.root ::
- Implementations2_1_0.getTransactionRequestTypesSupportedByBank ::
- Implementations2_1_0.createTransactionRequest ::
- Implementations2_1_0.answerTransactionRequestChallenge ::
- Implementations2_1_0.getTransactionRequests ::
- Implementations2_1_0.getRoles ::
- Implementations2_1_0.getEntitlementsByBankAndUser ::
- Implementations2_1_0.getConsumer ::
- Implementations2_1_0.getConsumers ::
- Implementations2_1_0.enableDisableConsumers ::
- Implementations2_1_0.addCardForBank ::
- Implementations2_1_0.getUsers ::
- Implementations2_1_0.createTransactionType ::
- Implementations2_1_0.getAtm ::
- Implementations2_1_0.getBranch ::
- Implementations2_1_0.updateBranch ::
- Implementations2_1_0.createBranch ::
- Implementations2_1_0.getProduct ::
- Implementations2_1_0.getProducts ::
- Implementations2_1_0.createCustomer ::
- Implementations2_1_0.getCustomersForCurrentUserAtBank ::
- Implementations2_1_0.getCustomersForUser ::
- Implementations2_1_0.updateConsumerRedirectUrl ::
- Implementations2_1_0.getMetrics ::
- Nil
-
- val allResourceDocs = Implementations2_1_0.resourceDocs ++
- Implementations2_0_0.resourceDocs ++
- Implementations1_4_0.resourceDocs ++
- Implementations1_3_0.resourceDocs ++
- Implementations1_2_1.resourceDocs
+ val Implementations2_1_0 = Http4s210.Implementations2_1_0
- // Filter the possible endpoints by the disabled / enabled Props settings and add them together
- val routes : List[OBPEndpoint] =
- getAllowedEndpoints(endpointsOf1_2_1, Implementations1_2_1.resourceDocs) :::
- getAllowedEndpoints(endpointsOf1_3_0, Implementations1_3_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf1_4_0, Implementations1_4_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf2_0_0, Implementations2_0_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf2_1_0, Implementations2_1_0.resourceDocs)
+ def allResourceDocs = collectResourceDocs(OBPAPI2_0_0.allResourceDocs, Http4s210.resourceDocs)
- registerRoutes(routes, allResourceDocs, apiPrefix)
+ val routes: List[OBPEndpoint] = Nil
- logger.info(s"version $version has been run! There are ${routes.length} routes.")
+ registerRoutes(routes, allResourceDocs, apiPrefix, true)
+ logger.info(s"version $version has been run! There are ${routes.length} routes, ${allResourceDocs.length} allResourceDocs.")
}
diff --git a/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala b/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala
index 88760f541f..6572cf49f1 100644
--- a/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala
+++ b/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala
@@ -1,1362 +1,9 @@
package code.api.v2_2_0
-import scala.language.reflectiveCalls
-import code.api.Constant._
-import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
-import code.api.util.APIUtil._
-import code.api.util.ApiRole._
-import code.api.util.ApiTag._
-import code.api.util.ErrorMessages.{BankAccountNotFound, _}
-import code.api.util.FutureUtil.EndpointContext
-import code.api.util.NewStyle.HttpCode
-import code.api.util._
-import code.api.util.newstyle.ViewNewStyle
-import code.api.v1_2_1.{CreateViewJsonV121, JSONFactory, UpdateViewJsonV121}
-import code.api.v2_1_0._
-import code.api.v2_2_0.JSONFactory220.transformV220ToBranch
-import code.api.v3_1_0.PostPutProductJsonV310
-import code.api.v4_0_0.AtmJsonV400
-import code.bankconnectors._
-import code.consumer.Consumers
-import code.entitlement.Entitlement
-import code.metadata.counterparties.{Counterparties, MappedCounterparty}
-import code.metrics.ConnectorMetricsProvider
-import code.model._
-import code.model.dataAccess.BankAccountCreation
-import code.util.Helper
-import code.util.Helper._
-import code.views.Views
-import code.views.system.ViewPermission
-import com.openbankproject.commons.ExecutionContext.Implicits.global
-import com.openbankproject.commons.model._
-import com.openbankproject.commons.util.ApiVersion
-import net.liftweb.common.Full
import net.liftweb.http.rest.RestHelper
-import net.liftweb.json.Extraction
-import net.liftweb.util.Helpers.tryo
-import net.liftweb.util.StringHelpers
-import java.util.Date
-import scala.collection.immutable.{List, Nil}
-import scala.collection.mutable.ArrayBuffer
-import scala.concurrent.Future
+trait APIMethods220 { self: RestHelper => }
-
-
-trait APIMethods220 {
- //needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
- self: RestHelper =>
-
- val Implementations2_2_0 = new Object() {
-
- val resourceDocs = ArrayBuffer[ResourceDoc]()
- val apiRelations = ArrayBuffer[ApiRelation]()
-
-
- val implementedInApiVersion = ApiVersion.v2_2_0
-
- val codeContext = CodeContext(resourceDocs, apiRelations)
-
-
- resourceDocs += ResourceDoc(
- root,
- implementedInApiVersion,
- "root",
- "GET",
- "/root",
- "Get API Info (root)",
- """Returns information about:
- |
- |* API version
- |* Hosted by information
- |* Git Commit""",
- EmptyBody,
- apiInfoJSON,
- List(UnknownError, MandatoryPropertyIsNotSet),
- apiTagApi :: Nil)
-
- lazy val root : OBPEndpoint = {
- case (Nil | "root" :: Nil) JsonGet _ => {
- cc =>
- implicit val ec = EndpointContext(Some(cc))
- for {
- _ <- Future(()) // Just start async call
- } yield {
- (JSONFactory.getApiInfoJSON(OBPAPI2_2_0.version, OBPAPI2_2_0.versionStatus), HttpCode.`200`(cc.callContext))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getViewsForBankAccount,
- implementedInApiVersion,
- "getViewsForBankAccount",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/views",
- "Get Views for Account",
- s"""#Views
- |
- |
- |Views in Open Bank Project provide a mechanism for fine grained access control and delegation to Accounts and Transactions. Account holders use the 'owner' view by default.
- |Delegated access is made through other views for example 'accountants', 'share-holders' or 'tagging-application'. Views can be created via the API and each view has a list of entitlements.
- |
- |Views on accounts and transactions filter the underlying data to redact certain fields for certain users. For instance the balance on an account may be hidden from the public. The way to know what is possible on a view is determined in the following JSON.
- |
- |**Data:** When a view moderates a set of data, some fields my contain the value `null` rather than the original value. This indicates either that the user is not allowed to see the original data or the field is empty.
- |
- |There is currently one exception to this rule; the 'holder' field in the JSON contains always a value which is either an alias or the real name - indicated by the 'is_alias' field.
- |
- |**Action:** When a user performs an action like trying to post a comment (with POST API call), if he is not allowed, the body response will contain an error message.
- |
- |**Metadata:**
- |Transaction metadata (like images, tags, comments, etc.) will appears *ONLY* on the view where they have been created e.g. comments posted to the public view only appear on the public view.
- |
- |The other account metadata fields (like image_URL, more_info, etc.) are unique through all the views. Example, if a user edits the 'more_info' field in the 'team' view, then the view 'authorities' will show the new value (if it is allowed to do it).
- |
- |# All
- |*Optional*
- |
- |Returns the list of the views created for account ACCOUNT_ID at BANK_ID.
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.""",
- EmptyBody,
- viewsJSONV220,
- List(
- AuthenticatedUserIsRequired,
- BankAccountNotFound,
- UnknownError
- ),
- List(apiTagView, apiTagAccount))
-
- lazy val getViewsForBankAccount : OBPEndpoint = {
- //get the available views on an bank account
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "views" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
- permission <- NewStyle.function.permission(bankId, accountId, u, callContext)
- anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)).find(true == _).getOrElse(false)
- _ <- Helper.booleanToFuture(
- s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT}` permission on any your views",
- cc= callContext
- ){
- anyViewContainsCanSeeAvailableViewsForBankAccountPermission
- }
- views <- Future(Views.views.vend.availableViewsForAccount(BankIdAccountId(account.bankId, account.accountId)))
- } yield {
- val viewsJSON = JSONFactory220.createViewsJSON(views)
- (viewsJSON, HttpCode.`200`(callContext))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- createViewForBankAccount,
- implementedInApiVersion,
- "createViewForBankAccount",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/views",
- "Create View",
- s"""#Create a view on bank account
- |
- | ${userAuthenticationMessage(true)} and the user needs to have access to the owner view.
- | The 'alias' field in the JSON can take one of three values:
- |
- | * _public_: to use the public alias if there is one specified for the other account.
- | * _private_: to use the private alias if there is one specified for the other account.
- |
- | * _''(empty string)_: to use no alias; the view shows the real name of the other account.
- |
- | The 'hide_metadata_if_alias_used' field in the JSON can take boolean values. If it is set to `true` and there is an alias on the other account then the other accounts' metadata (like more_info, url, image_url, open_corporates_url, etc.) will be hidden. Otherwise the metadata will be shown.
- |
- | The 'allowed_actions' field is a list containing the name of the actions allowed on this view, all the actions contained will be set to `true` on the view creation, the rest will be set to `false`.
- |
- | You should use a leading _ (underscore) for the view name because other view names may become reserved by OBP internally
- | """,
- createViewJsonV121,
- viewJSONV220,
- List(
- AuthenticatedUserIsRequired,
- InvalidJsonFormat,
- BankAccountNotFound,
- UnknownError
- ),
- List(apiTagAccount, apiTagView, apiTagOldStyle))
-
- lazy val createViewForBankAccount : OBPEndpoint = {
- //creates a view on an bank account
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "views" :: Nil JsonPost json -> _ => {
- cc =>
- for {
- createViewJsonV121 <- tryo{json.extract[CreateViewJsonV121]} ?~!InvalidJsonFormat
- //customer views are started ith `_`,eg _life, _work, and System views startWith letter, eg: owner
- _<- booleanToBox(isValidCustomViewName(createViewJsonV121.name), InvalidCustomViewFormat+s"Current view_name (${createViewJsonV121.name})")
- u <- cc.user ?~!AuthenticatedUserIsRequired
- account <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound
- createViewJson = CreateViewJson(
- createViewJsonV121.name,
- createViewJsonV121.description,
- metadata_view = "", //this only used from V300
- createViewJsonV121.is_public,
- createViewJsonV121.which_alias_to_use,
- createViewJsonV121.hide_metadata_if_alias_used,
- createViewJsonV121.allowed_actions
- )
- permission <- Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
- anyViewContainsCanCreateCustomViewPermission = permission.views.map(_.allowed_actions.exists(_ ==CAN_CREATE_CUSTOM_VIEW)).find(_ == true).getOrElse(false)
-
- _ <- booleanToBox(
- anyViewContainsCanCreateCustomViewPermission,
- s"${ErrorMessages.CreateCustomViewError} You need the `${CAN_CREATE_CUSTOM_VIEW}` permission on any your views"
- )
- view <- Views.views.vend.createCustomView(BankIdAccountId(bankId, accountId), createViewJson) ?~ CreateCustomViewError
- } yield {
- val viewJSON = JSONFactory220.createViewJSON(view)
- successJsonResponse(Extraction.decompose(viewJSON), 201)
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- updateViewForBankAccount,
- implementedInApiVersion,
- "updateViewForBankAccount",
- "PUT",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID",
- "Update View",
- s"""Update an existing view on a bank account
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.
- |
- |The json sent is the same as during view creation (above), with one difference: the 'name' field
- |of a view is not editable (it is only set when a view is created)""",
- updateViewJsonV121,
- viewJSONV220,
- List(
- InvalidJsonFormat,
- AuthenticatedUserIsRequired,
- BankAccountNotFound,
- UnknownError
- ),
- List(apiTagAccount, apiTagView, apiTagOldStyle)
- )
-
- lazy val updateViewForBankAccount : OBPEndpoint = {
- //updates a view on a bank account
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "views" :: ViewId(viewId) :: Nil JsonPut json -> _ => {
- cc =>
- for {
- updateJsonV121 <- tryo{json.extract[UpdateViewJsonV121]} ?~!InvalidJsonFormat
- //customer views are started ith `_`,eg _life, _work, and System views startWith letter, eg: owner
- _ <- booleanToBox(viewId.value.startsWith("_"), InvalidCustomViewFormat+s"Current view_name (${viewId.value})")
- view <- APIUtil.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), cc.user, Some(cc))
- _ <- booleanToBox(!view.isSystem, SystemViewsCanNotBeModified)
- u <- cc.user ?~!AuthenticatedUserIsRequired
- account <- BankAccountX(bankId, accountId) ?~!BankAccountNotFound
- updateViewJson = UpdateViewJSON(
- description = updateJsonV121.description,
- metadata_view = view.metadataView, //this only used from V300, here just copy from currentView .
- is_public = updateJsonV121.is_public,
- which_alias_to_use = updateJsonV121.which_alias_to_use,
- hide_metadata_if_alias_used = updateJsonV121.hide_metadata_if_alias_used,
- allowed_actions = updateJsonV121.allowed_actions
- )
-
- permission <- Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
- anyViewContainsCancanUpdateCustomViewPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW)).find(true == _).getOrElse(false)
-
- _ <- booleanToBox(
- anyViewContainsCancanUpdateCustomViewPermission,
- s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_UPDATE_CUSTOM_VIEW)}` permission on any your views"
- )
- updatedView <- Views.views.vend.updateCustomView(BankIdAccountId(bankId, accountId), viewId, updateViewJson) ?~ CreateCustomViewError
- } yield {
- val viewJSON = JSONFactory220.createViewJSON(updatedView)
- successJsonResponse(Extraction.decompose(viewJSON), 200)
- }
- }
- }
-
- // Not used yet.
- val getFxIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getFxIsPublic", false)
-
-
- resourceDocs += ResourceDoc(
- getCurrentFxRate,
- implementedInApiVersion,
- "getCurrentFxRate",
- "GET",
- "/banks/BANK_ID/fx/FROM_CURRENCY_CODE/TO_CURRENCY_CODE",
- "Get Current FxRate",
- """Get the latest FX rate specified by BANK_ID, FROM_CURRENCY_CODE and TO_CURRENCY_CODE
- |
- |OBP may try different sources of FX rate information depending on the Connector in operation.
- |
- |For example we want to convert EUR => USD:
- |
- |OBP will:
- |1st try - Connector (database, core banking system or external FX service)
- |2nd try part 1 - fallbackexchangerates/eur.json
- |2nd try part 2 - fallbackexchangerates/usd.json (the inverse rate is used)
- |3rd try - Hardcoded map of FX rates.
- |
- |
- |
- |**Public Access:** This endpoint can be made publicly accessible (no authentication required) by setting the property `apiOptions.getCurrentFxRateIsPublic=true` in the props file.
- |
- """.stripMargin,
- EmptyBody,
- fXRateJSON,
- List(InvalidISOCurrencyCode,AuthenticatedUserIsRequired,FXCurrencyCodeCombinationsNotSupported, UnknownError),
- List(apiTagFx))
-
- val getCurrentFxRateIsPublic = APIUtil.getPropsAsBoolValue("apiOptions.getCurrentFxRateIsPublic", false)
-
- lazy val getCurrentFxRate: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "fx" :: fromCurrencyCode :: toCurrencyCode :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (_, callContext) <- getCurrentFxRateIsPublic match {
- case false => authenticatedAccess(cc)
- case true => anonymousAccess(cc)
- }
- _ <- Helper.booleanToFuture(failMsg = ConsumerHasMissingRoles + CanReadFx, cc=callContext) {
- checkScope(bankId.value, getConsumerPrimaryKey(callContext), ApiRole.canReadFx)
- }
- fromCurrencyCodeUpperCase = fromCurrencyCode.toUpperCase
- toCurrencyCodeUpperCase = toCurrencyCode.toUpperCase
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- _ <- NewStyle.function.isValidCurrencyISOCode(fromCurrencyCodeUpperCase, callContext)
- _ <- NewStyle.function.isValidCurrencyISOCode(toCurrencyCodeUpperCase, callContext)
- fxRate <- NewStyle.function.getExchangeRate(bankId, fromCurrencyCodeUpperCase, toCurrencyCodeUpperCase, callContext)
- } yield {
- val viewJSON = JSONFactory220.createFXRateJSON(fxRate)
- (viewJSON, HttpCode.`200`(callContext))
- }
-
- }
- }
-
- resourceDocs += ResourceDoc(
- getExplicitCounterpartiesForAccount,
- implementedInApiVersion,
- "getExplicitCounterpartiesForAccount",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
- "Get Counterparties (Explicit)",
- s"""This endpoints gets the explicit Counterparties on an Account / View.
- |
- |For a general introduction to Counterparties in OBP, see ${Glossary.getGlossaryItemLink("Counterparties")}
- |
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody,
- counterpartiesJsonV220,
- List(
- AuthenticatedUserIsRequired,
- BankAccountNotFound,
- ViewNotFound,
- NoViewPermission,
- UserNoPermissionAccessView,
- UnknownError
- ),
- List(apiTagCounterparty, apiTagPSD2PIS, apiTagAccount, apiTagPsd2))
-
- lazy val getExplicitCounterpartiesForAccount : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
- view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
- _ <- Helper.booleanToFuture(
- s"${ErrorMessages.NoViewPermission} You need the `${(CAN_GET_COUNTERPARTY)}` permission on the View(${viewId.value} )",
- cc = callContext
- ) {
- ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_GET_COUNTERPARTY)
- }
- (counterparties, callContext) <- NewStyle.function.getCounterparties(bankId,accountId,viewId, callContext)
- //Here we need create the metadata for all the explicit counterparties. maybe show them in json response.
- //Note: actually we need update all the counterparty metadata when they from adapter. Some counterparties may be the first time to api, there is no metadata.
- _ <- Helper.booleanToFuture(CreateOrUpdateCounterpartyMetadataError, 400, cc=callContext) {
- {
- for {
- counterparty <- counterparties
- } yield {
- Counterparties.counterparties.vend.getOrCreateMetadata(bankId, accountId, counterparty.counterpartyId, counterparty.name) match {
- case Full(_) => true
- case _ => false
- }
- }
- }.forall(_ == true)
- }
- } yield {
- val counterpartiesJson = JSONFactory220.createCounterpartiesJSON(counterparties)
- (counterpartiesJson, HttpCode.`200`(callContext))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- getExplicitCounterpartyById,
- implementedInApiVersion,
- "getExplicitCounterpartyById",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties/COUNTERPARTY_ID",
- "Get Counterparty by Counterparty Id (Explicit)",
- s"""Information returned about the Counterparty specified by COUNTERPARTY_ID:
- |
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody,
- counterpartyWithMetadataJson,
- List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagCounterparty, apiTagPSD2PIS, apiTagCounterpartyMetaData, apiTagPsd2)
- )
-
- lazy val getExplicitCounterpartyById : OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: CounterpartyId(counterpartyId) :: Nil JsonGet req => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
- view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
-
- _ <- Helper.booleanToFuture(
- s"${ErrorMessages.NoViewPermission} You need the `${(CAN_GET_COUNTERPARTY)}` permission on the View(${viewId.value} )",
- cc = callContext
- ) {
- ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_GET_COUNTERPARTY)
- }
-
- counterpartyMetadata <- NewStyle.function.getMetadata(bankId, accountId, counterpartyId.value, callContext)
- (counterparty, callContext) <- NewStyle.function.getCounterpartyTrait(bankId, accountId, counterpartyId.value, callContext)
- } yield {
- val counterpartyJson = JSONFactory220.createCounterpartyWithMetadataJSON(counterparty,counterpartyMetadata)
- (counterpartyJson, HttpCode.`200`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- getMessageDocs,
- implementedInApiVersion,
- "getMessageDocs",
- "GET",
- "/message-docs/CONNECTOR",
- "Get Message Docs",
- """These message docs provide example messages sent by OBP to the (RabbitMq) message queue for processing by the Core Banking / Payment system Adapter - together with an example expected response and possible error codes.
- | Integrators can use these messages to build Adapters that provide core banking services to OBP.
- |
- | Note: API Explorer provides a Message Docs page where these messages are displayed.
- |
- | `CONNECTOR`: rest_vMar2019, stored_procedure_vDec2019 ...
- """.stripMargin,
- EmptyBody,
- messageDocsJson,
- List(InvalidConnector, UnknownError),
- List(apiTagMessageDoc, apiTagDocumentation, apiTagApi)
- )
-
- lazy val getMessageDocs: OBPEndpoint = {
- case "message-docs" :: connector :: Nil JsonGet _ => {
- cc => {
- implicit val ec = EndpointContext(Some(cc))
- for {
- connectorObject <- Future(tryo{Connector.getConnectorInstance(connector)}) map { i =>
- val msg = s"$InvalidConnector Current Input is $connector. It should be eg: rest_vMar2019..."
- unboxFullOrFail(i, cc.callContext, msg)
- }
- } yield {
- val json = JSONFactory220.createMessageDocsJson(connectorObject.messageDocs.toList)
- (json, HttpCode.`200`(cc.callContext))
- }
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- createBank,
- implementedInApiVersion,
- "createBank",
- "POST",
- "/banks",
- "Create Bank",
- s"""Create a new bank (Authenticated access).
- |${userAuthenticationMessage(true) }
- |""",
- bankJSONV220,
- bankJSONV220,
- List(
- InvalidJsonFormat,
- AuthenticatedUserIsRequired,
- InsufficientAuthorisationToCreateBank,
- UnknownError
- ),
- List(apiTagBank, apiTagOldStyle),
- Some(List(canCreateBank))
- )
-
- lazy val createBank: OBPEndpoint = {
- case "banks" :: Nil JsonPost json -> _ => {
- cc =>
- for {
- bank <- tryo{ json.extract[BankJSONV220] } ?~! ErrorMessages.InvalidJsonFormat
- _ <- Helper.booleanToBox(
- bank.id.length > 5,s"$InvalidJsonFormat Min length of BANK_ID should be 5 characters.")
-
- checkShortStringValue = APIUtil.checkShortString(bank.id)
-
- _ <- Helper.booleanToBox(checkShortStringValue == SILENCE_IS_GOLDEN, s"$checkShortStringValue.")
-
- _ <- Helper.booleanToBox(
- !`checkIfContains::::` (bank.id), s"$InvalidJsonFormat BANK_ID can not contain `::::` characters")
- u <- cc.user ?~!ErrorMessages.AuthenticatedUserIsRequired
- consumer <- cc.consumer ?~! ErrorMessages.InvalidConsumerCredentials
- _ <- NewStyle.function.hasEntitlementAndScope("", u.userId, consumer.id.get.toString, canCreateBank, cc.callContext)
- success <- Connector.connector.vend.createOrUpdateBank(
- bank.id,
- bank.full_name,
- bank.short_name,
- bank.logo_url,
- bank.website_url,
- bank.swift_bic,
- bank.national_identifier,
- bank.bank_routing.scheme,
- bank.bank_routing.address,
- Some(cc)
- )
- entitlements <- Entitlement.entitlement.vend.getEntitlementsByUserId(u.userId)
-
- entitlementsByBank = entitlements.filter(_.bankId==bank.id)
- _ <- entitlementsByBank.filter(_.roleName == CanCreateEntitlementAtOneBank.toString()).size > 0 match {
- case true =>
- // Already has entitlement
- Full(())
- case false =>
- Full(Entitlement.entitlement.vend.addEntitlement(bank.id, u.userId, CanCreateEntitlementAtOneBank.toString()))
- }
- _ <- entitlementsByBank.filter(_.roleName == CanReadDynamicResourceDocsAtOneBank.toString()).size > 0 match {
- case true =>
- // Already has entitlement
- Full(())
- case false =>
- Full(Entitlement.entitlement.vend.addEntitlement(bank.id, u.userId, CanReadDynamicResourceDocsAtOneBank.toString()))
- }
- } yield {
- val json = JSONFactory220.createBankJSON(success)
- createdJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
-
-
- // Create Branch
- val createBranchEntitlementsRequiredForSpecificBank = CanCreateBranch :: Nil
- val createBranchEntitlementsRequiredForAnyBank = CanCreateBranchAtAnyBank :: Nil
-
- // TODO Put the RequiredEntitlements and AlternativeRequiredEntitlements in the Resource Doc and use that in the Partial Function?
-
- resourceDocs += ResourceDoc(
- createBranch,
- implementedInApiVersion,
- "createBranch",
- "POST",
- "/banks/BANK_ID/branches",
- "Create Branch",
- s"""Create Branch for the Bank.
- |
- |${userAuthenticationMessage(true) }
- |
- |""",
- branchJsonV220,
- branchJsonV220,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- InsufficientAuthorisationToCreateBranch,
- UnknownError
- ),
- List(apiTagBranch, apiTagOpenData),
- Some(List(canCreateBranch,canCreateBranchAtAnyBank))
- )
-
- lazy val createBranch: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "branches" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- _ <- Future(
- NewStyle.function.hasAllEntitlements(bank.bankId.value, u.userId, canCreateBranch::Nil, canCreateBranchAtAnyBank::Nil, cc.callContext)
- )
- branchJsonV220 <- NewStyle.function.tryons(failMsg = InvalidJsonFormat + " BranchJsonV300", 400, callContext) {
- json.extract[BranchJsonV220]
- }
- _ <- Helper.booleanToFuture(failMsg = "BANK_ID has to be the same in the URL and Body", 400, callContext) {
- branchJsonV220.bank_id == bank.bankId.value
- }
- branch <- NewStyle.function.tryons(CouldNotTransformJsonToInternalModel + " Branch", 400, cc.callContext) {
- transformV220ToBranch(branchJsonV220).head
- }
- (success, callContext) <- NewStyle.function.createOrUpdateBranch(branch, callContext)
- } yield {
- (JSONFactory220.createBranchJson(success), HttpCode.`201`(callContext))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- createAtm,
- implementedInApiVersion,
- "createAtm",
- "POST",
- "/banks/BANK_ID/atms",
- "Create ATM",
- s"""Create ATM for the Bank.
- |
- |${userAuthenticationMessage(true) }
- |
- |""",
- atmJsonV220,
- atmJsonV220,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagATM),
- Some(List(canCreateAtm,canCreateAtmAtAnyBank))
- )
-
-
-
- lazy val createAtm: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "atms" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- atmJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the ${classOf[AtmJsonV400]}", 400, callContext) {
- json.extract[AtmJsonV220]
- }
- _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = createAtmEntitlementsRequiredText)(bankId.value, u.userId, createAtmEntitlements, callContext)
- _ <- Helper.booleanToFuture(s"$InvalidJsonValue BANK_ID has to be the same in the URL and Body", 400, callContext){atmJsonV400.bank_id == bankId.value}
- atm <- NewStyle.function.tryons(ErrorMessages.CouldNotTransformJsonToInternalModel + " Atm", 400, callContext) {
- JSONFactory220.transformToAtmFromV220(atmJson).head
- }
- (atm, callContext) <- NewStyle.function.createOrUpdateAtm(atm, callContext)
- } yield {
- (JSONFactory220.createAtmJson(atm), HttpCode.`201`(callContext))
- }
- }
- }
-
-
-
- val createProductEntitlementsRequiredForSpecificBank = canCreateProduct :: Nil
- val createProductEntitlementsRequiredForAnyBank = canCreateProductAtAnyBank :: Nil
-
- resourceDocs += ResourceDoc(
- createProduct,
- implementedInApiVersion,
- "createProduct",
- "PUT",
- "/banks/BANK_ID/products",
- "Create Product",
- s"""Create or Update Product for the Bank.
- |
- |${userAuthenticationMessage(true) }
- |
- |""",
- productJsonV220,
- productJsonV220,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagProduct),
- Some(List(canCreateProduct, canCreateProductAtAnyBank))
- )
-
-
-
- lazy val createProduct: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "products" :: Nil JsonPut json -> _ => {
- cc =>
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = createProductEntitlementsRequiredText)(bankId.value, u.userId, createProductEntitlements, callContext)
- (_, callContext) <- NewStyle.function.getBank(bankId, callContext)
- failMsg = s"$InvalidJsonFormat The Json body should be the $PostPutProductJsonV310 "
- product <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[ProductJsonV220]
- }
- (success, callContext) <- NewStyle.function.createOrUpdateProduct(
- bankId = bankId.value,
- code = product.code,
- parentProductCode = None,
- name = product.name,
- category = product.category,
- family = product.family,
- superFamily = product.super_family,
- moreInfoUrl = product.more_info_url,
- termsAndConditionsUrl = null,
- details = product.details,
- description = product.description,
- metaLicenceId = product.meta.license.id,
- metaLicenceName = product.meta.license.name,
- callContext
- )
- } yield {
- (JSONFactory220.createProductJson(success), HttpCode.`201`(callContext))
- }
- }
- }
-
-
-
- val createFxEntitlementsRequiredForSpecificBank = canCreateFxRate :: Nil
- val createFxEntitlementsRequiredForAnyBank = canCreateFxRateAtAnyBank :: Nil
-
- resourceDocs += ResourceDoc(
- createFx,
- implementedInApiVersion,
- "createFx",
- "PUT",
- "/banks/BANK_ID/fx",
- "Create Fx",
- s"""Create or Update Fx for the Bank.
- |
- |Example:
- |
- |“from_currency_code”:“EUR”,
- |“to_currency_code”:“USD”,
- |“conversion_value”: 1.136305,
- |“inverse_conversion_value”: 1 / 1.136305 = 0.8800454103431737,
- |
- | Thus 1 Euro = 1.136305 US Dollar
- | and
- | 1 US Dollar = 0.8800 Euro
- |
- |
- |${userAuthenticationMessage(true) }
- |
- |""",
- fxJsonV220,
- fxJsonV220,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- UserHasMissingRoles,
- UnknownError
- ),
- List(apiTagFx),
- Some(List(canCreateFxRate, canCreateFxRateAtAnyBank))
- )
-
-
-
- lazy val createFx: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "fx" :: Nil JsonPut json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- (bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
- _ <- Future {
- NewStyle.function.hasAllEntitlements(
- bank.bankId.value,
- u.userId,
- createFxEntitlementsRequiredForSpecificBank,
- createFxEntitlementsRequiredForAnyBank,
- callContext
- )
- }
- fx <- NewStyle.function.tryons(ErrorMessages.InvalidJsonFormat, 400, callContext) {
- json.extract[FXRateJsonV220]
- }
- _ <- NewStyle.function.isValidCurrencyISOCode(fx.from_currency_code, callContext)
- _ <- NewStyle.function.isValidCurrencyISOCode(fx.to_currency_code, callContext)
- (fxRate, callContext)<- NewStyle.function.createOrUpdateFXRate(
- bankId = fx.bank_id,
- fromCurrencyCode = fx.from_currency_code,
- toCurrencyCode = fx.to_currency_code,
- conversionValue = fx.conversion_value,
- inverseConversionValue = fx.inverse_conversion_value,
- effectiveDate = fx.effective_date,
- callContext
- )
- } yield {
- val viewJSON = JSONFactory220.createFXRateJSON(fxRate)
- (viewJSON, HttpCode.`201`(callContext))
- }
- }
- }
-
-
-
-
-
-
- resourceDocs += ResourceDoc(
- createAccount,
- implementedInApiVersion,
- "createAccount",
- "PUT",
- "/banks/BANK_ID/accounts/ACCOUNT_ID",
- "Create Account",
- """Create Account at bank specified by BANK_ID with Id specified by ACCOUNT_ID.
- |
- |
- |The User can create an Account for themself or an Account for another User if they have CanCreateAccount role.
- |
- |If USER_ID is not specified the account will be owned by the logged in User.
- |
- |The type field should be a product_code from Product.
- |
- |Note: The Amount must be zero.""".stripMargin,
- createAccountJSONV220,
- createAccountJSONV220,
- List(
- InvalidJsonFormat,
- BankNotFound,
- AuthenticatedUserIsRequired,
- InvalidUserId,
- InvalidAccountIdFormat,
- InvalidBankIdFormat,
- UserNotFoundById,
- UserHasMissingRoles,
- InvalidAccountBalanceAmount,
- InvalidAccountInitialBalance,
- InitialBalanceMustBeZero,
- InvalidAccountBalanceCurrency,
- AccountIdAlreadyExists,
- UnknownError
- ),
- List(apiTagAccount,apiTagOnboarding),
- Some(List(canCreateAccount))
- )
-
-
- lazy val createAccount : OBPEndpoint = {
- // Create a new account
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: Nil JsonPut json -> _ => {
- cc =>{
- implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- failMsg = s"$InvalidJsonFormat The Json body should be the $CreateAccountJSONV220 "
- createAccountJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
- json.extract[CreateAccountJSONV220]
- }
-
- loggedInUserId = u.userId
- userIdAccountOwner = if (createAccountJson.user_id.nonEmpty) createAccountJson.user_id else loggedInUserId
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext){
- isValidID(accountId.value)
- }
- _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext){
- isValidID(accountId.value)
- }
-
- (postedOrLoggedInUser,callContext) <- NewStyle.function.findByUserId(userIdAccountOwner, callContext)
-
- // User can create account for self or an account for another user if they have CanCreateAccount role
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext){
- isValidID(accountId.value)
- }
-
- _ <- if(userIdAccountOwner == loggedInUserId) Future.successful(Full(Unit))
- else NewStyle.function.hasEntitlement(bankId.value, loggedInUserId, canCreateAccount, callContext, s"${UserHasMissingRoles} $canCreateAccount or create account for self")
-
- initialBalanceAsString = createAccountJson.balance.amount
- accountType = createAccountJson.`type`
- accountLabel = createAccountJson.label
- initialBalanceAsNumber <- NewStyle.function.tryons(InvalidAccountInitialBalance, 400, callContext) {
- BigDecimal(initialBalanceAsString)
- }
-
- _ <- Helper.booleanToFuture(InitialBalanceMustBeZero, cc=callContext){0 == initialBalanceAsNumber}
-
- _ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc=callContext){isValidCurrencyISOCode(createAccountJson.balance.currency)}
-
-
- currency = createAccountJson.balance.currency
-
- (_, callContext ) <- NewStyle.function.getBank(bankId, callContext)
-
- (bankAccount,callContext) <- NewStyle.function.createBankAccount(
- bankId,
- accountId,
- accountType,
- accountLabel,
- currency,
- initialBalanceAsNumber,
- postedOrLoggedInUser.name,
- createAccountJson.branch_id,
- List(AccountRouting(createAccountJson.account_routing.scheme, createAccountJson.account_routing.address)),
- callContext
- )
- //1 Create or Update the `Owner` for the new account
- //2 Add permission to the user
- //3 Set the user as the account holder
- _ <- BankAccountCreation.setAccountHolderAndRefreshUserAccountAccess(bankId, accountId, postedOrLoggedInUser, callContext)
- } yield {
- (JSONFactory220.createAccountJSON(userIdAccountOwner, bankAccount), HttpCode.`200`(callContext))
-
- }
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- config,
- implementedInApiVersion,
- "config",
- "GET",
- "/config",
- "Get API Configuration",
- """Returns information about:
- |
- |* API Config
- |* Akka ports
- |* Elastic search ports
- |* Cached function """,
- EmptyBody,
- configurationJSON,
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- UnknownError
- ),
- apiTagApi :: Nil,
- Some(List(canGetConfig)))
-
- lazy val config: OBPEndpoint = {
- case "config" :: Nil JsonGet _ =>
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetConfig, callContext)
- } yield {
- (JSONFactory220.getConfigInfoJSON(), callContext)
- }
- }
-
-
-
- resourceDocs += ResourceDoc(
- getConnectorMetrics,
- implementedInApiVersion,
- "getConnectorMetrics",
- "GET",
- "/management/connector/metrics",
- "Get Connector Metrics",
- s"""Get the all metrics
- |
- |require CanGetConnectorMetrics role
- |
- |Filters Part 1.*filtering* (no wilde cards etc.) parameters to GET /management/connector/metrics
- |
- |Should be able to filter on the following metrics fields
- |
- |eg: /management/connector/metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&limit=50&offset=2
- |
- |1 from_date (defaults to one week before current date): eg:from_date=$DateWithMsExampleString
- |
- |2 to_date (defaults to current date) eg:to_date=$DateWithMsExampleString
- |
- |3 limit (for pagination: defaults to 1000) eg:limit=2000
- |
- |4 offset (for pagination: zero index, defaults to 0) eg: offset=10
- |
- |eg: /management/connector/metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&limit=100&offset=300
- |
- |Other filters:
- |
- |5 connector_name (if null ignore)
- |
- |6 function_name (if null ignore)
- |
- |7 correlation_id (if null ignore)
- |
- """.stripMargin,
- EmptyBody,
- connectorMetricsJson,
- List(
- InvalidDateFormat,
- UnknownError
- ),
- List(apiTagMetric, apiTagApi),
- Some(List(canGetConnectorMetrics)))
-
- lazy val getConnectorMetrics : OBPEndpoint = {
- case "management" :: "connector" :: "metrics" :: Nil JsonGet _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- NewStyle.function.hasEntitlement("", u.userId, ApiRole.canGetConnectorMetrics, callContext)
- httpParams <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
- (obpQueryParams, callContext) <- createQueriesByHttpParamsFuture(httpParams, callContext)
- metrics <- Future(ConnectorMetricsProvider.metrics.vend.getAllConnectorMetrics(obpQueryParams))
- } yield {
- (JSONFactory220.createConnectorMetricsJson(metrics), HttpCode.`200`(callContext))
- }
- }
- }
-
-
- resourceDocs += ResourceDoc(
- createConsumer,
- implementedInApiVersion,
- "createConsumer",
- "POST",
- "/management/consumers",
- "Post a Consumer",
- s"""Create a Consumer (Authenticated access).
- |
- |""",
- ConsumerPostJSON(
- "Test",
- "Test",
- "Description",
- "some@email.com",
- "redirecturl",
- "createdby",
- true,
- new Date(),
- """-----BEGIN CERTIFICATE-----
- |client_certificate_content
- |-----END CERTIFICATE-----""".stripMargin
- ),
- ConsumerPostJSON(
- "Some app name",
- "App type",
- "Description",
- "some.email@example.com",
- "Some redirect url",
- "Created by UUID",
- true,
- new Date(),
- """-----BEGIN CERTIFICATE-----
- |client_certificate_content
- |-----END CERTIFICATE-----""".stripMargin
- ),
- List(
- AuthenticatedUserIsRequired,
- UserHasMissingRoles,
- InvalidJsonFormat,
- UnknownError
- ),
- List(apiTagConsumer, apiTagOldStyle),
- Some(List(canCreateConsumer)))
-
-
- lazy val createConsumer: OBPEndpoint = {
- case "management" :: "consumers" :: Nil JsonPost json -> _ => {
- cc =>
- for {
- u <- cc.user ?~! AuthenticatedUserIsRequired
- _ <- NewStyle.function.ownEntitlement("", u.userId, ApiRole.canCreateConsumer, cc.callContext)
- postedJson <- tryo {json.extract[ConsumerPostJSON]} ?~! InvalidJsonFormat
- consumer <- Consumers.consumers.vend.createConsumer(Some(generateUUID()),
- Some(generateUUID()),
- Some(postedJson.enabled),
- Some(postedJson.app_name),
- None,
- Some(postedJson.description),
- Some(postedJson.developer_email),
- Some(postedJson.redirect_url),
- Some(u.userId),
- Some(postedJson.clientCertificate),
- None,
- None,
- )
- } yield {
- // Format the data as json
- val json = JSONFactory220.createConsumerJSON(consumer)
- // Return
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
-
- resourceDocs += ResourceDoc(
- createCounterparty,
- implementedInApiVersion,
- "createCounterparty",
- "POST",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
- "Create Counterparty (Explicit)",
- s"""Create Counterparty (Explicit) for an Account.
- |
- |In OBP, there are two types of Counterparty.
- |
- |* Explicit Counterparties (those here) which we create explicitly and are used in COUNTERPARTY Transaction Requests
- |
- |* Implicit Counterparties (AKA Other Accounts) which are generated automatically from the other sides of Transactions.
- |
- |Explicit Counterparties are created for the account / view
- |They are how the user of the view (e.g. account owner) refers to the other side of the transaction
- |
- |name : the human readable name (e.g. Piano teacher, Miss Nipa)
- |
- |description : the human readable name (e.g. Piano teacher, Miss Nipa)
- |
- |bank_routing_scheme : eg: bankId or bankCode or any other strings
- |
- |bank_routing_address : eg: `gh.29.uk`, must be valid sandbox bankIds
- |
- |account_routing_scheme : eg: AccountId or AccountNumber or any other strings
- |
- |account_routing_address : eg: `1d65db7c-a7b2-4839-af41-95`, must be valid accountIds
- |
- |other_account_secondary_routing_scheme : eg: IBan or any other strings
- |
- |other_account_secondary_routing_address : if it is an IBAN, it should be unique for each counterparty.
- |
- |other_branch_routing_scheme : eg: branchId or any other strings or you can leave it empty, not useful in sandbox mode.
- |
- |other_branch_routing_address : eg: `branch-id-123` or you can leave it empty, not useful in sandbox mode.
- |
- |is_beneficiary : must be set to `true` in order to send payments to this counterparty
- |
- |bespoke: It supports a list of key-value, you can add it to the counterparty.
- |
- |bespoke.key : any info-key you want to add to this counterparty
- |
- |bespoke.value : any info-value you want to add to this counterparty
- |
- |The view specified by VIEW_ID must have the canAddCounterparty permission
- |
- |A minimal example for TransactionRequestType == COUNTERPARTY
- | {
- | "name": "Tesobe1",
- | "description": "Good Company",
- | "other_bank_routing_scheme": "OBP",
- | "other_bank_routing_address": "gh.29.uk",
- | "other_account_routing_scheme": "OBP",
- | "other_account_routing_address": "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
- | "is_beneficiary": true,
- | "other_account_secondary_routing_scheme": "",
- | "other_account_secondary_routing_address": "",
- | "other_branch_routing_scheme": "",
- | "other_branch_routing_address": "",
- | "bespoke": []
- |}
- |
- |
- |A minimal example for TransactionRequestType == SEPA
- |
- | {
- | "name": "Tesobe2",
- | "description": "Good Company",
- | "other_bank_routing_scheme": "OBP",
- | "other_bank_routing_address": "gh.29.uk",
- | "other_account_routing_scheme": "OBP",
- | "other_account_routing_address": "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
- | "other_account_secondary_routing_scheme": "IBAN",
- | "other_account_secondary_routing_address": "DE89 3704 0044 0532 0130 00",
- | "is_beneficiary": true,
- | "other_branch_routing_scheme": "",
- | "other_branch_routing_address": "",
- | "bespoke": []
- |}
- |
- |${userAuthenticationMessage(true)}
- |
- |""".stripMargin,
- postCounterpartyJSON,
- counterpartyWithMetadataJson,
- List(
- AuthenticatedUserIsRequired,
- InvalidAccountIdFormat,
- InvalidBankIdFormat,
- BankNotFound,
- AccountNotFound,
- InvalidJsonFormat,
- ViewNotFound,
- CounterpartyAlreadyExists,
- UnknownError
- ),
- List(apiTagCounterparty, apiTagAccount))
-
-
- lazy val createCounterparty: OBPEndpoint = {
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: Nil JsonPost json -> _ => {
- cc => implicit val ec = EndpointContext(Some(cc))
- for {
- (Full(u), callContext) <- authenticatedAccess(cc)
- _ <- Helper.booleanToFuture(InvalidAccountIdFormat, cc=callContext) {isValidID(accountId.value)}
- _ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext) {isValidID(bankId.value)}
- (bank, callContext ) <- NewStyle.function.getBank(bankId, callContext)
- (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
- postJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $PostCounterpartyJSON", 400, cc.callContext) {
- json.extract[PostCounterpartyJSON]
- }
- view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
- _ <- Helper.booleanToFuture(
- s"${ErrorMessages.NoViewPermission} You need the `${(CAN_ADD_COUNTERPARTY)}` permission on the View(${viewId.value} )",
- cc = callContext
- ) {
- ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_ADD_COUNTERPARTY)
- }
- (counterparty, callContext) <- Connector.connector.vend.checkCounterpartyExists(postJson.name, bankId.value, accountId.value, viewId.value, callContext)
-
- _ <- Helper.booleanToFuture(CounterpartyAlreadyExists.replace("value for BANK_ID or ACCOUNT_ID or VIEW_ID or NAME.",
- s"COUNTERPARTY_NAME(${postJson.name}) for the BANK_ID(${bankId.value}) and ACCOUNT_ID(${accountId.value}) and VIEW_ID($viewId)"), cc=callContext){
- counterparty.isEmpty
- }
- _ <- booleanToFuture(s"$InvalidValueLength. The maximum length of `description` field is ${MappedCounterparty.mDescription.maxLen}", cc=callContext){
- postJson.description.length <= 36
- }
-
- //If other_account_routing_scheme=="OBP" or other_account_secondary_routing_address=="OBP" we will check if it is a real obp bank account.
- (_, callContext)<- if (postJson.other_bank_routing_scheme.equalsIgnoreCase("OBP") && postJson.other_account_routing_scheme.equalsIgnoreCase("OBP")){
- for{
- (_, callContext) <- NewStyle.function.getBank(BankId(postJson.other_bank_routing_address), Some(cc))
- (account, callContext) <- NewStyle.function.checkBankAccountExists(BankId(postJson.other_bank_routing_address), AccountId(postJson.other_account_routing_address), callContext)
-
- } yield {
- (account, callContext)
- }
- } else if (postJson.other_bank_routing_scheme.equalsIgnoreCase("OBP") && postJson.other_account_secondary_routing_scheme.equalsIgnoreCase("OBP")){
- for{
- (_, callContext) <- NewStyle.function.getBank(BankId(postJson.other_bank_routing_address), Some(cc))
- (account, callContext) <- NewStyle.function.checkBankAccountExists(BankId(postJson.other_bank_routing_address), AccountId(postJson.other_account_secondary_routing_address), callContext)
-
- } yield {
- (account, callContext)
- }
- }else if (postJson.other_bank_routing_scheme.equalsIgnoreCase("ACCOUNT_NUMBER")|| postJson.other_bank_routing_scheme.equalsIgnoreCase("ACCOUNT_NO")) {
- for {
- bankIdOption <- Future.successful(if (postJson.other_bank_routing_address.isEmpty) None else Some(postJson.other_bank_routing_address))
- (account, callContext) <- NewStyle.function.getBankAccountByNumber(
- bankIdOption.map(BankId(_)),
- postJson.other_bank_routing_address,
- callContext)
- } yield {
- (account, callContext)
- }
- }else
- Future{(Full(()), Some(cc))}
-
-
- otherAccountRoutingSchemeOBPFormat = if(postJson.other_account_routing_scheme.equalsIgnoreCase("AccountNo")) "ACCOUNT_NUMBER" else StringHelpers.snakify(postJson.other_account_routing_scheme).toUpperCase
-
-
- (counterparty, callContext) <- NewStyle.function.createCounterparty(
- name=postJson.name,
- description=postJson.description,
- currency = "",
- createdByUserId=u.userId,
- thisBankId=bankId.value,
- thisAccountId=accountId.value,
- thisViewId = viewId.value,
- otherAccountRoutingScheme=otherAccountRoutingSchemeOBPFormat,
- otherAccountRoutingAddress=postJson.other_account_routing_address,
- otherAccountSecondaryRoutingScheme=postJson.other_account_secondary_routing_scheme,
- otherAccountSecondaryRoutingAddress=postJson.other_account_secondary_routing_address,
- otherBankRoutingScheme=postJson.other_bank_routing_scheme,
- otherBankRoutingAddress=postJson.other_bank_routing_address,
- otherBranchRoutingScheme=postJson.other_branch_routing_scheme,
- otherBranchRoutingAddress=postJson.other_branch_routing_address,
- isBeneficiary=postJson.is_beneficiary,
- bespoke=postJson.bespoke.map(bespoke =>CounterpartyBespoke(bespoke.key,bespoke.value))
- , callContext)
-
- (counterpartyMetadata, callContext) <- NewStyle.function.getOrCreateMetadata(bankId, accountId, counterparty.counterpartyId, postJson.name, callContext)
-
- } yield {
- (JSONFactory220.createCounterpartyWithMetadataJSON(counterparty,counterpartyMetadata), HttpCode.`201`(callContext))
- }
- }
- }
-
-
-/*
- resourceDocs += ResourceDoc(
- getCustomerViewsForAccount,
- apiVersion,
- "getCustomerViews",
- "GET",
- "/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/customer-views",
- "Get Customers that have access to a View",
- s"""Returns the Customers (and the Users linked to the Customer) that have access to the view:
- |
- |* Customer: legal_name, customer_number, customer_id
- |* User: username, user_id, email
- |* View: view_id
- |
- |${authenticationRequiredMessage(true)}""".stripMargin,
- EmptyBody,
- customerViewsJsonV220,
- List(
- AuthenticatedUserIsRequired,
- BankNotFound,
- AccountNotFound,
- ViewNotFound
- ),
- List(apiTagAccount, apiTagCustomer, apiTagView)
- )
-
- lazy val getCustomerViewsForAccount : OBPEndpoint = {
- //get account by id
- case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "customer-views" :: Nil JsonGet req => {
- cc =>
- for {
- (bank, callContext) <- Bank(bankId, Some(cc)) ?~ BankNotFound
- account <- BankAccount(bank.bankId, accountId) ?~ ErrorMessages.AccountNotFound
- view <- Views.views.vend.view(viewId, BankIdAccountId(account.bankId, account.accountId))
- availableViews <- Full(account.permittedViews(user))
- canUserAccessView <- tryo(availableViews.find(_ == viewId)) ?~! UserNoPermissionAccessView
- moderatedAccount <- account.moderatedBankAccount(view, user)
- } yield {
- val viewsAvailable = availableViews.map(JSONFactory300.createViewJSON).sortBy(_.short_name)
- val moderatedAccountJson = createBankAccountJSON(moderatedAccount, viewsAvailable)
- successJsonResponse(Extraction.decompose(moderatedAccountJson))
- }
- }
- }
-
-*/
-
-
-
-/*
- lazy val getCustomerViewsForAccount : OBPEndpoint = {
- case "management" :: "connector" :: "metrics" :: Nil JsonGet _ => {
- cc =>{
- for {
- u <- user ?~! ErrorMessages.AuthenticatedUserIsRequired
- _ <- booleanToBox(hasEntitlement("", u.userId, ApiRole.CanGetConnectorMetrics), s"$CanGetConnectorMetrics entitlement required")
-
- } yield {
- val json = {}
- successJsonResponse(Extraction.decompose(json))
- }
- }
- }
- }
-
-*/
-
-/*
-
-
-
-
- */
-
- }
-}
\ No newline at end of file
+object APIMethods220 extends RestHelper with APIMethods220 {
+ val Implementations2_2_0 = Http4s220.Implementations2_2_0
+}
diff --git a/obp-api/src/main/scala/code/api/v2_2_0/OBPAPI2_2_0.scala b/obp-api/src/main/scala/code/api/v2_2_0/OBPAPI2_2_0.scala
index eef3885781..d8847ab52e 100644
--- a/obp-api/src/main/scala/code/api/v2_2_0/OBPAPI2_2_0.scala
+++ b/obp-api/src/main/scala/code/api/v2_2_0/OBPAPI2_2_0.scala
@@ -1,218 +1,250 @@
-
package code.api.v2_2_0
import scala.language.reflectiveCalls
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.util.APIUtil.OBPEndpoint
+import code.api.util.VersionedOBPApis
+import code.api.v2_0_0.Http4s200
+import code.api.v2_1_0.OBPAPI2_1_0
import code.util.Helper.MdcLoggable
-import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
-
-import scala.collection.immutable.Nil
+import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
-object OBPAPI2_2_0 extends OBPRestHelper with APIMethods130 with APIMethods140 with APIMethods200 with APIMethods210 with APIMethods220 with MdcLoggable with VersionedOBPApis{
+/*
+This file defines which endpoints from all the versions are available in v2.2.0.
+All v2.2.0 endpoints have been migrated to Http4s220 — this object is retained
+only for resource-doc aggregation and the Lift dispatch registry.
+ */
+object OBPAPI2_2_0 extends OBPRestHelper with MdcLoggable with VersionedOBPApis {
- val version : ApiVersion = ApiVersion.v2_2_0 // "2.2.0"
+ val version: ApiVersion = ApiVersion.v2_2_0
val versionStatus = ApiVersionStatus.STABLE.toString
- // Possible Endpoints from 1.2.1
- lazy val endpointsOf1_2_1 = Implementations1_2_1.addCommentForViewOnTransaction ::
- Implementations1_2_1.addCounterpartyCorporateLocation::
- Implementations1_2_1.addCounterpartyImageUrl ::
- Implementations1_2_1.addCounterpartyMoreInfo ::
- Implementations1_2_1.addCounterpartyOpenCorporatesUrl ::
- Implementations1_2_1.addCounterpartyPhysicalLocation ::
- Implementations1_2_1.addOtherAccountPrivateAlias ::
- Implementations1_2_1.addCounterpartyPublicAlias ::
- Implementations1_2_1.addCounterpartyUrl ::
- Implementations1_2_1.addImageForViewOnTransaction ::
- Implementations1_2_1.addPermissionForUserForBankAccountForMultipleViews ::
- Implementations1_2_1.addPermissionForUserForBankAccountForOneView ::
- Implementations1_2_1.addTagForViewOnTransaction ::
- Implementations1_2_1.addTransactionNarrative ::
- Implementations1_2_1.addWhereTagForViewOnTransaction ::
- // Now in 2.0.0 "allAccountsAllBanks"::
- Implementations1_2_1.bankById ::
- // Implementations1_2_1.createViewForBankAccount ::
- Implementations1_2_1.deleteCommentForViewOnTransaction ::
- Implementations1_2_1.deleteCommentForViewOnTransaction ::
- Implementations1_2_1.deleteCounterpartyCorporateLocation ::
- Implementations1_2_1.deleteCounterpartyImageUrl ::
- Implementations1_2_1.deleteCounterpartyMoreInfo ::
- Implementations1_2_1.deleteCounterpartyOpenCorporatesUrl ::
- Implementations1_2_1.deleteCounterpartyPhysicalLocation ::
- Implementations1_2_1.deleteCounterpartyPrivateAlias ::
- Implementations1_2_1.deleteCounterpartyPublicAlias ::
- Implementations1_2_1.deleteCounterpartyUrl ::
- Implementations1_2_1.deleteImageForViewOnTransaction ::
- Implementations1_2_1.deleteTagForViewOnTransaction ::
- Implementations1_2_1.deleteTransactionNarrative ::
- Implementations1_2_1.deleteViewForBankAccount::
- Implementations1_2_1.deleteWhereTagForViewOnTransaction ::
- Implementations1_2_1.getBanks ::
- Implementations1_2_1.getCommentsForViewOnTransaction ::
- Implementations1_2_1.getOtherAccountsForBankAccount ::
- Implementations1_2_1.getOtherAccountByIdForBankAccount ::
- Implementations1_2_1.getOtherAccountForTransaction ::
- Implementations1_2_1.getOtherAccountMetadata ::
- Implementations1_2_1.getOtherAccountPrivateAlias ::
- Implementations1_2_1.getCounterpartyPublicAlias ::
- Implementations1_2_1.getImagesForViewOnTransaction ::
- Implementations1_2_1.getTagsForViewOnTransaction ::
- Implementations1_2_1.getTransactionByIdForBankAccount ::
- Implementations1_2_1.getTransactionNarrative ::
- Implementations1_2_1.getTransactionsForBankAccount ::
- //Implementations1_2_1.getViewsForBankAccount ::
- Implementations1_2_1.getWhereTagForViewOnTransaction ::
- Implementations1_2_1.removePermissionForUserForBankAccountForAllViews ::
- Implementations1_2_1.removePermissionForUserForBankAccountForOneView ::
- Implementations1_2_1.updateAccountLabel ::
- Implementations1_2_1.updateCounterpartyCorporateLocation ::
- Implementations1_2_1.updateCounterpartyImageUrl ::
- Implementations1_2_1.updateCounterpartyMoreInfo ::
- Implementations1_2_1.updateCounterpartyOpenCorporatesUrl ::
- Implementations1_2_1.updateCounterpartyPhysicalLocation ::
- Implementations1_2_1.updateCounterpartyPrivateAlias ::
- Implementations1_2_1.updateCounterpartyPublicAlias ::
- Implementations1_2_1.updateCounterpartyUrl ::
- Implementations1_2_1.updateTransactionNarrative ::
- //Implementations1_2_1.updateViewForBankAccount ::
- Implementations1_2_1.updateWhereTagForViewOnTransaction ::
- Nil
-
-
- // Possible Endpoints 1.3.0
- val endpointsOf1_3_0 = Implementations1_3_0.getCards ::
- Implementations1_3_0.getCardsForBank ::
- Nil
-
-
-
-
-
- // Possible Endpoints 1.4.0
- val endpointsOf1_4_0 = Implementations1_4_0.getCustomersMessages ::
- Implementations1_4_0.addCustomerMessage ::
- Implementations1_4_0.getBranches ::
- Implementations1_4_0.getAtms ::
- Implementations1_4_0.getCrmEvents ::
- Implementations1_4_0.getTransactionRequestTypes ::
- Nil
+ val Implementations2_2_0 = Http4s220.Implementations2_2_0
+ val Implementations2_0_0 = Http4s200.Implementations2_0_0
+ def allResourceDocs = collectResourceDocs(OBPAPI2_1_0.allResourceDocs, Http4s220.resourceDocs)
- // Possible Endpoints 2.0.0 (less info about the views)
- val endpointsOf2_0_0 = Implementations2_0_0.getPrivateAccountsAllBanks ::
- Implementations2_0_0.accountById ::
- Implementations2_0_0.addEntitlement ::
- Implementations2_0_0.addKycCheck ::
- Implementations2_0_0.addKycDocument ::
- Implementations2_0_0.addKycMedia ::
- Implementations2_0_0.addKycStatus ::
- Implementations2_0_0.addSocialMediaHandle ::
- Implementations2_0_0.getPrivateAccountsAtOneBank ::
- //now in V220
- //Implementations2_0_0.createAccount ::
-// Implementations2_0_0.createMeeting ::
- Implementations2_0_0.createUser ::
- Implementations2_0_0.createUserCustomerLinks ::
- Implementations2_0_0.deleteEntitlement ::
- Implementations2_0_0.elasticSearchMetrics ::
- Implementations2_0_0.elasticSearchWarehouse ::
- Implementations2_0_0.getAllEntitlements ::
- Implementations2_0_0.getCoreAccountById ::
- // Implementations2_0_0.getCoreTransactionsForBankAccount ::
- Implementations2_0_0.getCurrentUser ::
- Implementations2_0_0.getEntitlements ::
- Implementations2_0_0.getKycChecks ::
- Implementations2_0_0.getKycDocuments ::
- Implementations2_0_0.getKycMedia ::
- Implementations2_0_0.getKycStatuses ::
-// Implementations2_0_0.getMeeting ::
-// Implementations2_0_0.getMeetings ::
- Implementations2_0_0.getPermissionForUserForBankAccount ::
- Implementations2_0_0.getPermissionsForBankAccount ::
- Implementations2_0_0.getSocialMediaHandles ::
- Implementations2_0_0.getTransactionTypes ::
- Implementations2_0_0.getUser ::
- Implementations2_0_0.corePrivateAccountsAllBanks ::
- Implementations2_0_0.privateAccountsAtOneBank ::
- Implementations2_0_0.publicAccountsAllBanks ::
- Implementations2_0_0.publicAccountsAtOneBank ::
- Nil
+ val routes: List[OBPEndpoint] = Nil
+ registerRoutes(routes, allResourceDocs, apiPrefix, true)
- // Possible Endpoints 2.1.0
- val endpointsOf2_1_0 = Implementations2_1_0.sandboxDataImport ::
- Implementations2_1_0.getTransactionRequestTypesSupportedByBank ::
- Implementations2_1_0.createTransactionRequest ::
- Implementations2_1_0.answerTransactionRequestChallenge ::
- Implementations2_1_0.getTransactionRequests ::
- Implementations2_1_0.getRoles ::
- Implementations2_1_0.getEntitlementsByBankAndUser ::
- Implementations2_1_0.getConsumer ::
- Implementations2_1_0.getConsumers ::
- Implementations2_1_0.enableDisableConsumers ::
- Implementations2_1_0.addCardForBank ::
- Implementations2_1_0.getUsers ::
- Implementations2_1_0.createTransactionType ::
- Implementations2_1_0.getAtm ::
- Implementations2_1_0.getBranch ::
- Implementations2_1_0.updateBranch ::
- //now in V220
- //Implementations2_1_0.createBranch ::
- Implementations2_1_0.getProduct ::
- Implementations2_1_0.getProducts ::
- Implementations2_1_0.createCustomer ::
- Implementations2_1_0.getCustomersForCurrentUserAtBank ::
- //Implementations2_1_0.getCustomersForUser ::
- Implementations2_1_0.updateConsumerRedirectUrl ::
- Implementations2_1_0.getMetrics ::
- Nil
-
- // Possible Endpoints 2.2.0
- val endpointsOf2_2_0 = Implementations2_2_0.getViewsForBankAccount ::
- Implementations2_2_0.root ::
- Implementations2_2_0.createViewForBankAccount ::
- Implementations2_2_0.updateViewForBankAccount ::
- Implementations2_2_0.getCurrentFxRate ::
- Implementations2_2_0.getExplicitCounterpartiesForAccount ::
- Implementations2_2_0.getExplicitCounterpartyById ::
- Implementations2_2_0.getMessageDocs ::
- Implementations2_2_0.createBank ::
- Implementations2_2_0.createAccount ::
- Implementations2_2_0.createBranch ::
- Implementations2_2_0.createAtm ::
- Implementations2_2_0.config ::
- Implementations2_2_0.getConnectorMetrics ::
- Implementations2_2_0.createConsumer ::
- Implementations2_2_0.createProduct ::
- Implementations2_2_0.createCounterparty ::
- Nil
-
- val allResourceDocs = Implementations2_2_0.resourceDocs ++
- Implementations2_1_0.resourceDocs ++
- Implementations2_0_0.resourceDocs ++
- Implementations1_4_0.resourceDocs ++
- Implementations1_3_0.resourceDocs ++
- Implementations1_2_1.resourceDocs
-
-
- // Filter the possible endpoints by the disabled / enabled Props settings and add them together
- val routes : List[OBPEndpoint] =
- getAllowedEndpoints(endpointsOf1_2_1, Implementations1_2_1.resourceDocs) :::
- getAllowedEndpoints(endpointsOf1_3_0, Implementations1_3_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf1_4_0, Implementations1_4_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf2_0_0, Implementations2_0_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf2_1_0, Implementations2_1_0.resourceDocs) :::
- getAllowedEndpoints(endpointsOf2_2_0, Implementations2_2_0.resourceDocs)
-
-
- registerRoutes(routes, allResourceDocs, apiPrefix)
-
- logger.info(s"version $version has been run! There are ${routes.length} routes.")
-
+ logger.info(s"version $version has been run! There are ${routes.length} routes, ${allResourceDocs.length} allResourceDocs.")
}
+
+//package code.api.v2_2_0
+//
+//import scala.language.reflectiveCalls
+//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.util.Helper.MdcLoggable
+//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 = ApiVersionStatus.STABLE.toString
+//
+// // Possible Endpoints from 1.2.1
+// lazy val endpointsOf1_2_1 = Implementations1_2_1.addCommentForViewOnTransaction ::
+// Implementations1_2_1.addCounterpartyCorporateLocation::
+// Implementations1_2_1.addCounterpartyImageUrl ::
+// Implementations1_2_1.addCounterpartyMoreInfo ::
+// Implementations1_2_1.addCounterpartyOpenCorporatesUrl ::
+// Implementations1_2_1.addCounterpartyPhysicalLocation ::
+// Implementations1_2_1.addOtherAccountPrivateAlias ::
+// Implementations1_2_1.addCounterpartyPublicAlias ::
+// Implementations1_2_1.addCounterpartyUrl ::
+// Implementations1_2_1.addImageForViewOnTransaction ::
+// Implementations1_2_1.addPermissionForUserForBankAccountForMultipleViews ::
+// Implementations1_2_1.addPermissionForUserForBankAccountForOneView ::
+// Implementations1_2_1.addTagForViewOnTransaction ::
+// Implementations1_2_1.addTransactionNarrative ::
+// Implementations1_2_1.addWhereTagForViewOnTransaction ::
+// // Now in 2.0.0 "allAccountsAllBanks"::
+// Implementations1_2_1.bankById ::
+// // Implementations1_2_1.createViewForBankAccount ::
+// Implementations1_2_1.deleteCommentForViewOnTransaction ::
+// Implementations1_2_1.deleteCommentForViewOnTransaction ::
+// Implementations1_2_1.deleteCounterpartyCorporateLocation ::
+// Implementations1_2_1.deleteCounterpartyImageUrl ::
+// Implementations1_2_1.deleteCounterpartyMoreInfo ::
+// Implementations1_2_1.deleteCounterpartyOpenCorporatesUrl ::
+// Implementations1_2_1.deleteCounterpartyPhysicalLocation ::
+// Implementations1_2_1.deleteCounterpartyPrivateAlias ::
+// Implementations1_2_1.deleteCounterpartyPublicAlias ::
+// Implementations1_2_1.deleteCounterpartyUrl ::
+// Implementations1_2_1.deleteImageForViewOnTransaction ::
+// Implementations1_2_1.deleteTagForViewOnTransaction ::
+// Implementations1_2_1.deleteTransactionNarrative ::
+// Implementations1_2_1.deleteViewForBankAccount::
+// Implementations1_2_1.deleteWhereTagForViewOnTransaction ::
+// Implementations1_2_1.getBanks ::
+// Implementations1_2_1.getCommentsForViewOnTransaction ::
+// Implementations1_2_1.getOtherAccountsForBankAccount ::
+// Implementations1_2_1.getOtherAccountByIdForBankAccount ::
+// Implementations1_2_1.getOtherAccountForTransaction ::
+// Implementations1_2_1.getOtherAccountMetadata ::
+// Implementations1_2_1.getOtherAccountPrivateAlias ::
+// Implementations1_2_1.getCounterpartyPublicAlias ::
+// Implementations1_2_1.getImagesForViewOnTransaction ::
+// Implementations1_2_1.getTagsForViewOnTransaction ::
+// Implementations1_2_1.getTransactionByIdForBankAccount ::
+// Implementations1_2_1.getTransactionNarrative ::
+// Implementations1_2_1.getTransactionsForBankAccount ::
+// //Implementations1_2_1.getViewsForBankAccount ::
+// Implementations1_2_1.getWhereTagForViewOnTransaction ::
+// Implementations1_2_1.removePermissionForUserForBankAccountForAllViews ::
+// Implementations1_2_1.removePermissionForUserForBankAccountForOneView ::
+// Implementations1_2_1.updateAccountLabel ::
+// Implementations1_2_1.updateCounterpartyCorporateLocation ::
+// Implementations1_2_1.updateCounterpartyImageUrl ::
+// Implementations1_2_1.updateCounterpartyMoreInfo ::
+// Implementations1_2_1.updateCounterpartyOpenCorporatesUrl ::
+// Implementations1_2_1.updateCounterpartyPhysicalLocation ::
+// Implementations1_2_1.updateCounterpartyPrivateAlias ::
+// Implementations1_2_1.updateCounterpartyPublicAlias ::
+// Implementations1_2_1.updateCounterpartyUrl ::
+// Implementations1_2_1.updateTransactionNarrative ::
+// //Implementations1_2_1.updateViewForBankAccount ::
+// Implementations1_2_1.updateWhereTagForViewOnTransaction ::
+// Nil
+//
+//
+// // Possible Endpoints 1.3.0
+// val endpointsOf1_3_0 = Implementations1_3_0.getCards ::
+// Implementations1_3_0.getCardsForBank ::
+// Nil
+//
+//
+//
+//
+//
+// // Possible Endpoints 1.4.0
+// val endpointsOf1_4_0 = Implementations1_4_0.getCustomersMessages ::
+// Implementations1_4_0.addCustomerMessage ::
+// Implementations1_4_0.getBranches ::
+// Implementations1_4_0.getAtms ::
+// Implementations1_4_0.getCrmEvents ::
+// Implementations1_4_0.getTransactionRequestTypes ::
+// Nil
+//
+//
+// // Possible Endpoints 2.0.0 (less info about the views)
+// val endpointsOf2_0_0 = Implementations2_0_0.getPrivateAccountsAllBanks ::
+// Implementations2_0_0.accountById ::
+// Implementations2_0_0.addEntitlement ::
+// Implementations2_0_0.addKycCheck ::
+// Implementations2_0_0.addKycDocument ::
+// Implementations2_0_0.addKycMedia ::
+// Implementations2_0_0.addKycStatus ::
+// Implementations2_0_0.addSocialMediaHandle ::
+// Implementations2_0_0.getPrivateAccountsAtOneBank ::
+// //now in V220
+// //Implementations2_0_0.createAccount ::
+// // Implementations2_0_0.createMeeting ::
+// Implementations2_0_0.createUser ::
+// Implementations2_0_0.createUserCustomerLinks ::
+// Implementations2_0_0.deleteEntitlement ::
+// Implementations2_0_0.elasticSearchMetrics ::
+// Implementations2_0_0.elasticSearchWarehouse ::
+// Implementations2_0_0.getAllEntitlements ::
+// Implementations2_0_0.getCoreAccountById ::
+// // Implementations2_0_0.getCoreTransactionsForBankAccount ::
+// Implementations2_0_0.getCurrentUser ::
+// Implementations2_0_0.getEntitlements ::
+// Implementations2_0_0.getKycChecks ::
+// Implementations2_0_0.getKycDocuments ::
+// Implementations2_0_0.getKycMedia ::
+// Implementations2_0_0.getKycStatuses ::
+// // Implementations2_0_0.getMeeting ::
+// // Implementations2_0_0.getMeetings ::
+// Implementations2_0_0.getPermissionForUserForBankAccount ::
+// Implementations2_0_0.getPermissionsForBankAccount ::
+// Implementations2_0_0.getSocialMediaHandles ::
+// Implementations2_0_0.getTransactionTypes ::
+// Implementations2_0_0.getUser ::
+// Implementations2_0_0.corePrivateAccountsAllBanks ::
+// Implementations2_0_0.privateAccountsAtOneBank ::
+// Implementations2_0_0.publicAccountsAllBanks ::
+// Implementations2_0_0.publicAccountsAtOneBank ::
+// Nil
+//
+//
+// // Possible Endpoints 2.1.0
+// val endpointsOf2_1_0 = Implementations2_1_0.sandboxDataImport ::
+// Implementations2_1_0.getTransactionRequestTypesSupportedByBank ::
+// Implementations2_1_0.createTransactionRequest ::
+// Implementations2_1_0.answerTransactionRequestChallenge ::
+// Implementations2_1_0.getTransactionRequests ::
+// Implementations2_1_0.getRoles ::
+// Implementations2_1_0.getEntitlementsByBankAndUser ::
+// Implementations2_1_0.getConsumer ::
+// Implementations2_1_0.getConsumers ::
+// Implementations2_1_0.enableDisableConsumers ::
+// Implementations2_1_0.addCardForBank ::
+// Implementations2_1_0.getUsers ::
+// Implementations2_1_0.createTransactionType ::
+// Implementations2_1_0.getAtm ::
+// Implementations2_1_0.getBranch ::
+// Implementations2_1_0.updateBranch ::
+// //now in V220
+// //Implementations2_1_0.createBranch ::
+// Implementations2_1_0.getProduct ::
+// Implementations2_1_0.getProducts ::
+// Implementations2_1_0.createCustomer ::
+// Implementations2_1_0.getCustomersForCurrentUserAtBank ::
+// //Implementations2_1_0.getCustomersForUser ::
+// Implementations2_1_0.updateConsumerRedirectUrl ::
+// Implementations2_1_0.getMetrics ::
+// Nil
+//
+// // Possible Endpoints 2.2.0
+// val endpointsOf2_2_0 = Implementations2_2_0.getViewsForBankAccount ::
+// Implementations2_2_0.root ::
+// Implementations2_2_0.createViewForBankAccount ::
+// Implementations2_2_0.updateViewForBankAccount ::
+// Implementations2_2_0.getCurrentFxRate ::
+// Implementations2_2_0.getExplicitCounterpartiesForAccount ::
+// Implementations2_2_0.getExplicitCounterpartyById ::
+// Implementations2_2_0.getMessageDocs ::
+// Implementations2_2_0.createBank ::
+// Implementations2_2_0.createAccount ::
+// Implementations2_2_0.createBranch ::
+// Implementations2_2_0.createAtm ::
+// Implementations2_2_0.config ::
+// Implementations2_2_0.getConnectorMetrics ::
+// Implementations2_2_0.createConsumer ::
+// Implementations2_2_0.createProduct ::
+// Implementations2_2_0.createCounterparty ::
+// Nil
+//
+// val allResourceDocs = Implementations2_2_0.resourceDocs ++
+// Implementations2_1_0.resourceDocs ++
+// Implementations2_0_0.resourceDocs ++
+// Implementations1_4_0.resourceDocs ++
+// Implementations1_3_0.resourceDocs ++
+// Implementations1_2_1.resourceDocs
+//
+//
+// // Filter the possible endpoints by the disabled / enabled Props settings and add them together
+// val routes : List[OBPEndpoint] =
+// getAllowedEndpoints(endpointsOf1_2_1, Implementations1_2_1.resourceDocs) :::
+// getAllowedEndpoints(endpointsOf1_3_0, Implementations1_3_0.resourceDocs) :::
+// getAllowedEndpoints(endpointsOf1_4_0, Implementations1_4_0.resourceDocs) :::
+// getAllowedEndpoints(endpointsOf2_0_0, Implementations2_0_0.resourceDocs) :::
+// getAllowedEndpoints(endpointsOf2_1_0, Implementations2_1_0.resourceDocs) :::
+// getAllowedEndpoints(endpointsOf2_2_0, Implementations2_2_0.resourceDocs)
+//
+//
+// registerRoutes(routes, allResourceDocs, apiPrefix)
+//
+// logger.info(s"version $version has been run! There are ${routes.length} routes.")
+//
+//}
\ No newline at end of file
diff --git a/obp-api/src/main/scala/code/api/v3_0_0/Http4s300.scala b/obp-api/src/main/scala/code/api/v3_0_0/Http4s300.scala
index 32aac47370..74cc17d2fd 100644
--- a/obp-api/src/main/scala/code/api/v3_0_0/Http4s300.scala
+++ b/obp-api/src/main/scala/code/api/v3_0_0/Http4s300.scala
@@ -4,7 +4,9 @@ import cats.data.{Kleisli, OptionT}
import cats.effect._
import code.api.Constant
import code.api.Constant._
+import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
+import code.api.v2_0_0.AccountsHelper._
import code.api.util.APIUtil.{EmptyBody, ResourceDoc, _}
import code.api.util.{ApiRole, FutureUtil}
import code.api.util.ApiRole._
@@ -70,16 +72,24 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(root), "GET", "/root",
+ null,
+ implementedInApiVersion,
+ nameOf(root),
+ "GET",
+ "/root",
"Get API Info (root)",
"""Returns information about:
- |
- |* API version
- |* Hosted by information
- |* Git Commit""",
- EmptyBody, apiInfoJSON,
- List(UnknownError, MandatoryPropertyIsNotSet), apiTagApi :: Nil, None,
- http4sPartialFunction = Some(root))
+ |
+ |* API version
+ |* Hosted by information
+ |* Git Commit""",
+ EmptyBody,
+ apiInfoJSON,
+ List(UnknownError, MandatoryPropertyIsNotSet),
+ apiTagApi :: Nil,
+ None,
+ http4sPartialFunction = Some(root)
+ )
// ─── getViewsForBankAccount ───────────────────────────────────────────────
@@ -100,16 +110,43 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getViewsForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getViewsForBankAccount),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/views",
"Get Views for Account",
- s"""Returns the list of the views created for account ACCOUNT_ID at BANK_ID.
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.""",
- EmptyBody, viewsJsonV300,
+ s"""#Views
+ |
+ |
+ |Views in Open Bank Project provide a mechanism for fine grained access control and delegation to Accounts and Transactions. Account holders use the 'owner' view by default. Delegated access is made through other views for example 'accountants', 'share-holders' or 'tagging-application'. Views can be created via the API and each view has a list of entitlements.
+ |
+ |Views on accounts and transactions filter the underlying data to redact certain fields for certain users. For instance the balance on an account may be hidden from the public. The way to know what is possible on a view is determined in the following JSON.
+ |
+ |**Data:** When a view moderates a set of data, some fields my contain the value `null` rather than the original value. This indicates either that the user is not allowed to see the original data or the field is empty.
+ |
+ |There is currently one exception to this rule; the 'holder' field in the JSON contains always a value which is either an alias or the real name - indicated by the 'is_alias' field.
+ |
+ |**Action:** When a user performs an action like trying to post a comment (with POST API call), if he is not allowed, the body response will contain an error message.
+ |
+ |**Metadata:**
+ |Transaction metadata (like images, tags, comments, etc.) will appears *ONLY* on the view where they have been created e.g. comments posted to the public view only appear on the public view.
+ |
+ |The other account metadata fields (like image_URL, more_info, etc.) are unique through all the views. Example, if a user edits the 'more_info' field in the 'team' view, then the view 'authorities' will show the new value (if it is allowed to do it).
+ |
+ |# All
+ |*Optional*
+ |
+ |Returns the list of the views created for account ACCOUNT_ID at BANK_ID.
+ |
+ |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.""",
+ EmptyBody,
+ viewsJsonV300,
List(AuthenticatedUserIsRequired, BankAccountNotFound, UnknownError),
- List(apiTagView, apiTagAccount), None,
- http4sPartialFunction = Some(getViewsForBankAccount))
+ List(apiTagView, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getViewsForBankAccount)
+ )
// ─── createViewForBankAccount ─────────────────────────────────────────────
@@ -134,16 +171,37 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createViewForBankAccount), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createViewForBankAccount),
+ "POST",
"/banks/BANK_ID/accounts/VIEW_ACCOUNT_ID/views",
"Create Custom View",
- s"""Create a custom view on bank account.
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.""",
- createViewJsonV300, viewJsonV300,
+ s"""Create a custom view on bank account
+ |
+ | ${userAuthenticationMessage(true)} and the user needs to have access to the owner view.
+ | The 'alias' field in the JSON can take one of three values:
+ |
+ | * _public_: to use the public alias if there is one specified for the other account.
+ | * _private_: to use the private alias if there is one specified for the other account.
+ |
+ | * _''(empty string)_: to use no alias; the view shows the real name of the other account.
+ |
+ | The 'hide_metadata_if_alias_used' field in the JSON can take boolean values. If it is set to `true` and there is an alias on the other account then the other accounts' metadata (like more_info, url, image_url, open_corporates_url, etc.) will be hidden. Otherwise the metadata will be shown.
+ |
+ | The 'allowed_actions' field is a list containing the name of the actions allowed on this view, all the actions contained will be set to `true` on the view creation, the rest will be set to `false`.
+ |
+ | The 'metadata_view' field determines where metadata (comments, tags, images, where tags) for transactions are stored and retrieved. If set to another view's ID (e.g. 'owner'), metadata added through this view will be shared with all other views that also use the same metadata_view value. If left empty, metadata is stored under this view's own ID and is not shared with other views.
+ |
+ | You MUST use a leading _ (underscore) in the view name because other view names are reserved for OBP [system views](/index#group-View-System).
+ | """,
+ SwaggerDefinitionsJSON.createViewJsonV300,
+ viewJsonV300,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, BankAccountNotFound, UnknownError),
- List(apiTagView, apiTagAccount), None,
- http4sPartialFunction = Some(createViewForBankAccount))
+ List(apiTagView, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(createViewForBankAccount)
+ )
private def createViewImpl300(user: User, account: BankAccount, body: String, cc: CallContext): Future[ViewJsonV300] = {
for {
@@ -184,16 +242,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateViewForBankAccount), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateViewForBankAccount),
+ "PUT",
"/banks/BANK_ID/accounts/ACCOUNT_ID/views/UPD_VIEW_ID",
"Update Custom View",
- s"""Update an existing custom view on a bank account.
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.""",
- updateViewJsonV300, viewJsonV300,
+ s"""Update an existing custom view on a bank account
+ |
+ |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.
+ |
+ |The json sent is the same as during view creation (above), with one difference: the 'name' field
+ |of a view is not editable (it is only set when a view is created)""",
+ updateViewJsonV300,
+ viewJsonV300,
List(InvalidJsonFormat, AuthenticatedUserIsRequired, BankAccountNotFound, UnknownError),
- List(apiTagView, apiTagAccount), None,
- http4sPartialFunction = Some(updateViewForBankAccount))
+ List(apiTagView, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(updateViewForBankAccount)
+ )
private def updateViewImpl300(user: User, account: BankAccount, viewId: ViewId, body: String, cc: CallContext): Future[ViewJsonV300] = {
for {
@@ -244,16 +311,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPermissionForUserForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPermissionForUserForBankAccount),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/permissions/PROVIDER/PROVIDER_ID",
"Get Account access for User",
s"""Returns the list of the views at BANK_ID for account ACCOUNT_ID that a user identified by PROVIDER_ID at their provider PROVIDER has access to.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, viewsJsonV300,
+ |All url parameters must be [%-encoded](http://en.wikipedia.org/wiki/Percent-encoding), which is often especially relevant for USER_ID and PROVIDER.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |The user needs to have access to the owner view.""",
+ EmptyBody,
+ viewsJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, AccountNotFound, UnknownError),
- List(apiTagView, apiTagAccount, apiTagUser), None,
- http4sPartialFunction = Some(getPermissionForUserForBankAccount))
+ List(apiTagView, apiTagAccount, apiTagUser),
+ None,
+ http4sPartialFunction = Some(getPermissionForUserForBankAccount)
+ )
// ─── getPrivateAccountById ────────────────────────────────────────────────
@@ -267,14 +343,35 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPrivateAccountById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPrivateAccountById),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/account",
"Get Account by Id (Full)",
- """Information returned about an account specified by ACCOUNT_ID as moderated by the view (VIEW_ID).""",
- EmptyBody, moderatedCoreAccountJsonV300,
+ """Information returned about an account specified by ACCOUNT_ID as moderated by the view (VIEW_ID):
+ |
+ |* Number
+ |* Owners
+ |* Type
+ |* Balance
+ |* IBAN
+ |* Available views (sorted by short_name)
+ |
+ |More details about the data moderation by the view [here](#1_2_1-getViewsForBankAccount).
+ |
+ |PSD2 Context: PSD2 requires customers to have access to their account information via third party applications.
+ |This call provides balance and other account information via delegated authentication using OAuth.
+ |
+ |Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
+ |""".stripMargin,
+ EmptyBody,
+ moderatedCoreAccountJsonV300,
List(BankNotFound, AccountNotFound, ViewNotFound, UserNoPermissionAccessView, UnknownError),
- apiTagAccount :: Nil, None,
- http4sPartialFunction = Some(getPrivateAccountById))
+ apiTagAccount :: Nil,
+ None,
+ http4sPartialFunction = Some(getPrivateAccountById)
+ )
// ─── getPublicAccountById ─────────────────────────────────────────────────
@@ -291,16 +388,37 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPublicAccountById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPublicAccountById),
+ "GET",
"/banks/BANK_ID/public/accounts/ACCOUNT_ID/VIEW_ID/account",
"Get Public Account by Id",
- s"""Returns information about an account that has a public view.
- |
- |${userAuthenticationMessage(false)}""",
- EmptyBody, moderatedCoreAccountJsonV300,
+ s"""
+ |Returns information about an account that has a public view.
+ |
+ |The account is specified by ACCOUNT_ID. The information is moderated by the view specified by VIEW_ID.
+ |
+ |* Number
+ |* Owners
+ |* Type
+ |* Balance
+ |* Routing
+ |
+ |
+ |PSD2 Context: PSD2 requires customers to have access to their account information via third party applications.
+ |This call provides balance and other account information via delegated authentication using OAuth.
+ |
+ |${userAuthenticationMessage(false)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ moderatedCoreAccountJsonV300,
List(BankNotFound, AccountNotFound, ViewNotFound, UnknownError),
- apiTagAccountPublic :: apiTagAccount :: Nil, None,
- http4sPartialFunction = Some(getPublicAccountById))
+ apiTagAccountPublic :: apiTagAccount :: Nil,
+ None,
+ http4sPartialFunction = Some(getPublicAccountById)
+ )
// ─── getCoreAccountById ───────────────────────────────────────────────────
@@ -318,16 +436,35 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCoreAccountById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCoreAccountById),
+ "GET",
"/my/banks/BANK_ID/accounts/ACCOUNT_ID/account",
"Get Account by Id (Core)",
- s"""Information returned about the account specified by ACCOUNT_ID.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, newModeratedCoreAccountJsonV300,
+ s"""Information returned about the account specified by ACCOUNT_ID:
+ |
+ |* Number - The human readable account number given by the bank that identifies the account.
+ |* Label - A label given by the owner of the account
+ |* Owners - Users that own this account
+ |* Type - The type of account
+ |* Balance - Currency and Value
+ |* Account Routings - A list that might include IBAN or national account identifiers
+ |* Account Rules - A list that might include Overdraft and other bank specific rules
+ |
+ |This call returns the owner view and requires access to that view.
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ newModeratedCoreAccountJsonV300,
List(BankAccountNotFound, UnknownError),
- apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(getCoreAccountById))
+ apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(getCoreAccountById)
+ )
// ─── corePrivateAccountsAllBanks ──────────────────────────────────────────
@@ -343,16 +480,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(corePrivateAccountsAllBanks), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(corePrivateAccountsAllBanks),
+ "GET",
"/my/accounts",
"Get Accounts at all Banks (private)",
s"""Returns the list of accounts containing private views for the user.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, coreAccountsJsonV300,
+ |Each account lists the views available to the user.
+ |
+ |${accountTypeFilterText("/my/accounts")}
+ |
+ |${userAuthenticationMessage(true)}
+ |""",
+ EmptyBody,
+ coreAccountsJsonV300,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagAccount, apiTagPSD2AIS, apiTagPrivateData, apiTagPsd2), None,
- http4sPartialFunction = Some(corePrivateAccountsAllBanks))
+ List(apiTagAccount, apiTagPSD2AIS, apiTagPrivateData, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(corePrivateAccountsAllBanks)
+ )
// ─── getFirehoseAccountsAtOneBank ─────────────────────────────────────────
// Uses FIREHOSE_BANK_ID / FIREHOSE_VIEW_ID in the ResourceDoc URL template so middleware
@@ -406,17 +553,43 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getFirehoseAccountsAtOneBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getFirehoseAccountsAtOneBank),
+ "GET",
"/banks/FIREHOSE_BANK_ID/firehose/accounts/views/FIREHOSE_VIEW_ID",
"Get Firehose Accounts at Bank",
- s"""Get all Accounts at a Bank that have a Firehose View.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, moderatedCoreAccountsJsonV300,
+ s"""
+ |Get all Accounts at a Bank.
+ |
+ |This endpoint allows bulk access to all accounts at the specified bank.
+ |
+ |Requires the CanUseFirehoseAtAnyBank Role or CanUseAccountFirehose Role
+ |
+ |Returns all accounts at the bank. The VIEW_ID parameter determines what account data fields are visible according to the view's permissions.
+ |
+ |The view specified must have is_firehose = true
+ |
+ |For VIEW_ID try 'owner' or 'firehose'
+ |
+ |Optional request parameters for filtering by account attributes:
+ |URL params example:
+ | /banks/some-bank-id/firehose/accounts/views/owner?limit=50&offset=1
+ |
+ |To invalidate browser cache, add timestamp query parameter as follows (the parameter name must be `_timestamp_`):
+ |URL params example:
+ | `/banks/some-bank-id/firehose/accounts/views/owner?limit=50&offset=1&_timestamp_=1596762180358`
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ moderatedCoreAccountsJsonV300,
List(AuthenticatedUserIsRequired, AccountFirehoseNotAllowedOnThisInstance, UnknownError),
List(apiTagAccount, apiTagAccountFirehose, apiTagFirehoseData),
None,
- http4sPartialFunction = Some(getFirehoseAccountsAtOneBank))
+ http4sPartialFunction = Some(getFirehoseAccountsAtOneBank)
+ )
// ─── getFirehoseTransactionsForBankAccount ────────────────────────────────
// Uses non-standard FIREHOSE_* vars so middleware skips bank/account/view validation.
@@ -461,17 +634,34 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getFirehoseTransactionsForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getFirehoseTransactionsForBankAccount),
+ "GET",
"/banks/FIREHOSE_BANK_ID/firehose/accounts/FIREHOSE_ACCOUNT_ID/views/FIREHOSE_VIEW_ID/transactions",
"Get Firehose Transactions for Account",
- s"""Get Transactions for an Account that has a firehose View.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, transactionsJsonV300,
+ s"""
+ |Get Transactions for an Account that has a firehose View.
+ |
+ |Allows bulk access to an account's transactions.
+ |User must have the CanUseFirehoseAtAnyBank Role
+ |
+ |To find ACCOUNT_IDs, use the getFirehoseAccountsAtOneBank call.
+ |
+ |For VIEW_ID try 'owner'
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ transactionsJsonV300,
List(AuthenticatedUserIsRequired, AccountFirehoseNotAllowedOnThisInstance, UserHasMissingRoles, UnknownError),
List(apiTagTransaction, apiTagAccountFirehose, apiTagTransactionFirehose, apiTagFirehoseData),
None,
- http4sPartialFunction = Some(getFirehoseTransactionsForBankAccount))
+ http4sPartialFunction = Some(getFirehoseTransactionsForBankAccount)
+ )
// ─── getCoreTransactionsForBankAccount ────────────────────────────────────
@@ -497,17 +687,27 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCoreTransactionsForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCoreTransactionsForBankAccount),
+ "GET",
"/my/banks/BANK_ID/accounts/ACCOUNT_ID/transactions",
"Get Transactions for Account (Core)",
s"""Returns transactions list (Core info) of the account specified by ACCOUNT_ID.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, coreTransactionsJsonV300,
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |""",
+ EmptyBody,
+ coreTransactionsJsonV300,
List(FilterSortDirectionError, FilterOffersetError, FilterLimitError, FilterDateFormatError,
- AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound, UnknownError),
- List(apiTagTransaction, apiTagPSD2AIS, apiTagAccount, apiTagPsd2), None,
- http4sPartialFunction = Some(getCoreTransactionsForBankAccount))
+ AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound, UnknownError),
+ List(apiTagTransaction, apiTagPSD2AIS, apiTagAccount, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getCoreTransactionsForBankAccount)
+ )
// ─── getTransactionsForBankAccount ────────────────────────────────────────
@@ -532,17 +732,29 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionsForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionsForBankAccount),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transactions",
"Get Transactions for Account (Full)",
- s"""Returns transactions list of the account specified by ACCOUNT_ID and moderated by the view (VIEW_ID).
- |
- |${userAuthenticationMessage(false)}""",
- EmptyBody, transactionsJsonV300,
+ s"""Returns transactions list of the account specified by ACCOUNT_ID and [moderated](#1_2_1-getViewsForBankAccount) by the view (VIEW_ID).
+ |
+ |${userAuthenticationMessage(false)}
+ |
+ |Authentication is required if the view is not public.
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |""",
+ EmptyBody,
+ transactionsJsonV300,
List(FilterSortDirectionError, FilterOffersetError, FilterLimitError, FilterDateFormatError,
- AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound, UnknownError),
- List(apiTagTransaction, apiTagAccount), None,
- http4sPartialFunction = Some(getTransactionsForBankAccount))
+ AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound, UnknownError),
+ List(apiTagTransaction, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getTransactionsForBankAccount)
+ )
// ─── dataWarehouseSearch ──────────────────────────────────────────────────
@@ -578,17 +790,48 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(dataWarehouseSearch), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(dataWarehouseSearch),
+ "POST",
"/search/warehouse/INDEX",
"Data Warehouse Search",
- s"""Search the data warehouse and get row level results.
- |
- |${userAuthenticationMessage(true)}""",
- elasticSearchJsonV300, emptyElasticSearch,
+ s"""
+ |Search the data warehouse and get row level results.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |CanSearchWarehouse entitlement is required. You can request the Role below.
+ |
+ |Elastic (search) is used in the background. See links below for syntax.
+ |
+ |Examples of usage:
+ |
+ |
+ |POST /search/warehouse/THE_INDEX_YOU_WANT_TO_USE
+ |
+ |POST /search/warehouse/INDEX1,INDEX2
+ |
+ |POST /search/warehouse/ALL
+ |
+ |{ Any valid elasticsearch query DSL in the body }
+ |
+ |
+ |[Elasticsearch query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html)
+ |
+ |[Elastic simple query](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-request-body.html)
+ |
+ |[Elastic aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations.html)
+ |
+ |
+ """,
+ elasticSearchJsonV300,
+ emptyElasticSearch,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagSearchWarehouse),
Some(List(canSearchWarehouse)),
- http4sPartialFunction = Some(dataWarehouseSearch))
+ http4sPartialFunction = Some(dataWarehouseSearch)
+ )
// ─── dataWarehouseStatistics ──────────────────────────────────────────────
@@ -622,17 +865,49 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(dataWarehouseStatistics), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(dataWarehouseStatistics),
+ "POST",
"/search/warehouse/statistics/INDEX/FIELD",
"Data Warehouse Statistics",
- s"""Search the data warehouse and get statistical aggregations over a warehouse field.
- |
- |${userAuthenticationMessage(true)}""",
- elasticSearchJsonV300, emptyElasticSearch,
+ s"""
+ |Search the data warehouse and get statistical aggregations over a warehouse field
+ |
+ |Does a stats aggregation over some numeric field:
+ |
+ |https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-stats-aggregation.html
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |CanSearchWarehouseStats Role is required. You can request this below.
+ |
+ |Elastic (search) is used in the background. See links below for syntax.
+ |
+ |Examples of usage:
+ |
+ |POST /search/warehouse/statistics/INDEX/FIELD
+ |
+ |POST /search/warehouse/statistics/ALL/FIELD
+ |
+ |{ Any valid elasticsearch query DSL in the body }
+ |
+ |
+ |[Elasticsearch query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html)
+ |
+ |[Elastic simple query](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-request-body.html)
+ |
+ |[Elastic aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations.html)
+ |
+ |
+ """,
+ elasticSearchJsonV300,
+ emptyElasticSearch,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagSearchWarehouse),
Some(List(canSearchWarehouseStatistics)),
- http4sPartialFunction = Some(dataWarehouseStatistics))
+ http4sPartialFunction = Some(dataWarehouseStatistics)
+ )
// ─── getUser (by email) ───────────────────────────────────────────────────
@@ -647,17 +922,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUser),
+ "GET",
"/users/email/USER_EMAIL/terminator",
"Get Users by Email Address",
- s"""Get users by email address.
+ s"""Get users by email address
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, usersJsonV200,
+ |${userAuthenticationMessage(true)}
+ |CanGetAnyUser entitlement is required,
+ |
+ """.stripMargin,
+ EmptyBody,
+ usersJsonV200,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UserNotFoundByEmail, UnknownError),
List(apiTagUser),
Some(List(canGetAnyUser)),
- http4sPartialFunction = Some(getUser))
+ http4sPartialFunction = Some(getUser)
+ )
// ─── getUserByUserId ──────────────────────────────────────────────────────
@@ -675,17 +958,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserByUserId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserByUserId),
+ "GET",
"/users/user_id/USER_ID",
"Get User by USER_ID",
- s"""Get user by USER_ID.
+ s"""Get user by USER_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |CanGetAnyUser entitlement is required,
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, usersJsonV200,
+ """.stripMargin,
+ EmptyBody,
+ usersJsonV200,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UserNotFoundById, UnknownError),
List(apiTagUser),
Some(List(canGetAnyUser)),
- http4sPartialFunction = Some(getUserByUserId))
+ http4sPartialFunction = Some(getUserByUserId)
+ )
// ─── getUserByUsername ────────────────────────────────────────────────────
@@ -703,17 +994,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserByUsername), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserByUsername),
+ "GET",
"/users/username/USERNAME",
"Get User by USERNAME",
- s"""Get user by USERNAME.
+ s"""Get user by USERNAME
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |CanGetAnyUser entitlement is required,
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, usersJsonV200,
+ """.stripMargin,
+ EmptyBody,
+ usersJsonV200,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UserNotFoundByProviderAndUsername, UnknownError),
List(apiTagUser),
Some(List(canGetAnyUser)),
- http4sPartialFunction = Some(getUserByUsername))
+ http4sPartialFunction = Some(getUserByUsername)
+ )
// ─── getAdapterInfoForBank ────────────────────────────────────────────────
@@ -728,17 +1028,24 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAdapterInfoForBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAdapterInfoForBank),
+ "GET",
"/banks/BANK_ID/adapter",
"Get Adapter Info for a bank",
s"""Get basic information about the Adapter listening on behalf of this bank.
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, adapterInfoJsonV300,
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ adapterInfoJsonV300,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagApi),
Some(List(canGetAdapterInfoAtOneBank)),
- http4sPartialFunction = Some(getAdapterInfoForBank))
+ http4sPartialFunction = Some(getAdapterInfoForBank)
+ )
// ─── createBranch ─────────────────────────────────────────────────────────
@@ -760,17 +1067,24 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBranch), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBranch),
+ "POST",
"/banks/BANK_ID/branches",
"Create Branch",
s"""Create Branch for the Bank.
- |
- |${userAuthenticationMessage(true)}""",
- branchJsonV300, branchJsonV300,
+ |
+ |${userAuthenticationMessage(true) }
+ |
+ |""",
+ branchJsonV300,
+ branchJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, InsufficientAuthorisationToCreateBranch, UnknownError),
List(apiTagBranch),
Some(List(canCreateBranch, canCreateBranchAtAnyBank)),
- http4sPartialFunction = Some(createBranch))
+ http4sPartialFunction = Some(createBranch)
+ )
// ─── updateBranch ─────────────────────────────────────────────────────────
@@ -796,17 +1110,24 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBranch), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBranch),
+ "PUT",
"/banks/BANK_ID/branches/BRANCH_ID",
"Update Branch",
- s"""Update an existing branch for a bank account.
- |
- |${userAuthenticationMessage(true)}""",
- postBranchJsonV300, branchJsonV300,
+ s"""Update an existing branch for a bank account (Authenticated access).
+ |
+ |${userAuthenticationMessage(true) }
+ |
+ |""",
+ postBranchJsonV300,
+ branchJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, InsufficientAuthorisationToCreateBranch, UnknownError),
List(apiTagBranch),
Some(List(canUpdateBranch)),
- http4sPartialFunction = Some(updateBranch))
+ http4sPartialFunction = Some(updateBranch)
+ )
// ─── createAtm ────────────────────────────────────────────────────────────
@@ -828,17 +1149,24 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createAtm), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createAtm),
+ "POST",
"/banks/BANK_ID/atms",
"Create ATM",
s"""Create ATM for the Bank.
- |
- |${userAuthenticationMessage(true)}""",
- atmJsonV300, atmJsonV300,
+ |
+ |${userAuthenticationMessage(true) }
+ |
+ |""",
+ atmJsonV300,
+ atmJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, UserHasMissingRoles, UnknownError),
List(apiTagATM),
Some(List(canCreateAtm, canCreateAtmAtAnyBank)),
- http4sPartialFunction = Some(createAtm))
+ http4sPartialFunction = Some(createAtm)
+ )
// ─── getBranch ────────────────────────────────────────────────────────────
@@ -857,16 +1185,27 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBranch), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBranch),
+ "GET",
"/banks/BANK_ID/branches/BRANCH_ID",
"Get Branch",
- s"""Returns information about a single Branch specified by BANK_ID and BRANCH_ID.
- |
- |${userAuthenticationMessage(!getBranchesIsPublic)}""",
- EmptyBody, branchJsonV300,
+ s"""Returns information about a single Branch specified by BANK_ID and BRANCH_ID including:
+ |
+ |* Name
+ |* Address
+ |* Geo Location
+ |* License the data under this endpoint is released under.
+ |
+ |${userAuthenticationMessage(!getBranchesIsPublic)}""".stripMargin,
+ EmptyBody,
+ branchJsonV300,
List(AuthenticatedUserIsRequired, BranchNotFoundByBranchId, UnknownError),
- List(apiTagBranch, apiTagBank), None,
- http4sPartialFunction = Some(getBranch))
+ List(apiTagBranch, apiTagBank),
+ None,
+ http4sPartialFunction = Some(getBranch)
+ )
// ─── getBranches ──────────────────────────────────────────────────────────
@@ -944,16 +1283,47 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBranches), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBranches),
+ "GET",
"/banks/BANK_ID/branches",
"Get Branches for a Bank",
- s"""Returns information about branches for a single bank specified by BANK_ID.
- |
- |${userAuthenticationMessage(!getBranchesIsPublic)}""",
- EmptyBody, branchesJsonV300,
+ s"""Returns information about branches for a single bank specified by BANK_ID including:
+ |
+ |* Name
+ |* Address
+ |* Geo Location
+ |* License the data under this endpoint is released under
+ |* Structured opening hours
+ |* Accessible flag
+ |* Branch Type
+ |* More Info
+ |
+ |Pagination:
+ |
+ |By default, 50 records are returned.
+ |
+ |You can use the url query parameters *limit* and *offset* for pagination
+ |You can also use the follow url query parameters:
+ |
+ | - city - string, find Branches those in this city, optional
+ |
+ |
+ | - withinMetersOf - number, find Branches within given meters distance, optional
+ | - nearLatitude - number, a position of latitude value, cooperate with withMetersOf do query filter, optional
+ | - nearLongitude - number, a position of longitude value, cooperate with withMetersOf do query filter, optional
+ |
+ |note: withinMetersOf, nearLatitude and nearLongitude either all empty or all have value.
+ |
+ |${userAuthenticationMessage(!getBranchesIsPublic)}""".stripMargin,
+ EmptyBody,
+ branchesJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, BranchesNotFoundLicense, UnknownError),
- List(apiTagBranch, apiTagBank), None,
- http4sPartialFunction = Some(getBranches))
+ List(apiTagBranch, apiTagBank),
+ None,
+ http4sPartialFunction = Some(getBranches)
+ )
// ─── getAtm ───────────────────────────────────────────────────────────────
@@ -972,16 +1342,28 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAtm), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAtm),
+ "GET",
"/banks/BANK_ID/atms/ATM_ID",
"Get Bank ATM",
- s"""Returns information about ATM for a single bank specified by BANK_ID and ATM_ID.
- |
- |${userAuthenticationMessage(!getAtmsIsPublic)}""",
- EmptyBody, atmJsonV300,
+ s"""Returns information about ATM for a single bank specified by BANK_ID and ATM_ID including:
+ |
+ |* Address
+ |* Geo Location
+ |* License the data under this endpoint is released under
+ |
+ |
+ |
+ |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
+ EmptyBody,
+ atmJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, AtmNotFoundByAtmId, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(getAtm))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(getAtm)
+ )
// ─── getAtms ──────────────────────────────────────────────────────────────
@@ -1020,16 +1402,32 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAtms), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAtms),
+ "GET",
"/banks/BANK_ID/atms",
"Get Bank ATMS",
- s"""Returns information about ATMs for a single bank specified by BANK_ID.
- |
- |${userAuthenticationMessage(!getAtmsIsPublic)}""",
- EmptyBody, atmJsonV300,
+ s"""Returns information about ATMs for a single bank specified by BANK_ID including:
+ |
+ |* Address
+ |* Geo Location
+ |* License the data under this endpoint is released under
+ |
+ |Pagination:
+ |
+ |By default, 100 records are returned.
+ |
+ |You can use the url query parameters *limit* and *offset* for pagination
+ |
+ |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
+ EmptyBody,
+ atmJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(getAtms))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(getAtms)
+ )
// ─── getUsers ─────────────────────────────────────────────────────────────
@@ -1046,17 +1444,29 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUsers), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUsers),
+ "GET",
"/users",
"Get all Users",
- s"""Get all users.
+ s"""Get all users
+ |
+ |${userAuthenticationMessage(true)}
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, usersJsonV200,
+ |CanGetAnyUser entitlement is required,
+ |
+ |${urlParametersDocument(false, false)}
+ |* locked_status (if null ignore)
+ |
+ """.stripMargin,
+ EmptyBody,
+ usersJsonV200,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagUser),
Some(List(canGetAnyUser)),
- http4sPartialFunction = Some(getUsers))
+ http4sPartialFunction = Some(getUsers)
+ )
// ─── getCustomersForUser ──────────────────────────────────────────────────
@@ -1073,16 +1483,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomersForUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomersForUser),
+ "GET",
"/users/current/customers",
"Get Customers for Current User",
s"""Gets all Customers that are linked to a User.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, customersWithAttributesJsonV300,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customersWithAttributesJsonV300,
List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
- List(apiTagCustomer, apiTagUser), None,
- http4sPartialFunction = Some(getCustomersForUser))
+ List(apiTagCustomer, apiTagUser),
+ None,
+ http4sPartialFunction = Some(getCustomersForUser)
+ )
// ─── getCurrentUser ───────────────────────────────────────────────────────
@@ -1099,16 +1518,23 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCurrentUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCurrentUser),
+ "GET",
"/users/current",
"Get User (Current)",
- s"""Get the logged in user.
+ s"""Get the logged in user
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, userJsonV300,
+ |${userAuthenticationMessage(true)}
+ """.stripMargin,
+ EmptyBody,
+ userJsonV300,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagUser), None,
- http4sPartialFunction = Some(getCurrentUser))
+ List(apiTagUser),
+ None,
+ http4sPartialFunction = Some(getCurrentUser)
+ )
// ─── privateAccountsAtOneBank ─────────────────────────────────────────────
@@ -1124,16 +1550,27 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(privateAccountsAtOneBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(privateAccountsAtOneBank),
+ "GET",
"/banks/BANK_ID/accounts/private",
"Get Accounts at Bank (Minimal)",
s"""Returns the minimal list of private accounts at BANK_ID that the user has access to.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, coreAccountsJsonV300,
+ |For each account, the API returns the ID, routing addresses and the views available to the current user.
+ |
+ |If you want to see more information on the Views, use the Account Detail call.
+ |
+ |${accountTypeFilterText("/banks/BANK_ID/accounts/private")}
+ |
+ |${userAuthenticationMessage(true)}""".stripMargin,
+ EmptyBody,
+ coreAccountsJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagAccount, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(privateAccountsAtOneBank))
+ List(apiTagAccount, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(privateAccountsAtOneBank)
+ )
// ─── getPrivateAccountIdsbyBankId ─────────────────────────────────────────
@@ -1150,16 +1587,30 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPrivateAccountIdsbyBankId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPrivateAccountIdsbyBankId),
+ "GET",
"/banks/BANK_ID/accounts/account_ids/private",
"Get Accounts at Bank (IDs only)",
s"""Returns only the list of accounts ids at BANK_ID that the user has access to.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, accountsIdsJsonV300,
+ |
+ |Each account must have at least one private View.
+ |
+ |For each account the API returns its account ID.
+ |
+ |If you want to see more information on the Views, use the Account Detail call.
+ |
+ |${accountTypeFilterText("/banks/BANK_ID/accounts/account_ids/private")}
+ |
+ |${userAuthenticationMessage(true)}""".stripMargin,
+ EmptyBody,
+ accountsIdsJsonV300,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagAccount, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(getPrivateAccountIdsbyBankId))
+ List(apiTagAccount, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getPrivateAccountIdsbyBankId)
+ )
// ─── getOtherAccountsForBankAccount ───────────────────────────────────────
@@ -1173,16 +1624,23 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getOtherAccountsForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getOtherAccountsForBankAccount),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts",
"Get Other Accounts of one Account",
s"""Returns data about all the other accounts that have shared at least one transaction with the ACCOUNT_ID at BANK_ID.
- |
- |${userAuthenticationMessage(false)}""",
- EmptyBody, otherAccountsJsonV300,
+ |${userAuthenticationMessage(false)}
+ |
+ |Authentication is required if the view VIEW_ID is not public.""",
+ EmptyBody,
+ otherAccountsJsonV300,
List(AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound, InvalidConnectorResponse, UnknownError),
- List(apiTagCounterparty, apiTagAccount), None,
- http4sPartialFunction = Some(getOtherAccountsForBankAccount))
+ List(apiTagCounterparty, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getOtherAccountsForBankAccount)
+ )
// ─── getOtherAccountByIdForBankAccount ────────────────────────────────────
@@ -1196,16 +1654,23 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getOtherAccountByIdForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getOtherAccountByIdForBankAccount),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID",
"Get Other Account by Id",
s"""Returns data about the Other Account that has shared at least one transaction with ACCOUNT_ID at BANK_ID.
- |
- |${userAuthenticationMessage(false)}""",
- EmptyBody, otherAccountJsonV300,
+ |${userAuthenticationMessage(false)}
+ |
+ |Authentication is required if the view is not public.""",
+ EmptyBody,
+ otherAccountJsonV300,
List(AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound, InvalidConnectorResponse, UnknownError),
- List(apiTagCounterparty, apiTagAccount), None,
- http4sPartialFunction = Some(getOtherAccountByIdForBankAccount))
+ List(apiTagCounterparty, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getOtherAccountByIdForBankAccount)
+ )
// ─── addEntitlementRequest ────────────────────────────────────────────────
@@ -1232,17 +1697,35 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(addEntitlementRequest), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(addEntitlementRequest),
+ "POST",
"/entitlement-requests",
"Create Entitlement Request for current User",
s"""Create Entitlement Request.
- |
- |${userAuthenticationMessage(true)}""",
- code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createEntitlementJSON, entitlementRequestJSON,
+ |
+ |Any logged in User can use this endpoint to request an Entitlement
+ |
+ |Entitlements are used to grant System or Bank level roles to Users. (For Account level privileges, see Views)
+ |
+ |For a System level Role (.e.g CanGetAnyUser), set bank_id to an empty string i.e. "bank_id":""
+ |
+ |For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
+ |
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createEntitlementJSON,
+ entitlementRequestJSON,
List(AuthenticatedUserIsRequired, UserNotFoundById, InvalidJsonFormat, IncorrectRoleName,
- EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementRequestAlreadyExists, EntitlementRequestCannotBeAdded, UnknownError),
- List(apiTagRole, apiTagEntitlement, apiTagUser), None,
- http4sPartialFunction = Some(addEntitlementRequest))
+ EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementRequestAlreadyExists, EntitlementRequestCannotBeAdded, UnknownError),
+ List(apiTagRole, apiTagEntitlement, apiTagUser),
+ None,
+ http4sPartialFunction = Some(addEntitlementRequest)
+ )
// ─── getAllEntitlementRequests ─────────────────────────────────────────────
@@ -1261,17 +1744,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllEntitlementRequests), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllEntitlementRequests),
+ "GET",
"/entitlement-requests",
"Get all Entitlement Requests",
- s"""Get all Entitlement Requests.
+ s"""
+ |Get all Entitlement Requests
+ |
+ |${urlParametersDocument(true, true)}
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, entitlementRequestsJSON,
+ |${userAuthenticationMessage(true)}
+ """.stripMargin,
+ EmptyBody,
+ entitlementRequestsJSON,
List(AuthenticatedUserIsRequired, InvalidConnectorResponse, UnknownError),
List(apiTagRole, apiTagEntitlement, apiTagUser),
Some(List(canGetEntitlementRequestsAtOneBank, canGetEntitlementRequestsAtAnyBank)),
- http4sPartialFunction = Some(getAllEntitlementRequests))
+ http4sPartialFunction = Some(getAllEntitlementRequests)
+ )
// ─── getEntitlementRequests ───────────────────────────────────────────────
@@ -1289,17 +1781,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getEntitlementRequests), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getEntitlementRequests),
+ "GET",
"/users/USER_ID/entitlement-requests",
"Get Entitlement Requests for a User",
s"""Get Entitlement Requests for a User.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, entitlementRequestsJSON,
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ entitlementRequestsJSON,
List(AuthenticatedUserIsRequired, InvalidConnectorResponse, UnknownError),
List(apiTagRole, apiTagEntitlement, apiTagUser),
Some(List(canGetEntitlementRequestsAtOneBank, canGetEntitlementRequestsAtAnyBank)),
- http4sPartialFunction = Some(getEntitlementRequests))
+ http4sPartialFunction = Some(getEntitlementRequests)
+ )
// ─── getEntitlementRequestsForCurrentUser ─────────────────────────────────
@@ -1314,16 +1815,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getEntitlementRequestsForCurrentUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getEntitlementRequestsForCurrentUser),
+ "GET",
"/my/entitlement-requests",
"Get Entitlement Requests for the current User",
s"""Get Entitlement Requests for the current User.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, entitlementRequestsJSON,
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ entitlementRequestsJSON,
List(AuthenticatedUserIsRequired, InvalidConnectorResponse, UnknownError),
- List(apiTagRole, apiTagEntitlement, apiTagUser), None,
- http4sPartialFunction = Some(getEntitlementRequestsForCurrentUser))
+ List(apiTagRole, apiTagEntitlement, apiTagUser),
+ None,
+ http4sPartialFunction = Some(getEntitlementRequestsForCurrentUser)
+ )
// ─── deleteEntitlementRequest ─────────────────────────────────────────────
@@ -1345,17 +1856,24 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteEntitlementRequest), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteEntitlementRequest),
+ "DELETE",
"/entitlement-requests/ENTITLEMENT_REQUEST_ID",
"Delete Entitlement Request",
- s"""Delete the Entitlement Request specified by ENTITLEMENT_REQUEST_ID.
+ s"""Delete the Entitlement Request specified by ENTITLEMENT_REQUEST_ID for a user specified by USER_ID
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, EmptyBody,
+ |
+ |${userAuthenticationMessage(true)}
+ """.stripMargin,
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, InvalidConnectorResponse, UnknownError),
List(apiTagRole, apiTagEntitlement, apiTagUser),
Some(List(canDeleteEntitlementRequestsAtOneBank, canDeleteEntitlementRequestsAtAnyBank)),
- http4sPartialFunction = Some(deleteEntitlementRequest))
+ http4sPartialFunction = Some(deleteEntitlementRequest)
+ )
// ─── getEntitlementsForCurrentUser ────────────────────────────────────────
@@ -1376,16 +1894,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getEntitlementsForCurrentUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getEntitlementsForCurrentUser),
+ "GET",
"/my/entitlements",
"Get Entitlements for the current User",
s"""Get Entitlements for the current User.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, entitlementJSONs,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ entitlementJSONs,
List(AuthenticatedUserIsRequired, InvalidConnectorResponse, UnknownError),
- List(apiTagRole, apiTagEntitlement, apiTagUser), None,
- http4sPartialFunction = Some(getEntitlementsForCurrentUser))
+ List(apiTagRole, apiTagEntitlement, apiTagUser),
+ None,
+ http4sPartialFunction = Some(getEntitlementsForCurrentUser)
+ )
// ─── getApiGlossary ───────────────────────────────────────────────────────
@@ -1406,14 +1933,32 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getApiGlossary), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getApiGlossary),
+ "GET",
"/api/glossary",
"Get Glossary of the API",
- """Get API Glossary. Returns the glossary of the API.""",
- EmptyBody, glossaryItemsJsonV300,
+ """Get API Glossary
+ |
+ |Returns the glossary of the API.
+ |
+ |The glossary content is static and only changes when the API is redeployed.
+ |This endpoint supports HTTP caching:
+ |
+ |* The response includes a **Cache-Control** header (max-age=3600) indicating clients should cache for 1 hour.
+ |* The response includes an **ETag** header. Clients can send **If-None-Match** with the ETag value on subsequent requests to receive a **304 Not Modified** if the content has not changed.
+ |
+ |Clients and agents are encouraged to cache the glossary response locally.
+ |
+ |""",
+ EmptyBody,
+ glossaryItemsJsonV300,
List(UnknownError),
- apiTagDocumentation :: Nil, None,
- http4sPartialFunction = Some(getApiGlossary))
+ apiTagDocumentation :: Nil,
+ None,
+ http4sPartialFunction = Some(getApiGlossary)
+ )
// ─── getAccountsHeld ──────────────────────────────────────────────────────
@@ -1431,16 +1976,28 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountsHeld), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountsHeld),
+ "GET",
"/banks/BANK_ID/accounts-held",
"Get Accounts Held",
s"""Get Accounts held by the current User if even the User has not been assigned the owner View yet.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, coreAccountsHeldJsonV300,
+ |
+ |Can be used to onboard the account to the API - since all other account and transaction endpoints require views to be assigned.
+ |
+ |${accountTypeFilterText("/banks/BANK_ID/accounts-held")}
+ |
+ |
+ |
+ """.stripMargin,
+ EmptyBody,
+ coreAccountsHeldJsonV300,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagAccount, apiTagPSD2AIS, apiTagView, apiTagPsd2), None,
- http4sPartialFunction = Some(getAccountsHeld))
+ List(apiTagAccount, apiTagPSD2AIS, apiTagView, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getAccountsHeld)
+ )
// ─── getAggregateMetrics ──────────────────────────────────────────────────
@@ -1459,17 +2016,62 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAggregateMetrics), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAggregateMetrics),
+ "GET",
"/management/aggregate-metrics",
"Get Aggregate Metrics",
- s"""Returns aggregate metrics on api usage.
+ s"""Returns aggregate metrics on api usage eg. total count, response time (in ms), etc.
+ |
+ |Should be able to filter on the following fields
+ |
+ |eg: /management/aggregate-metrics?from_date=$DateWithMsExampleString&to_date=$DateWithMsExampleString&consumer_id=5
+ |&user_id=66214b8e-259e-44ad-8868-3eb47be70646&implemented_by_partial_function=getTransactionsForBankAccount
+ |&implemented_in_version=v3.0.0&url=/obp/v3.0.0/banks/gh.29.uk/accounts/8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0/owner/transactions
+ |&verb=GET&anon=false&app_name=MapperPostman
+ |&exclude_app_names=API-EXPLORER,API-Manager,SOFI,null
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, aggregateMetricsJSONV300,
+ |1 from_date (defaults to the day before the current date): eg:from_date=$DateWithMsExampleString
+ |
+ |2 to_date (defaults to the current date) eg:to_date=$DateWithMsExampleString
+ |
+ |3 consumer_id (if null ignore)
+ |
+ |4 user_id (if null ignore)
+ |
+ |5 anon (if null ignore) only support two value : true (return where user_id is null.) or false (return where user_id is not null.)
+ |
+ |6 url (if null ignore), note: can not contain '&'.
+ |
+ |7 app_name (if null ignore)
+ |
+ |8 implemented_by_partial_function (if null ignore),
+ |
+ |9 implemented_in_version (if null ignore)
+ |
+ |10 verb (if null ignore)
+ |
+ |11 correlation_id (if null ignore)
+ |
+ |12 duration (if null ignore) non digit chars will be silently omitted
+ |
+ |13 exclude_app_names (if null ignore).eg: &exclude_app_names=API-EXPLORER,API-Manager,SOFI,null
+ |
+ |14 exclude_url_patterns (if null ignore).you can design you own SQL NOT LIKE pattern. eg: &exclude_url_patterns=%management/metrics%,%management/aggregate-metrics%
+ |
+ |15 exclude_implemented_by_partial_functions (if null ignore).eg: &exclude_implemented_by_partial_functions=getMetrics,getConnectorMetrics,getAggregateMetrics
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ aggregateMetricsJSONV300,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagMetric, apiTagAggregateMetrics),
Some(List(canReadAggregateMetrics)),
- http4sPartialFunction = Some(getAggregateMetrics))
+ http4sPartialFunction = Some(getAggregateMetrics)
+ )
// ─── addScope ─────────────────────────────────────────────────────────────
@@ -1504,16 +2106,29 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(addScope), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(addScope),
+ "POST",
"/consumers/CONSUMER_ID/scopes",
"Create Scope for a Consumer",
- """Create Scope. Grant Role to Consumer.""",
- code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createScopeJson, scopeJson,
+ """Create Scope. Grant Role to Consumer.
+ |
+ |Scopes are used to grant System or Bank level roles to the Consumer (App). (For Account level privileges, see Views)
+ |
+ |For a System level Role (.e.g CanGetAnyUser), set bank_id to an empty string i.e. "bank_id":""
+ |
+ |For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
+ |
+ |""",
+ SwaggerDefinitionsJSON.createScopeJson,
+ scopeJson,
List(AuthenticatedUserIsRequired, ConsumerNotFoundById, InvalidJsonFormat, IncorrectRoleName,
- EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementAlreadyExists, UnknownError),
+ EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementAlreadyExists, UnknownError),
List(apiTagScope, apiTagConsumer),
Some(List(canCreateScopeAtOneBank, canCreateScopeAtAnyBank)),
- http4sPartialFunction = Some(addScope))
+ http4sPartialFunction = Some(addScope)
+ )
// ─── deleteScope ──────────────────────────────────────────────────────────
@@ -1541,15 +2156,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteScope), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteScope),
+ "DELETE",
"/consumers/CONSUMER_ID/scope/SCOPE_ID",
"Delete Consumer Scope",
- """Delete Consumer Scope specified by SCOPE_ID for a consumer specified by CONSUMER_ID.""",
- EmptyBody, EmptyBody,
+ """Delete Consumer Scope specified by SCOPE_ID for an consumer specified by CONSUMER_ID
+ |
+ |Authentication is required and the user needs to be a Super Admin.
+ |Super Admins are listed in the Props file.
+ |
+ |
+ """.stripMargin,
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, EntitlementNotFound, UnknownError),
List(apiTagScope, apiTagConsumer),
Some(List(canDeleteScopeAtOneBank, canDeleteScopeAtAnyBank)),
- http4sPartialFunction = Some(deleteScope))
+ http4sPartialFunction = Some(deleteScope)
+ )
// ─── getScopes ────────────────────────────────────────────────────────────
@@ -1569,16 +2195,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getScopes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getScopes),
+ "GET",
"/consumers/CONSUMER_ID/scopes",
"Get Scopes for Consumer",
- s"""Get all the scopes for a consumer specified by CONSUMER_ID.
+ s"""Get all the scopes for an consumer specified by CONSUMER_ID
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, scopeJsons,
+ |${userAuthenticationMessage(true)}
+ |
+ |
+ """.stripMargin,
+ EmptyBody,
+ scopeJsons,
List(AuthenticatedUserIsRequired, EntitlementNotFound, UnknownError),
- List(apiTagScope, apiTagConsumer), None,
- http4sPartialFunction = Some(getScopes))
+ List(apiTagScope, apiTagConsumer),
+ None,
+ http4sPartialFunction = Some(getScopes)
+ )
// ─── getBanks ─────────────────────────────────────────────────────────────
@@ -1595,14 +2230,26 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBanks), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBanks),
+ "GET",
"/banks",
"Get Banks",
- """Get banks on this API instance. Returns a list of banks supported on this server.""",
- EmptyBody, banksJSON,
+ """Get banks on this API instance
+ |Returns a list of banks supported on this server:
+ |
+ |* ID used as parameter in URLs
+ |* Short and full name of bank
+ |* Logo URL
+ |* Website""",
+ EmptyBody,
+ banksJSON,
List(UnknownError),
- apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(getBanks))
+ apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(getBanks)
+ )
// ─── bankById ─────────────────────────────────────────────────────────────
@@ -1614,14 +2261,25 @@ object Http4s300 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(bankById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(bankById),
+ "GET",
"/banks/BANK_ID",
"Get Bank",
- """Get the bank specified by BANK_ID.""",
- EmptyBody, bankJson400,
+ """Get the bank specified by BANK_ID
+ |Returns information about a single bank specified by BANK_ID including:
+ |
+ |* Short and full name of bank
+ |* Logo URL
+ |* Website""",
+ EmptyBody,
+ bankJson400,
List(AuthenticatedUserIsRequired, UnknownError, BankNotFound),
- apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(bankById))
+ apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(bankById)
+ )
// ─── helpers ──────────────────────────────────────────────────────────────
diff --git a/obp-api/src/main/scala/code/api/v3_1_0/Http4s310.scala b/obp-api/src/main/scala/code/api/v3_1_0/Http4s310.scala
index eebae85bd5..d337804b68 100644
--- a/obp-api/src/main/scala/code/api/v3_1_0/Http4s310.scala
+++ b/obp-api/src/main/scala/code/api/v3_1_0/Http4s310.scala
@@ -5,6 +5,7 @@ import cats.effect._
import code.api.Constant._
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
+import code.api.util.Glossary
import code.api.util.ExampleValue._
import code.api.util.APIUtil.{EmptyBody, ResourceDoc, _}
import code.api.util.ApiRole
@@ -71,6 +72,30 @@ object Http4s310 {
object Implementations3_1_0 {
val prefixPath: Path = Root / ApiPathZero.toString / implementedInApiVersion.toString
+ private val productAttributeGeneralInfo =
+ s"""Product Attributes are used to describe a financial Product with a list of typed key value pairs.
+ |
+ |Each Product Attribute is linked to its Product by PRODUCT_CODE
+ |""".stripMargin
+
+ private val accountAttributeGeneralInfo =
+ s"""Account Attributes are used to describe a financial Product with a list of typed key value pairs.
+ |
+ |Each Account Attribute is linked to its Account by ACCOUNT_ID
+ |""".stripMargin
+
+ private val generalObpConsentText: String =
+ s"""An OBP Consent allows the holder of the Consent to call one or more endpoints.
+ |
+ |Consents must be created and authorised using SCA (Strong Customer Authentication).
+ |
+ |That is, Consents can be created by an authorised User via the OBP REST API but they must be confirmed via an out of band (OOB) mechanism such as a code sent to a mobile phone.
+ |
+ |Each Consent has one of the following states: ${code.consent.ConsentStatus.values.toList.sorted.mkString(", ")}.
+ |""".stripMargin
+
+ private val supportedConnectorNames = NewStyle.function.getSupportedConnectorNames().mkString("[", " | ", "]")
+
// ─── root ─────────────────────────────────────────────────────────────────
val root: HttpRoutes[IO] = HttpRoutes.of[IO] {
@@ -85,16 +110,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(root), "GET", "/root",
+ null,
+ implementedInApiVersion,
+ nameOf(root),
+ "GET",
+ "/root",
"Get API Info (root)",
"""Returns information about:
- |
- |* API version
- |* Hosted by information
- |* Git Commit""",
- EmptyBody, apiInfoJSON,
- List(UnknownError, MandatoryPropertyIsNotSet), apiTagApi :: Nil, None,
- http4sPartialFunction = Some(root))
+ |
+ |* API version
+ |* Hosted by information
+ |* Git Commit""",
+ EmptyBody,
+ apiInfoJSON,
+ List(UnknownError, MandatoryPropertyIsNotSet),
+ apiTagApi :: Nil,
+ None,
+ http4sPartialFunction = Some(root)
+ )
// ─── getCheckbookOrders ───────────────────────────────────────────────────
@@ -136,17 +169,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getStatusOfCreditCardOrder), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getStatusOfCreditCardOrder),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/credit_cards/orders",
"Get status of Credit Card order ",
s"""${mockedDataText(false)}Get status of Credit Card orders
- |Get all orders
- |""",
- EmptyBody, creditCardOrderStatusResponseJson,
+ |Get all orders
+ |""",
+ EmptyBody,
+ creditCardOrderStatusResponseJson,
List(AuthenticatedUserIsRequired, BankNotFound, BankAccountNotFound,
- InvalidConnectorResponseForGetStatusOfCreditCardOrderFuture, UnknownError),
- apiTagCard :: Nil, None,
- http4sPartialFunction = Some(getStatusOfCreditCardOrder))
+ InvalidConnectorResponseForGetStatusOfCreditCardOrderFuture, UnknownError),
+ apiTagCard :: Nil,
+ None,
+ http4sPartialFunction = Some(getStatusOfCreditCardOrder)
+ )
// ─── getTopAPIs ───────────────────────────────────────────────────────────
@@ -165,17 +204,63 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTopAPIs), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTopAPIs),
+ "GET",
"/management/metrics/top-apis",
"Get Top APIs",
s"""Get metrics about the most popular APIs. e.g.: total count, response time (in ms), etc.
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, topApisJson,
+ |Should be able to filter on the following fields
+ |
+ |eg: /management/metrics/top-apis?from_date=$epochTimeString&to_date=$DefaultToDateString&consumer_id=5
+ |&user_id=66214b8e-259e-44ad-8868-3eb47be70646&implemented_by_partial_function=getTransactionsForBankAccount
+ |&implemented_in_version=v3.0.0&url=/obp/v3.0.0/banks/gh.29.uk/accounts/8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0/owner/transactions
+ |&verb=GET&anon=false&app_name=MapperPostman
+ |&exclude_app_names=API-EXPLORER,API-Manager,SOFI,null
+ |
+ |1 from_date (defaults to the one year ago): eg:from_date=$epochTimeString
+ |
+ |2 to_date (defaults to the current date) eg:to_date=$DefaultToDateString
+ |
+ |3 consumer_id (if null ignore)
+ |
+ |4 user_id (if null ignore)
+ |
+ |5 anon (if null ignore) only support two value : true (return where user_id is null.) or false (return where user_id is not null.)
+ |
+ |6 url (if null ignore), note: can not contain '&'.
+ |
+ |7 app_name (if null ignore)
+ |
+ |8 implemented_by_partial_function (if null ignore),
+ |
+ |9 implemented_in_version (if null ignore)
+ |
+ |10 verb (if null ignore)
+ |
+ |11 correlation_id (if null ignore)
+ |
+ |12 duration (if null ignore) non digit chars will be silently omitted
+ |
+ |13 exclude_app_names (if null ignore).eg: &exclude_app_names=API-EXPLORER,API-Manager,SOFI,null
+ |
+ |14 exclude_url_patterns (if null ignore).you can design you own SQL NOT LIKE pattern. eg: &exclude_url_patterns=%management/metrics%,%management/aggregate-metrics%
+ |
+ |15 exclude_implemented_by_partial_functions (if null ignore).eg: &exclude_implemented_by_partial_functions=getMetrics,getConnectorMetrics,getAggregateMetrics
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ topApisJson,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidFilterParameterFormat,
- GetTopApisError, UnknownError),
- apiTagMetric :: Nil, Some(List(canReadMetrics)),
- http4sPartialFunction = Some(getTopAPIs))
+ GetTopApisError, UnknownError),
+ apiTagMetric :: Nil,
+ Some(List(canReadMetrics)),
+ http4sPartialFunction = Some(getTopAPIs)
+ )
// ─── getMetricsTopConsumers ───────────────────────────────────────────────
@@ -194,17 +279,66 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMetricsTopConsumers), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMetricsTopConsumers),
+ "GET",
"/management/metrics/top-consumers",
"Get Top Consumers",
s"""Get metrics about the top consumers of the API usage e.g. total count, consumer_id and app_name.
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, topConsumersJson,
+ |Should be able to filter on the following fields
+ |
+ |e.g.: /management/metrics/top-consumers?from_date=$epochTimeString&to_date=$DefaultToDateString&consumer_id=5
+ |&user_id=66214b8e-259e-44ad-8868-3eb47be70646&implemented_by_partial_function=getTransactionsForBankAccount
+ |&implemented_in_version=v3.0.0&url=/obp/v3.0.0/banks/gh.29.uk/accounts/8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0/owner/transactions
+ |&verb=GET&anon=false&app_name=MapperPostman
+ |&exclude_app_names=API-EXPLORER,API-Manager,SOFI,null
+ |&limit=100
+ |
+ |1 from_date (defaults to the one year ago): eg:from_date=$epochTimeString
+ |
+ |2 to_date (defaults to the current date) eg:to_date=$DefaultToDateString
+ |
+ |3 consumer_id (if null ignore)
+ |
+ |4 user_id (if null ignore)
+ |
+ |5 anon (if null ignore) only support two value : true (return where user_id is null.) or false (return where user_id is not null.)
+ |
+ |6 url (if null ignore), note: can not contain '&'.
+ |
+ |7 app_name (if null ignore)
+ |
+ |8 implemented_by_partial_function (if null ignore),
+ |
+ |9 implemented_in_version (if null ignore)
+ |
+ |10 verb (if null ignore)
+ |
+ |11 correlation_id (if null ignore)
+ |
+ |12 duration (if null ignore) non digit chars will be silently omitted
+ |
+ |13 exclude_app_names (if null ignore).eg: &exclude_app_names=API-EXPLORER,API-Manager,SOFI,null
+ |
+ |14 exclude_url_patterns (if null ignore).you can design you own SQL NOT LIKE pattern. eg: &exclude_url_patterns=%management/metrics%,%management/aggregate-metrics%
+ |
+ |15 exclude_implemented_by_partial_functions (if null ignore).eg: &exclude_implemented_by_partial_functions=getMetrics,getConnectorMetrics,getAggregateMetrics
+ |
+ |16 limit (for pagination: defaults to 50) eg:limit=200
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ topConsumersJson,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidFilterParameterFormat,
- GetMetricsTopConsumersError, UnknownError),
- apiTagMetric :: Nil, Some(List(canReadMetrics)),
- http4sPartialFunction = Some(getMetricsTopConsumers))
+ GetMetricsTopConsumersError, UnknownError),
+ apiTagMetric :: Nil,
+ Some(List(canReadMetrics)),
+ http4sPartialFunction = Some(getMetricsTopConsumers)
+ )
// ─── getFirehoseCustomers ────────────────────────────────────────────────
// Firehose pattern: prop check (→400) before role check (→403) before bank lookup (→404).
@@ -242,24 +376,31 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getFirehoseCustomers), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getFirehoseCustomers),
+ "GET",
"/banks/FIREHOSE_BANK_ID/firehose/customers",
"Get Firehose Customers",
s"""
- |Get Customers that has a firehose View.
- |
- |Allows bulk access to customers.
- |User must have the CanUseFirehoseAtAnyBank Role
- |
- |${urlParametersDocument(true, true)}
- |
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody, customerJSONs,
+ |Get Customers that has a firehose View.
+ |
+ |Allows bulk access to customers.
+ |User must have the CanUseFirehoseAtAnyBank Role
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ customerJSONs,
List(AuthenticatedUserIsRequired, CustomerFirehoseNotAllowedOnThisInstance,
- UserHasMissingRoles, UnknownError),
- List(apiTagCustomer, apiTagFirehoseData), None,
- http4sPartialFunction = Some(getFirehoseCustomers))
+ UserHasMissingRoles, UnknownError),
+ List(apiTagCustomer, apiTagFirehoseData),
+ None,
+ http4sPartialFunction = Some(getFirehoseCustomers)
+ )
// ─── getBadLoginStatus ────────────────────────────────────────────────────
@@ -279,18 +420,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBadLoginStatus), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBadLoginStatus),
+ "GET",
"/users/USERNAME/lock-status",
"Get User Lock Status",
s"""
- |Get User Login Status.
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody, badLoginStatusJson,
+ |Get User Login Status.
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ badLoginStatusJson,
List(AuthenticatedUserIsRequired, UserNotFoundByProviderAndUsername,
- UserHasMissingRoles, UnknownError),
- List(apiTagUser), Some(List(canReadUserLockedStatus)),
- http4sPartialFunction = Some(getBadLoginStatus))
+ UserHasMissingRoles, UnknownError),
+ List(apiTagUser),
+ Some(List(canReadUserLockedStatus)),
+ http4sPartialFunction = Some(getBadLoginStatus)
+ )
// ─── getCallsLimit ────────────────────────────────────────────────────────
@@ -306,18 +454,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCallsLimit), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCallsLimit),
+ "GET",
"/management/consumers/CONSUMER_ID/consumer/call-limits",
"Get Rate Limits for a Consumer",
s"""
- |Get Rate Limits per Consumer.
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody, callLimitJson,
+ |Get Rate Limits per Consumer.
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ callLimitJson,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidConsumerId,
- ConsumerNotFoundByConsumerId, UserHasMissingRoles, UpdateConsumerError, UnknownError),
- List(apiTagConsumer), Some(List(canReadCallLimits)),
- http4sPartialFunction = Some(getCallsLimit))
+ ConsumerNotFoundByConsumerId, UserHasMissingRoles, UpdateConsumerError, UnknownError),
+ List(apiTagConsumer),
+ Some(List(canReadCallLimits)),
+ http4sPartialFunction = Some(getCallsLimit)
+ )
// ─── getConsumer ──────────────────────────────────────────────────────────
@@ -333,17 +488,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsumer), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsumer),
+ "GET",
"/management/consumers/CONSUMER_ID",
"Get Consumer",
s"""Get the Consumer specified by CONSUMER_ID.
- |
- |""",
- EmptyBody, consumerJSON,
+ |
+ |""",
+ EmptyBody,
+ consumerJSON,
List(AuthenticatedUserIsRequired, UserHasMissingRoles,
- ConsumerNotFoundByConsumerId, UnknownError),
- List(apiTagConsumer), Some(List(canGetConsumers)),
- http4sPartialFunction = Some(getConsumer))
+ ConsumerNotFoundByConsumerId, UnknownError),
+ List(apiTagConsumer),
+ Some(List(canGetConsumers)),
+ http4sPartialFunction = Some(getConsumer)
+ )
// ─── getConsumersForCurrentUser ──────────────────────────────────────────
@@ -357,16 +518,22 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsumersForCurrentUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsumersForCurrentUser),
+ "GET",
"/management/users/current/consumers",
"Get Consumers (logged in User)",
s"""Get the Consumers for logged in User.
- |
- |""",
- EmptyBody, consumersJson310,
+ |
+ |""",
+ EmptyBody,
+ consumersJson310,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagConsumer), None,
- http4sPartialFunction = Some(getConsumersForCurrentUser))
+ List(apiTagConsumer),
+ None,
+ http4sPartialFunction = Some(getConsumersForCurrentUser)
+ )
// ─── getConsumers ────────────────────────────────────────────────────────
@@ -385,20 +552,26 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsumers), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsumers),
+ "GET",
"/management/consumers",
"Get Consumers",
s"""Get the all Consumers.
- |
- |${userAuthenticationMessage(true)}
- |
- |${urlParametersDocument(true, true)}
- |
- |""",
- EmptyBody, consumersJson310,
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |${urlParametersDocument(true, true)}
+ |
+ |""",
+ EmptyBody,
+ consumersJson310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagConsumer), Some(List(canGetConsumers)),
- http4sPartialFunction = Some(getConsumers))
+ List(apiTagConsumer),
+ Some(List(canGetConsumers)),
+ http4sPartialFunction = Some(getConsumers)
+ )
// ─── getAccountWebhooks ──────────────────────────────────────────────────
@@ -418,22 +591,29 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountWebhooks), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountWebhooks),
+ "GET",
"/management/banks/BANK_ID/account-web-hooks",
"Get Account Webhooks",
s"""Get Account Webhooks.
- |
- |Possible custom URL parameters for pagination:
- |
- |${urlParametersDocument(false, false)}
- |* account_id=STRING (if null ignore)
- |* user_id=STRING (if null ignore)
- |
- |""",
- EmptyBody, accountWebhooksJson,
+ |
+ |Possible custom URL parameters for pagination:
+ |
+ |${urlParametersDocument(false, false)}
+ |* account_id=STRING (if null ignore)
+ |* user_id=STRING (if null ignore)
+ |
+ |
+ |""",
+ EmptyBody,
+ accountWebhooksJson,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- apiTagWebhook :: apiTagBank :: Nil, Some(List(canGetWebhooks)),
- http4sPartialFunction = Some(getAccountWebhooks))
+ apiTagWebhook :: apiTagBank :: Nil,
+ Some(List(canGetWebhooks)),
+ http4sPartialFunction = Some(getAccountWebhooks)
+ )
// ─── config ───────────────────────────────────────────────────────────────
@@ -447,19 +627,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(config), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(config),
+ "GET",
"/config",
"Get API Configuration",
"""Returns information about:
- |
- |* The default bank_id
- |* Akka configuration
- |* Elastic Search configuration
- |* Cached functions """,
- EmptyBody, configurationJSON,
+ |
+ |* The default bank_id
+ |* Akka configuration
+ |* Elastic Search configuration
+ |* Cached functions """,
+ EmptyBody,
+ configurationJSON,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- apiTagApi :: Nil, Some(List(canGetConfig)),
- http4sPartialFunction = Some(config))
+ apiTagApi :: Nil,
+ Some(List(canGetConfig)),
+ http4sPartialFunction = Some(config)
+ )
// ─── getAdapterInfo ───────────────────────────────────────────────────────
@@ -474,17 +660,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAdapterInfo), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAdapterInfo),
+ "GET",
"/adapter",
"Get Adapter Info",
s"""Get basic information about the Adapter.
|
|${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody, adapterInfoJsonV300,
+ |
+ """.stripMargin,
+ EmptyBody,
+ adapterInfoJsonV300,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagApi), Some(List(canGetAdapterInfo)),
- http4sPartialFunction = Some(getAdapterInfo))
+ List(apiTagApi),
+ Some(List(canGetAdapterInfo)),
+ http4sPartialFunction = Some(getAdapterInfo)
+ )
// ─── getRateLimitingInfo ──────────────────────────────────────────────────
// Anonymous endpoint — no auth required.
@@ -502,7 +695,10 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getRateLimitingInfo), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getRateLimitingInfo),
+ "GET",
"/rate-limiting",
"Get Rate Limiting Info",
s"""Get information about the Rate Limiting setup on this OBP Instance such as:
@@ -513,11 +709,17 @@ object Http4s310 {
|Note: Rate limiting can be set at the Consumer level and also for anonymous calls.
|
|See the consumer rate limits / call limits endpoints.
- |""".stripMargin,
- EmptyBody, rateLimitingInfoV310,
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ rateLimitingInfoV310,
List(UnknownError),
- List(apiTagApi, apiTagRateLimits), None,
- http4sPartialFunction = Some(getRateLimitingInfo))
+ List(apiTagApi, apiTagRateLimits),
+ None,
+ http4sPartialFunction = Some(getRateLimitingInfo)
+ )
// ─── getCustomerByCustomerId ──────────────────────────────────────────────
@@ -534,17 +736,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerByCustomerId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerByCustomerId),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID",
"Get Customer by CUSTOMER_ID",
s"""Gets the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, customerWithAttributesJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customerWithAttributesJsonV310,
List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canGetCustomersAtOneBank)),
- http4sPartialFunction = Some(getCustomerByCustomerId))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canGetCustomersAtOneBank)),
+ http4sPartialFunction = Some(getCustomerByCustomerId)
+ )
// ─── getUserAuthContexts ─────────────────────────────────────────────────
@@ -560,17 +770,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserAuthContexts), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserAuthContexts),
+ "GET",
"/users/USER_ID/auth-context",
"Get User Auth Contexts",
s"""Get User Auth Contexts for a User.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, userAuthContextsJson,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ userAuthContextsJson,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagUser), Some(canGetUserAuthContext :: Nil),
- http4sPartialFunction = Some(getUserAuthContexts))
+ List(apiTagUser),
+ Some(canGetUserAuthContext :: Nil),
+ http4sPartialFunction = Some(getUserAuthContexts)
+ )
// ─── getTaxResidence ─────────────────────────────────────────────────────
@@ -586,17 +804,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTaxResidence), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTaxResidence),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID/tax-residences",
"Get Tax Residences of Customer",
s"""Get the Tax Residences of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, taxResidencesJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ taxResidencesJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canGetTaxResidence)),
- http4sPartialFunction = Some(getTaxResidence))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canGetTaxResidence)),
+ http4sPartialFunction = Some(getTaxResidence)
+ )
// ─── getAllEntitlements ──────────────────────────────────────────────────
@@ -614,20 +840,30 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllEntitlements), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllEntitlements),
+ "GET",
"/entitlements",
"Get all Entitlements",
s"""
+ |
|Login is required.
|
|Possible filter on the role field:
|
|eg: /entitlements?role=${canGetCustomersAtOneBank.toString}
- |""".stripMargin,
- EmptyBody, entitlementJSonsV310,
+ |
+ |
+ |
+ """.stripMargin,
+ EmptyBody,
+ entitlementJSonsV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagRole, apiTagEntitlement), None,
- http4sPartialFunction = Some(getAllEntitlements))
+ List(apiTagRole, apiTagEntitlement),
+ None,
+ http4sPartialFunction = Some(getAllEntitlements)
+ )
// ─── getCustomerAddresses ────────────────────────────────────────────────
@@ -643,17 +879,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerAddresses), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerAddresses),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID/addresses",
"Get Customer Addresses",
s"""Get the Addresses of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, customerAddressesJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customerAddressesJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canGetCustomerAddress)),
- http4sPartialFunction = Some(getCustomerAddresses))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canGetCustomerAddress)),
+ http4sPartialFunction = Some(getCustomerAddresses)
+ )
// ─── getProductAttribute ─────────────────────────────────────────────────
@@ -669,18 +913,28 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductAttribute), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductAttribute),
+ "GET",
"/banks/BANK_ID/products/PRODUCT_CODE/attributes/PRODUCT_ATTRIBUTE_ID",
"Get Product Attribute",
- s"""Get one Product Attribute by its id.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, productAttributeResponseJson,
+ s""" Get Product Attribute
+ |
+ |$productAttributeGeneralInfo
+ |
+ |Get one product attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ productAttributeResponseJson,
List(UserHasMissingRoles, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canGetProductAttribute)),
- http4sPartialFunction = Some(getProductAttribute))
+ http4sPartialFunction = Some(getProductAttribute)
+ )
// ─── getAccountApplications ──────────────────────────────────────────────
@@ -697,17 +951,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountApplications), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountApplications),
+ "GET",
"/banks/BANK_ID/account-applications",
"Get Account Applications",
s"""Get the Account Applications.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, accountApplicationsJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ accountApplicationsJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagAccountApplication, apiTagAccount), None,
- http4sPartialFunction = Some(getAccountApplications))
+ List(apiTagAccountApplication, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getAccountApplications)
+ )
// ─── getAccountApplication ───────────────────────────────────────────────
@@ -725,17 +987,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountApplication), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountApplication),
+ "GET",
"/banks/BANK_ID/account-applications/ACCOUNT_APPLICATION_ID",
"Get Account Application by Id",
s"""Get the Account Application.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, accountApplicationResponseJson,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ accountApplicationResponseJson,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagAccountApplication, apiTagAccount), None,
- http4sPartialFunction = Some(getAccountApplication))
+ List(apiTagAccountApplication, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getAccountApplication)
+ )
// ─── getMeetings ─────────────────────────────────────────────────────────
@@ -749,7 +1019,10 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMeetings), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMeetings),
+ "GET",
"/banks/BANK_ID/meetings",
"Get Meetings",
"""Meetings contain meta data about, and are used to facilitate, video conferences / chats etc.
@@ -760,10 +1033,13 @@ object Http4s310 {
|
|This call is **experimental** and will require further authorisation in the future.
""".stripMargin,
- EmptyBody, meetingsJsonV310,
+ EmptyBody,
+ meetingsJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagMeeting, apiTagCustomer, apiTagExperimental), None,
- http4sPartialFunction = Some(getMeetings))
+ List(apiTagMeeting, apiTagCustomer, apiTagExperimental),
+ None,
+ http4sPartialFunction = Some(getMeetings)
+ )
// ─── getMeeting ──────────────────────────────────────────────────────────
@@ -777,7 +1053,10 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMeeting), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMeeting),
+ "GET",
"/banks/BANK_ID/meetings/MEETING_ID",
"Get Meeting",
"""Get Meeting specified by BANK_ID / MEETING_ID
@@ -789,10 +1068,13 @@ object Http4s310 {
|
|This call is **experimental** and will require further authorisation in the future.
""".stripMargin,
- EmptyBody, meetingJsonV310,
+ EmptyBody,
+ meetingJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, MeetingNotFound, UnknownError),
- List(apiTagMeeting, apiTagCustomer, apiTagExperimental), None,
- http4sPartialFunction = Some(getMeeting))
+ List(apiTagMeeting, apiTagCustomer, apiTagExperimental),
+ None,
+ http4sPartialFunction = Some(getMeeting)
+ )
// ─── getServerJWK ────────────────────────────────────────────────────────
@@ -804,16 +1086,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getServerJWK), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getServerJWK),
+ "GET",
"/certs",
"Get JSON Web Key (JWK)",
"""Get the server's public JSON Web Key (JWK) set and certificate chain.
| It is required by client applications to validate ID tokens, self-contained access tokens and other issued objects.
- |""".stripMargin,
- EmptyBody, severJWK,
+ |
+ """.stripMargin,
+ EmptyBody,
+ severJWK,
List(UnknownError),
- List(apiTagApi, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(getServerJWK))
+ List(apiTagApi, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getServerJWK)
+ )
// ─── getOAuth2ServerJWKsURIs ─────────────────────────────────────────────
@@ -825,16 +1114,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getOAuth2ServerJWKsURIs), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getOAuth2ServerJWKsURIs),
+ "GET",
"/jwks-uris",
"Get JSON Web Key (JWK) URIs",
"""Get the OAuth2 server's public JSON Web Key (JWK) URIs.
| It is required by client applications to validate ID tokens, self-contained access tokens and other issued objects.
- |""".stripMargin,
- EmptyBody, oAuth2ServerJwksUrisJson,
+ |
+ """.stripMargin,
+ EmptyBody,
+ oAuth2ServerJwksUrisJson,
List(UnknownError),
- List(apiTagApi, apiTagOAuth, apiTagOIDC), None,
- http4sPartialFunction = Some(getOAuth2ServerJWKsURIs))
+ List(apiTagApi, apiTagOAuth, apiTagOIDC),
+ None,
+ http4sPartialFunction = Some(getOAuth2ServerJWKsURIs)
+ )
// ─── getMethodRoutings ───────────────────────────────────────────────────
@@ -876,25 +1172,34 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMethodRoutings), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMethodRoutings),
+ "GET",
"/management/method_routings",
"Get MethodRoutings",
s"""Get the all MethodRoutings.
- |
- |Query url parameters:
- |
- |* method_name: filter with method_name
- |* active: if active = true, it will show all the webui_ props.
- |""",
+ |
+ |Query url parameters:
+ |
+ |* method_name: filter with method_name
+ |* active: if active = true, it will show all the webui_ props. Even if they are set yet, we will return all the default webui_ props
+ |
+ |eg:
+ |${getObpApiRoot}/v3.1.0/management/method_routings?active=true
+ |${getObpApiRoot}/v3.1.0/management/method_routings?method_name=getBank
+ |
+ |""",
EmptyBody,
ListResult(
"method_routings",
- List(code.methodrouting.MethodRoutingCommons("getBanks", "rest_vMar2019", false, Some("some_bank_.*"),
- List(code.methodrouting.MethodRoutingParam("url", "http://mydomain.com/xxx")), Some("method-routing-id")))
+ (List(MethodRoutingCommons("getBanks", "rest_vMar2019", false, Some("some_bank_.*"), List(MethodRoutingParam("url", "http://mydomain.com/xxx")), Some("method-routing-id"))))
),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagMethodRouting, apiTagApi), Some(List(canGetMethodRoutings)),
- http4sPartialFunction = Some(getMethodRoutings))
+ List(apiTagMethodRouting, apiTagApi),
+ Some(List(canGetMethodRoutings)),
+ http4sPartialFunction = Some(getMethodRoutings)
+ )
// ─── getSystemView ───────────────────────────────────────────────────────
// VIEW_ID path is /system-views/VIEW_ID — no BANK_ID/ACCOUNT_ID, so the middleware
@@ -913,17 +1218,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getSystemView), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getSystemView),
+ "GET",
"/system-views/SYS_VIEW_ID",
"Get System View",
- s"""Get System View.
+ s"""Get System View
|
- |${userAuthenticationMessage(true)} and the user needs to have access to the $canGetSystemView entitlement.
- |""",
- EmptyBody, viewJsonV300,
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ viewJSONV220,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, ViewNotFound, UnknownError),
- List(apiTagSystemView), Some(List(canGetSystemView)),
- http4sPartialFunction = Some(getSystemView))
+ List(apiTagSystemView),
+ Some(List(canGetSystemView)),
+ http4sPartialFunction = Some(getSystemView)
+ )
// ─── getCardsForBank ─────────────────────────────────────────────────────
@@ -941,16 +1253,29 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCardsForBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCardsForBank),
+ "GET",
"/management/banks/BANK_ID/cards",
"Get Cards for the specified bank",
- s"""Cards for the specified bank.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, physicalCardsJsonV310,
+ s"""Should be able to filter on the following fields
+ |
+ |eg:/management/banks/BANK_ID/cards?customer_id=66214b8e-259e-44ad-8868-3eb47be70646&account_id=8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0
+ |
+ |1 customer_id should be valid customer_id, otherwise, it will return an empty card list.
+ |
+ |2 account_id should be valid account_id , otherwise, it will return an empty card list.
+ |
+ |
+ |${userAuthenticationMessage(true)}""".stripMargin,
+ EmptyBody,
+ physicalCardsJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagCard), None,
- http4sPartialFunction = Some(getCardsForBank))
+ List(apiTagCard),
+ None,
+ http4sPartialFunction = Some(getCardsForBank)
+ )
// ─── getCardForBank ──────────────────────────────────────────────────────
@@ -971,16 +1296,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCardForBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCardForBank),
+ "GET",
"/management/banks/BANK_ID/cards/CARD_ID",
"Get Card By Id",
- s"""Get the details of a card by its id.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, physicalCardWithAttributesJsonV310,
+ s"""
+ |This will the datails of the card.
+ |It shows the account infomation which linked the the card.
+ |Also shows the card attributes of the card.
+ |
+ """.stripMargin,
+ EmptyBody,
+ physicalCardWithAttributesJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagCard), Some(List(canGetCardsForBank)),
- http4sPartialFunction = Some(getCardForBank))
+ List(apiTagCard),
+ Some(List(canGetCardsForBank)),
+ http4sPartialFunction = Some(getCardForBank)
+ )
// ─── getBankAccountsBalances ─────────────────────────────────────────────
@@ -1044,7 +1378,10 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(checkFundsAvailable), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(checkFundsAvailable),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/funds-available",
"Check Available Funds",
"""Check Available Funds
@@ -1052,12 +1389,16 @@ object Http4s310 {
|
|* amount=NUMBER
|* currency=STRING
- |""".stripMargin,
- EmptyBody, checkFundsAvailableJson,
+ |
+ """.stripMargin,
+ EmptyBody,
+ checkFundsAvailableJson,
List(AuthenticatedUserIsRequired, BankNotFound, BankAccountNotFound,
- InvalidAmount, InvalidISOCurrencyCode, UnknownError),
- apiTagAccount :: apiTagPSD2PIIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(checkFundsAvailable))
+ InvalidAmount, InvalidISOCurrencyCode, UnknownError),
+ apiTagAccount :: apiTagPSD2PIIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(checkFundsAvailable)
+ )
// ─── getTransactionByIdForBankAccount ────────────────────────────────────
@@ -1077,18 +1418,26 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionByIdForBankAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionByIdForBankAccount),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transactions/TRANSACTION_ID/transaction",
"Get Transaction by Id",
- s"""Returns one transaction specified by TRANSACTION_ID of the account ACCOUNT_ID and moderated by the view (VIEW_ID).
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, transactionJsonV300,
+ s"""Returns one transaction specified by TRANSACTION_ID of the account ACCOUNT_ID and [moderated](#1_2_1-getViewsForBankAccount) by the view (VIEW_ID).
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |
+ |""",
+ EmptyBody,
+ transactionJsonV300,
List(AuthenticatedUserIsRequired, BankAccountNotFound, ViewNotFound,
- UserNoPermissionAccessView, UnknownError),
- List(apiTagTransaction), None,
- http4sPartialFunction = Some(getTransactionByIdForBankAccount))
+ UserNoPermissionAccessView, UnknownError),
+ List(apiTagTransaction),
+ None,
+ http4sPartialFunction = Some(getTransactionByIdForBankAccount)
+ )
// ─── getTransactionRequests ──────────────────────────────────────────────
@@ -1112,19 +1461,42 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionRequests), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionRequests),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-requests",
"Get Transaction Requests.",
"""Returns transaction requests for account specified by ACCOUNT_ID at bank specified by BANK_ID.
|
|The VIEW_ID specified must be 'owner' and the user must have access to this view.
- |""".stripMargin,
- EmptyBody, transactionRequestWithChargeJSONs210,
+ |
+ |Version 2.0.0 now returns charge information.
+ |
+ |Transaction Requests serve to initiate transactions that may or may not proceed. They contain information including:
+ |
+ |* Transaction Request Id
+ |* Type
+ |* Status (INITIATED, COMPLETED)
+ |* Challenge (in order to confirm the request)
+ |* From Bank / Account
+ |* Details including Currency, Value, Description and other initiation information specific to each type. (Could potentialy include a list of future transactions.)
+ |* Related Transactions
+ |
+ |PSD2 Context: PSD2 requires transparency of charges to the customer.
+ |This endpoint provides the charge that would be applied if the Transaction Request proceeds - and a record of that charge there after.
+ |The customer can proceed with the Transaction by answering the security challenge.
+ |
+ """.stripMargin,
+ EmptyBody,
+ transactionRequestWithChargeJSONs210,
List(AuthenticatedUserIsRequired, BankNotFound, BankAccountNotFound,
- UserNoPermissionAccessView, ViewDoesNotPermitAccess,
- GetTransactionRequestsException, UnknownError),
- List(apiTagTransactionRequest, apiTagPSD2PIS), None,
- http4sPartialFunction = Some(getTransactionRequests))
+ UserNoPermissionAccessView, ViewDoesNotPermitAccess,
+ GetTransactionRequestsException, UnknownError),
+ List(apiTagTransactionRequest, apiTagPSD2PIS),
+ None,
+ http4sPartialFunction = Some(getTransactionRequests)
+ )
// ─── getProduct ──────────────────────────────────────────────────────────
// Conditional auth: middleware uses `userAuthenticationMessage(!getProductsIsPublic)`
@@ -1143,16 +1515,33 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProduct), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProduct),
+ "GET",
"/banks/BANK_ID/products/PRODUCT_CODE",
"Get Bank Product",
- s"""Returns information about a financial Product offered by the bank specified by BANK_ID and PRODUCT_CODE.
- |
- |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
- EmptyBody, productJsonV310,
+ s"""Returns information about a financial Product offered by the bank specified by BANK_ID and PRODUCT_CODE including:
+ |
+ |* Name
+ |* Code
+ |* Parent Product Code
+ |* Category
+ |* Family
+ |* Super Family
+ |* More info URL
+ |* Description
+ |* Terms and Conditions
+ |* License the data under this endpoint is released under
+ |
+ |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
+ EmptyBody,
+ productJsonV310,
List(AuthenticatedUserIsRequired, ProductNotFoundByProductCode, UnknownError),
- List(apiTagProduct), None,
- http4sPartialFunction = Some(getProduct))
+ List(apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProduct)
+ )
// ─── getProductTree ──────────────────────────────────────────────────────
@@ -1168,17 +1557,38 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductTree), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductTree),
+ "GET",
"/banks/BANK_ID/product-tree/PRODUCT_CODE",
"Get Product Tree",
s"""Returns information about a particular financial product specified by BANK_ID and PRODUCT_CODE
- |and it's parent product(s) recursively as specified by parent_product_code.
- |
- |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
- EmptyBody, childProductTreeJsonV310,
+ |and it's parent product(s) recursively as specified by parent_product_code.
+ |
+ |Each product includes the following information.
+ |
+ |* Name
+ |* Code
+ |* Parent Product Code
+ |* Category
+ |* Family
+ |* Super Family
+ |* More info URL
+ |* Description
+ |* Terms and Conditions
+ |* License: The licence under which this product data is released. Licence can be an Open Data licence such as Open Data Commons Public Domain Dedication and License (PDDL) or Copyright etc.
+ |
+ |
+ |
+ |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
+ EmptyBody,
+ childProductTreeJsonV310,
List(AuthenticatedUserIsRequired, ProductNotFoundByProductCode, UnknownError),
- List(apiTagProduct), None,
- http4sPartialFunction = Some(getProductTree))
+ List(apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProductTree)
+ )
// ─── getProducts ─────────────────────────────────────────────────────────
@@ -1221,14 +1631,22 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductCollection), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductCollection),
+ "GET",
"/banks/BANK_ID/product-collections/COLLECTION_CODE",
"Get Product Collection",
- """Returns information about the financial Product Collection specified by BANK_ID and COLLECTION_CODE.""",
- EmptyBody, productCollectionJsonTreeV310,
+ s"""Returns information about the financial Product Collection specified by BANK_ID and COLLECTION_CODE:
+ |
+ """,
+ EmptyBody,
+ productCollectionJsonTreeV310,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagProductCollection, apiTagProduct), None,
- http4sPartialFunction = Some(getProductCollection))
+ List(apiTagProductCollection, apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProductCollection)
+ )
// ─── getConsents ─────────────────────────────────────────────────────────
@@ -1258,17 +1676,29 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsents), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsents),
+ "GET",
"/banks/BANK_ID/my/consents",
"Get Consents",
- s"""Get Consents for the current User at the specified bank.
+ s"""
+ |This endpoint gets the Consents that the current User created.
|
|${userAuthenticationMessage(true)}
- |""",
- EmptyBody, consentsJsonV310,
+ |
+ |1 limit (for pagination: defaults to 50) eg:limit=200
+ |
+ |2 offset (for pagination: zero index, defaults to 0) eg: offset=10
+ |
+ """.stripMargin,
+ EmptyBody,
+ consentsJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(getConsents))
+ List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getConsents)
+ )
// ─── getPrivateAccountByIdFull ───────────────────────────────────────────
@@ -1289,22 +1719,35 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPrivateAccountByIdFull), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPrivateAccountByIdFull),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/account",
"Get Account by Id (Full)",
"""Information returned about an account specified by ACCOUNT_ID as moderated by the view (VIEW_ID):
- |
- |* Number
- |* Owners
- |* Type
- |* Balance
- |* IBAN
- |* Available views (sorted by short_name)
- |""".stripMargin,
- EmptyBody, moderatedAccountJSON310,
+ |
+ |* Number
+ |* Owners
+ |* Type
+ |* Balance
+ |* IBAN
+ |* Available views (sorted by short_name)
+ |
+ |More details about the data moderation by the view [here](#1_2_1-getViewsForBankAccount).
+ |
+ |PSD2 Context: PSD2 requires customers to have access to their account information via third party applications.
+ |This call provides balance and other account information via delegated authentication using OAuth.
+ |
+ |Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
+ |""".stripMargin,
+ EmptyBody,
+ moderatedAccountJSON310,
List(BankNotFound, AccountNotFound, ViewNotFound, UserNoPermissionAccessView, UnknownError),
- apiTagAccount :: Nil, None,
- http4sPartialFunction = Some(getPrivateAccountByIdFull))
+ apiTagAccount :: Nil,
+ None,
+ http4sPartialFunction = Some(getPrivateAccountByIdFull)
+ )
// ─── getWebUiProps ───────────────────────────────────────────────────────
@@ -1334,21 +1777,53 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getWebUiProps), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getWebUiProps),
+ "GET",
"/management/webui_props",
"Get WebUiProps",
- s"""Get WebUiProps.
- |
- |${userAuthenticationMessage(true)}
- |""",
+ s"""
+ |
+ |Get WebUiProps - properties that configure the Web UI behavior and appearance.
+ |
+ |Properties with names starting with "webui_" can be stored in the database and managed via API.
+ |
+ |**Data Sources:**
+ |
+ |1. **Explicit WebUiProps (Database)**: Custom values created/updated via the API and stored in the database.
+ |
+ |2. **Implicit WebUiProps (Configuration File)**: Default values defined in the `sample.props.template` configuration file.
+ |
+ |**Query Parameter:**
+ |
+ |* `active` (optional, boolean string, default: "false")
+ | - If `active=false` or omitted: Returns only explicit props from the database
+ | - If `active=true`: Returns explicit props + implicit (default) props from configuration file
+ | - When both sources have the same property name, the database value takes precedence
+ | - Implicit props are marked with `webUiPropsId = "default"`
+ |
+ |**Examples:**
+ |
+ |Get only database-stored props:
+ |${getObpApiRoot}/v3.1.0/management/webui_props
+ |
+ |Get database props combined with defaults:
+ |${getObpApiRoot}/v3.1.0/management/webui_props?active=true
+ |
+ |For more details about WebUI Props, including how to set config file defaults and precedence order, see ${Glossary.getGlossaryItemLink("webui_props")}.
+ |
+ |""",
EmptyBody,
ListResult(
"webui_props",
- List(WebUiPropsCommons("webui_api_explorer_url", "https://apiexplorer.openbankproject.com", Some("web-ui-props-id")))
+ (List(WebUiPropsCommons("webui_api_explorer_url", "https://apiexplorer.openbankproject.com", Some("web-ui-props-id"))))
),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagWebUiProps), Some(List(canGetWebUiProps)),
- http4sPartialFunction = Some(getWebUiProps))
+ List(apiTagWebUiProps),
+ Some(List(canGetWebUiProps)),
+ http4sPartialFunction = Some(getWebUiProps)
+ )
// ─── deleteUserAuthContexts ──────────────────────────────────────────────
@@ -1364,17 +1839,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteUserAuthContexts), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteUserAuthContexts),
+ "DELETE",
"/users/USER_ID/auth-context",
"Delete User's Auth Contexts",
s"""Delete the Auth Contexts of a User specified by USER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagUser), Some(List(canDeleteUserAuthContext)),
- http4sPartialFunction = Some(deleteUserAuthContexts))
+ List(apiTagUser),
+ Some(List(canDeleteUserAuthContext)),
+ http4sPartialFunction = Some(deleteUserAuthContexts)
+ )
// ─── deleteUserAuthContextById ──────────────────────────────────────────
@@ -1390,17 +1873,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteUserAuthContextById), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteUserAuthContextById),
+ "DELETE",
"/users/USER_ID/auth-context/USER_AUTH_CONTEXT_ID",
"Delete User Auth Context",
s"""Delete a User AuthContext of the User specified by USER_AUTH_CONTEXT_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagUser), Some(List(canDeleteUserAuthContext)),
- http4sPartialFunction = Some(deleteUserAuthContextById))
+ List(apiTagUser),
+ Some(List(canDeleteUserAuthContext)),
+ http4sPartialFunction = Some(deleteUserAuthContextById)
+ )
// ─── deleteTaxResidence ──────────────────────────────────────────────────
@@ -1416,17 +1907,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteTaxResidence), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteTaxResidence),
+ "DELETE",
"/banks/BANK_ID/customers/CUSTOMER_ID/tax_residencies/TAX_RESIDENCE_ID",
"Delete Tax Residence",
s"""Delete a Tax Residence of the Customer specified by TAX_RESIDENCE_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canDeleteTaxResidence)),
- http4sPartialFunction = Some(deleteTaxResidence))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canDeleteTaxResidence)),
+ http4sPartialFunction = Some(deleteTaxResidence)
+ )
// ─── deleteCustomerAddress ───────────────────────────────────────────────
@@ -1442,17 +1941,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCustomerAddress), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCustomerAddress),
+ "DELETE",
"/banks/BANK_ID/customers/CUSTOMER_ID/addresses/CUSTOMER_ADDRESS_ID",
"Delete Customer Address",
s"""Delete an Address of the Customer specified by CUSTOMER_ADDRESS_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canDeleteCustomerAddress)),
- http4sPartialFunction = Some(deleteCustomerAddress))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canDeleteCustomerAddress)),
+ http4sPartialFunction = Some(deleteCustomerAddress)
+ )
// ─── deleteProductAttribute ──────────────────────────────────────────────
// Note: this DELETE returns 204 (matches original v3.1.0 behavior).
@@ -1469,18 +1976,28 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteProductAttribute), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteProductAttribute),
+ "DELETE",
"/banks/BANK_ID/products/PRODUCT_CODE/attributes/PRODUCT_ATTRIBUTE_ID",
"Delete Product Attribute",
- s"""Delete a Product Attribute by its id.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ s""" Delete Product Attribute
+ |
+ |$productAttributeGeneralInfo
+ |
+ |Delete a Product Attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, BankNotFound, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canDeleteProductAttribute)),
- http4sPartialFunction = Some(deleteProductAttribute))
+ http4sPartialFunction = Some(deleteProductAttribute)
+ )
// ─── deleteBranch ────────────────────────────────────────────────────────
@@ -1499,17 +2016,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBranch), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBranch),
+ "DELETE",
"/banks/BANK_ID/branches/BRANCH_ID",
"Delete Branch",
s"""Delete Branch from given Bank.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |${userAuthenticationMessage(true) }
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, BankNotFound, InsufficientAuthorisationToDeleteBranch, UnknownError),
- List(apiTagBranch), Some(List(canDeleteBranch, canDeleteBranchAtAnyBank)),
- http4sPartialFunction = Some(deleteBranch))
+ List(apiTagBranch),
+ Some(List(canDeleteBranch, canDeleteBranchAtAnyBank)),
+ http4sPartialFunction = Some(deleteBranch)
+ )
// ─── deleteSystemView ────────────────────────────────────────────────────
@@ -1548,17 +2072,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteMethodRouting), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteMethodRouting),
+ "DELETE",
"/management/method_routings/METHOD_ROUTING_ID",
"Delete MethodRouting",
s"""Delete a MethodRouting specified by METHOD_ROUTING_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagMethodRouting, apiTagApi), Some(List(canDeleteMethodRouting)),
- http4sPartialFunction = Some(deleteMethodRouting))
+ List(apiTagMethodRouting, apiTagApi),
+ Some(List(canDeleteMethodRouting)),
+ http4sPartialFunction = Some(deleteMethodRouting)
+ )
// ─── deleteCardForBank ───────────────────────────────────────────────────
// Note: original v3.1.0 returns 204 — use withUserAndBankDelete.
@@ -1574,17 +2106,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCardForBank), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCardForBank),
+ "DELETE",
"/management/banks/BANK_ID/cards/CARD_ID",
"Delete Card",
- s"""Delete a Card at bank specified by CARD_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ s"""Delete a Card at bank specified by CARD_ID .
+ |
+ |${userAuthenticationMessage(true)}
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, AllowedValuesAre, UnknownError),
- List(apiTagCard), Some(List(canCreateCardsForBank)),
- http4sPartialFunction = Some(deleteCardForBank))
+ List(apiTagCard),
+ Some(List(canCreateCardsForBank)),
+ http4sPartialFunction = Some(deleteCardForBank)
+ )
// ─── deleteWebUiProps ────────────────────────────────────────────────────
@@ -1601,17 +2139,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteWebUiProps), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteWebUiProps),
+ "DELETE",
"/management/webui_props/WEB_UI_PROPS_ID",
"Delete WebUiProps",
s"""Delete a WebUiProps specified by WEB_UI_PROPS_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagWebUiProps), Some(List(canDeleteWebUiProps)),
- http4sPartialFunction = Some(deleteWebUiProps))
+ List(apiTagWebUiProps),
+ Some(List(canDeleteWebUiProps)),
+ http4sPartialFunction = Some(deleteWebUiProps)
+ )
// ─── revokeConsent ───────────────────────────────────────────────────────
// Routed as GET in Lift — keep matching shape.
@@ -1661,17 +2207,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createTaxResidence), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createTaxResidence),
+ "POST",
"/banks/BANK_ID/customers/CUSTOMER_ID/tax-residence",
"Create Tax Residence",
s"""Create a Tax Residence for a Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postTaxResidenceJsonV310, taxResidenceV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ postTaxResidenceJsonV310,
+ taxResidenceV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canCreateTaxResidence)),
- http4sPartialFunction = Some(createTaxResidence))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canCreateTaxResidence)),
+ http4sPartialFunction = Some(createTaxResidence)
+ )
// ─── createCustomerAddress (POST) ────────────────────────────────────────
@@ -1694,17 +2248,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createCustomerAddress), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createCustomerAddress),
+ "POST",
"/banks/BANK_ID/customers/CUSTOMER_ID/address",
"Create Address",
s"""Create an Address for a Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postCustomerAddressJsonV310, customerAddressJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ postCustomerAddressJsonV310,
+ customerAddressJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(List(canCreateCustomerAddress)),
- http4sPartialFunction = Some(createCustomerAddress))
+ List(apiTagCustomer),
+ Some(List(canCreateCustomerAddress)),
+ http4sPartialFunction = Some(createCustomerAddress)
+ )
// ─── updateCustomerAddress (PUT) ─────────────────────────────────────────
@@ -1727,17 +2289,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerAddress), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerAddress),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/addresses/CUSTOMER_ADDRESS_ID",
"Update the Address of a Customer",
s"""Update an Address of the Customer specified by CUSTOMER_ADDRESS_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postCustomerAddressJsonV310, customerAddressJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ postCustomerAddressJsonV310,
+ customerAddressJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(List(canCreateCustomer)),
- http4sPartialFunction = Some(updateCustomerAddress))
+ List(apiTagCustomer),
+ Some(List(canCreateCustomer)),
+ http4sPartialFunction = Some(updateCustomerAddress)
+ )
// ─── createUserAuthContext (POST) ────────────────────────────────────────
@@ -1754,17 +2324,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createUserAuthContext), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createUserAuthContext),
+ "POST",
"/users/USER_ID/auth-context",
"Create User Auth Context",
- s"""Create User Auth Context.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postUserAuthContextJson, userAuthContextJson,
+ s"""Create User Auth Context. These key value pairs will be propagated over connector to adapter. Normally used for mapping OBP user and
+ | Bank User/Customer.
+ |${userAuthenticationMessage(true)}
+ |""",
+ postUserAuthContextJson,
+ userAuthContextJson,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, CreateUserAuthContextError, UnknownError),
- List(apiTagUser), Some(List(canCreateUserAuthContext)),
- http4sPartialFunction = Some(createUserAuthContext))
+ List(apiTagUser),
+ Some(List(canCreateUserAuthContext)),
+ http4sPartialFunction = Some(createUserAuthContext)
+ )
// ─── createProductAttribute (POST) ───────────────────────────────────────
@@ -1786,18 +2362,44 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createProductAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createProductAttribute),
+ "POST",
"/banks/BANK_ID/products/PRODUCT_CODE/attribute",
"Create Product Attribute",
- s"""Create a Product Attribute on a Product.
- |
- |${userAuthenticationMessage(true)}
- |""",
- productAttributeJson, productAttributeResponseJson,
+ s""" Create Product Attribute
+ |
+ |$productAttributeGeneralInfo
+ |
+ |Typical product attributes might be:
+ |
+ |ISIN (for International bonds)
+ |VKN (for German bonds)
+ |REDCODE (markit short code for credit derivative)
+ |LOAN_ID (e.g. used for Anacredit reporting)
+ |
+ |ISSUE_DATE (When the bond was issued in the market)
+ |MATURITY_DATE (End of life time of a product)
+ |TRADABLE
+ |
+ |See [FPML](http://www.fpml.org/) for more examples.
+ |
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productAttributeJson,
+ productAttributeResponseJson,
List(InvalidJsonFormat, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canCreateProductAttribute)),
- http4sPartialFunction = Some(createProductAttribute))
+ http4sPartialFunction = Some(createProductAttribute)
+ )
// ─── createAccountWebhook (POST) ─────────────────────────────────────────
@@ -1836,17 +2438,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createAccountWebhook), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createAccountWebhook),
+ "POST",
"/banks/BANK_ID/account-web-hooks",
"Create an Account Webhook",
s"""Create an Account Webhook
- |
- |$accountWebHookInfo
- |""",
- accountWebhookPostJson, accountWebhookJson,
+ |
+ |$accountWebHookInfo
+ |""",
+ accountWebhookPostJson,
+ accountWebhookJson,
List(UnknownError),
- apiTagWebhook :: apiTagBank :: Nil, Some(List(canCreateWebhook)),
- http4sPartialFunction = Some(createAccountWebhook))
+ apiTagWebhook :: apiTagBank :: Nil,
+ Some(List(canCreateWebhook)),
+ http4sPartialFunction = Some(createAccountWebhook)
+ )
// ─── unlockUser (PUT) ────────────────────────────────────────────────────
@@ -1868,20 +2476,28 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(unlockUser), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(unlockUser),
+ "PUT",
"/users/USERNAME/lock-status",
"Unlock the user",
- s"""Unlock a User.
- |
- |(Perhaps the user was locked due to multiple failed login attempts)
- |
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- EmptyBody, badLoginStatusJson,
+ s"""
+ |Unlock a User.
+ |
+ |(Perhaps the user was locked due to multiple failed login attempts)
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ badLoginStatusJson,
List(AuthenticatedUserIsRequired, UserNotFoundByProviderAndUsername,
- UserHasMissingRoles, UnknownError),
- List(apiTagUser), Some(List(canUnlockUser)),
- http4sPartialFunction = Some(unlockUser))
+ UserHasMissingRoles, UnknownError),
+ List(apiTagUser),
+ Some(List(canUnlockUser)),
+ http4sPartialFunction = Some(unlockUser)
+ )
// ─── callsLimit (PUT) ────────────────────────────────────────────────────
@@ -1909,18 +2525,35 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(callsLimit), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(callsLimit),
+ "PUT",
"/management/consumers/CONSUMER_ID/consumer/call-limits",
"Set Rate Limits (call limits) per Consumer",
- s"""Set the API rate limiting (call limits) per Consumer.
- |
- |${userAuthenticationMessage(true)}
- |""".stripMargin,
- callLimitPostJson, callLimitPostJson,
+ s"""
+ |Set the API rate limiting (call limits) per Consumer:
+ |
+ |Rate limits can be set:
+ |
+ |Per Second
+ |Per Minute
+ |Per Hour
+ |Per Week
+ |Per Month
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ callLimitPostJson,
+ callLimitPostJson,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidConsumerId,
- ConsumerNotFoundByConsumerId, UserHasMissingRoles, UpdateConsumerError, UnknownError),
- List(apiTagConsumer), Some(List(canUpdateRateLimits)),
- http4sPartialFunction = Some(callsLimit))
+ ConsumerNotFoundByConsumerId, UserHasMissingRoles, UpdateConsumerError, UnknownError),
+ List(apiTagConsumer),
+ Some(List(canUpdateRateLimits)),
+ http4sPartialFunction = Some(callsLimit)
+ )
// ─── enableDisableAccountWebhook (PUT) ───────────────────────────────────
@@ -1944,17 +2577,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(enableDisableAccountWebhook), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(enableDisableAccountWebhook),
+ "PUT",
"/banks/BANK_ID/account-web-hooks",
"Enable/Disable an Account Webhook",
s"""Enable/Disable an Account Webhook
- |
- |$accountWebHookInfo
- |""",
- accountWebhookPutJson, accountWebhookJson,
+ |
+ |
+ |$accountWebHookInfo
+ |""",
+ accountWebhookPutJson,
+ accountWebhookJson,
List(UnknownError),
- apiTagWebhook :: apiTagBank :: Nil, Some(List(canUpdateWebhook)),
- http4sPartialFunction = Some(enableDisableAccountWebhook))
+ apiTagWebhook :: apiTagBank :: Nil,
+ Some(List(canUpdateWebhook)),
+ http4sPartialFunction = Some(enableDisableAccountWebhook)
+ )
// ─── enableDisableConsumers (PUT) ────────────────────────────────────────
@@ -2003,19 +2643,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateSystemView), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateSystemView),
+ "PUT",
"/system-views/SYS_VIEW_ID",
"Update System View",
- s"""Update an existing view on a bank account.
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.
- |
- |The json sent is the same as during view creation, with one difference: the 'name' field
- |of a view is not editable (it is only set when a view is created).""",
- updateSystemViewJson310, viewJsonV300,
+ s"""Update an existing view on a bank account
+ |
+ |${userAuthenticationMessage(true)} and the user needs to have access to the owner view.
+ |
+ |The json sent is the same as during view creation (above), with one difference: the 'name' field
+ |of a view is not editable (it is only set when a view is created)""",
+ updateSystemViewJson310,
+ viewJsonV300,
List(InvalidJsonFormat, AuthenticatedUserIsRequired, BankAccountNotFound, UnknownError),
- List(apiTagSystemView), Some(List(canUpdateSystemView)),
- http4sPartialFunction = Some(updateSystemView))
+ List(apiTagSystemView),
+ Some(List(canUpdateSystemView)),
+ http4sPartialFunction = Some(updateSystemView)
+ )
// ─── updateProductAttribute (PUT) ────────────────────────────────────────
@@ -2038,18 +2684,29 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateProductAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateProductAttribute),
+ "PUT",
"/banks/BANK_ID/products/PRODUCT_CODE/attributes/PRODUCT_ATTRIBUTE_ID",
"Update Product Attribute",
- s"""Update one Product Attribute by its id.
- |
- |${userAuthenticationMessage(true)}
- |""",
- productAttributeJson, productAttributeResponseJson,
+ s""" Update Product Attribute.
+ |
+
+ |$productAttributeGeneralInfo
+ |
+ |Update one Product Attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productAttributeJson,
+ productAttributeResponseJson,
List(UserHasMissingRoles, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canUpdateProductAttribute)),
- http4sPartialFunction = Some(updateProductAttribute))
+ http4sPartialFunction = Some(updateProductAttribute)
+ )
// ─── updateCustomerEmail (PUT) ───────────────────────────────────────────
@@ -2066,17 +2723,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerEmail), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerEmail),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/email",
"Update the email of a Customer",
s"""Update an email of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerEmailJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerEmailJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerEmail :: Nil),
- http4sPartialFunction = Some(updateCustomerEmail))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerEmail :: Nil),
+ http4sPartialFunction = Some(updateCustomerEmail)
+ )
// ─── updateCustomerNumber (PUT) ──────────────────────────────────────────
@@ -2097,17 +2762,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerNumber), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerNumber),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/number",
"Update the number of a Customer",
s"""Update the number of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerNumberJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerNumberJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerNumber :: Nil),
- http4sPartialFunction = Some(updateCustomerNumber))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerNumber :: Nil),
+ http4sPartialFunction = Some(updateCustomerNumber)
+ )
// ─── updateCustomerMobileNumber (PUT) ────────────────────────────────────
@@ -2124,17 +2797,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerMobileNumber), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerMobileNumber),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/mobile-number",
"Update the mobile number of a Customer",
s"""Update the mobile number of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerMobileNumberJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerMobileNumberJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerMobilePhoneNumber :: Nil),
- http4sPartialFunction = Some(updateCustomerMobileNumber))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerMobilePhoneNumber :: Nil),
+ http4sPartialFunction = Some(updateCustomerMobileNumber)
+ )
// ─── updateCustomerIdentity (PUT) ────────────────────────────────────────
@@ -2155,17 +2836,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerIdentity), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerIdentity),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/identity",
"Update the identity data of a Customer",
s"""Update the identity data of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerIdentityJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerIdentityJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerIdentity :: Nil),
- http4sPartialFunction = Some(updateCustomerIdentity))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerIdentity :: Nil),
+ http4sPartialFunction = Some(updateCustomerIdentity)
+ )
// ─── updateCustomerCreditLimit (PUT) ─────────────────────────────────────
@@ -2182,17 +2871,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerCreditLimit), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerCreditLimit),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/credit-limit",
"Update the credit limit of a Customer",
s"""Update the credit limit of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerCreditLimitJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerCreditLimitJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerCreditLimit :: Nil),
- http4sPartialFunction = Some(updateCustomerCreditLimit))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerCreditLimit :: Nil),
+ http4sPartialFunction = Some(updateCustomerCreditLimit)
+ )
// ─── updateCustomerCreditRatingAndSource (PUT) ───────────────────────────
@@ -2210,18 +2907,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerCreditRatingAndSource), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerCreditRatingAndSource),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/credit-rating-and-source",
"Update the credit rating and source of a Customer",
s"""Update the credit rating and source of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerCreditRatingAndSourceJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerCreditRatingAndSourceJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagCustomer),
Some(canUpdateCustomerCreditRatingAndSource :: canUpdateCustomerCreditRatingAndSourceAtAnyBank :: Nil),
- http4sPartialFunction = Some(updateCustomerCreditRatingAndSource))
+ http4sPartialFunction = Some(updateCustomerCreditRatingAndSource)
+ )
// ─── updateCustomerBranch (PUT) ──────────────────────────────────────────
@@ -2240,17 +2944,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerBranch), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerBranch),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/branch",
"Update the Branch of a Customer",
s"""Update the Branch of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putCustomerBranchJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putCustomerBranchJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerBranch :: Nil),
- http4sPartialFunction = Some(updateCustomerBranch))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerBranch :: Nil),
+ http4sPartialFunction = Some(updateCustomerBranch)
+ )
// ─── updateCustomerData (PUT) ────────────────────────────────────────────
@@ -2275,17 +2987,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerData), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerData),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/data",
"Update the other data of a Customer",
s"""Update the other data of the Customer specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putUpdateCustomerDataJsonV310, customerJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ putUpdateCustomerDataJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagCustomer), Some(canUpdateCustomerData :: Nil),
- http4sPartialFunction = Some(updateCustomerData))
+ List(apiTagCustomer),
+ Some(canUpdateCustomerData :: Nil),
+ http4sPartialFunction = Some(updateCustomerData)
+ )
// ─── updateAccountApplicationStatus (PUT) ────────────────────────────────
// Side effect: when status == "ACCEPTED", a new bank account is created for the
@@ -2325,17 +3045,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAccountApplicationStatus), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAccountApplicationStatus),
+ "PUT",
"/banks/BANK_ID/account-applications/ACCOUNT_APPLICATION_ID",
"Update Account Application Status",
- s"""Update an Account Application status.
- |
- |${userAuthenticationMessage(true)}
- |""",
- accountApplicationUpdateStatusJson, accountApplicationResponseJson,
+ s"""Update an Account Application status
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ accountApplicationUpdateStatusJson,
+ accountApplicationResponseJson,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
- List(apiTagAccountApplication, apiTagAccount), None,
- http4sPartialFunction = Some(updateAccountApplicationStatus))
+ List(apiTagAccountApplication, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(updateAccountApplicationStatus)
+ )
// ─── createCustomer (POST) ───────────────────────────────────────────────
@@ -2375,23 +3103,29 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createCustomer), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createCustomer),
+ "POST",
"/banks/BANK_ID/customers",
"Create Customer",
- s"""The Customer resource stores the customer number (which is set by the backend), legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
- |Dates need to be in the format 2013-01-21T23:08:00Z
- |
- |Note: If you need to set a specific customer number, use the Update Customer Number endpoint after this call.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postCustomerJsonV310, customerJsonV310,
+ s"""
+ |The Customer resource stores the customer number (which is set by the backend), legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
+ |Dates need to be in the format 2013-01-21T23:08:00Z
+ |
+ |Note: If you need to set a specific customer number, use the Update Customer Number endpoint after this call.
+ |
+ |${userAuthenticationMessage(true)}
+ |""",
+ postCustomerJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat,
- CustomerNumberAlreadyExists, UserNotFoundById, CustomerAlreadyExistsForUser,
- CreateCustomerError, UnknownError),
+ CustomerNumberAlreadyExists, UserNotFoundById, CustomerAlreadyExistsForUser,
+ CreateCustomerError, UnknownError),
List(apiTagCustomer, apiTagPerson),
Some(List(canCreateCustomer, canCreateCustomerAtAnyBank)),
- http4sPartialFunction = Some(createCustomer))
+ http4sPartialFunction = Some(createCustomer)
+ )
// ─── getCustomerByCustomerNumber (POST → 200) ────────────────────────────
@@ -2408,17 +3142,25 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerByCustomerNumber), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerByCustomerNumber),
+ "POST",
"/banks/BANK_ID/customers/customer-number",
"Get Customer by CUSTOMER_NUMBER",
s"""Gets the Customer specified by CUSTOMER_NUMBER.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postCustomerNumberJsonV310, customerWithAttributesJsonV310,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ postCustomerNumberJsonV310,
+ customerWithAttributesJsonV310,
List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
- List(apiTagCustomer, apiTagKyc), Some(List(canGetCustomersAtOneBank)),
- http4sPartialFunction = Some(getCustomerByCustomerNumber))
+ List(apiTagCustomer, apiTagKyc),
+ Some(List(canGetCustomersAtOneBank)),
+ http4sPartialFunction = Some(getCustomerByCustomerNumber)
+ )
// ─── createAccountApplication (POST) ─────────────────────────────────────
@@ -2444,17 +3186,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createAccountApplication), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createAccountApplication),
+ "POST",
"/banks/BANK_ID/account-applications",
"Create Account Application",
- s"""Create Account Application.
- |
- |${userAuthenticationMessage(true)}
- |""",
- accountApplicationJson, accountApplicationResponseJson,
+ s""" Create Account Application
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ accountApplicationJson,
+ accountApplicationResponseJson,
List(InvalidJsonFormat, UnknownError),
- List(apiTagAccountApplication, apiTagAccount), None,
- http4sPartialFunction = Some(createAccountApplication))
+ List(apiTagAccountApplication, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(createAccountApplication)
+ )
// ─── createAccountAttribute (POST) ───────────────────────────────────────
@@ -2479,18 +3228,41 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createAccountAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createAccountAttribute),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/products/PRODUCT_CODE/attribute",
"Create Account Attribute",
- s"""Create an Account Attribute.
- |
- |${userAuthenticationMessage(true)}
- |""",
- accountAttributeJson, accountAttributeResponseJson,
+ s""" Create Account Attribute
+ |
+ |$accountAttributeGeneralInfo
+ |
+ |Typical account attributes might be:
+ |
+ |ISIN (for International bonds)
+ |VKN (for German bonds)
+ |REDCODE (markit short code for credit derivative)
+ |LOAN_ID (e.g. used for Anacredit reporting)
+ |
+ |ISSUE_DATE (When the bond was issued in the market)
+ |MATURITY_DATE (End of life time of a product)
+ |TRADABLE
+ |
+ |See [FPML](http://www.fpml.org/) for more examples.
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ accountAttributeJson,
+ accountAttributeResponseJson,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
List(apiTagAccount, apiTagAccountAttribute, apiTagAttribute),
Some(List(canCreateAccountAttributeAtOneBank)),
- http4sPartialFunction = Some(createAccountAttribute))
+ http4sPartialFunction = Some(createAccountAttribute)
+ )
// ─── updateAccountAttribute (PUT) ────────────────────────────────────────
@@ -2516,18 +3288,39 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAccountAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAccountAttribute),
+ "PUT",
"/banks/BANK_ID/accounts/ACCOUNT_ID/products/PRODUCT_CODE/attributes/ACCOUNT_ATTRIBUTE_ID",
"Update Account Attribute",
- s"""Update an Account Attribute by its id.
- |
- |${userAuthenticationMessage(true)}
- |""",
- accountAttributeJson, accountAttributeResponseJson,
+ s""" Update Account Attribute
+ |
+ |$accountAttributeGeneralInfo
+ |
+ |Typical account attributes might be:
+ |
+ |ISIN (for International bonds)
+ |VKN (for German bonds)
+ |REDCODE (markit short code for credit derivative)
+ |LOAN_ID (e.g. used for Anacredit reporting)
+ |
+ |ISSUE_DATE (When the bond was issued in the market)
+ |MATURITY_DATE (End of life time of a product)
+ |TRADABLE
+ |
+ |See [FPML](http://www.fpml.org/) for more examples.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ accountAttributeJson,
+ accountAttributeResponseJson,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
List(apiTagAccount, apiTagAccountAttribute, apiTagAttribute),
Some(List(canUpdateAccountAttribute)),
- http4sPartialFunction = Some(updateAccountAttribute))
+ http4sPartialFunction = Some(updateAccountAttribute)
+ )
// ─── createMeeting (POST) ────────────────────────────────────────────────
@@ -2594,17 +3387,37 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createSystemView), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createSystemView),
+ "POST",
"/system-views",
"Create System View",
- s"""Create a system view.
- |
- |${userAuthenticationMessage(true)} and the user needs to have access to the $canCreateSystemView entitlement.
- |""",
- SwaggerDefinitionsJSON.createSystemViewJsonV300, viewJsonV300,
+ s"""Create a system view
+ |
+ | ${userAuthenticationMessage(true)} and the user needs to have access to the $canCreateSystemView entitlement.
+ | The 'alias' field in the JSON can take one of two values:
+ |
+ | * _public_: to use the public alias if there is one specified for the other account.
+ | * _private_: to use the private alias if there is one specified for the other account.
+ |
+ | * _''(empty string)_: to use no alias; the view shows the real name of the other account.
+ |
+ | The 'hide_metadata_if_alias_used' field in the JSON can take boolean values. If it is set to `true` and there is an alias on the other account then the other accounts' metadata (like more_info, url, image_url, open_corporates_url, etc.) will be hidden. Otherwise the metadata will be shown.
+ |
+ | The 'allowed_actions' field is a list containing the name of the actions allowed on this view, all the actions contained will be set to `true` on the view creation, the rest will be set to `false`.
+ |
+ | The 'metadata_view' field determines where metadata (comments, tags, images, where tags) for transactions are stored and retrieved. If set to another view's ID (e.g. 'owner'), metadata added through this view will be shared with all other views that also use the same metadata_view value. If left empty, metadata is stored under this view's own ID and is not shared with other views.
+ |
+ | Please note that system views cannot be public. In case you try to set it you will get the error $SystemViewCannotBePublicError
+ | """,
+ SwaggerDefinitionsJSON.createSystemViewJsonV300,
+ viewJsonV300,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagSystemView), Some(List(canCreateSystemView)),
- http4sPartialFunction = Some(createSystemView))
+ List(apiTagSystemView),
+ Some(List(canCreateSystemView)),
+ http4sPartialFunction = Some(createSystemView)
+ )
// ─── createProductCollection (PUT — "Create or Update") ──────────────────
@@ -2630,17 +3443,38 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createProductCollection), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createProductCollection),
+ "PUT",
"/banks/BANK_ID/product-collections/COLLECTION_CODE",
"Create Product Collection",
s"""Create or Update a Product Collection at the Bank.
- |
- |${userAuthenticationMessage(true)}
- |""",
- putProductCollectionsV310, productCollectionsJsonV310,
+ |
+ |Use Product Collections to create Product "Baskets", "Portfolios", "Indices", "Collections", "Underlyings-lists", "Buckets" etc. etc.
+ |
+ |There is a many to many relationship between Products and Product Collections:
+ |
+ |* A Product can exist in many Collections
+ |
+ |* A Collection can contain many Products.
+ |
+ |A collection has collection code, one parent Product and one or more child Products.
+ |
+ |
+ |$productHiearchyAndCollectionNote
+
+ |${userAuthenticationMessage(true) }
+ |
+ |
+ |""",
+ putProductCollectionsV310,
+ productCollectionsJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, UserHasMissingRoles, UnknownError),
- List(apiTagProductCollection, apiTagProduct), Some(List(canMaintainProductCollection)),
- http4sPartialFunction = Some(createProductCollection))
+ List(apiTagProductCollection, apiTagProduct),
+ Some(List(canMaintainProductCollection)),
+ http4sPartialFunction = Some(createProductCollection)
+ )
// ─── addCardForBank (POST) ───────────────────────────────────────────────
@@ -2705,17 +3539,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(addCardForBank), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(addCardForBank),
+ "POST",
"/management/banks/BANK_ID/cards",
"Create Card",
- s"""Create Card at bank specified by BANK_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- createPhysicalCardJsonV310, physicalCardJsonV310,
+ s"""Create Card at bank specified by BANK_ID .
+ |
+ |${userAuthenticationMessage(true)}
+ |""",
+ createPhysicalCardJsonV310,
+ physicalCardJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, AllowedValuesAre, UnknownError),
- List(apiTagCard), None,
- http4sPartialFunction = Some(addCardForBank))
+ List(apiTagCard),
+ None,
+ http4sPartialFunction = Some(addCardForBank)
+ )
// ─── updatedCardForBank (PUT) ────────────────────────────────────────────
@@ -2771,17 +3611,22 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updatedCardForBank), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updatedCardForBank),
+ "PUT",
"/management/banks/BANK_ID/cards/CARD_ID",
"Update Card",
- s"""Update Card at bank specified by CARD_ID.
- |
- |${userAuthenticationMessage(true)}
- |""",
- updatePhysicalCardJsonV310, physicalCardJsonV310,
+ s"""Update Card at bank specified by CARD_ID .
+ |${userAuthenticationMessage(true)}
+ |""",
+ updatePhysicalCardJsonV310,
+ physicalCardJsonV310,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, AllowedValuesAre, UnknownError),
- List(apiTagCard), Some(List(canCreateCardsForBank)),
- http4sPartialFunction = Some(updatedCardForBank))
+ List(apiTagCard),
+ Some(List(canCreateCardsForBank)),
+ http4sPartialFunction = Some(updatedCardForBank)
+ )
// ─── createCardAttribute (POST) ──────────────────────────────────────────
@@ -2803,27 +3648,40 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createCardAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createCardAttribute),
+ "POST",
"/management/banks/BANK_ID/cards/CARD_ID/attribute",
"Create Card Attribute",
- s"""Create a Card Attribute.
- |
- |${userAuthenticationMessage(true)}
- |""",
+ s""" Create Card Attribute
+ |
+ |Card Attributes are used to describe a financial Product with a list of typed key value pairs.
+ |
+ |Each Card Attribute is linked to its Card by CARD_ID
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
CardAttributeJson(
cardAttributeNameExample.value,
CardAttributeType.DOUBLE.toString,
- cardAttributeValueExample.value),
+ cardAttributeValueExample.value
+ ),
CardAttributeCommons(
- Some(BankId(bankIdExample.value)),
- Some(cardIdExample.value),
- Some(cardAttributeIdExample.value),
- cardAttributeNameExample.value,
- CardAttributeType.DOUBLE,
- cardAttributeValueExample.value),
+ Some(BankId(bankIdExample.value)),
+ Some(cardIdExample.value),
+ Some(cardAttributeIdExample.value),
+ cardAttributeNameExample.value,
+ CardAttributeType.DOUBLE,
+ cardAttributeValueExample.value),
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagCard, apiTagCardAttribute, apiTagAttribute), None,
- http4sPartialFunction = Some(createCardAttribute))
+ List(apiTagCard, apiTagCardAttribute, apiTagAttribute),
+ None,
+ http4sPartialFunction = Some(createCardAttribute)
+ )
// ─── updateCardAttribute (PUT) ───────────────────────────────────────────
@@ -2846,27 +3704,38 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCardAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCardAttribute),
+ "PUT",
"/management/banks/BANK_ID/cards/CARD_ID/attributes/CARD_ATTRIBUTE_ID",
"Update Card Attribute",
- s"""Update a Card Attribute.
- |
- |${userAuthenticationMessage(true)}
- |""",
+ s""" Update Card Attribute
+ |
+ |Card Attributes are used to describe a financial Product with a list of typed key value pairs.
+ |
+ |Each Card Attribute is linked to its Card by CARD_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
CardAttributeJson(
cardAttributeNameExample.value,
CardAttributeType.DOUBLE.toString,
- cardAttributeValueExample.value),
+ cardAttributeValueExample.value
+ ),
CardAttributeCommons(
- Some(BankId(bankIdExample.value)),
- Some(cardIdExample.value),
- Some(cardAttributeIdExample.value),
- cardAttributeNameExample.value,
- CardAttributeType.DOUBLE,
- cardAttributeValueExample.value),
+ Some(BankId(bankIdExample.value)),
+ Some(cardIdExample.value),
+ Some(cardAttributeIdExample.value),
+ cardAttributeNameExample.value,
+ CardAttributeType.DOUBLE,
+ cardAttributeValueExample.value),
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagCard, apiTagCardAttribute, apiTagAttribute), None,
- http4sPartialFunction = Some(updateCardAttribute))
+ List(apiTagCard, apiTagCardAttribute, apiTagAttribute),
+ None,
+ http4sPartialFunction = Some(updateCardAttribute)
+ )
// ─── createWebUiProps (POST) ─────────────────────────────────────────────
@@ -2886,18 +3755,60 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createWebUiProps), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createWebUiProps),
+ "POST",
"/management/webui_props",
"Create WebUiProps",
s"""Create a WebUiProps.
- |
- |${userAuthenticationMessage(true)}
- |""",
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |Explaination of Fields:
+ |
+ |* name is required String value
+ |* value is required String value
+ |
+ |The line break and double quotations should do escape, example:
+ |
+ |```
+ |
+ |{"name": "webui_some", "value": "this value
+ |have "line break" and double quotations."}
+ |
+ |```
+ |should do escape like this:
+ |
+ |```
+ |
+ |{"name": "webui_some", "value": "this value\\nhave \\"line break\\" and double quotations."}
+ |
+ |```
+ |
+ |Insert image examples:
+ |
+ |```
+ |// set width=100 and height=50
+ |{"name": "webui_some_pic", "value": "here is a picture "}
+ |
+ |// only set height=50
+ |{"name": "webui_some_pic", "value": "here is a picture "}
+ |
+ |// only width=20%
+ |{"name": "webui_some_pic", "value": "here is a picture "}
+ |
+ |```
+ |
+ |""",
WebUiPropsCommons("webui_api_explorer_url", "https://apiexplorer.openbankproject.com"),
- WebUiPropsCommons("webui_api_explorer_url", "https://apiexplorer.openbankproject.com", Some("web-ui-props-id")),
+ WebUiPropsCommons( "webui_api_explorer_url", "https://apiexplorer.openbankproject.com", Some("some-web-ui-props-id")),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
- List(apiTagWebUiProps), Some(List(canCreateWebUiProps)),
- http4sPartialFunction = Some(createWebUiProps))
+ List(apiTagWebUiProps),
+ Some(List(canCreateWebUiProps)),
+ http4sPartialFunction = Some(createWebUiProps)
+ )
// ─── createUserAuthContextUpdateRequest (POST) ───────────────────────────
@@ -2920,16 +3831,26 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createUserAuthContextUpdateRequest), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createUserAuthContextUpdateRequest),
+ "POST",
"/banks/BANK_ID/users/current/auth-context-updates/SCA_METHOD",
"Create User Auth Context Update Request",
s"""Create User Auth Context Update Request.
- |${userAuthenticationMessage(true)}
- |""",
- postUserAuthContextJson, userAuthContextUpdateJson,
+ |${userAuthenticationMessage(true)}
+ |
+ |A One Time Password (OTP) (AKA security challenge) is sent Out of Band (OOB) to the User via the transport defined in SCA_METHOD
+ |SCA_METHOD is typically "SMS" or "EMAIL". "EMAIL" is used for testing purposes.
+ |
+ |""",
+ postUserAuthContextJson,
+ userAuthContextUpdateJson,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, CreateUserAuthContextError, UnknownError),
- List(apiTagUser), None,
- http4sPartialFunction = Some(createUserAuthContextUpdateRequest))
+ List(apiTagUser),
+ None,
+ http4sPartialFunction = Some(createUserAuthContextUpdateRequest)
+ )
// ─── answerUserAuthContextUpdateChallenge (POST → 200) ───────────────────
@@ -2957,15 +3878,22 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(answerUserAuthContextUpdateChallenge), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(answerUserAuthContextUpdateChallenge),
+ "POST",
"/banks/BANK_ID/users/current/auth-context-updates/AUTH_CONTEXT_UPDATE_ID/challenge",
"Answer Auth Context Update Challenge",
- s"""Answer Auth Context Update Challenge.""",
+ s"""
+ |Answer Auth Context Update Challenge.
+ |""",
PostUserAuthContextUpdateJsonV310(answer = "12345678"),
userAuthContextUpdateJson,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat, InvalidConnectorResponse, UnknownError),
- apiTagUser :: Nil, None,
- http4sPartialFunction = Some(answerUserAuthContextUpdateChallenge))
+ apiTagUser :: Nil,
+ None,
+ http4sPartialFunction = Some(answerUserAuthContextUpdateChallenge)
+ )
// ─── refreshUser (POST) ──────────────────────────────────────────────────
@@ -2986,17 +3914,26 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(refreshUser), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(refreshUser),
+ "POST",
"/users/USER_ID/refresh",
"Refresh User",
- s"""The endpoint is used for updating the accounts, views, account holders for the user.
- |
- |${userAuthenticationMessage(true)}
- |""",
- EmptyBody, refresUserJson,
+ s""" The endpoint is used for updating the accounts, views, account holders for the user.
+ | As to the Json body, you can leave it as Empty.
+ | This call will get data from backend, no need to prepare the json body in api side.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ refresUserJson,
List(UserHasMissingRoles, UnknownError),
- List(apiTagUser), Some(List(canRefreshUser)),
- http4sPartialFunction = Some(refreshUser))
+ List(apiTagUser),
+ Some(List(canRefreshUser)),
+ http4sPartialFunction = Some(refreshUser)
+ )
// ─── createProduct (PUT — "Create or Update") ────────────────────────────
@@ -3089,21 +4026,60 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createMethodRouting), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createMethodRouting),
+ "POST",
"/management/method_routings",
"Create MethodRouting",
s"""Create a MethodRouting.
- |
- |${userAuthenticationMessage(true)}
- |""",
- MethodRoutingCommons("getBank", "rest_vMar2019", false, Some("some_bankId_.*"),
- List(MethodRoutingParam("url", "http://mydomain.com/xxx"))),
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |Explanation of Fields:
+ |
+ |* method_name is required String value, current supported value: $supportedConnectorNames
+ |* connector_name is required String value
+ |* is_bank_id_exact_match is required boolean value, if bank_id_pattern is exact bank_id value, this value is true; if bank_id_pattern is null or a regex, this value is false
+ |* bank_id_pattern is optional String value, it can be null, a exact bank_id or a regex
+ |* parameters is optional array of key value pairs. You can set some parameters for this method
+ |
+ |note and CAVEAT!:
+ |
+ |* bank_id_pattern has to be empty for methods that do not take bank_id as a function parameter, otherwise might get empty result
+ |* methods that aggregate bank objects (e.g. getBankAccountsForUser) have to take any existing method routings for these objects into consideration
+ |* so if you create e.g. a bank specific method routing for getting an account, make sure that it is also served by endpoints getting ALL accounts for ALL banks
+ |* if bank_id_pattern is regex, special characters need to do escape, for example: bank_id_pattern = "some\\-id_pattern_\\d+"
+ |
+ |If the connector name starts with rest, parameters can contain "outBoundMapping" and "inBoundMapping", convert OutBound and InBound json structure.
+ |for example:
+ | outBoundMapping example, convert json from source to target:
+ |
+ |Build OutBound json value rules:
+ |1 set cId value with: outboundAdapterCallContext.correlationId value
+ |2 set bankId value with: concat bankId.value value with string helloworld
+ |3 set originalJson value with: whole source json, note: the field value expression is $$root
+ |
+ |
+ | inBoundMapping example, convert json from source to target:
+ |
+ |Build InBound json value rules:
+ |1 and 2 set inboundAdapterCallContext and status value: because field name ends with "$$default", remove "$$default" from field name, not change the value
+ |3 set fullName value with: concat string full: with result.name value
+ |4 set bankRoutingScheme value: because source value is Array, but target value is not Array, the mapping field name must ends with [0].
+ |""",
+ MethodRoutingCommons("getBank", "rest_vMar2019", false, Some("some_bankId_.*"), List(MethodRoutingParam("url", "http://mydomain.com/xxx"))),
MethodRoutingCommons("getBank", "rest_vMar2019", false, Some("some_bankId_.*"),
- List(MethodRoutingParam("url", "http://mydomain.com/xxx")), Some("this-method-routing-Id")),
+ List(MethodRoutingParam("url", "http://mydomain.com/xxx")),
+ Some("this-method-routing-Id")
+ ),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat,
- InvalidConnectorName, InvalidConnectorMethodName, UnknownError),
- List(apiTagMethodRouting, apiTagApi), Some(List(canCreateMethodRouting)),
- http4sPartialFunction = Some(createMethodRouting))
+ InvalidConnectorName, InvalidConnectorMethodName, UnknownError),
+ List(apiTagMethodRouting, apiTagApi),
+ Some(List(canCreateMethodRouting)),
+ http4sPartialFunction = Some(createMethodRouting)
+ )
// ─── updateMethodRouting (PUT) ───────────────────────────────────────────
@@ -3151,21 +4127,53 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateMethodRouting), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateMethodRouting),
+ "PUT",
"/management/method_routings/METHOD_ROUTING_ID",
"Update MethodRouting",
s"""Update a MethodRouting.
- |
- |${userAuthenticationMessage(true)}
- |""",
- MethodRoutingCommons("getBank", "rest_vMar2019", true, Some("some_bankId"),
- List(MethodRoutingParam("url", "http://mydomain.com/xxx"))),
- MethodRoutingCommons("getBank", "rest_vMar2019", true, Some("some_bankId"),
- List(MethodRoutingParam("url", "http://mydomain.com/xxx")), Some("this-method-routing-Id")),
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |Explaination of Fields:
+ |
+ |* method_name is required String value, current supported value: $supportedConnectorNames
+ |* connector_name is required String value
+ |* is_bank_id_exact_match is required boolean value, if bank_id_pattern is exact bank_id value, this value is true; if bank_id_pattern is null or a regex, this value is false
+ |* bank_id_pattern is optional String value, it can be null, a exact bank_id or a regex
+ |* parameters is optional array of key value pairs. You can set some paremeters for this method
+ |note:
+ |
+ |* if bank_id_pattern is regex, special characters need to do escape, for example: bank_id_pattern = "some\\-id_pattern_\\d+"
+ |
+ |If connector name start with rest, parameters can contain "outBoundMapping" and "inBoundMapping", to convert OutBound and InBound json structure.
+ |for example:
+ | outBoundMapping example, convert json from source to target:
+ |
+ |Build OutBound json value rules:
+ |1 set cId value with: outboundAdapterCallContext.correlationId value
+ |2 set bankId value with: concat bankId.value value with string helloworld
+ |3 set originalJson value with: whole source json, note: the field value expression is $$root
+ |
+ |
+ | inBoundMapping example, convert json from source to target:
+ |
+ |Build InBound json value rules:
+ |1 and 2 set inboundAdapterCallContext and status value: because field name ends with "$$default", remove "$$default" from field name, not change the value
+ |3 set fullName value with: concat string full: with result.name value
+ |4 set bankRoutingScheme value: because source value is Array, but target value is not Array, the mapping field name must ends with [0].
+ |""",
+ MethodRoutingCommons("getBank", "rest_vMar2019", true, Some("some_bankId"), List(MethodRoutingParam("url", "http://mydomain.com/xxx"))),
+ MethodRoutingCommons("getBank", "rest_vMar2019", true, Some("some_bankId"), List(MethodRoutingParam("url", "http://mydomain.com/xxx")), Some("this-method-routing-Id")),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat,
- InvalidConnectorName, InvalidConnectorMethodName, UnknownError),
- List(apiTagMethodRouting, apiTagApi), Some(List(canUpdateMethodRouting)),
- http4sPartialFunction = Some(updateMethodRouting))
+ InvalidConnectorName, InvalidConnectorMethodName, UnknownError),
+ List(apiTagMethodRouting, apiTagApi),
+ Some(List(canUpdateMethodRouting)),
+ http4sPartialFunction = Some(updateMethodRouting)
+ )
// ─── updateAccount (PUT) ─────────────────────────────────────────────────
@@ -3203,17 +4211,24 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAccount), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAccount),
+ "PUT",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID",
"Update Account",
s"""Update the account.
- |
- |${userAuthenticationMessage(true)}
- |""",
- updateAccountRequestJsonV310, updateAccountResponseJsonV310,
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ updateAccountRequestJsonV310,
+ updateAccountResponseJsonV310,
List(InvalidJsonFormat, AuthenticatedUserIsRequired, UnknownError, BankAccountNotFound),
- List(apiTagAccount), Some(List(canUpdateAccount)),
- http4sPartialFunction = Some(updateAccount))
+ List(apiTagAccount),
+ Some(List(canUpdateAccount)),
+ http4sPartialFunction = Some(updateAccount)
+ )
// ─── createAccount (PUT) ─────────────────────────────────────────────────
// Self-or-other role check: when the logged-in user is creating an account
@@ -3413,58 +4428,217 @@ object Http4s310 {
val createConsentImplicit: HttpRoutes[IO] = createConsent
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createConsentEmail), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createConsentEmail),
+ "POST",
"/banks/BANK_ID/my/consents/EMAIL",
"Create Consent (Email)",
- s"""This endpoint starts the process of creating a Consent via Email SCA method.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postConsentRequestJsonV310,
- ConsentJsonV310(
- consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
- jwt = "eyJ...",
- status = "INITIATED"),
+ s"""
+ |
+ |This endpoint starts the process of creating a Consent.
+ |
+ |The Consent is created in an ${ConsentStatus.INITIATED} state.
+ |
+ |A One Time Password (OTP) (AKA security challenge) is sent Out of Band (OOB) to the User via the transport defined in SCA_METHOD
+ |SCA_METHOD is typically "SMS","EMAIL" or "IMPLICIT". "EMAIL" is used for testing purposes. OBP mapped mode "IMPLICIT" is "EMAIL".
+ |Other mode, bank can decide it in the connector method 'getConsentImplicitSCA'.
+ |
+ |When the Consent is created, OBP (or a backend system) stores the challenge so it can be checked later against the value supplied by the User with the Answer Consent Challenge endpoint.
+ |
+ |$generalObpConsentText
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |Example 1:
+ |{
+ | "everything": true,
+ | "views": [],
+ | "entitlements": [],
+ | "consumer_id": "7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh",
+ | "phone_number": "+49 170 1234567"
+ |}
+ |
+ |Please note that consumer_id is optional field
+ |Example 2:
+ |{
+ | "everything": true,
+ | "views": [],
+ | "entitlements": [],
+ | "phone_number": "+49 170 1234567"
+ |}
+ |
+ |Please note if everything=false you need to explicitly specify views and entitlements
+ |Example 3:
+ |{
+ | "everything": false,
+ | "views": [
+ | {
+ | "bank_id": "GENODEM1GLS",
+ | "account_id": "8ca8a7e4-6d02-40e3-a129-0b2bf89de9f0",
+ | "view_id": "${Constant.SYSTEM_OWNER_VIEW_ID}"
+ | }
+ | ],
+ | "entitlements": [
+ | {
+ | "bank_id": "GENODEM1GLS",
+ | "role_name": "CanGetCustomersAtOneBank"
+ | }
+ | ],
+ | "consumer_id": "7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh",
+ | "phone_number": "+49 170 1234567"
+ |}
+ |
+ |""",
+ postConsentEmailJsonV310,
+ consentJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat,
- ConsentMaxTTL, RolesAllowedInConsent, ViewsAllowedInConsent, UnknownError),
- apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(createConsentEmail))
+ ConsentMaxTTL, RolesAllowedInConsent, ViewsAllowedInConsent, UnknownError),
+ apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(createConsentEmail)
+ )
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createConsentSms), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createConsentSms),
+ "POST",
"/banks/BANK_ID/my/consents/SMS",
"Create Consent (SMS)",
- s"""This endpoint starts the process of creating a Consent via SMS SCA method.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postConsentRequestJsonV310,
- ConsentJsonV310(
- consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
- jwt = "eyJ...",
- status = "INITIATED"),
+ s"""
+ |
+ |This endpoint starts the process of creating a Consent.
+ |
+ |The Consent is created in an ${ConsentStatus.INITIATED} state.
+ |
+ |A One Time Password (OTP) (AKA security challenge) is sent Out of Band (OOB) to the User via the transport defined in SCA_METHOD
+ |SCA_METHOD is typically "SMS","EMAIL" or "IMPLICIT". "EMAIL" is used for testing purposes. OBP mapped mode "IMPLICIT" is "EMAIL".
+ |Other mode, bank can decide it in the connector method 'getConsentImplicitSCA'.
+ |
+ |When the Consent is created, OBP (or a backend system) stores the challenge so it can be checked later against the value supplied by the User with the Answer Consent Challenge endpoint.
+ |
+ |$generalObpConsentText
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |Example 1:
+ |{
+ | "everything": true,
+ | "views": [],
+ | "entitlements": [],
+ | "consumer_id": "7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh",
+ | "email": "eveline@example.com"
+ |}
+ |
+ |Please note that consumer_id is optional field
+ |Example 2:
+ |{
+ | "everything": true,
+ | "views": [],
+ | "entitlements": [],
+ | "email": "eveline@example.com"
+ |}
+ |
+ |Please note if everything=false you need to explicitly specify views and entitlements
+ |Example 3:
+ |{
+ | "everything": false,
+ | "views": [
+ | {
+ | "bank_id": "GENODEM1GLS",
+ | "account_id": "8ca8a7e4-6d02-40e3-a129-0b2bf89de9f0",
+ | "view_id": "${Constant.SYSTEM_OWNER_VIEW_ID}"
+ | }
+ | ],
+ | "entitlements": [
+ | {
+ | "bank_id": "GENODEM1GLS",
+ | "role_name": "CanGetCustomersAtOneBank"
+ | }
+ | ],
+ | "consumer_id": "7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh",
+ | "email": "eveline@example.com"
+ |}
+ |
+ |""",
+ postConsentPhoneJsonV310,
+ consentJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat,
- ConsentMaxTTL, RolesAllowedInConsent, ViewsAllowedInConsent, UnknownError),
- apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(createConsentSms))
+ ConsentMaxTTL, RolesAllowedInConsent, ViewsAllowedInConsent, UnknownError),
+ apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(createConsentSms)
+ )
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createConsentImplicit), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createConsentImplicit),
+ "POST",
"/banks/BANK_ID/my/consents/IMPLICIT",
"Create Consent (Implicit)",
- s"""This endpoint starts the process of creating a Consent via Implicit SCA method.
- |
- |${userAuthenticationMessage(true)}
- |""",
- postConsentRequestJsonV310,
- ConsentJsonV310(
- consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
- jwt = "eyJ...",
- status = "INITIATED"),
+ s"""
+ |
+ |This endpoint starts the process of creating a Consent.
+ |
+ |The Consent is created in an ${ConsentStatus.INITIATED} state.
+ |
+ |A One Time Password (OTP) (AKA security challenge) is sent Out of Band (OOB) to the User via the transport defined in SCA_METHOD
+ |SCA_METHOD is typically "SMS","EMAIL" or "IMPLICIT". "EMAIL" is used for testing purposes. OBP mapped mode "IMPLICIT" is "EMAIL".
+ |Other mode, bank can decide it in the connector method 'getConsentImplicitSCA'.
+ |
+ |When the Consent is created, OBP (or a backend system) stores the challenge so it can be checked later against the value supplied by the User with the Answer Consent Challenge endpoint.
+ |
+ |$generalObpConsentText
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |Example 1:
+ |{
+ | "everything": true,
+ | "views": [],
+ | "entitlements": [],
+ | "consumer_id": "7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh",
+ |}
+ |
+ |Please note that consumer_id is optional field
+ |Example 2:
+ |{
+ | "everything": true,
+ | "views": [],
+ | "entitlements": [],
+ |}
+ |
+ |Please note if everything=false you need to explicitly specify views and entitlements
+ |Example 3:
+ |{
+ | "everything": false,
+ | "views": [
+ | {
+ | "bank_id": "GENODEM1GLS",
+ | "account_id": "8ca8a7e4-6d02-40e3-a129-0b2bf89de9f0",
+ | "view_id": "${Constant.SYSTEM_OWNER_VIEW_ID}"
+ | }
+ | ],
+ | "entitlements": [
+ | {
+ | "bank_id": "GENODEM1GLS",
+ | "role_name": "CanGetCustomersAtOneBank"
+ | }
+ | ],
+ | "consumer_id": "7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh",
+ |}
+ |
+ |""",
+ postConsentImplicitJsonV310,
+ consentJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat,
- ConsentMaxTTL, RolesAllowedInConsent, ViewsAllowedInConsent, UnknownError),
- apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(createConsentImplicit))
+ ConsentMaxTTL, RolesAllowedInConsent, ViewsAllowedInConsent, UnknownError),
+ apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(createConsentImplicit)
+ )
// ─── answerConsentChallenge (POST → 201) ─────────────────────────────────
@@ -3480,21 +4654,36 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(answerConsentChallenge), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(answerConsentChallenge),
+ "POST",
"/banks/BANK_ID/consents/CONSENT_ID/challenge",
"Answer Consent Challenge",
- s"""This endpoint is used to confirm a Consent previously created.
- |
- |The User must supply a code that was sent out of band (OOB) for example via an SMS.
- |
- |${userAuthenticationMessage(true)}
- |""",
+ s"""
+ |
+ |$generalObpConsentText
+ |
+ |
+ |This endpoint is used to confirm a Consent previously created.
+ |
+ |The User must supply a code that was sent out of band (OOB) for example via an SMS.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
PostConsentChallengeJsonV310(answer = "12345678"),
- ConsentJsonV310("9d429899-24f5-42c8-8565-943ffa6a7945", "eyJ...", "INITIATED"),
+ ConsentChallengeJsonV310(
+ consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
+ jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4",
+ status = "INITIATED"
+ ),
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat,
- InvalidConnectorResponse, UnknownError),
- apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(answerConsentChallenge))
+ InvalidConnectorResponse, UnknownError),
+ apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(answerConsentChallenge)
+ )
// ─── getObpConnectorLoopback ─────────────────────────────────────────────
@@ -3508,18 +4697,23 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getObpConnectorLoopback), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getObpConnectorLoopback),
+ "GET",
"/connector/loopback",
"Get Connector Status (Loopback)",
s"""This endpoint makes a call to the Connector to check the backend transport is reachable. (Deprecated)
- |
- |${userAuthenticationMessage(false)}
- |
- |""".stripMargin,
- EmptyBody, obpApiLoopbackJson,
+ |
+ |${userAuthenticationMessage(false)}
+ |
+ |""",
+ EmptyBody,
+ obpApiLoopbackJson,
List(UnknownError),
List(apiTagApi, apiTagOAuth, apiTagOIDC),
- http4sPartialFunction = Some(getObpConnectorLoopback))
+ http4sPartialFunction = Some(getObpConnectorLoopback)
+ )
// ─── getMessageDocsSwagger ───────────────────────────────────────────────
// Real routing is handled by Http4sResourceDocs (wildcard /obp/*/message-docs/{CONNECTOR}/swagger2.0
@@ -3529,7 +4723,10 @@ object Http4s310 {
val getMessageDocsSwagger: HttpRoutes[IO] = HttpRoutes.empty
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMessageDocsSwagger), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMessageDocsSwagger),
+ "GET",
"/message-docs/CONNECTOR/swagger2.0",
"Get Message Docs Swagger",
"""
@@ -3547,7 +4744,8 @@ object Http4s310 {
EmptyBody,
EmptyBody,
List(UnknownError),
- List(apiTagMessageDoc, apiTagDocumentation, apiTagApi))
+ List(apiTagMessageDoc, apiTagDocumentation, apiTagApi)
+ )
// ─── saveHistoricalTransaction (POST) ────────────────────────────────────
@@ -3629,20 +4827,90 @@ object Http4s310 {
}
resourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(saveHistoricalTransaction), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(saveHistoricalTransaction),
+ "POST",
"/management/historical/transactions",
"Save Historical Transactions",
- s"""Import the historical transactions.
- |
- |The fields bank_id, account_id, counterparty_id in the json body are all optional ones.
- |
- |This call is experimental.""".stripMargin,
- postHistoricalTransactionJson, postHistoricalTransactionResponseJson,
+ s"""
+ |Import the historical transactions.
+ |
+ |The fields bank_id, account_id, counterparty_id in the json body are all optional ones.
+ |It support transfer money from account to account, account to counterparty and counterparty to counterparty
+ |Both bank_id + account_id and counterparty_id can identify the account, so OBP only need one of them to make the payment.
+ |So:
+ |When you need the account to account, just omit counterparty_id field.eg:
+ |{
+ | "from": {
+ | "bank_id": "gh.29.uk",
+ | "account_id": "1ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
+ | },
+ | "to": {
+ | "bank_id": "gh.29.uk",
+ | "account_id": "2ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
+ | },
+ | "value": {
+ | "currency": "GBP",
+ | "amount": "10"
+ | },
+ | "description": "this is for work",
+ | "posted": "2017-09-19T02:31:05Z",
+ | "completed": "2017-09-19T02:31:05Z",
+ | "type": "SANDBOX_TAN",
+ | "charge_policy": "SHARED"
+ |}
+ |
+ |When you need the counterparty to counterparty, need to omit bank_id and account_id field.eg:
+ |{
+ | "from": {
+ | "counterparty_id": "f6392b7d-4218-45ea-b9a7-eaa71c0202f9"
+ | },
+ | "to": {
+ | "counterparty_id": "26392b7d-4218-45ea-b9a7-eaa71c0202f9"
+ | },
+ | "value": {
+ | "currency": "GBP",
+ | "amount": "10"
+ | },
+ | "description": "this is for work",
+ | "posted": "2017-09-19T02:31:05Z",
+ | "completed": "2017-09-19T02:31:05Z",
+ | "type": "SANDBOX_TAN",
+ | "charge_policy": "SHARED"
+ |}
+ |
+ |or, you can counterparty to account
+ |{
+ | "from": {
+ | "counterparty_id": "f6392b7d-4218-45ea-b9a7-eaa71c0202f9"
+ | },
+ | "to": {
+ | "bank_id": "gh.29.uk",
+ | "account_id": "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
+ | },
+ | "value": {
+ | "currency": "GBP",
+ | "amount": "10"
+ | },
+ | "description": "this is for work",
+ | "posted": "2017-09-19T02:31:05Z",
+ | "completed": "2017-09-19T02:31:05Z",
+ | "type": "SANDBOX_TAN",
+ | "charge_policy": "SHARED"
+ |}
+ |
+ |This call is experimental.
+ """.stripMargin,
+ postHistoricalTransactionJson,
+ postHistoricalTransactionResponseJson,
List(InvalidJsonFormat, BankNotFound, AccountNotFound,
- CounterpartyNotFoundByCounterpartyId, InvalidNumber, NotPositiveAmount,
- InvalidTransactionRequestCurrency, UnknownError),
- List(apiTagTransactionRequest), Some(List(canCreateHistoricalTransaction)),
- http4sPartialFunction = Some(saveHistoricalTransaction))
+ CounterpartyNotFoundByCounterpartyId, InvalidNumber, NotPositiveAmount,
+ InvalidTransactionRequestCurrency, UnknownError),
+ List(apiTagTransactionRequest),
+ Some(List(canCreateHistoricalTransaction)),
+ http4sPartialFunction = Some(saveHistoricalTransaction)
+ )
// ─── allRoutes ────────────────────────────────────────────────────────────
diff --git a/obp-api/src/main/scala/code/api/v4_0_0/Http4s400.scala b/obp-api/src/main/scala/code/api/v4_0_0/Http4s400.scala
index 801eaaf40f..f8ab352905 100644
--- a/obp-api/src/main/scala/code/api/v4_0_0/Http4s400.scala
+++ b/obp-api/src/main/scala/code/api/v4_0_0/Http4s400.scala
@@ -3,13 +3,19 @@ package code.api.v4_0_0
import cats.data.{Kleisli, OptionT}
import cats.effect._
import code.api.Constant._
+import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
+import code.api.v3_1_0.ConsentChallengeJsonV310
+import code.consent.ConsentStatus
+import com.openbankproject.commons.model.enums.{AttributeCategory, AttributeType, UserInvitationPurpose}
import code.api.util.APIUtil.{EmptyBody, ResourceDoc, _}
import code.api.util.ApiRole._
import code.api.util.ApiTag._
import code.api.util.ErrorMessages._
import code.api.util.ExampleValue._
import code.api.util.Glossary
+import code.api.util.Glossary._
+import code.api.dynamic.endpoint.helper.practise.PractiseEndpoint
import code.api.Constant
import code.api.dynamic.endpoint.helper.DynamicEndpointHelper
import code.api.dynamic.entity.helper.DynamicEntityInfo
@@ -101,6 +107,46 @@ object Http4s400 {
val implementedInApiVersion: com.openbankproject.commons.util.ScannedApiVersion = Http4s400.implementedInApiVersion
val prefixPath: Path = Root / ApiPathZero.toString / implementedInApiVersion.toString
+ private val productAttributeGeneralInfo =
+ s"""Product Attributes are used to describe a financial Product with a list of typed key value pairs.
+ |
+ |Each Product Attribute is linked to its Product by PRODUCT_CODE
+ |""".stripMargin
+
+ private val customerAttributeGeneralInfo =
+ s"""CustomerAttributes are used to enhance the OBP Customer object with Bank specific entities.
+ |""".stripMargin
+
+ private val generalWebHookInfo =
+ s"""Webhooks are used to call external web services when certain events happen.
+ |
+ |For instance, a webhook can be used to notify an external service if a transaction is created on an account.
+ |""".stripMargin
+
+ private val accountNotificationWebhookInfo =
+ s"""When an account notification webhook fires it will POST to the URL you specify during the creation of the webhook.
+ |
+ |Inside the payload you will find account_id and transaction_id and also user_ids and customer_ids of the Users / Customers linked to the Account.
+ |
+ |The webhook will POST the following structure to your service:
+ |
+ |{
+ | "event_name": "OnCreateTransaction",
+ | "event_id": "9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
+ | "bank_id": "gh.29.uk",
+ | "account_id": "8ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
+ | "transaction_id": "7ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
+ | "related_entities": [
+ | {
+ | "user_id": "8ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
+ | "customer_ids": ["3ca9a7e4-6d02-40e3-a129-0b2bf89de9b1"]
+ | }
+ | ]
+ |}
+ |
+ |Thus, your service should accept the above POST body structure.
+ |""".stripMargin
+
// ─── getMapperDatabaseInfo ────────────────────────────────────────────────
lazy val getMapperDatabaseInfo: HttpRoutes[IO] = HttpRoutes.of[IO] {
@@ -113,16 +159,24 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMapperDatabaseInfo), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMapperDatabaseInfo),
+ "GET",
"/database/info",
"Get Mapper Database Info",
s"""Get basic information about the Mapper Database.
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, adapterInfoJsonV300,
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ adapterInfoJsonV300,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagApi), Some(List(canGetDatabaseInfo)),
- http4sPartialFunction = Some(getMapperDatabaseInfo))
+ List(apiTagApi),
+ Some(List(canGetDatabaseInfo)),
+ http4sPartialFunction = Some(getMapperDatabaseInfo)
+ )
// ─── getLogoutLink ────────────────────────────────────────────────────────
@@ -137,16 +191,23 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getLogoutLink), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getLogoutLink),
+ "GET",
"/users/current/logout-link",
"Get Logout Link",
s"""Get the Logout Link
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, logoutLinkV400,
+ |${userAuthenticationMessage(true)}
+ """.stripMargin,
+ EmptyBody,
+ logoutLinkV400,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagUser), None,
- http4sPartialFunction = Some(getLogoutLink))
+ List(apiTagUser),
+ None,
+ http4sPartialFunction = Some(getLogoutLink)
+ )
// ─── getBanks ─────────────────────────────────────────────────────────────
// v4.0.0 overrides v3.x getBanks — v4 uses createBanksJson which adds attributes.
@@ -161,15 +222,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBanks), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBanks),
+ "GET",
"/banks",
"Get Banks",
"""Get banks on this API instance
- |Returns a list of banks supported on this server.""".stripMargin,
- EmptyBody, banksJSON400,
+ |Returns a list of banks supported on this server:
+ |
+ |* ID used as parameter in URLs
+ |* Short and full name of bank
+ |* Logo URL
+ |* Website""",
+ EmptyBody,
+ banksJSON400,
List(UnknownError),
- apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(getBanks))
+ apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(getBanks)
+ )
// ─── getBank ──────────────────────────────────────────────────────────────
// v4.0.0 overrides v3.x getBank — v4 includes bank attributes.
@@ -184,14 +256,25 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBank),
+ "GET",
"/banks/BANK_ID",
"Get Bank",
- """Get the bank specified by BANK_ID.""".stripMargin,
- EmptyBody, bankJson400,
+ """Get the bank specified by BANK_ID
+ |Returns information about a single bank specified by BANK_ID including:
+ |
+ |* Short and full name of bank
+ |* Logo URL
+ |* Website""",
+ EmptyBody,
+ bankJson400,
List(UnknownError, BankNotFound),
- apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(getBank))
+ apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(getBank)
+ )
// ─── ibanChecker (POST → 200) ─────────────────────────────────────────────
@@ -205,14 +288,22 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(ibanChecker), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(ibanChecker),
+ "POST",
"/account/check/scheme/iban",
"Validate and check IBAN",
- """Validate and check IBAN for errors""",
- ibanCheckerPostJsonV400, ibanCheckerJsonV400,
+ """Validate and check IBAN for errors
+ |
+ |""",
+ ibanCheckerPostJsonV400,
+ ibanCheckerJsonV400,
List(UnknownError),
- apiTagAccount :: Nil, None,
- http4sPartialFunction = Some(ibanChecker))
+ apiTagAccount :: Nil,
+ None,
+ http4sPartialFunction = Some(ibanChecker)
+ )
// ─── callsLimit (PUT → 200) ───────────────────────────────────────────────
// v4.0.0 overrides v3.1.0 — v4 takes additional api_version / api_name / bank_id fields
@@ -241,18 +332,35 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(callsLimit), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(callsLimit),
+ "PUT",
"/management/consumers/CONSUMER_ID/consumer/call-limits",
"Set Rate Limits / Call Limits per Consumer",
- s"""Set the API rate limits / call limits for a Consumer.
- |
- |${userAuthenticationMessage(true)}""",
- callLimitPostJsonV400, callLimitPostJsonV400,
+ s"""
+ |Set the API rate limits / call limits for a Consumer:
+ |
+ |Rate limiting can be set:
+ |
+ |Per Second
+ |Per Minute
+ |Per Hour
+ |Per Week
+ |Per Month
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ callLimitPostJsonV400,
+ callLimitPostJsonV400,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, InvalidConsumerId,
- ConsumerNotFoundByConsumerId, UserHasMissingRoles, UpdateConsumerError, UnknownError),
+ ConsumerNotFoundByConsumerId, UserHasMissingRoles, UpdateConsumerError, UnknownError),
List(apiTagConsumer, apiTagRateLimits),
Some(List(canUpdateRateLimits)),
- http4sPartialFunction = Some(callsLimit))
+ http4sPartialFunction = Some(callsLimit)
+ )
// ─── createBank (POST → 201) ──────────────────────────────────────────────
// v4 overrides v2.2.0's createBank — v4 grants CanCreateEntitlementAtOneBank +
@@ -340,16 +448,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(root), "GET", "/root",
+ null,
+ implementedInApiVersion,
+ nameOf(root),
+ "GET",
+ "/root",
"Get API Info (root)",
"""Returns information about:
- |
- |* API version
- |* Hosted by information
- |* Git Commit""",
- EmptyBody, apiInfoJson400,
- List(UnknownError, MandatoryPropertyIsNotSet), apiTagApi :: Nil, None,
- http4sPartialFunction = Some(root))
+ |
+ |* API version
+ |* Hosted by information
+ |* Hosted at information
+ |* Energy source information
+ |* Git Commit""",
+ EmptyBody,
+ apiInfoJson400,
+ List(UnknownError, MandatoryPropertyIsNotSet),
+ apiTagApi :: Nil,
+ None,
+ http4sPartialFunction = Some(root)
+ )
// ─── getAtms (GET) — v4 override; conditional auth via getAtmsIsPublic ───
@@ -378,16 +496,32 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAtms), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAtms),
+ "GET",
"/banks/BANK_ID/atms",
"Get Bank ATMS",
- s"""Returns information about ATMs for a single bank specified by BANK_ID.
- |
- |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
- EmptyBody, atmsJsonV400,
+ s"""Returns information about ATMs for a single bank specified by BANK_ID including:
+ |
+ |* Address
+ |* Geo Location
+ |* License the data under this endpoint is released under
+ |
+ |Pagination:
+ |
+ |By default, 100 records are returned.
+ |
+ |You can use the url query parameters *limit* and *offset* for pagination
+ |
+ |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
+ EmptyBody,
+ atmsJsonV400,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(getAtms))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(getAtms)
+ )
// ─── getAtm (GET) — v4 override; conditional auth ────────────────────────
@@ -401,16 +535,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAtm), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAtm),
+ "GET",
"/banks/BANK_ID/atms/ATM_ID",
"Get Bank ATM",
- s"""Returns information about ATM for a single bank specified by BANK_ID and ATM_ID.
- |
- |${userAuthenticationMessage(!getAtmsIsPublic)}""".stripMargin,
- EmptyBody, atmJsonV400,
+ s"""Returns information about ATM for a single bank specified by BANK_ID and ATM_ID including:
+ |
+ |* Address
+ |* Geo Location
+ |* License the data under this endpoint is released under
+ |${userAuthenticationMessage(!getAtmsIsPublic)}
+ |""".stripMargin,
+ EmptyBody,
+ atmJsonV400,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(getAtm))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(getAtm)
+ )
// ─── getProducts (GET) — v4 override; conditional auth ───────────────────
@@ -428,16 +572,36 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProducts), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProducts),
+ "GET",
"/banks/BANK_ID/products",
"Get Products",
- s"""Returns information about the financial products offered by a bank specified by BANK_ID.
- |
- |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
- EmptyBody, productsJsonV400,
+ s"""Returns information about the financial products offered by a bank specified by BANK_ID including:
+ |
+ |* Name
+ |* Code
+ |* Parent Product Code
+ |* More info URL
+ |* Terms And Conditions URL
+ |* Description
+ |* Terms and Conditions
+ |* License the data under this endpoint is released under
+ |
+ |The combination of bank_id and product_code is unique.
+ |
+ |Can filter with attributes name and values.
+ |URL params example: /banks/some-bank-id/products?&limit=50&offset=1
+ |
+ |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
+ EmptyBody,
+ productsJsonV400,
List(AuthenticatedUserIsRequired, BankNotFound, ProductNotFoundByProductCode, UnknownError),
- List(apiTagProduct), None,
- http4sPartialFunction = Some(getProducts))
+ List(apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProducts)
+ )
// ─── getProduct (GET) — v4 override; loads attributes + fees ─────────────
@@ -455,16 +619,35 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProduct), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProduct),
+ "GET",
"/banks/BANK_ID/products/PRODUCT_CODE",
"Get Bank Product",
- s"""Returns information about a financial Product offered by the bank specified by BANK_ID and PRODUCT_CODE.
- |
- |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
- EmptyBody, productJsonV400,
+ s"""Returns information about a financial Product offered by the bank specified by BANK_ID and PRODUCT_CODE including:
+ |
+ |* Name
+ |* Code
+ |* Parent Product Code
+ |* More info URL
+ |* Description
+ |* Terms and Conditions
+ |* Description
+ |* Meta
+ |* Attributes
+ |* Fees
+ |
+ |The combination of bank_id and product_code is unique.
+ |
+ |${userAuthenticationMessage(!getProductsIsPublic)}""".stripMargin,
+ EmptyBody,
+ productJsonV400,
List(AuthenticatedUserIsRequired, BankNotFound, ProductNotFoundByProductCode, UnknownError),
- List(apiTagProduct), None,
- http4sPartialFunction = Some(getProduct))
+ List(apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProduct)
+ )
// ─── createAtm (POST → 201) — v4 override ─────────────────────────────────
@@ -548,17 +731,37 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createProduct), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createProduct),
+ "PUT",
"/banks/BANK_ID/products/PRODUCT_CODE",
"Create Product",
s"""Create or Update Product for the Bank.
- |
- |${userAuthenticationMessage(true)}""",
- putProductJsonV400, productJsonV400.copy(attributes = None, fees = None),
+ |
+ |
+ |Typical Super Family values / Asset classes are:
+ |
+ |Debt
+ |Equity
+ |FX
+ |Commodity
+ |Derivative
+ |
+ |$productHiearchyAndCollectionNote
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |
+ |""",
+ putProductJsonV400,
+ productJsonV400.copy(attributes = None, fees = None),
List(AuthenticatedUserIsRequired, BankNotFound, UserHasMissingRoles, UnknownError),
List(apiTagProduct),
Some(List(canCreateProduct, canCreateProductAtAnyBank)),
- http4sPartialFunction = Some(createProduct))
+ http4sPartialFunction = Some(createProduct)
+ )
// ─── createProductAttribute (POST → 201) — v4 override ────────────────────
@@ -581,17 +784,44 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createProductAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createProductAttribute),
+ "POST",
"/banks/BANK_ID/products/PRODUCT_CODE/attribute",
"Create Product Attribute",
- s"""Create a Product Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- productAttributeJsonV400, productAttributeResponseJsonV400,
+ s""" Create Product Attribute
+ |
+ |$productAttributeGeneralInfo
+ |
+ |Typical product attributes might be:
+ |
+ |ISIN (for International bonds)
+ |VKN (for German bonds)
+ |REDCODE (markit short code for credit derivative)
+ |LOAN_ID (e.g. used for Anacredit reporting)
+ |
+ |ISSUE_DATE (When the bond was issued in the market)
+ |MATURITY_DATE (End of life time of a product)
+ |TRADABLE
+ |
+ |See [FPML](http://www.fpml.org/) for more examples.
+ |
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productAttributeJsonV400,
+ productAttributeResponseJsonV400,
List(InvalidJsonFormat, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canCreateProductAttribute)),
- http4sPartialFunction = Some(createProductAttribute))
+ http4sPartialFunction = Some(createProductAttribute)
+ )
// ─── updateProductAttribute (PUT → 200) — v4 override ─────────────────────
@@ -614,17 +844,29 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateProductAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateProductAttribute),
+ "PUT",
"/banks/BANK_ID/products/PRODUCT_CODE/attributes/PRODUCT_ATTRIBUTE_ID",
"Update Product Attribute",
- s"""Update one Product Attribute by its id.
- |
- |${userAuthenticationMessage(true)}""",
- productAttributeJsonV400, productAttributeResponseJsonV400,
+ s""" Update Product Attribute.
+ |
+
+ |$productAttributeGeneralInfo
+ |
+ |Update one Product Attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productAttributeJsonV400,
+ productAttributeResponseJsonV400,
List(UserHasMissingRoles, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canUpdateProductAttribute)),
- http4sPartialFunction = Some(updateProductAttribute))
+ http4sPartialFunction = Some(updateProductAttribute)
+ )
// ─── getEntitlements (GET /users/USER_ID/entitlements) — v4 override ────
@@ -845,20 +1087,29 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createCustomer), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createCustomer),
+ "POST",
"/banks/BANK_ID/customers",
"Create Customer",
- s"""The Customer resource stores the customer number (set by backend), legal name, email, phone number, date of birth, etc.
- |
- |${userAuthenticationMessage(true)}""",
- code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.postCustomerJsonV310,
- code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.customerJsonV310,
+ s"""
+ |The Customer resource stores the customer number (which is set by the backend), legal name, email, phone number, their date of birth, relationship status, education attained, a url for a profile image, KYC status etc.
+ |Dates need to be in the format 2013-01-21T23:08:00Z
+ |
+ |Note: If you need to set a specific customer number, use the Update Customer Number endpoint after this call.
+ |
+ |${userAuthenticationMessage(true)}
+ |""",
+ postCustomerJsonV310,
+ customerJsonV310,
List(AuthenticatedUserIsRequired, BankNotFound, InvalidJsonFormat,
- CustomerNumberAlreadyExists, UserNotFoundById, CustomerAlreadyExistsForUser,
- CreateCustomerError, UnknownError),
+ CustomerNumberAlreadyExists, UserNotFoundById, CustomerAlreadyExistsForUser,
+ CreateCustomerError, UnknownError),
List(apiTagCustomer, apiTagPerson),
Some(List(canCreateCustomer, canCreateCustomerAtAnyBank)),
- http4sPartialFunction = Some(createCustomer))
+ http4sPartialFunction = Some(createCustomer)
+ )
// ─── getBankAccountsBalancesForCurrentUser (GET /banks/BANK_ID/balances) — v4
@@ -873,14 +1124,20 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankAccountsBalancesForCurrentUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankAccountsBalancesForCurrentUser),
+ "GET",
"/banks/BANK_ID/balances",
"Get Accounts Balances",
- "Get the Balances for the Accounts of the current User at one bank.",
- EmptyBody, accountBalancesV400Json,
+ """Get the Balances for the Accounts of the current User at one bank.""",
+ EmptyBody,
+ accountBalancesV400Json,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(getBankAccountsBalancesForCurrentUser))
+ apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(getBankAccountsBalancesForCurrentUser)
+ )
// ─── getCoreAccountById (GET /my/banks/BANK_ID/accounts/ACCOUNT_ID/account)
@@ -903,16 +1160,34 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCoreAccountById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCoreAccountById),
+ "GET",
"/my/banks/BANK_ID/accounts/ACCOUNT_ID/account",
"Get Account by Id (Core)",
- s"""Information returned about the account specified by ACCOUNT_ID.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, moderatedCoreAccountJsonV400,
+ s"""Information returned about the account specified by ACCOUNT_ID:
+ |
+ |* Number - The human readable account number given by the bank that identifies the account.
+ |* Label - A label given by the owner of the account
+ |* Owners - Users that own this account
+ |* Type - The type of account
+ |* Balance - Currency and Value
+ |* Account Routings - A list that might include IBAN or national account identifiers
+ |* Account Rules - A list that might include Overdraft and other bank specific rules
+ |* Tags - A list of Tags assigned to this account
+ |
+ |This call returns the owner view and requires access to that view.
+ |
+ |
+ |""".stripMargin,
+ EmptyBody,
+ moderatedCoreAccountJsonV400,
List(AuthenticatedUserIsRequired, BankAccountNotFound, UnknownError),
- apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: Nil, None,
- http4sPartialFunction = Some(getCoreAccountById))
+ apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: Nil,
+ None,
+ http4sPartialFunction = Some(getCoreAccountById)
+ )
// ─── getPrivateAccountByIdFull (GET /banks/BANK_ID/.../VIEW_ID/account) ──
@@ -935,15 +1210,36 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPrivateAccountByIdFull), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPrivateAccountByIdFull),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/account",
"Get Account by Id (Full)",
- """Information returned about an account specified by ACCOUNT_ID moderated by the view (VIEW_ID).""",
- EmptyBody, moderatedAccountJSON400,
+ """Information returned about an account specified by ACCOUNT_ID as moderated by the view (VIEW_ID):
+ |
+ |* Number
+ |* Owners
+ |* Type
+ |* Balance
+ |* IBAN
+ |* Available views (sorted by short_name)
+ |
+ |More details about the data moderation by the view [here](#1_2_1-getViewsForBankAccount).
+ |
+ |PSD2 Context: PSD2 requires customers to have access to their account information via third party applications.
+ |This call provides balance and other account information via delegated authentication using OAuth.
+ |
+ |Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
+ |""".stripMargin,
+ EmptyBody,
+ moderatedAccountJSON400,
List(AuthenticatedUserIsRequired, BankNotFound, BankAccountNotFound,
- UserNoPermissionAccessView, UnknownError),
- apiTagAccount :: Nil, None,
- http4sPartialFunction = Some(getPrivateAccountByIdFull))
+ UserNoPermissionAccessView, UnknownError),
+ apiTagAccount :: Nil,
+ None,
+ http4sPartialFunction = Some(getPrivateAccountByIdFull)
+ )
// ─── getPrivateAccountsAtOneBank (GET /banks/BANK_ID/accounts) — v4 override
@@ -970,20 +1266,35 @@ object Http4s400 {
}
(availablePrivateAccounts, _) <- code.model.BankExtended(bank).privateAccountsFuture(
privateAccountAccess2, Some(cc))
- } yield code.api.v2_0_0.OBPAPI2_0_0.Implementations2_0_0.processAccounts(
+ } yield code.api.v2_0_0.Http4s200.Implementations2_0_0.processAccounts(
privateViewsUserCanAccessAtOneBank, availablePrivateAccounts)
}
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getPrivateAccountsAtOneBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getPrivateAccountsAtOneBank),
+ "GET",
"/banks/BANK_ID/accounts",
"Get Accounts at Bank",
- s"""Returns the list of accounts at BANK_ID that the user has access to.""",
- EmptyBody, basicAccountsJSON,
+ s"""
+ |Returns the list of accounts at BANK_ID that the user has access to.
+ |For each account the API returns the account ID and the views available to the user..
+ |Each account must have at least one private View.
+ |
+ |optional request parameters for filter with attributes
+ |URL params example: /banks/some-bank-id/accounts?&limit=50&offset=1
+ |
+ |
+ """.stripMargin,
+ EmptyBody,
+ basicAccountsJSON,
List(AuthenticatedUserIsRequired, BankNotFound, UnknownError),
- List(apiTagAccount, apiTagPrivateData, apiTagPublicData), None,
- http4sPartialFunction = Some(getPrivateAccountsAtOneBank))
+ List(apiTagAccount, apiTagPrivateData, apiTagPublicData),
+ None,
+ http4sPartialFunction = Some(getPrivateAccountsAtOneBank)
+ )
// ─── createUserCustomerLinks (POST → 201) — v4 override ─────────────────
@@ -1051,18 +1362,27 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getSystemDynamicEntities), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getSystemDynamicEntities),
+ "GET",
"/management/system-dynamic-entities",
"Get System Dynamic Entities",
s"""Get all System Dynamic Entities.
- |
- |For more information see ${Glossary.getGlossaryItemLink("Dynamic-Entities")}""",
+ |
+ |For more information see ${Glossary.getGlossaryItemLink(
+ "Dynamic-Entities"
+ )} """,
EmptyBody,
- ListResult("dynamic_entities", List(dynamicEntityResponseBodyExample)),
+ ListResult(
+ "dynamic_entities",
+ List(dynamicEntityResponseBodyExample)
+ ),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagManageDynamicEntity, apiTagApi),
Some(List(canGetSystemLevelDynamicEntities)),
- http4sPartialFunction = Some(getSystemDynamicEntities))
+ http4sPartialFunction = Some(getSystemDynamicEntities)
+ )
// ─── getBankLevelDynamicEntities ──────────────────────────────────────────
@@ -1081,18 +1401,27 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankLevelDynamicEntities), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankLevelDynamicEntities),
+ "GET",
"/management/banks/BANK_ID/dynamic-entities",
"Get Bank Level Dynamic Entities",
s"""Get all the bank level Dynamic Entities for one bank.
- |
- |For more information see ${Glossary.getGlossaryItemLink("Dynamic-Entities")}""",
+ |
+ |For more information see ${Glossary.getGlossaryItemLink(
+ "Dynamic-Entities"
+ )}""",
EmptyBody,
- ListResult("dynamic_entities", List(dynamicEntityResponseBodyExample)),
+ ListResult(
+ "dynamic_entities",
+ List(dynamicEntityResponseBodyExample)
+ ),
List(BankNotFound, AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagManageDynamicEntity, apiTagApi),
Some(List(canGetBankLevelDynamicEntities, canGetAnyBankLevelDynamicEntities)),
- http4sPartialFunction = Some(getBankLevelDynamicEntities))
+ http4sPartialFunction = Some(getBankLevelDynamicEntities)
+ )
// ─── getMyDynamicEntities ─────────────────────────────────────────────────
@@ -1109,17 +1438,27 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyDynamicEntities), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyDynamicEntities),
+ "GET",
"/my/dynamic-entities",
"Get My Dynamic Entities",
- s"""Get all the Dynamic Entities created by the current user.
- |
- |For more information see ${Glossary.getGlossaryItemLink("Dynamic-Entities")}""",
+ s"""Get all my Dynamic Entities (definitions I created).
+ |
+ |For more information see ${Glossary.getGlossaryItemLink(
+ "My-Dynamic-Entities"
+ )}""",
EmptyBody,
- ListResult("dynamic_entities", List(dynamicEntityResponseBodyExample)),
+ ListResult(
+ "dynamic_entities",
+ List(dynamicEntityResponseBodyExample)
+ ),
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagManageDynamicEntity, apiTagApi), None,
- http4sPartialFunction = Some(getMyDynamicEntities))
+ List(apiTagManageDynamicEntity, apiTagApi),
+ None,
+ http4sPartialFunction = Some(getMyDynamicEntities)
+ )
// ─── dynamic-entity shared helpers (ported from APIMethods400) ──────────
@@ -1339,17 +1678,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteSystemDynamicEntity), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteSystemDynamicEntity),
+ "DELETE",
"/management/system-dynamic-entities/DYNAMIC_ENTITY_ID",
"Delete System Level Dynamic Entity",
- s"""Delete a system-level DynamicEntity specified by DYNAMIC_ENTITY_ID.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, EmptyBody,
+ s"""Delete a DynamicEntity specified by DYNAMIC_ENTITY_ID.
+ |
+ |For more information see ${Glossary.getGlossaryItemLink(
+ "Dynamic-Entities"
+ )}/
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagManageDynamicEntity, apiTagApi),
Some(List(canDeleteSystemLevelDynamicEntity)),
- http4sPartialFunction = Some(deleteSystemDynamicEntity))
+ http4sPartialFunction = Some(deleteSystemDynamicEntity)
+ )
// ─── deleteBankLevelDynamicEntity (200) ──────────────────────────────────
@@ -1361,17 +1709,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankLevelDynamicEntity), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankLevelDynamicEntity),
+ "DELETE",
"/management/banks/BANK_ID/dynamic-entities/DYNAMIC_ENTITY_ID",
"Delete Bank Level Dynamic Entity",
- s"""Delete a bank-level DynamicEntity specified by DYNAMIC_ENTITY_ID.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, EmptyBody,
+ s"""Delete a Bank Level DynamicEntity specified by DYNAMIC_ENTITY_ID.
+ |
+ |For more information see ${Glossary.getGlossaryItemLink(
+ "Dynamic-Entities"
+ )}/
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(BankNotFound, AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagManageDynamicEntity, apiTagApi),
Some(List(canDeleteBankLevelDynamicEntity)),
- http4sPartialFunction = Some(deleteBankLevelDynamicEntity))
+ http4sPartialFunction = Some(deleteBankLevelDynamicEntity)
+ )
// ─── updateMyDynamicEntity ────────────────────────────────────────────────
@@ -1443,16 +1800,25 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteMyDynamicEntity), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteMyDynamicEntity),
+ "DELETE",
"/my/dynamic-entities/DYNAMIC_ENTITY_ID",
"Delete My Dynamic Entity",
s"""Delete my DynamicEntity specified by DYNAMIC_ENTITY_ID.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, EmptyBody,
+ |
+ |For more information see ${Glossary.getGlossaryItemLink(
+ "My-Dynamic-Entities"
+ )}
+ |""",
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, InvalidMyDynamicEntityUser, UnknownError),
- List(apiTagManageDynamicEntity, apiTagApi), None,
- http4sPartialFunction = Some(deleteMyDynamicEntity))
+ List(apiTagManageDynamicEntity, apiTagApi),
+ None,
+ http4sPartialFunction = Some(deleteMyDynamicEntity)
+ )
// ─── dynamic-endpoint shared helpers (ported from APIMethods400) ────────
@@ -1543,18 +1909,31 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createDynamicEndpoint), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createDynamicEndpoint),
+ "POST",
"/management/dynamic-endpoints",
"Create Dynamic Endpoint",
- s"""Create dynamic endpoints with one json format swagger content.
- |
- |${userAuthenticationMessage(true)}""",
- dynamicEndpointRequestBodyExample, dynamicEndpointResponseBodyExample,
+ s"""Create dynamic endpoints.
+ |
+ |Create dynamic endpoints with one json format swagger content.
+ |
+ |If the host of swagger is `dynamic_entity`, then you need link the swagger fields to the dynamic entity fields,
+ |please check `Endpoint Mapping` endpoints.
+ |
+ |If the host of swagger is `obp_mock`, every dynamic endpoint will return example response of swagger,\n
+ |when create MethodRouting for given dynamic endpoint, it will be routed to given url.
+ |
+ |""",
+ dynamicEndpointRequestBodyExample,
+ dynamicEndpointResponseBodyExample,
List(AuthenticatedUserIsRequired, UserHasMissingRoles, DynamicEndpointExists,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canCreateDynamicEndpoint)),
- http4sPartialFunction = Some(createDynamicEndpoint))
+ http4sPartialFunction = Some(createDynamicEndpoint)
+ )
// ─── createBankLevelDynamicEndpoint (POST → 201) ─────────────────────────
@@ -1574,18 +1953,31 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankLevelDynamicEndpoint), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankLevelDynamicEndpoint),
+ "POST",
"/management/banks/BANK_ID/dynamic-endpoints",
"Create Bank Level Dynamic Endpoint",
- s"""Create dynamic endpoints with one json format swagger content.
- |
- |${userAuthenticationMessage(true)}""",
- dynamicEndpointRequestBodyExample, dynamicEndpointResponseBodyExample,
+ s"""Create dynamic endpoints.
+ |
+ |Create dynamic endpoints with one json format swagger content.
+ |
+ |If the host of swagger is `dynamic_entity`, then you need link the swagger fields to the dynamic entity fields,
+ |please check `Endpoint Mapping` endpoints.
+ |
+ |If the host of swagger is `obp_mock`, every dynamic endpoint will return example response of swagger,\n
+ |when create MethodRouting for given dynamic endpoint, it will be routed to given url.
+ |
+ |""",
+ dynamicEndpointRequestBodyExample,
+ dynamicEndpointResponseBodyExample,
List(BankNotFound, AuthenticatedUserIsRequired, UserHasMissingRoles, DynamicEndpointExists,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canCreateBankLevelDynamicEndpoint, canCreateDynamicEndpoint)),
- http4sPartialFunction = Some(createBankLevelDynamicEndpoint))
+ http4sPartialFunction = Some(createBankLevelDynamicEndpoint)
+ )
// ─── updateDynamicEndpointHost (PUT → 201) ───────────────────────────────
@@ -1602,17 +1994,23 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateDynamicEndpointHost), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateDynamicEndpointHost),
+ "PUT",
"/management/dynamic-endpoints/DYNAMIC_ENDPOINT_ID/host",
" Update Dynamic Endpoint Host",
s"""Update dynamic endpoint Host.
- |The value can be obp_mock, dynamic_entity, or some service url.""",
- dynamicEndpointHostJson400, dynamicEndpointHostJson400,
+ |The value can be obp_mock, dynamic_entity, or some service url.
+ |""",
+ dynamicEndpointHostJson400,
+ dynamicEndpointHostJson400,
List(AuthenticatedUserIsRequired, UserHasMissingRoles,
- DynamicEntityNotFoundByDynamicEntityId, InvalidJsonFormat, UnknownError),
+ DynamicEntityNotFoundByDynamicEntityId, InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canUpdateDynamicEndpoint)),
- http4sPartialFunction = Some(updateDynamicEndpointHost))
+ http4sPartialFunction = Some(updateDynamicEndpointHost)
+ )
// ─── updateBankLevelDynamicEndpointHost (PUT → 201) ──────────────────────
@@ -1630,16 +2028,23 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBankLevelDynamicEndpointHost), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBankLevelDynamicEndpointHost),
+ "PUT",
"/management/banks/BANK_ID/dynamic-endpoints/DYNAMIC_ENDPOINT_ID/host",
" Update Bank Level Dynamic Endpoint Host",
- s"""Update Bank Level dynamic endpoint Host.""",
- dynamicEndpointHostJson400, dynamicEndpointHostJson400,
+ s"""Update Bank Level dynamic endpoint Host.
+ |The value can be obp_mock, dynamic_entity, or some service url.
+ |""",
+ dynamicEndpointHostJson400,
+ dynamicEndpointHostJson400,
List(BankNotFound, AuthenticatedUserIsRequired, UserHasMissingRoles,
- DynamicEntityNotFoundByDynamicEntityId, InvalidJsonFormat, UnknownError),
+ DynamicEntityNotFoundByDynamicEntityId, InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canUpdateBankLevelDynamicEndpoint, canUpdateDynamicEndpoint)),
- http4sPartialFunction = Some(updateBankLevelDynamicEndpointHost))
+ http4sPartialFunction = Some(updateBankLevelDynamicEndpointHost)
+ )
// ─── getDynamicEndpoint (GET → 200) ──────────────────────────────────────
@@ -1651,16 +2056,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getDynamicEndpoint), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getDynamicEndpoint),
+ "GET",
"/management/dynamic-endpoints/DYNAMIC_ENDPOINT_ID",
"Get Dynamic Endpoint",
- s"""Get a Dynamic Endpoint by DYNAMIC_ENDPOINT_ID.""",
- EmptyBody, dynamicEndpointResponseBodyExample,
+ s"""Get a Dynamic Endpoint.
+ |
+ |
+ |Get one DynamicEndpoint,
+ |
+ |""",
+ EmptyBody,
+ dynamicEndpointResponseBodyExample,
List(AuthenticatedUserIsRequired, UserHasMissingRoles,
- DynamicEndpointNotFoundByDynamicEndpointId, InvalidJsonFormat, UnknownError),
+ DynamicEndpointNotFoundByDynamicEndpointId, InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canGetDynamicEndpoint)),
- http4sPartialFunction = Some(getDynamicEndpoint))
+ http4sPartialFunction = Some(getDynamicEndpoint)
+ )
// ─── getDynamicEndpoints (GET → 200) ─────────────────────────────────────
@@ -1672,15 +2087,27 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getDynamicEndpoints), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getDynamicEndpoints),
+ "GET",
"/management/dynamic-endpoints",
" Get Dynamic Endpoints",
- s"""Get Dynamic Endpoints.""",
- EmptyBody, ListResult("dynamic_endpoints", List(dynamicEndpointResponseBodyExample)),
+ s"""
+ |
+ |Get Dynamic Endpoints.
+ |
+ |""",
+ EmptyBody,
+ ListResult(
+ "dynamic_endpoints",
+ List(dynamicEndpointResponseBodyExample)
+ ),
List(AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canGetDynamicEndpoints)),
- http4sPartialFunction = Some(getDynamicEndpoints))
+ http4sPartialFunction = Some(getDynamicEndpoints)
+ )
// ─── getBankLevelDynamicEndpoint (GET → 200) ─────────────────────────────
@@ -1692,16 +2119,22 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankLevelDynamicEndpoint), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankLevelDynamicEndpoint),
+ "GET",
"/management/banks/BANK_ID/dynamic-endpoints/DYNAMIC_ENDPOINT_ID",
" Get Bank Level Dynamic Endpoint",
- s"""Get a Bank Level Dynamic Endpoint.""",
- EmptyBody, dynamicEndpointResponseBodyExample,
+ s"""Get a Bank Level Dynamic Endpoint.
+ |""",
+ EmptyBody,
+ dynamicEndpointResponseBodyExample,
List(BankNotFound, AuthenticatedUserIsRequired, UserHasMissingRoles,
- DynamicEndpointNotFoundByDynamicEndpointId, InvalidJsonFormat, UnknownError),
+ DynamicEndpointNotFoundByDynamicEndpointId, InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canGetBankLevelDynamicEndpoint, canGetDynamicEndpoint)),
- http4sPartialFunction = Some(getBankLevelDynamicEndpoint))
+ http4sPartialFunction = Some(getBankLevelDynamicEndpoint)
+ )
// ─── getBankLevelDynamicEndpoints (GET → 200) ────────────────────────────
@@ -1713,16 +2146,28 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankLevelDynamicEndpoints), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankLevelDynamicEndpoints),
+ "GET",
"/management/banks/BANK_ID/dynamic-endpoints",
"Get Bank Level Dynamic Endpoints",
- s"""Get Bank Level Dynamic Endpoints.""",
- EmptyBody, ListResult("dynamic_endpoints", List(dynamicEndpointResponseBodyExample)),
+ s"""
+ |
+ |Get Bank Level Dynamic Endpoints.
+ |
+ |""",
+ EmptyBody,
+ ListResult(
+ "dynamic_endpoints",
+ List(dynamicEndpointResponseBodyExample)
+ ),
List(BankNotFound, AuthenticatedUserIsRequired, UserHasMissingRoles,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canGetBankLevelDynamicEndpoints, canGetDynamicEndpoints)),
- http4sPartialFunction = Some(getBankLevelDynamicEndpoints))
+ http4sPartialFunction = Some(getBankLevelDynamicEndpoints)
+ )
// ─── deleteDynamicEndpoint (DELETE → 204) ────────────────────────────────
@@ -1734,15 +2179,20 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteDynamicEndpoint), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteDynamicEndpoint),
+ "DELETE",
"/management/dynamic-endpoints/DYNAMIC_ENDPOINT_ID",
" Delete Dynamic Endpoint",
- s"""Delete a DynamicEndpoint specified by DYNAMIC_ENDPOINT_ID.""",
- EmptyBody, EmptyBody,
+ s"""Delete a DynamicEndpoint specified by DYNAMIC_ENDPOINT_ID.""".stripMargin,
+ EmptyBody,
+ EmptyBody,
List(AuthenticatedUserIsRequired, DynamicEndpointNotFoundByDynamicEndpointId, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canDeleteDynamicEndpoint)),
- http4sPartialFunction = Some(deleteDynamicEndpoint))
+ http4sPartialFunction = Some(deleteDynamicEndpoint)
+ )
// ─── deleteBankLevelDynamicEndpoint (DELETE → 204) ───────────────────────
@@ -1754,16 +2204,21 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankLevelDynamicEndpoint), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankLevelDynamicEndpoint),
+ "DELETE",
"/management/banks/BANK_ID/dynamic-endpoints/DYNAMIC_ENDPOINT_ID",
" Delete Bank Level Dynamic Endpoint",
- s"""Delete a Bank Level DynamicEndpoint specified by DYNAMIC_ENDPOINT_ID.""",
- EmptyBody, EmptyBody,
+ s"""Delete a Bank Level DynamicEndpoint specified by DYNAMIC_ENDPOINT_ID.""".stripMargin,
+ EmptyBody,
+ EmptyBody,
List(BankNotFound, AuthenticatedUserIsRequired,
- DynamicEndpointNotFoundByDynamicEndpointId, UnknownError),
+ DynamicEndpointNotFoundByDynamicEndpointId, UnknownError),
List(apiTagManageDynamicEndpoint, apiTagApi),
Some(List(canDeleteBankLevelDynamicEndpoint, canDeleteDynamicEndpoint)),
- http4sPartialFunction = Some(deleteBankLevelDynamicEndpoint))
+ http4sPartialFunction = Some(deleteBankLevelDynamicEndpoint)
+ )
// ─── getMyDynamicEndpoints (GET → 200) ───────────────────────────────────
@@ -1784,14 +2239,23 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyDynamicEndpoints), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyDynamicEndpoints),
+ "GET",
"/my/dynamic-endpoints",
"Get My Dynamic Endpoints",
- s"""Get My Dynamic Endpoints.""",
- EmptyBody, ListResult("dynamic_endpoints", List(dynamicEndpointResponseBodyExample)),
+ s"""Get My Dynamic Endpoints.""".stripMargin,
+ EmptyBody,
+ ListResult(
+ "dynamic_endpoints",
+ List(dynamicEndpointResponseBodyExample)
+ ),
List(AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagManageDynamicEndpoint, apiTagApi), None,
- http4sPartialFunction = Some(getMyDynamicEndpoints))
+ List(apiTagManageDynamicEndpoint, apiTagApi),
+ None,
+ http4sPartialFunction = Some(getMyDynamicEndpoints)
+ )
// ─── deleteMyDynamicEndpoint (DELETE → 204) ──────────────────────────────
@@ -1832,17 +2296,28 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductAttribute), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductAttribute),
+ "GET",
"/banks/BANK_ID/products/PRODUCT_CODE/attributes/PRODUCT_ATTRIBUTE_ID",
"Get Product Attribute",
- s"""Get one Product Attribute by its id.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, productAttributeResponseJsonV400,
+ s""" Get Product Attribute
+ |
+ |$productAttributeGeneralInfo
+ |
+ |Get one product attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ productAttributeResponseJsonV400,
List(UserHasMissingRoles, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canGetProductAttribute)),
- http4sPartialFunction = Some(getProductAttribute))
+ http4sPartialFunction = Some(getProductAttribute)
+ )
// ─── getScopes (GET /consumers/CONSUMER_ID/scopes) — v4 override of Http4s300 ─
@@ -1867,16 +2342,25 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getScopes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getScopes),
+ "GET",
"/consumers/CONSUMER_ID/scopes",
"Get Scopes for Consumer",
s"""Get all the scopes for an consumer specified by CONSUMER_ID
|
- |${userAuthenticationMessage(true)}""",
- EmptyBody, scopeJsons,
+ |${userAuthenticationMessage(true)}
+ |
+ |
+ """.stripMargin,
+ EmptyBody,
+ scopeJsons,
List(AuthenticatedUserIsRequired, EntitlementNotFound, ConsumerNotFoundByConsumerId, UnknownError),
- List(apiTagScope, apiTagConsumer), None,
- http4sPartialFunction = Some(getScopes))
+ List(apiTagScope, apiTagConsumer),
+ None,
+ http4sPartialFunction = Some(getScopes)
+ )
// ─── addScope (POST /consumers/CONSUMER_ID/scopes → 201) — v4 override ────
@@ -1913,18 +2397,29 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(addScope), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(addScope),
+ "POST",
"/consumers/CONSUMER_ID/scopes",
"Create Scope for a Consumer",
"""Create Scope. Grant Role to Consumer.
- |
- |Scopes are used to grant System or Bank level roles to the Consumer (App).""",
- createScopeJson, scopeJson,
+ |
+ |Scopes are used to grant System or Bank level roles to the Consumer (App). (For Account level privileges, see Views)
+ |
+ |For a System level Role (.e.g CanGetAnyUser), set bank_id to an empty string i.e. "bank_id":""
+ |
+ |For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
+ |
+ |""",
+ SwaggerDefinitionsJSON.createScopeJson,
+ scopeJson,
List(AuthenticatedUserIsRequired, ConsumerNotFoundById, InvalidJsonFormat,
- IncorrectRoleName, EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementAlreadyExists, UnknownError),
+ IncorrectRoleName, EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementAlreadyExists, UnknownError),
List(apiTagScope, apiTagConsumer),
Some(List(canCreateScopeAtAnyBank, canCreateScopeAtOneBank)),
- http4sPartialFunction = Some(addScope))
+ http4sPartialFunction = Some(addScope)
+ )
// ─── getConsents (GET /banks/BANK_ID/my/consents) — v4 override of Http4s310 ─
@@ -1951,20 +2446,30 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsents), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsents),
+ "GET",
"/banks/BANK_ID/my/consents",
"Get Consents",
- s"""This endpoint gets the Consents that the current User created.
+ s"""
+ |
+ |This endpoint gets the Consents that the current User created.
|
|${userAuthenticationMessage(true)}
|
|1 limit (for pagination: defaults to 50) eg:limit=200
|
- |2 offset (for pagination: zero index, defaults to 0) eg: offset=10""",
- EmptyBody, consentsJsonV400,
+ |2 offset (for pagination: zero index, defaults to 0) eg: offset=10
+ |
+ """.stripMargin,
+ EmptyBody,
+ consentsJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
- List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(getConsents))
+ List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getConsents)
+ )
// ─── updateAccountLabel (POST /banks/BANK_ID/accounts/ACCOUNT_ID → 200) — v4 override of Http4s121 ─
@@ -1995,17 +2500,26 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAccountLabel), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAccountLabel),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID",
"Update Account Label",
- s"""Update the label for the account. The label is how the account is known to the account owner e.g. 'My savings account'.
- |
- |${userAuthenticationMessage(true)}""",
- updateAccountJsonV400, successMessage,
+ s"""Update the label for the account. The label is how the account is known to the account owner e.g. 'My savings account'
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ updateAccountJsonV400,
+ successMessage,
List(InvalidJsonFormat, $AuthenticatedUserIsRequired, $BankAccountNotFound,
- "user does not have access to owner view on account", UnknownError),
- List(apiTagAccount), None,
- http4sPartialFunction = Some(updateAccountLabel))
+ "user does not have access to owner view on account", UnknownError),
+ List(apiTagAccount),
+ None,
+ http4sPartialFunction = Some(updateAccountLabel)
+ )
// ─── getExplicitCounterpartiesForAccount (GET .../counterparties) — v4 override ─
@@ -2223,16 +2737,43 @@ object Http4s400 {
}
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getFirehoseAccountsAtOneBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getFirehoseAccountsAtOneBank),
+ "GET",
"/banks/FIREHOSE_BANK_ID/firehose/accounts/views/FIREHOSE_VIEW_ID",
"Get Firehose Accounts at Bank",
- s"""Get all Accounts at a Bank that have a Firehose View.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, moderatedFirehoseAccountsJsonV400,
+ s"""
+ |Get all Accounts at a Bank.
+ |
+ |This endpoint allows bulk access to all accounts at the specified bank.
+ |
+ |Requires the CanUseFirehoseAtAnyBank Role or CanUseAccountFirehose Role
+ |
+ |Returns all accounts at the bank. The VIEW_ID parameter determines what account data fields are visible according to the view's permissions.
+ |
+ |The view specified must have is_firehose = true
+ |
+ |For VIEW_ID try 'owner' or 'firehose'
+ |
+ |Optional request parameters for filtering by account attributes:
+ |URL params example:
+ | /banks/some-bank-id/firehose/accounts/views/owner?limit=50&offset=1
+ |
+ |To invalidate browser cache, add timestamp query parameter as follows (the parameter name must be `_timestamp_`):
+ |URL params example:
+ | `/banks/some-bank-id/firehose/accounts/views/owner?limit=50&offset=1&_timestamp_=1596762180358`
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ moderatedFirehoseAccountsJsonV400,
List(AuthenticatedUserIsRequired, AccountFirehoseNotAllowedOnThisInstance, UnknownError),
- List(apiTagAccountFirehose, apiTagAccount, apiTagFirehoseData, apiTagAccount), None,
- http4sPartialFunction = Some(getFirehoseAccountsAtOneBank))
+ List(apiTagAccountFirehose, apiTagAccount, apiTagFirehoseData, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getFirehoseAccountsAtOneBank)
+ )
// ─── createTransactionRequest (POST /banks/.../trans-request-types/TYPE/trans-requests → 201) ─
//
@@ -2850,41 +3391,77 @@ object Http4s400 {
private def initBatch8ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCounterpartiesForAnyAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCounterpartiesForAnyAccount),
+ "GET",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
"Get Counterparties for any account (Explicit)",
- s"""Get Counterparties for any account.""".stripMargin,
- EmptyBody, counterpartiesJson400,
+ s"""This is a management endpoint that gets the Counterparties that have been explicitly created for an Account / View.
+ |
+ |For a general introduction to Counterparties in OBP, see ${Glossary
+ .getGlossaryItemLink("Counterparties")}
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ counterpartiesJson400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- ViewNotFound, CreateOrUpdateCounterpartyMetadataError, UnknownError),
+ ViewNotFound, CreateOrUpdateCounterpartyMetadataError, UnknownError),
List(apiTagCounterparty, apiTagAccount),
Some(List(canGetCounterpartiesAtAnyBank, canGetCounterparties)),
- http4sPartialFunction = Some(getCounterpartiesForAnyAccount))
+ http4sPartialFunction = Some(getCounterpartiesForAnyAccount)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCounterpartyByIdForAnyAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCounterpartyByIdForAnyAccount),
+ "GET",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties/COUNTERPARTY_ID_PARAM",
"Get Counterparty by Id for any account (Explicit)",
- s"""Get Counterparty by COUNTERPARTY_ID.""".stripMargin,
- EmptyBody, counterpartyWithMetadataJson400,
+ s"""This is a management endpoint that gets information about any single explicitly created Counterparty on an Account / View specified by its COUNTERPARTY_ID",
+ |
+ |For a general introduction to Counterparties in OBP, see ${Glossary
+ .getGlossaryItemLink("Counterparties")}
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ counterpartyWithMetadataJson400,
List($AuthenticatedUserIsRequired, InvalidAccountIdFormat, InvalidBankIdFormat,
- $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, ViewNotFound, UnknownError),
+ $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, ViewNotFound, UnknownError),
List(apiTagCounterparty, apiTagAccount),
Some(List(canGetCounterpartyAtAnyBank, canGetCounterparty)),
- http4sPartialFunction = Some(getCounterpartyByIdForAnyAccount))
+ http4sPartialFunction = Some(getCounterpartyByIdForAnyAccount)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCounterpartyByNameForAnyAccount), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCounterpartyByNameForAnyAccount),
+ "GET",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparty-names/COUNTERPARTY_NAME",
"Get Counterparty by name for any account (Explicit)",
- s"""Get Counterparty by COUNTERPARTY_NAME.""".stripMargin,
- EmptyBody, counterpartyWithMetadataJson400,
+ s"""This is a management endpoint that allows the retrieval of any Counterparty on an Account / View by its Name.
+ |
+ |For a general introduction to Counterparties in OBP, see ${Glossary
+ .getGlossaryItemLink("Counterparties")}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ counterpartyWithMetadataJson400,
List($AuthenticatedUserIsRequired, InvalidAccountIdFormat, InvalidBankIdFormat,
- $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, ViewNotFound,
- CounterpartyNotFound, UnknownError),
+ $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, ViewNotFound,
+ CounterpartyNotFound, UnknownError),
List(apiTagCounterparty, apiTagAccount),
Some(List(canGetCounterpartyAtAnyBank, canGetCounterparty)),
- http4sPartialFunction = Some(getCounterpartyByNameForAnyAccount))
+ http4sPartialFunction = Some(getCounterpartyByNameForAnyAccount)
+ )
}
initBatch8ResourceDocs()
@@ -3144,31 +3721,53 @@ object Http4s400 {
private def initBatch9ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteExplicitCounterparty), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteExplicitCounterparty),
+ "DELETE",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties/COUNTERPARTY_ID_PARAM",
"Delete Counterparty (Explicit)",
- s"""Delete Counterparty (Explicit).
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, EmptyBody,
+ s"""This endpoint deletes the Counterparty on the Account / View specified by the COUNTERPARTY_ID.
+ |It also deletes any related Counterparty Metadata.
+ |
+ |The User calling this endpoint must have access to the View specified in the URL and that View must have the permission `can_delete_counterparty`.
+ |
+ |For a general introduction to Counterparties in OBP see ${Glossary
+ .getGlossaryItemLink("Counterparties")}
+ | |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankAccountNotFound, $BankNotFound,
- InvalidAccountIdFormat, InvalidBankIdFormat, NoViewPermission, UnknownError),
- List(apiTagCounterparty, apiTagAccount), None,
- http4sPartialFunction = Some(deleteExplicitCounterparty))
+ InvalidAccountIdFormat, InvalidBankIdFormat, NoViewPermission, UnknownError),
+ List(apiTagCounterparty, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(deleteExplicitCounterparty)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCounterpartyForAnyAccount), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCounterpartyForAnyAccount),
+ "DELETE",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties/COUNTERPARTY_ID",
"Delete Counterparty for any account (Explicit)",
- s"""Delete Counterparty for any account.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, EmptyBody,
+ s"""This is a management endpoint that enables the deletion of any specified Counterparty along with any related Metadata of that Counterparty.
+ |
+ |For a general introduction to Counterparties in OBP, see ${Glossary
+ .getGlossaryItemLink("Counterparties")}
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankAccountNotFound, $BankNotFound,
- InvalidAccountIdFormat, InvalidBankIdFormat, UserHasMissingRoles, UnknownError),
+ InvalidAccountIdFormat, InvalidBankIdFormat, UserHasMissingRoles, UnknownError),
List(apiTagCounterparty, apiTagAccount),
Some(List(canDeleteCounterparty, canDeleteCounterpartyAtAnyBank)),
- http4sPartialFunction = Some(deleteCounterpartyForAnyAccount))
+ http4sPartialFunction = Some(deleteCounterpartyForAnyAccount)
+ )
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, "deleteTagForViewOnAccount", "DELETE",
@@ -3211,30 +3810,53 @@ object Http4s400 {
http4sPartialFunction = Some(addTagForViewOnAccount))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getDoubleEntryTransaction), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getDoubleEntryTransaction),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transactions/TRANSACTION_ID/double-entry-transaction",
"Get Double Entry Transaction",
- s"""Get Double Entry Transaction.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, doubleEntryTransactionJson,
+ s"""Get Double Entry Transaction
+ |
+ |This endpoint can be used to see the double entry transactions. It returns the `bank_id`, `account_id` and `transaction_id`
+ |for the debit end the credit transaction. The other side account can be a settlement account or an OBP account.
+ |
+ |The endpoint also provide the `transaction_request` object which contains the `bank_id`, `account_id` and
+ |`transaction_request_id` of the transaction request at the origin of the transaction. Please note that if none
+ |transaction request is at the origin of the transaction, the `transaction_request` object will be `null`.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ doubleEntryTransactionJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- $UserNoPermissionAccessView, InvalidJsonFormat, UnknownError),
+ $UserNoPermissionAccessView, InvalidJsonFormat, UnknownError),
List(apiTagTransaction),
Some(List(canGetDoubleEntryTransactionAtAnyBank, canGetDoubleEntryTransactionAtOneBank)),
- http4sPartialFunction = Some(getDoubleEntryTransaction))
+ http4sPartialFunction = Some(getDoubleEntryTransaction)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBalancingTransaction), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBalancingTransaction),
+ "GET",
"/transactions/TRANSACTION_ID/balancing-transaction",
"Get Balancing Transaction",
- s"""Get Balancing Transaction.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, doubleEntryTransactionJson,
+ s"""Get Balancing Transaction
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ doubleEntryTransactionJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagTransaction), Some(List()),
- http4sPartialFunction = Some(getBalancingTransaction))
+ List(apiTagTransaction),
+ Some(List()),
+ http4sPartialFunction = Some(getBalancingTransaction)
+ )
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, nameOf(getBankAccountBalancesForCurrentUser), "GET",
@@ -3247,63 +3869,137 @@ object Http4s400 {
http4sPartialFunction = Some(getBankAccountBalancesForCurrentUser))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountByAccountRouting), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountByAccountRouting),
+ "POST",
"/management/accounts/account-routing-query",
"Get Account by Account Routing",
- """Get Account by Account Routing.""",
- bankAccountRoutingJson, moderatedAccountJSON400,
+ """This endpoint returns the account (if it exists) linked with the provided scheme and address.
+ |
+ |The `bank_id` field is optional, but if it's not provided, we don't guarantee that the returned account is unique across all the banks.
+ |
+ |Example of account routing scheme: `IBAN`, "OBP", "AccountNumber", ...
+ |Example of account routing address: `DE17500105178275645584`, "321774cc-fccd-11ea-adc1-0242ac120002", "55897106215", ...
+ |
+ |""".stripMargin,
+ bankAccountRoutingJson,
+ moderatedAccountJSON400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- $UserNoPermissionAccessView, UnknownError),
- List(apiTagAccount), None,
- http4sPartialFunction = Some(getAccountByAccountRouting))
+ $UserNoPermissionAccessView, UnknownError),
+ List(apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getAccountByAccountRouting)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountsByAccountRoutingRegex), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountsByAccountRoutingRegex),
+ "POST",
"/management/accounts/account-routing-regex-query",
"Get Accounts by Account Routing Regex",
- """Get Accounts by Account Routing Regex.""",
- bankAccountRoutingJson, moderatedAccountsJSON400,
+ """This endpoint returns an array of accounts matching the provided routing scheme and the routing address regex.
+ |
+ |The `bank_id` field is optional.
+ |
+ |Example of account routing scheme: `IBAN`, `OBP`, `AccountNumber`, ...
+ |Example of account routing address regex: `DE175.*`, `55897106215-[A-Z]{3}`, ...
+ |
+ |This endpoint can be used to retrieve multiples accounts matching a same account routing address pattern.
+ |For example, if you want to link multiple accounts having different currencies, you can create an account
+ |with `123456789-EUR` as Account Number and an other account with `123456789-USD` as Account Number.
+ |So we can identify the Account Number as `123456789`, so to get all the accounts with the same account number
+ |and the different currencies, we can use this body in the request :
+ |
+ |```
+ |{
+ | "bank_id": "BANK_ID",
+ | "account_routing": {
+ | "scheme": "AccountNumber",
+ | "address": "123456789-[A-Z]{3}"
+ | }
+ |}
+ |```
+ |
+ |This request will returns the accounts matching the routing address regex (`123456789-EUR` and `123456789-USD`).
+ |
+ |""".stripMargin,
+ bankAccountRoutingJson,
+ moderatedAccountsJSON400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- $UserNoPermissionAccessView, UnknownError),
- List(apiTagAccount), None,
- http4sPartialFunction = Some(getAccountsByAccountRoutingRegex))
+ $UserNoPermissionAccessView, UnknownError),
+ List(apiTagAccount),
+ None,
+ http4sPartialFunction = Some(getAccountsByAccountRoutingRegex)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(lockUser), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(lockUser),
+ "POST",
"/users/USERNAME/locks",
"Lock the user",
- s"""Lock a User.
- |
- |${userAuthenticationMessage(true)}""",
- EmptyBody, userLockStatusJson,
+ s"""
+ |Lock a User.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ userLockStatusJson,
List($AuthenticatedUserIsRequired, UserNotFoundByProviderAndUsername,
- UserHasMissingRoles, UnknownError),
+ UserHasMissingRoles, UnknownError),
List(apiTagUser),
Some(List(canLockUser)),
- http4sPartialFunction = Some(lockUser))
+ http4sPartialFunction = Some(lockUser)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(resetPasswordUrl), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(resetPasswordUrl),
+ "POST",
"/management/user/reset-password-url",
"Create password reset url",
- s"""Create password reset url.""",
- PostResetPasswordUrlJsonV400("jobloggs", "jo@gmail.com", "74a8ebcc-10e4-4036-bef3-9835922246bf"),
- ResetPasswordUrlJsonV400("https://apisandbox.openbankproject.com/user_mgt/reset_password/QOL1CPNJPCZ4BRMPX3Z01DPOX1HMGU3L"),
+ s"""Create password reset url.
+ |
+ |""",
+ PostResetPasswordUrlJsonV400(
+ "jobloggs",
+ "jo@gmail.com",
+ "74a8ebcc-10e4-4036-bef3-9835922246bf"
+ ),
+ ResetPasswordUrlJsonV400(
+ "https://apisandbox.openbankproject.com/user_mgt/reset_password/QOL1CPNJPCZ4BRMPX3Z01DPOX1HMGU3L"
+ ),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagUser),
Some(List(canCreateResetPasswordUrl)),
- http4sPartialFunction = Some(resetPasswordUrl))
+ http4sPartialFunction = Some(resetPasswordUrl)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getSettlementAccounts), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getSettlementAccounts),
+ "GET",
"/banks/BANK_ID/settlement-accounts",
"Get Settlement accounts at Bank",
- """Get Settlement accounts at Bank.""",
- EmptyBody, settlementAccountsJson,
+ """Get settlement accounts on this API instance
+ |Returns a list of settlement accounts at this Bank
+ |
+ |Note: a settlement account is considered as a bank account.
+ |So you can update it and add account attributes to it using the regular account endpoints
+ |""",
+ EmptyBody,
+ settlementAccountsJson,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, $BankNotFound, UnknownError),
List(apiTagBank, apiTagPsd2),
Some(List(canGetSettlementAccountAtOneBank)),
- http4sPartialFunction = Some(getSettlementAccounts))
+ http4sPartialFunction = Some(getSettlementAccounts)
+ )
}
initBatch9ResourceDocs()
@@ -3556,162 +4252,283 @@ object Http4s400 {
private def initBatch10ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankAttribute),
+ "POST",
"/banks/BANK_ID/attribute",
"Create Bank Attribute",
- s"""Create Bank Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- bankAttributeJsonV400, bankAttributeResponseJsonV400,
+ s""" Create Bank Attribute
+ |
+ |Typical product attributes might be:
+ |
+ |ISIN (for International bonds)
+ |VKN (for German bonds)
+ |REDCODE (markit short code for credit derivative)
+ |LOAN_ID (e.g. used for Anacredit reporting)
+ |
+ |ISSUE_DATE (When the bond was issued in the market)
+ |MATURITY_DATE (End of life time of a product)
+ |TRADABLE
+ |
+ |See [FPML](http://www.fpml.org/) for more examples.
+ |
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ bankAttributeJsonV400,
+ bankAttributeResponseJsonV400,
List(InvalidJsonFormat, UnknownError),
List(apiTagBank, apiTagBankAttribute, apiTagAttribute),
Some(List(canCreateBankAttribute)),
- http4sPartialFunction = Some(createBankAttribute))
+ http4sPartialFunction = Some(createBankAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBankAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBankAttribute),
+ "PUT",
"/banks/BANK_ID/attributes/BANK_ATTRIBUTE_ID",
"Update Bank Attribute",
- s"""Update Bank Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- bankAttributeJsonV400, bankAttributeDefinitionJsonV400,
+ s""" Update Bank Attribute.
+ |
+ |Update one Bak Attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ bankAttributeJsonV400,
+ bankAttributeDefinitionJsonV400,
List(UserHasMissingRoles, UnknownError),
List(apiTagBank, apiTagBankAttribute, apiTagAttribute),
Some(List(canUpdateBankAttribute)),
- http4sPartialFunction = Some(updateBankAttribute))
+ http4sPartialFunction = Some(updateBankAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createCustomerAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createCustomerAttribute),
+ "POST",
"/banks/BANK_ID/customers/CUSTOMER_ID/attribute",
"Create Customer Attribute",
- s"""Create Customer Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- customerAttributeJsonV400, customerAttributeResponseJson,
+ s""" Create Customer Attribute
+ |
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ customerAttributeJsonV400,
+ customerAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canCreateCustomerAttributeAtOneBank, canCreateCustomerAttributeAtAnyBank)),
- http4sPartialFunction = Some(createCustomerAttribute))
+ http4sPartialFunction = Some(createCustomerAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateCustomerAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateCustomerAttribute),
+ "PUT",
"/banks/BANK_ID/customers/CUSTOMER_ID/attributes/CUSTOMER_ATTRIBUTE_ID",
"Update Customer Attribute",
- s"""Update Customer Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- customerAttributeJsonV400, customerAttributeResponseJson,
+ s""" Update Customer Attribute
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ customerAttributeJsonV400,
+ customerAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canUpdateCustomerAttributeAtOneBank, canUpdateCustomerAttributeAtAnyBank)),
- http4sPartialFunction = Some(updateCustomerAttribute))
+ http4sPartialFunction = Some(updateCustomerAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createTransactionAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createTransactionAttribute),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transactions/TRANSACTION_ID/attribute",
"Create Transaction Attribute",
- s"""Create Transaction Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- transactionAttributeJsonV400, transactionAttributeResponseJson,
+ s""" Create Transaction Attribute
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ transactionAttributeJsonV400,
+ transactionAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canCreateTransactionAttributeAtOneBank)),
- http4sPartialFunction = Some(createTransactionAttribute))
+ http4sPartialFunction = Some(createTransactionAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateTransactionAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateTransactionAttribute),
+ "PUT",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transactions/TRANSACTION_ID/attributes/ACCOUNT_ATTRIBUTE_ID",
"Update Transaction Attribute",
- s"""Update Transaction Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- transactionAttributeJsonV400, transactionAttributeResponseJson,
+ s""" Update Transaction Attribute
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ transactionAttributeJsonV400,
+ transactionAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canUpdateTransactionAttributeAtOneBank)),
- http4sPartialFunction = Some(updateTransactionAttribute))
+ http4sPartialFunction = Some(updateTransactionAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createTransactionRequestAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createTransactionRequestAttribute),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transaction-requests/TRANSACTION_REQUEST_ID/attribute",
"Create Transaction Request Attribute",
- s"""Create Transaction Request Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- transactionRequestAttributeJsonV400, transactionRequestAttributeResponseJson,
+ s""" Create Transaction Request Attribute
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ transactionRequestAttributeJsonV400,
+ transactionRequestAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canCreateTransactionRequestAttributeAtOneBank)),
- http4sPartialFunction = Some(createTransactionRequestAttribute))
+ http4sPartialFunction = Some(createTransactionRequestAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateTransactionRequestAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateTransactionRequestAttribute),
+ "PUT",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transaction-requests/TRANSACTION_REQUEST_ID/attributes/ATTRIBUTE_ID",
"Update Transaction Request Attribute",
- s"""Update Transaction Request Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- transactionRequestAttributeJsonV400, transactionRequestAttributeResponseJson,
+ s""" Update Transaction Request Attribute
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ transactionRequestAttributeJsonV400,
+ transactionRequestAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- InvalidJsonFormat, UnknownError),
+ InvalidJsonFormat, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canUpdateTransactionRequestAttributeAtOneBank)),
- http4sPartialFunction = Some(updateTransactionRequestAttribute))
+ http4sPartialFunction = Some(updateTransactionRequestAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createProductFee), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createProductFee),
+ "POST",
"/banks/BANK_ID/products/PRODUCT_CODE/fee",
"Create Product Fee",
- s"""Create Product Fee.
- |
- |${userAuthenticationMessage(true)}""",
- productFeeJsonV400.copy(product_fee_id = None), productFeeResponseJsonV400,
+ s"""Create Product Fee
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productFeeJsonV400.copy(product_fee_id = None),
+ productFeeResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagProduct),
Some(List(canCreateProductFee)),
- http4sPartialFunction = Some(createProductFee))
+ http4sPartialFunction = Some(createProductFee)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateProductFee), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateProductFee),
+ "PUT",
"/banks/BANK_ID/products/PRODUCT_CODE/fees/PRODUCT_FEE_ID",
"Update Product Fee",
- s"""Update Product Fee.
- |
- |${userAuthenticationMessage(true)}""",
- productFeeJsonV400.copy(product_fee_id = None), productFeeResponseJsonV400,
+ s""" Update Product Fee.
+ |
+ |Update one Product Fee by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productFeeJsonV400.copy(product_fee_id = None),
+ productFeeResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UserHasMissingRoles, UnknownError),
List(apiTagProduct),
Some(List(canUpdateProductFee)),
- http4sPartialFunction = Some(updateProductFee))
+ http4sPartialFunction = Some(updateProductFee)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createMyPersonalUserAttribute), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createMyPersonalUserAttribute),
+ "POST",
"/my/user/attributes",
"Create My Personal User Attribute",
- s"""Create My Personal User Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- userAttributeJsonV400, userAttributeResponseJson,
+ s""" Create My Personal User Attribute
+ |
+ |The `type` field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ userAttributeJsonV400,
+ userAttributeResponseJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagUser), Some(List()),
- http4sPartialFunction = Some(createMyPersonalUserAttribute))
+ List(apiTagUser),
+ Some(List()),
+ http4sPartialFunction = Some(createMyPersonalUserAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateMyPersonalUserAttribute), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateMyPersonalUserAttribute),
+ "PUT",
"/my/user/attributes/USER_ATTRIBUTE_ID",
"Update My Personal User Attribute",
- s"""Update My Personal User Attribute.
- |
- |${userAuthenticationMessage(true)}""",
- userAttributeJsonV400, userAttributeResponseJson,
+ s"""Update My Personal User Attribute for current user by USER_ATTRIBUTE_ID
+ |
+ |The type field must be one of "STRING", "INTEGER", "DOUBLE" or DATE_WITH_DAY"
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ userAttributeJsonV400,
+ userAttributeResponseJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagUser), Some(List()),
- http4sPartialFunction = Some(updateMyPersonalUserAttribute))
+ List(apiTagUser),
+ Some(List()),
+ http4sPartialFunction = Some(updateMyPersonalUserAttribute)
+ )
}
initBatch10ResourceDocs()
@@ -3926,15 +4743,24 @@ object Http4s400 {
private def initBatch11ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserInvitationAnonymous), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserInvitationAnonymous),
+ "POST",
"/banks/BANK_ID/user-invitations",
"Get User Invitation (Anonymous)",
- s"""Get User Invitation.""",
- PostUserInvitationAnonymousJsonV400(1L), userInvitationJsonV400,
+ s"""Get User Invitation Information.
+ |
+ |${userAuthenticationMessage(false)}
+ |""",
+ PostUserInvitationAnonymousJsonV400(secret_key = 5819479115482092878L),
+ userInvitationJsonV400,
List($BankNotFound, InvalidJsonFormat, UnknownError),
- List(apiTagUserInvitation), None,
- http4sPartialFunction = Some(getUserInvitationAnonymous))
-
+ List(apiTagUserInvitation),
+ None,
+ http4sPartialFunction = Some(getUserInvitationAnonymous)
+ )
+
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, "grantUserAccessToView", "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/account-access/grant",
@@ -3981,69 +4807,132 @@ object Http4s400 {
http4sPartialFunction = Some(revokeGrantUserAccessToViews))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createMyApiCollection), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createMyApiCollection),
+ "POST",
"/my/api-collections",
"Create My Api Collection",
- s"""Create My Api Collection.
- |
- |${userAuthenticationMessage(true)}""",
- postApiCollectionJson400, apiCollectionJson400,
+ s"""Create Api Collection for logged in user.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ postApiCollectionJson400,
+ apiCollectionJson400,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(createMyApiCollection))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(createMyApiCollection)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createMyApiCollectionEndpoint), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createMyApiCollectionEndpoint),
+ "POST",
"/my/api-collections/API_COLLECTION_NAME/api-collection-endpoints",
"Create My Api Collection Endpoint",
- s"""Create My Api Collection Endpoint.
- |
- |${userAuthenticationMessage(true)}""",
- postApiCollectionEndpointJson400, apiCollectionEndpointJson400,
+ s"""Create Api Collection Endpoint.
+ |
+ |${Glossary.getGlossaryItem("API Collections")}
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ postApiCollectionEndpointJson400,
+ apiCollectionEndpointJson400,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(createMyApiCollectionEndpoint))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(createMyApiCollectionEndpoint)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createMyApiCollectionEndpointById), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createMyApiCollectionEndpointById),
+ "POST",
"/my/api-collection-ids/API_COLLECTION_ID/api-collection-endpoints",
"Create My Api Collection Endpoint By Id",
- s"""Create My Api Collection Endpoint By Id.
- |
- |${userAuthenticationMessage(true)}""",
- postApiCollectionEndpointJson400, apiCollectionEndpointJson400,
+ s"""Create Api Collection Endpoint By Id.
+ |
+ |${Glossary.getGlossaryItem("API Collections")}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ postApiCollectionEndpointJson400,
+ apiCollectionEndpointJson400,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(createMyApiCollectionEndpointById))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(createMyApiCollectionEndpointById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateConsentStatus), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateConsentStatus),
+ "PUT",
"/banks/BANK_ID/consents/CONSENT_ID",
"Update Consent Status",
- s"""Update Consent Status.
- |
- |${userAuthenticationMessage(true)}""",
+ s"""
+ |
+ |
+ |This endpoint is used to update the Status of Consent.
+ |
+ |Each Consent has one of the following states: ${ConsentStatus.values.toList.sorted
+ .mkString(", ")}.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
PutConsentStatusJsonV400(status = "AUTHORISED"),
- code.api.v3_1_0.ConsentChallengeJsonV310(
- "9d429899-24f5-42c8-8565-943ffa6a7945", "...", "AUTHORISED"),
+ ConsentChallengeJsonV310(
+ consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
+ jwt =
+ "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4",
+ status = "AUTHORISED"
+ ),
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat,
- InvalidConnectorResponse, UnknownError),
- apiTagConsent :: apiTagPSD2AIS :: Nil, None,
- http4sPartialFunction = Some(updateConsentStatus))
+ InvalidConnectorResponse, UnknownError),
+ apiTagConsent :: apiTagPSD2AIS :: Nil,
+ None,
+ http4sPartialFunction = Some(updateConsentStatus)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(addConsentUser), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(addConsentUser),
+ "PUT",
"/banks/BANK_ID/consents/CONSENT_ID/user-update-request",
"Add User to a Consent",
- s"""Add User to a Consent.
- |
- |${userAuthenticationMessage(true)}""",
- PutConsentUserJsonV400("uuid-user"),
- code.api.v3_1_0.ConsentJsonV310("9d429899-24f5-42c8-8565-943ffa6a7945", "...", "AUTHORISED"),
+ s"""
+ |
+ |
+ |This endpoint is used to add the User of Consent.
+ |
+ |Each Consent has one of the following states: ${ConsentStatus.values.toList.sorted
+ .mkString(", ")}.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ PutConsentUserJsonV400(user_id = "ed7a7c01-db37-45cc-ba12-0ae8891c195c"),
+ ConsentChallengeJsonV310(
+ consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
+ jwt =
+ "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4",
+ status = "AUTHORISED"
+ ),
List($AuthenticatedUserIsRequired, $BankNotFound, UserNotFoundByUserId,
- ConsentUserAlreadyAdded, InvalidJsonFormat, ConsentNotFound, UnknownError),
- apiTagConsent :: apiTagPSD2AIS :: Nil, None,
- http4sPartialFunction = Some(addConsentUser))
+ ConsentUserAlreadyAdded, InvalidJsonFormat, ConsentNotFound, UnknownError),
+ apiTagConsent :: apiTagPSD2AIS :: Nil,
+ None,
+ http4sPartialFunction = Some(addConsentUser)
+ )
}
initBatch11ResourceDocs()
@@ -4217,87 +5106,161 @@ object Http4s400 {
private def initBatch12ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createDirectDebit), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createDirectDebit),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/direct-debit",
"Create Direct Debit",
- s"""Create direct debit for an account.""",
- postDirectDebitJsonV400, directDebitJsonV400,
+ s"""Create direct debit for an account.
+ |
+ |""",
+ postDirectDebitJsonV400,
+ directDebitJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- NoViewPermission, InvalidJsonFormat, CustomerNotFoundByCustomerId,
- UserNotFoundByUserId, CounterpartyNotFoundByCounterpartyId, UnknownError),
- List(apiTagDirectDebit, apiTagAccount), None,
- http4sPartialFunction = Some(createDirectDebit))
+ NoViewPermission, InvalidJsonFormat, CustomerNotFoundByCustomerId,
+ UserNotFoundByUserId, CounterpartyNotFoundByCounterpartyId, UnknownError),
+ List(apiTagDirectDebit, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(createDirectDebit)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createDirectDebitManagement), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createDirectDebitManagement),
+ "POST",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/direct-debit",
"Create Direct Debit (management)",
- s"""Create direct debit for an account.""",
- postDirectDebitJsonV400, directDebitJsonV400,
+ s"""Create direct debit for an account.
+ |
+ |""",
+ postDirectDebitJsonV400,
+ directDebitJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- NoViewPermission, InvalidJsonFormat, CustomerNotFoundByCustomerId,
- UserNotFoundByUserId, CounterpartyNotFoundByCounterpartyId, UnknownError),
+ NoViewPermission, InvalidJsonFormat, CustomerNotFoundByCustomerId,
+ UserNotFoundByUserId, CounterpartyNotFoundByCounterpartyId, UnknownError),
List(apiTagDirectDebit, apiTagAccount),
Some(List(canCreateDirectDebitAtOneBank)),
- http4sPartialFunction = Some(createDirectDebitManagement))
+ http4sPartialFunction = Some(createDirectDebitManagement)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createStandingOrder), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createStandingOrder),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/standing-order",
"Create Standing Order",
- s"""Create standing order for an account.""",
- postStandingOrderJsonV400, standingOrderJsonV400,
+ s"""Create standing order for an account.
+ |
+ |when -> frequency = {‘YEARLY’,’MONTHLY, ‘WEEKLY’, ‘BI-WEEKLY’, DAILY’}
+ |when -> detail = { ‘FIRST_MONDAY’, ‘FIRST_DAY’, ‘LAST_DAY’}}
+ |
+ |""",
+ postStandingOrderJsonV400,
+ standingOrderJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- NoViewPermission, InvalidJsonFormat, InvalidNumber, InvalidISOCurrencyCode,
- CustomerNotFoundByCustomerId, UserNotFoundByUserId, UnknownError),
- List(apiTagStandingOrder, apiTagAccount), None,
- http4sPartialFunction = Some(createStandingOrder))
+ NoViewPermission, InvalidJsonFormat, InvalidNumber, InvalidISOCurrencyCode,
+ CustomerNotFoundByCustomerId, UserNotFoundByUserId, UnknownError),
+ List(apiTagStandingOrder, apiTagAccount),
+ None,
+ http4sPartialFunction = Some(createStandingOrder)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createStandingOrderManagement), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createStandingOrderManagement),
+ "POST",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/standing-order",
"Create Standing Order (management)",
- s"""Create standing order for an account.""",
- postStandingOrderJsonV400, standingOrderJsonV400,
+ s"""Create standing order for an account.
+ |
+ |when -> frequency = {‘YEARLY’,’MONTHLY, ‘WEEKLY’, ‘BI-WEEKLY’, DAILY’}
+ |when -> detail = { ‘FIRST_MONDAY’, ‘FIRST_DAY’, ‘LAST_DAY’}}
+ |
+ |
+ |""",
+ postStandingOrderJsonV400,
+ standingOrderJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound,
- NoViewPermission, InvalidJsonFormat, InvalidNumber, InvalidISOCurrencyCode,
- CustomerNotFoundByCustomerId, UserNotFoundByUserId, UnknownError),
+ NoViewPermission, InvalidJsonFormat, InvalidNumber, InvalidISOCurrencyCode,
+ CustomerNotFoundByCustomerId, UserNotFoundByUserId, UnknownError),
List(apiTagStandingOrder, apiTagAccount),
Some(List(canCreateStandingOrderAtOneBank)),
- http4sPartialFunction = Some(createStandingOrderManagement))
+ http4sPartialFunction = Some(createStandingOrderManagement)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createSystemAccountNotificationWebhook), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createSystemAccountNotificationWebhook),
+ "POST",
"/web-hooks/account/notifications/on-create-transaction",
"Create System Level Account Notification Webhook",
- s"""Create System Level Account Notification Webhook.""",
- accountNotificationWebhookPostJson, systemAccountNotificationWebhookJson,
+ s"""
+ |Create a notification Webhook that will fire for all accounts on the system.
+ |
+ |$generalWebHookInfo
+ |
+ |$accountNotificationWebhookInfo
+ |
+ |""",
+ accountNotificationWebhookPostJson,
+ systemAccountNotificationWebhookJson,
List(UnknownError),
apiTagWebhook :: apiTagBank :: Nil,
Some(List(canCreateSystemAccountNotificationWebhook)),
- http4sPartialFunction = Some(createSystemAccountNotificationWebhook))
+ http4sPartialFunction = Some(createSystemAccountNotificationWebhook)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankAccountNotificationWebhook), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankAccountNotificationWebhook),
+ "POST",
"/banks/BANK_ID/web-hooks/account/notifications/on-create-transaction",
"Create bank level Account Notification Webhook",
- s"""Create bank level Account Notification Webhook.""",
- accountNotificationWebhookPostJson, bankAccountNotificationWebhookJson,
+ s"""Create a notification Webhook that will fire for all accounts on the specified Bank.
+ |
+ |$generalWebHookInfo
+ |
+ |$accountNotificationWebhookInfo
+ |
+ |""",
+ accountNotificationWebhookPostJson,
+ bankAccountNotificationWebhookJson,
List(AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
apiTagWebhook :: apiTagBank :: Nil,
Some(List(canCreateAccountNotificationWebhookAtOneBank)),
- http4sPartialFunction = Some(createBankAccountNotificationWebhook))
+ http4sPartialFunction = Some(createBankAccountNotificationWebhook)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getFastFirehoseAccountsAtOneBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getFastFirehoseAccountsAtOneBank),
+ "GET",
"/management/banks/BANK_ID/fast-firehose/accounts",
"Get Fast Firehose Accounts at Bank",
- s"""Get Fast Firehose Accounts at Bank.""",
- EmptyBody, fastFirehoseAccountsJsonV400,
+ s"""
+ |
+ |This endpoint allows bulk access to accounts.
+ |
+ |optional pagination parameters for filter with accounts
+ |${urlParametersDocument(true, false)}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ EmptyBody,
+ fastFirehoseAccountsJsonV400,
List($BankNotFound),
List(apiTagAccount, apiTagAccountFirehose, apiTagFirehoseData),
Some(List(canUseAccountFirehoseAtAnyBank, code.api.util.ApiRole.canUseAccountFirehose)),
- http4sPartialFunction = Some(getFastFirehoseAccountsAtOneBank))
+ http4sPartialFunction = Some(getFastFirehoseAccountsAtOneBank)
+ )
}
initBatch12ResourceDocs()
@@ -4389,81 +5352,172 @@ object Http4s400 {
private def initBatch7ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateCustomerAttributeAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateCustomerAttributeAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/customer",
"Create or Update Customer Attribute Definition",
- s"""Create or Update Customer Attribute Definition.""".stripMargin,
- customerAttributeDefinitionJsonV400, customerAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Customer Attribute Definition
+ |
+ |The category field must be one of: ${AttributeCategory.Customer}
+ |
+ |The type field must be one of; ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ templateAttributeDefinitionJsonV400,
+ templateAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canCreateCustomerAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateCustomerAttributeAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateCustomerAttributeAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateAccountAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateAccountAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/account",
"Create or Update Account Attribute Definition",
- s"""Create or Update Account Attribute Definition.""".stripMargin,
- accountAttributeDefinitionJsonV400, accountAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Account Attribute Definition
+ |
+ |The category field must be ${AttributeCategory.Account}
+ |
+ |The type field must be one of; ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ accountAttributeDefinitionJsonV400,
+ accountAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagAccount, apiTagAccountAttribute, apiTagAttribute),
Some(List(canCreateAccountAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateAccountAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateAccountAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateProductAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateProductAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/product",
"Create or Update Product Attribute Definition",
- s"""Create or Update Product Attribute Definition.""".stripMargin,
- productAttributeDefinitionJsonV400, productAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Product Attribute Definition
+ |
+ |The category field must be ${AttributeCategory.Product}
+ |
+ |The type field must be one of; ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ productAttributeDefinitionJsonV400,
+ productAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canCreateProductAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateProductAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateProductAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateTransactionAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateTransactionAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/transaction",
"Create or Update Transaction Attribute Definition",
- s"""Create or Update Transaction Attribute Definition.""".stripMargin,
- transactionAttributeDefinitionJsonV400, transactionAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Transaction Attribute Definition
+ |
+ |The category field must be ${AttributeCategory.Transaction}
+ |
+ |The type field must be one of; ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ transactionAttributeDefinitionJsonV400,
+ transactionAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canCreateTransactionAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateTransactionAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateTransactionAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateCardAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateCardAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/card",
"Create or Update Card Attribute Definition",
- s"""Create or Update Card Attribute Definition.""".stripMargin,
- cardAttributeDefinitionJsonV400, cardAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Card Attribute Definition
+ |
+ |The category field must be ${AttributeCategory.Card}
+ |
+ |The type field must be one of; ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ cardAttributeDefinitionJsonV400,
+ cardAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCard, apiTagCardAttribute, apiTagAttribute),
Some(List(canCreateCardAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateCardAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateCardAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateTransactionRequestAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateTransactionRequestAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/transaction-request",
"Create or Update Transaction Request Attribute Definition",
- s"""Create or Update Transaction Request Attribute Definition.""".stripMargin,
- transactionRequestAttributeDefinitionJsonV400, transactionRequestAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Transaction Request Attribute Definition
+ |
+ |The category field must be ${AttributeCategory.TransactionRequest}
+ |
+ |The type field must be one of: ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ transactionRequestAttributeDefinitionJsonV400,
+ transactionRequestAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canCreateTransactionRequestAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateTransactionRequestAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateTransactionRequestAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createOrUpdateBankAttributeDefinition), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(createOrUpdateBankAttributeDefinition),
+ "PUT",
"/banks/BANK_ID/attribute-definitions/bank",
"Create or Update Bank Attribute Definition",
- s"""Create or Update Bank Attribute Definition.""".stripMargin,
- bankAttributeDefinitionJsonV400, bankAttributeDefinitionResponseJsonV400,
+ s""" Create or Update Bank Attribute Definition
+ |
+ |The category field must be ${AttributeCategory.Bank}
+ |
+ |The type field must be one of; ${AttributeType.DOUBLE}, ${AttributeType.STRING}, ${AttributeType.INTEGER} and ${AttributeType.DATE_WITH_DAY}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ bankAttributeDefinitionJsonV400,
+ bankAttributeDefinitionResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagBank, apiTagBankAttribute, apiTagAttribute),
Some(List(canCreateBankAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(createOrUpdateBankAttributeDefinition))
+ http4sPartialFunction = Some(createOrUpdateBankAttributeDefinition)
+ )
}
initBatch7ResourceDocs()
@@ -4556,75 +5610,122 @@ object Http4s400 {
private def initBatch6ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtmSupportedCurrencies), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtmSupportedCurrencies),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID/supported-currencies",
"Update ATM Supported Currencies",
- s"""Update ATM Supported Currencies.""".stripMargin,
- supportedCurrenciesJson, atmSupportedCurrenciesJson,
+ s"""Update ATM Supported Currencies.
+ |""",
+ supportedCurrenciesJson,
+ atmSupportedCurrenciesJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(updateAtmSupportedCurrencies))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(updateAtmSupportedCurrencies)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtmSupportedLanguages), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtmSupportedLanguages),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID/supported-languages",
"Update ATM Supported Languages",
- s"""Update ATM Supported Languages.""".stripMargin,
- supportedLanguagesJson, atmSupportedLanguagesJson,
+ s"""Update ATM Supported Languages.
+ |""",
+ supportedLanguagesJson,
+ atmSupportedLanguagesJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(updateAtmSupportedLanguages))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(updateAtmSupportedLanguages)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtmAccessibilityFeatures), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtmAccessibilityFeatures),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID/accessibility-features",
"Update ATM Accessibility Features",
- s"""Update ATM Accessibility Features.""".stripMargin,
- accessibilityFeaturesJson, atmAccessibilityFeaturesJson,
+ s"""Update ATM Accessibility Features.
+ |""",
+ accessibilityFeaturesJson,
+ atmAccessibilityFeaturesJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(updateAtmAccessibilityFeatures))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(updateAtmAccessibilityFeatures)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtmServices), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtmServices),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID/services",
"Update ATM Services",
- s"""Update ATM Services.""".stripMargin,
- atmServicesJson, atmServicesResponseJson,
+ s"""Update ATM Services.
+ |""",
+ atmServicesJson,
+ atmServicesResponseJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(updateAtmServices))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(updateAtmServices)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtmNotes), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtmNotes),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID/notes",
"Update ATM Notes",
- s"""Update ATM Notes.""".stripMargin,
- atmNotesJson, atmNotesResponseJson,
+ s"""Update ATM Notes.
+ |""",
+ atmNotesJson,
+ atmNotesResponseJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(updateAtmNotes))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(updateAtmNotes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtmLocationCategories), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtmLocationCategories),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID/location-categories",
"Update ATM Location Categories",
- s"""Update ATM Location Categories.""".stripMargin,
- atmLocationCategoriesJsonV400, atmLocationCategoriesResponseJsonV400,
+ s"""Update ATM Location Categories.
+ |""",
+ atmLocationCategoriesJsonV400,
+ atmLocationCategoriesResponseJsonV400,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagATM), None,
- http4sPartialFunction = Some(updateAtmLocationCategories))
+ List(apiTagATM),
+ None,
+ http4sPartialFunction = Some(updateAtmLocationCategories)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAtm), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAtm),
+ "PUT",
"/banks/BANK_ID/atms/ATM_ID",
"Update ATM",
- s"""Update ATM.""".stripMargin,
- atmJsonV400, atmJsonV400,
+ s"""Update ATM.""",
+ atmJsonV400.copy(id = None),
+ atmJsonV400,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
List(apiTagATM),
Some(List(canUpdateAtm, canCreateAtmAtAnyBank)),
- http4sPartialFunction = Some(updateAtm))
+ http4sPartialFunction = Some(updateAtm)
+ )
}
initBatch6ResourceDocs()
@@ -4824,198 +5925,347 @@ object Http4s400 {
private def initBatch5ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductFee), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductFee),
+ "GET",
"/banks/BANK_ID/products/PRODUCT_CODE/fees/PRODUCT_FEE_ID",
"Get Product Fee",
- s"""Get Product Fee""".stripMargin,
- EmptyBody, productFeeResponseJsonV400,
+ s""" Get Product Fee
+ |
+ |Get one product fee by its id.
+ |
+ |${userAuthenticationMessage(false)}
+ |
+ |""",
+ EmptyBody,
+ productFeeResponseJsonV400,
List($BankNotFound, UnknownError),
- List(apiTagProduct), None,
- http4sPartialFunction = Some(getProductFee))
+ List(apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProductFee)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductFees), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductFees),
+ "GET",
"/banks/BANK_ID/products/PRODUCT_CODE/fees",
"Get Product Fees",
- s"""Get Product Fees""".stripMargin,
- EmptyBody, productFeesResponseJsonV400,
+ s"""Get Product Fees
+ |
+ |${userAuthenticationMessage(false)}
+ |
+ |""",
+ EmptyBody,
+ productFeesResponseJsonV400,
List($BankNotFound, UnknownError),
- List(apiTagProduct), None,
- http4sPartialFunction = Some(getProductFees))
+ List(apiTagProduct),
+ None,
+ http4sPartialFunction = Some(getProductFees)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionAttributes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionAttributes),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transactions/TRANSACTION_ID/attributes",
"Get Transaction Attributes",
- s"""Get Transaction Attributes
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionAttributesResponseJson,
+ s""" Get Transaction Attributes
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ transactionAttributesResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canGetTransactionAttributesAtOneBank)),
- http4sPartialFunction = Some(getTransactionAttributes))
+ http4sPartialFunction = Some(getTransactionAttributes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionAttributeById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionAttributeById),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transactions/TRANSACTION_ID/attributes/ATTRIBUTE_ID",
"Get Transaction Attribute By Id",
- s"""Get Transaction Attribute By Id
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionAttributeResponseJson,
+ s""" Get Transaction Attribute By Id
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ transactionAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canGetTransactionAttributeAtOneBank)),
- http4sPartialFunction = Some(getTransactionAttributeById))
+ http4sPartialFunction = Some(getTransactionAttributeById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionRequestAttributes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionRequestAttributes),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transaction-requests/TRANSACTION_REQUEST_ID/attributes",
"Get Transaction Request Attributes",
- s"""Get Transaction Request Attributes
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionRequestAttributesResponseJson,
+ s""" Get Transaction Request Attributes
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ transactionRequestAttributesResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canGetTransactionRequestAttributesAtOneBank)),
- http4sPartialFunction = Some(getTransactionRequestAttributes))
+ http4sPartialFunction = Some(getTransactionRequestAttributes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionRequestAttributeById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionRequestAttributeById),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/transaction-requests/TRANSACTION_REQUEST_ID/attributes/ATTRIBUTE_ID",
"Get Transaction Request Attribute By Id",
- s"""Get Transaction Request Attribute By Id
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionRequestAttributeResponseJson,
+ s""" Get Transaction Request Attribute By Id
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ transactionRequestAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, InvalidJsonFormat, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canGetTransactionRequestAttributeAtOneBank)),
- http4sPartialFunction = Some(getTransactionRequestAttributeById))
+ http4sPartialFunction = Some(getTransactionRequestAttributeById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionRequestAttributeDefinition), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionRequestAttributeDefinition),
+ "GET",
"/banks/BANK_ID/attribute-definitions/transaction-request",
"Get Transaction Request Attribute Definition",
- s"""Get Transaction Request Attribute Definition
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionRequestAttributeDefinitionsResponseJsonV400,
+ s""" Get Transaction Request Attribute Definition
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ transactionRequestAttributeDefinitionsResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canGetTransactionRequestAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(getTransactionRequestAttributeDefinition))
+ http4sPartialFunction = Some(getTransactionRequestAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionRequest), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionRequest),
+ "GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-requests/TRANSACTION_REQUEST_ID",
"Get Transaction Request.",
- s"""Returns the transaction request specified by TRANSACTION_REQUEST_ID at BANK_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionRequestWithChargeJSON400,
+ """Returns transaction request for transaction specified by TRANSACTION_REQUEST_ID and for account specified by ACCOUNT_ID at bank specified by BANK_ID.
+ |
+ |The VIEW_ID specified must be 'owner' and the user must have access to this view.
+ |
+ |Version 2.0.0 now returns charge information.
+ |
+ |Transaction Requests serve to initiate transactions that may or may not proceed. They contain information including:
+ |
+ |* Transaction Request Id
+ |* Type
+ |* Status (INITIATED, COMPLETED)
+ |* Challenge (in order to confirm the request)
+ |* From Bank / Account
+ |* Details including Currency, Value, Description and other initiation information specific to each type. (Could potentialy include a list of future transactions.)
+ |* Related Transactions
+ |
+ |PSD2 Context: PSD2 requires transparency of charges to the customer.
+ |This endpoint provides the charge that would be applied if the Transaction Request proceeds - and a record of that charge there after.
+ |The customer can proceed with the Transaction by answering the security challenge.
+ |
+ """.stripMargin,
+ EmptyBody,
+ transactionRequestWithChargeJSON210,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, $UserNoPermissionAccessView, UnknownError),
- List(apiTagTransactionRequest), None,
- http4sPartialFunction = Some(getTransactionRequest))
+ List(apiTagTransactionRequest),
+ None,
+ http4sPartialFunction = Some(getTransactionRequest)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyCorrelatedEntities), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyCorrelatedEntities),
+ "GET",
"/my/correlated-entities",
"Get Correlated Entities for the current User",
s"""Correlated Entities are users and customers linked to the currently authenticated user via User-Customer-Links
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, correlatedUsersResponseJson,
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ correlatedUsersResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
- List(apiTagCustomer), None,
- http4sPartialFunction = Some(getMyCorrelatedEntities))
+ List(apiTagCustomer),
+ None,
+ http4sPartialFunction = Some(getMyCorrelatedEntities)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCorrelatedUsersInfoByCustomerId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCorrelatedUsersInfoByCustomerId),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID/correlated-users",
"Get Correlated User Info by Customer",
s"""Get Correlated User Info by CUSTOMER_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, customerAndUsersWithAttributesResponseJson,
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customerAndUsersWithAttributesResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCustomer),
Some(List(canGetCorrelatedUsersInfoAtAnyBank, canGetCorrelatedUsersInfo)),
- http4sPartialFunction = Some(getCorrelatedUsersInfoByCustomerId))
+ http4sPartialFunction = Some(getCorrelatedUsersInfoByCustomerId)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountsMinimalByCustomerId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountsMinimalByCustomerId),
+ "GET",
"/customers/CUSTOMER_ID/accounts-minimal",
"Get Accounts Minimal for a Customer",
- s"""Get Accounts Minimal that are owned by a Customer.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, accountsMinimalJson400,
+ s"""Get Accounts Minimal by CUSTOMER_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ accountsMinimalJson400,
List($AuthenticatedUserIsRequired, CustomerNotFoundByCustomerId, UnknownError),
List(apiTagCustomer),
Some(List(canGetAccountsMinimalForCustomerAtOneBank, canGetAccountsMinimalForCustomerAtAnyBank)),
- http4sPartialFunction = Some(getAccountsMinimalByCustomerId))
+ http4sPartialFunction = Some(getAccountsMinimalByCustomerId)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomersByCustomerPhoneNumber), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomersByCustomerPhoneNumber),
+ "POST",
"/banks/BANK_ID/search/customers/mobile-phone-number",
"Get Customers by MOBILE_PHONE_NUMBER",
- s"""Gets the Customers specified by MOBILE_PHONE_NUMBER.""".stripMargin,
- postCustomerPhoneNumberJsonV400, customerJsonV310,
+ s"""Gets the Customers specified by MOBILE_PHONE_NUMBER.
+ |
+ |There are two wildcards often used in conjunction with the LIKE operator:
+ | % - The percent sign represents zero, one, or multiple characters
+ | _ - The underscore represents a single character
+ |For example {"customer_phone_number":"%381%"} lists all numbers which contain 381 sequence
+ |
+ |""",
+ postCustomerPhoneNumberJsonV400,
+ customerJsonV310,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCustomer),
Some(List(canGetCustomersAtOneBank)),
- http4sPartialFunction = Some(getCustomersByCustomerPhoneNumber))
+ http4sPartialFunction = Some(getCustomersByCustomerPhoneNumber)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomersAtAnyBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomersAtAnyBank),
+ "GET",
"/customers",
"Get Customers at Any Bank",
- s"""Get Customers at Any Bank.""".stripMargin,
- EmptyBody, customersJsonV300,
+ s"""Get Customers at Any Bank.
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customersJsonV300,
List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
List(apiTagCustomer, apiTagUser),
Some(List(canGetCustomersAtAllBanks)),
- http4sPartialFunction = Some(getCustomersAtAnyBank))
+ http4sPartialFunction = Some(getCustomersAtAnyBank)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomersMinimalAtAnyBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomersMinimalAtAnyBank),
+ "GET",
"/customers-minimal",
"Get Customers Minimal at Any Bank",
- s"""Get Customers Minimal at Any Bank.""".stripMargin,
- EmptyBody, customersMinimalJsonV300,
+ s"""Get Customers Minimal at Any Bank.
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customersMinimalJsonV300,
List(AuthenticatedUserIsRequired, UserCustomerLinksNotFoundForUser, UnknownError),
List(apiTagCustomer, apiTagUser),
Some(List(canGetCustomersMinimalAtAllBanks)),
- http4sPartialFunction = Some(getCustomersMinimalAtAnyBank))
+ http4sPartialFunction = Some(getCustomersMinimalAtAnyBank)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserInvitation), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserInvitation),
+ "GET",
"/banks/BANK_ID/user-invitations/SECRET_LINK",
"Get User Invitation",
- s"""Get User Invitation
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userInvitationJsonV400,
+ s""" Get User Invitation
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ userInvitationJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagUserInvitation),
Some(List(canGetUserInvitation)),
- http4sPartialFunction = Some(getUserInvitation))
+ http4sPartialFunction = Some(getUserInvitation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserInvitations), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserInvitations),
+ "GET",
"/banks/BANK_ID/user-invitations",
"Get User Invitations",
- s"""Get User Invitations
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userInvitationJsonV400,
+ s""" Get User Invitations
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ userInvitationJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagUserInvitation),
Some(List(canGetUserInvitation)),
- http4sPartialFunction = Some(getUserInvitations))
+ http4sPartialFunction = Some(getUserInvitations)
+ )
}
initBatch5ResourceDocs()
@@ -5202,165 +6452,333 @@ object Http4s400 {
private def initBatch4ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsentInfosByBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsentInfosByBank),
+ "GET",
"/banks/BANK_ID/my/consent-infos",
"Get My Consents Info At Bank",
- s"""This endpoint gets the Consents that the current User created at bank.""".stripMargin,
- EmptyBody, consentInfosJsonV400,
+ s"""
+ |
+ |This endpoint gets the Consents that the current User created at bank.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ consentInfosJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
- List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(getConsentInfosByBank))
+ List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getConsentInfosByBank)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConsentInfos), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConsentInfos),
+ "GET",
"/my/consent-infos",
"Get My Consents Info",
- s"""This endpoint gets the Consents that the current User created.""".stripMargin,
- EmptyBody, consentInfosJsonV400,
+ s"""
+ |
+ |This endpoint gets the Consents that the current User created.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ consentInfosJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
- List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2), None,
- http4sPartialFunction = Some(getConsentInfos))
+ List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2),
+ None,
+ http4sPartialFunction = Some(getConsentInfos)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyApiCollectionByName), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyApiCollectionByName),
+ "GET",
"/my/api-collections/name/API_COLLECTION_NAME",
"Get My Api Collection By Name",
- s"""Get Api Collection By API_COLLECTION_NAME.""".stripMargin,
- EmptyBody, apiCollectionJson400,
+ s"""Get Api Collection By API_COLLECTION_NAME.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionJson400,
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getMyApiCollectionByName))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getMyApiCollectionByName)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyApiCollectionById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyApiCollectionById),
+ "GET",
"/my/api-collections/API_COLLECTION_ID",
"Get My Api Collection By Id",
- s"""Get Api Collection By API_COLLECTION_ID.""".stripMargin,
- EmptyBody, apiCollectionJson400,
+ s"""Get Api Collection By API_COLLECTION_ID.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionJson400,
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getMyApiCollectionById))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getMyApiCollectionById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getSharableApiCollectionById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getSharableApiCollectionById),
+ "GET",
"/api-collections/sharable/API_COLLECTION_ID",
"Get Sharable Api Collection By Id",
- s"""Get Sharable Api Collection By Id.""".stripMargin,
- EmptyBody, apiCollectionJson400,
+ s"""Get Sharable Api Collection By Id.
+ |${userAuthenticationMessage(false)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionJson400,
List(UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getSharableApiCollectionById))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getSharableApiCollectionById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getApiCollectionsForUser), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getApiCollectionsForUser),
+ "GET",
"/users/USER_ID/api-collections",
"Get Api Collections for User",
- s"""Get Api Collections for User.""".stripMargin,
- EmptyBody, apiCollectionsJson400,
+ s"""Get Api Collections for User.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionsJson400,
List(UserNotFoundByUserId, UnknownError),
List(apiTagApiCollection),
Some(canGetApiCollectionsForUser :: Nil),
- http4sPartialFunction = Some(getApiCollectionsForUser))
+ http4sPartialFunction = Some(getApiCollectionsForUser)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getFeaturedApiCollections), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getFeaturedApiCollections),
+ "GET",
"/api-collections/featured",
"Get Featured Api Collections",
- s"""Get Featured Api Collections.""".stripMargin,
- EmptyBody, apiCollectionsJson400,
+ s"""Get Featured Api Collections.
+ |
+ |${userAuthenticationMessage(false)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionsJson400,
List(UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getFeaturedApiCollections))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getFeaturedApiCollections)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyApiCollections), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyApiCollections),
+ "GET",
"/my/api-collections",
"Get My Api Collections",
- s"""Get all the apiCollections for logged in user.""".stripMargin,
- EmptyBody, apiCollectionsJson400,
+ s"""Get all the apiCollections for logged in user.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |1 limit (for pagination: defaults to 50) eg:limit=200
+ |
+ |2 offset (for pagination: zero index, defaults to 0) eg: offset=10
+ |
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionsJson400,
List($AuthenticatedUserIsRequired, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getMyApiCollections))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getMyApiCollections)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyApiCollectionEndpoint), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyApiCollectionEndpoint),
+ "GET",
"/my/api-collections/API_COLLECTION_NAME/api-collection-endpoints/OPERATION_ID",
"Get My Api Collection Endpoint",
- s"""Get Api Collection Endpoint By OPERATION_ID.""".stripMargin,
- EmptyBody, apiCollectionEndpointJson400,
+ s"""Get Api Collection Endpoint By API_COLLECTION_NAME and OPERATION_ID.
+ |
+ |${userAuthenticationMessage(false)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionEndpointJson400,
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getMyApiCollectionEndpoint))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getMyApiCollectionEndpoint)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getApiCollectionEndpoints), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getApiCollectionEndpoints),
+ "GET",
"/api-collections/API_COLLECTION_ID/api-collection-endpoints",
"Get Api Collection Endpoints",
- s"""Get Api Collection Endpoints By API_COLLECTION_ID.""".stripMargin,
- EmptyBody, apiCollectionEndpointsJson400,
+ s"""Get Api Collection Endpoints By API_COLLECTION_ID.
+ |
+ |${userAuthenticationMessage(false)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionEndpointsJson400,
List($AuthenticatedUserIsRequired, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getApiCollectionEndpoints))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getApiCollectionEndpoints)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyApiCollectionEndpoints), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyApiCollectionEndpoints),
+ "GET",
"/my/api-collections/API_COLLECTION_NAME/api-collection-endpoints",
"Get My Api Collection Endpoints",
- s"""Get Api Collection Endpoints By API_COLLECTION_NAME.""".stripMargin,
- EmptyBody, apiCollectionEndpointsJson400,
+ s"""Get Api Collection Endpoints By API_COLLECTION_NAME.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionEndpointsJson400,
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getMyApiCollectionEndpoints))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getMyApiCollectionEndpoints)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyApiCollectionEndpointsById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyApiCollectionEndpointsById),
+ "GET",
"/my/api-collection-ids/API_COLLECTION_ID/api-collection-endpoints",
"Get My Api Collection Endpoints By Id",
- s"""Get Api Collection Endpoints By API_COLLECTION_ID.""".stripMargin,
- EmptyBody, apiCollectionEndpointsJson400,
+ s"""Get Api Collection Endpoints By API_COLLECTION_ID.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ apiCollectionEndpointsJson400,
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(getMyApiCollectionEndpointsById))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(getMyApiCollectionEndpointsById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteMyApiCollection), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteMyApiCollection),
+ "DELETE",
"/my/api-collections/API_COLLECTION_ID",
"Delete My Api Collection",
- s"""Delete Api Collection By API_COLLECTION_ID.""".stripMargin,
- EmptyBody, Full(true),
+ s"""Delete Api Collection By API_COLLECTION_ID
+ |
+ |${Glossary.getGlossaryItem("API Collections")}
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |
+ |
+ |""",
+ EmptyBody,
+ Full(true),
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(deleteMyApiCollection))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(deleteMyApiCollection)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteMyApiCollectionEndpoint), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteMyApiCollectionEndpoint),
+ "DELETE",
"/my/api-collections/API_COLLECTION_NAME/api-collection-endpoints/OPERATION_ID",
"Delete My Api Collection Endpoint",
- s"""Delete Api Collection Endpoint By OPERATION_ID.""".stripMargin,
- EmptyBody, Full(true),
+ s"""${Glossary.getGlossaryItem("API Collections")}
+ |
+ |
+ |Delete Api Collection Endpoint By OPERATION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ Full(true),
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(deleteMyApiCollectionEndpoint))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(deleteMyApiCollectionEndpoint)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteMyApiCollectionEndpointByOperationId), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteMyApiCollectionEndpointByOperationId),
+ "DELETE",
"/my/api-collection-ids/API_COLLECTION_ID/api-collection-endpoints/OPERATION_ID",
"Delete My Api Collection Endpoint By Id",
- s"""Delete Api Collection Endpoint By OPERATION_ID.""".stripMargin,
- EmptyBody, Full(true),
+ s"""${Glossary.getGlossaryItem("API Collections")}
+ |
+ |Delete Api Collection Endpoint By OPERATION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ Full(true),
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(deleteMyApiCollectionEndpointByOperationId))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(deleteMyApiCollectionEndpointByOperationId)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteMyApiCollectionEndpointById), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteMyApiCollectionEndpointById),
+ "DELETE",
"/my/api-collection-ids/API_COLLECTION_ID/api-collection-endpoint-ids/API_COLLECTION_ENDPOINT_ID",
"Delete My Api Collection Endpoint By Id",
- s"""Delete Api Collection Endpoint By Id.""".stripMargin,
- EmptyBody, Full(true),
+ s"""${Glossary.getGlossaryItem("API Collections")}
+ |Delete Api Collection Endpoint
+ |Delete Api Collection Endpoint By Id
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ Full(true),
List($AuthenticatedUserIsRequired, UserNotFoundByUserId, UnknownError),
- List(apiTagApiCollection), None,
- http4sPartialFunction = Some(deleteMyApiCollectionEndpointById))
+ List(apiTagApiCollection),
+ None,
+ http4sPartialFunction = Some(deleteMyApiCollectionEndpointById)
+ )
}
initBatch4ResourceDocs()
@@ -5602,173 +7020,270 @@ object Http4s400 {
private def initBatch3ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteTransactionAttributeDefinition), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteTransactionAttributeDefinition),
+ "DELETE",
"/banks/BANK_ID/attribute-definitions/ATTRIBUTE_DEFINITION_ID/transaction",
"Delete Transaction Attribute Definition",
- s"""Delete Transaction Attribute Definition by ATTRIBUTE_DEFINITION_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Transaction Attribute Definition by ATTRIBUTE_DEFINITION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canDeleteTransactionAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(deleteTransactionAttributeDefinition))
+ http4sPartialFunction = Some(deleteTransactionAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCustomerAttributeDefinition), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCustomerAttributeDefinition),
+ "DELETE",
"/banks/BANK_ID/attribute-definitions/ATTRIBUTE_DEFINITION_ID/customer",
"Delete Customer Attribute Definition",
- s"""Delete Customer Attribute Definition by ATTRIBUTE_DEFINITION_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Customer Attribute Definition by ATTRIBUTE_DEFINITION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canDeleteCustomerAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(deleteCustomerAttributeDefinition))
+ http4sPartialFunction = Some(deleteCustomerAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteAccountAttributeDefinition), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteAccountAttributeDefinition),
+ "DELETE",
"/banks/BANK_ID/attribute-definitions/ATTRIBUTE_DEFINITION_ID/account",
"Delete Account Attribute Definition",
- s"""Delete Account Attribute Definition by ATTRIBUTE_DEFINITION_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Account Attribute Definition by ATTRIBUTE_DEFINITION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagAccount, apiTagAccountAttribute, apiTagAttribute),
Some(List(canDeleteAccountAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(deleteAccountAttributeDefinition))
+ http4sPartialFunction = Some(deleteAccountAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteProductAttributeDefinition), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteProductAttributeDefinition),
+ "DELETE",
"/banks/BANK_ID/attribute-definitions/ATTRIBUTE_DEFINITION_ID/product",
"Delete Product Attribute Definition",
- s"""Delete Product Attribute Definition by ATTRIBUTE_DEFINITION_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Product Attribute Definition by ATTRIBUTE_DEFINITION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canDeleteProductAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(deleteProductAttributeDefinition))
+ http4sPartialFunction = Some(deleteProductAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCardAttributeDefinition), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCardAttributeDefinition),
+ "DELETE",
"/banks/BANK_ID/attribute-definitions/ATTRIBUTE_DEFINITION_ID/card",
"Delete Card Attribute Definition",
- s"""Delete Card Attribute Definition by ATTRIBUTE_DEFINITION_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Card Attribute Definition by ATTRIBUTE_DEFINITION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCard, apiTagCardAttribute, apiTagAttribute),
Some(List(canDeleteCardAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(deleteCardAttributeDefinition))
+ http4sPartialFunction = Some(deleteCardAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteTransactionRequestAttributeDefinition), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteTransactionRequestAttributeDefinition),
+ "DELETE",
"/banks/BANK_ID/attribute-definitions/ATTRIBUTE_DEFINITION_ID/transaction-request",
"Delete Transaction Request Attribute Definition",
- s"""Delete Transaction Request Attribute Definition by ATTRIBUTE_DEFINITION_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, Full(true),
+ s""" Delete Transaction Request Attribute Definition by ATTRIBUTE_DEFINITION_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ Full(true),
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagTransactionRequest, apiTagTransactionRequestAttribute, apiTagAttribute),
Some(List(canDeleteTransactionRequestAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(deleteTransactionRequestAttributeDefinition))
+ http4sPartialFunction = Some(deleteTransactionRequestAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteUser), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteUser),
+ "DELETE",
"/users/USER_ID",
"Delete a User",
s"""Delete a User.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagUser),
Some(List(canDeleteUser)),
- http4sPartialFunction = Some(deleteUser))
+ http4sPartialFunction = Some(deleteUser)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteUserCustomerLink), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteUserCustomerLink),
+ "DELETE",
"/banks/BANK_ID/user_customer_links/USER_CUSTOMER_LINK_ID",
- "Delete User Customer Link",
- s"""Delete User Customer Link by USER_CUSTOMER_LINK_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ "Delete User Customer Link",
+ s""" Delete User Customer Link by USER_CUSTOMER_LINK_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UserHasMissingRoles, UnknownError),
List(apiTagCustomer),
Some(List(canDeleteUserCustomerLink)),
- http4sPartialFunction = Some(deleteUserCustomerLink))
+ http4sPartialFunction = Some(deleteUserCustomerLink)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteTransactionCascade), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteTransactionCascade),
+ "DELETE",
"/management/cascading/banks/BANK_ID/accounts/ACCOUNT_ID/transactions/TRANSACTION_ID",
"Delete Transaction Cascade",
s"""Delete a Transaction Cascade specified by TRANSACTION_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, UserHasMissingRoles, UnknownError),
List(apiTagTransaction),
Some(List(canDeleteTransactionCascade)),
- http4sPartialFunction = Some(deleteTransactionCascade))
+ http4sPartialFunction = Some(deleteTransactionCascade)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteAccountCascade), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteAccountCascade),
+ "DELETE",
"/management/cascading/banks/BANK_ID/accounts/ACCOUNT_ID",
"Delete Account Cascade",
s"""Delete an Account Cascade specified by ACCOUNT_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, UserHasMissingRoles, UnknownError),
List(apiTagAccount),
Some(List(canDeleteAccountCascade)),
- http4sPartialFunction = Some(deleteAccountCascade))
+ http4sPartialFunction = Some(deleteAccountCascade)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankCascade), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankCascade),
+ "DELETE",
"/management/cascading/banks/BANK_ID",
"Delete Bank Cascade",
s"""Delete a Bank Cascade specified by BANK_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, UserHasMissingRoles, UnknownError),
List(apiTagBank),
Some(List(canDeleteBankCascade)),
- http4sPartialFunction = Some(deleteBankCascade))
+ http4sPartialFunction = Some(deleteBankCascade)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteProductCascade), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteProductCascade),
+ "DELETE",
"/management/cascading/banks/BANK_ID/products/PRODUCT_CODE",
"Delete Product Cascade",
s"""Delete a Product Cascade specified by PRODUCT_CODE.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, UserHasMissingRoles, UnknownError),
List(apiTagProduct),
Some(List(canDeleteProductCascade)),
- http4sPartialFunction = Some(deleteProductCascade))
+ http4sPartialFunction = Some(deleteProductCascade)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCustomerCascade), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCustomerCascade),
+ "DELETE",
"/management/cascading/banks/BANK_ID/customers/CUSTOMER_ID",
"Delete Customer Cascade",
s"""Delete a Customer Cascade specified by CUSTOMER_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ |
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, $BankNotFound, CustomerNotFoundByCustomerId, UserHasMissingRoles, UnknownError),
List(apiTagCustomer),
Some(List(canDeleteCustomerCascade)),
- http4sPartialFunction = Some(deleteCustomerCascade))
+ http4sPartialFunction = Some(deleteCustomerCascade)
+ )
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, nameOf(deleteSystemLevelEndpointTag), "DELETE",
@@ -5793,52 +7308,86 @@ object Http4s400 {
http4sPartialFunction = Some(deleteBankLevelEndpointTag))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteAuthenticationTypeValidation), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteAuthenticationTypeValidation),
+ "DELETE",
"/management/authentication-type-validations/OPERATION_ID",
"Delete an Authentication Type Validation",
- s"""Delete an Authentication Type Validation by operation_id.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete an Authentication Type Validation by operation_id.
+ |
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagAuthenticationTypeValidation),
Some(List(canDeleteAuthenticationValidation)),
- http4sPartialFunction = Some(deleteAuthenticationTypeValidation))
+ http4sPartialFunction = Some(deleteAuthenticationTypeValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteJsonSchemaValidation), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteJsonSchemaValidation),
+ "DELETE",
"/management/json-schema-validations/OPERATION_ID",
"Delete a JSON Schema Validation",
- s"""Delete a JSON Schema Validation by operation_id.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a JSON Schema Validation by operation_id.
+ |
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagJsonSchemaValidation),
Some(List(canDeleteJsonSchemaValidation)),
- http4sPartialFunction = Some(deleteJsonSchemaValidation))
+ http4sPartialFunction = Some(deleteJsonSchemaValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteCustomerAttribute), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteCustomerAttribute),
+ "DELETE",
"/banks/BANK_ID/customers/attributes/CUSTOMER_ATTRIBUTE_ID",
"Delete Customer Attribute",
- s"""Delete Customer Attribute.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Customer Attribute
+ |
+ |$customerAttributeGeneralInfo
+ |
+ |Delete a Customer Attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(UserHasMissingRoles, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canDeleteCustomerAttributeAtOneBank, canDeleteCustomerAttributeAtAnyBank)),
- http4sPartialFunction = Some(deleteCustomerAttribute))
+ http4sPartialFunction = Some(deleteCustomerAttribute)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankAttribute), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankAttribute),
+ "DELETE",
"/banks/BANK_ID/attributes/BANK_ATTRIBUTE_ID",
"Delete Bank Attribute",
- s"""Delete Bank Attribute.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, EmptyBody,
+ s""" Delete Bank Attribute
+ |
+ |Delete a Bank Attribute by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ EmptyBody,
List(UserHasMissingRoles, BankNotFound, UnknownError),
List(apiTagBank, apiTagBankAttribute, apiTagAttribute),
Some(List(canDeleteBankAttribute)),
- http4sPartialFunction = Some(deleteBankAttribute))
+ http4sPartialFunction = Some(deleteBankAttribute)
+ )
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, nameOf(deleteAtm), "DELETE",
@@ -5852,37 +7401,60 @@ object Http4s400 {
http4sPartialFunction = Some(deleteAtm))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteProductFee), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteProductFee),
+ "DELETE",
"/banks/BANK_ID/products/PRODUCT_CODE/fees/PRODUCT_FEE_ID",
"Delete Product Fee",
- s"""Delete Product Fee.""",
- EmptyBody, EmptyBody,
+ s"""Delete Product Fee
+ |
+ |Delete one product fee by its id.
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List(UserHasMissingRoles, UnknownError),
List(apiTagProduct),
Some(List(canDeleteProductFee)),
- http4sPartialFunction = Some(deleteProductFee))
+ http4sPartialFunction = Some(deleteProductFee)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteEndpointMapping), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteEndpointMapping),
+ "DELETE",
"/management/endpoint-mappings/ENDPOINT_MAPPING_ID",
"Delete Endpoint Mapping",
- s"""Delete a Endpoint Mapping.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a Endpoint Mapping.
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagEndpointMapping),
Some(List(canDeleteEndpointMapping)),
- http4sPartialFunction = Some(deleteEndpointMapping))
+ http4sPartialFunction = Some(deleteEndpointMapping)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankLevelEndpointMapping), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankLevelEndpointMapping),
+ "DELETE",
"/management/banks/BANK_ID/endpoint-mappings/ENDPOINT_MAPPING_ID",
"Delete Bank Level Endpoint Mapping",
- s"""Delete a Bank Level Endpoint Mapping.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a Bank Level Endpoint Mapping.
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagEndpointMapping),
Some(List(canDeleteBankLevelEndpointMapping, canDeleteEndpointMapping)),
- http4sPartialFunction = Some(deleteBankLevelEndpointMapping))
+ http4sPartialFunction = Some(deleteBankLevelEndpointMapping)
+ )
}
initBatch3ResourceDocs()
@@ -6106,339 +7678,522 @@ object Http4s400 {
private def initBatch2ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getEntitlementsForBank), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getEntitlementsForBank),
+ "GET",
"/banks/BANK_ID/entitlements",
"Get Entitlements for One Bank",
- s"""${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, entitlementsJsonV400,
+ s"""
+ |
+ """.stripMargin,
+ EmptyBody,
+ entitlementsJsonV400,
List($AuthenticatedUserIsRequired, BankNotFound, UserHasMissingRoles, UnknownError),
List(apiTagRole, apiTagEntitlement, apiTagUser, apiTagBank),
Some(List(canGetEntitlementsForOneBank, canGetEntitlementsForAnyBank)),
- http4sPartialFunction = Some(getEntitlementsForBank))
+ http4sPartialFunction = Some(getEntitlementsForBank)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMyPersonalUserAttributes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMyPersonalUserAttributes),
+ "GET",
"/my/user/attributes",
"Get my personal User Attributes",
- s"""Get my personal User Attributes
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userAttributesResponseJson,
+ s"""Get My Personal User Attributes.
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ userAttributesResponseJson,
List($AuthenticatedUserIsRequired, UnknownError),
- List(apiTagUser), None,
- http4sPartialFunction = Some(getMyPersonalUserAttributes))
+ List(apiTagUser),
+ None,
+ http4sPartialFunction = Some(getMyPersonalUserAttributes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserWithAttributes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserWithAttributes),
+ "GET",
"/users/USER_ID/attributes",
"Get User with Attributes by USER_ID",
s"""Get User Attributes for the user defined via USER_ID.
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userWithAttributesResponseJson,
+ |
+ |${userAuthenticationMessage(true)}
+ |""".stripMargin,
+ EmptyBody,
+ userWithAttributesResponseJson,
List($AuthenticatedUserIsRequired, UnknownError),
List(apiTagUser),
Some(canGetUsersWithAttributes :: Nil),
- http4sPartialFunction = Some(getUserWithAttributes))
+ http4sPartialFunction = Some(getUserWithAttributes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerAttributes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerAttributes),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID/attributes",
"Get Customer Attributes",
- s"""Get Customer Attributes
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, customerAttributesResponseJson,
+ s""" Get Customer Attributes
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customerAttributesResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canGetCustomerAttributesAtOneBank, canGetCustomerAttributesAtAnyBank)),
- http4sPartialFunction = Some(getCustomerAttributes))
+ http4sPartialFunction = Some(getCustomerAttributes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerAttributeById), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerAttributeById),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID/attributes/ATTRIBUTE_ID",
"Get Customer Attribute By Id",
- s"""Get Customer Attribute By Id
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, customerAttributeResponseJson,
+ s""" Get Customer Attribute By Id
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customerAttributeResponseJson,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canGetCustomerAttributeAtOneBank, canGetCustomerAttributeAtAnyBank)),
- http4sPartialFunction = Some(getCustomerAttributeById))
+ http4sPartialFunction = Some(getCustomerAttributeById)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getProductAttributeDefinition), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getProductAttributeDefinition),
+ "GET",
"/banks/BANK_ID/attribute-definitions/product",
"Get Product Attribute Definition",
- s"""Get Product Attribute Definition
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, productAttributeDefinitionsResponseJsonV400,
+ s""" Get Product Attribute Definition
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ productAttributeDefinitionsResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagProduct, apiTagProductAttribute, apiTagAttribute),
Some(List(canGetProductAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(getProductAttributeDefinition))
+ http4sPartialFunction = Some(getProductAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerAttributeDefinition), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerAttributeDefinition),
+ "GET",
"/banks/BANK_ID/attribute-definitions/customer",
"Get Customer Attribute Definition",
- s"""Get Customer Attribute Definition
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, customerAttributeDefinitionsResponseJsonV400,
+ s""" Get Customer Attribute Definition
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customerAttributeDefinitionsResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCustomer, apiTagCustomerAttribute, apiTagAttribute),
Some(List(canGetCustomerAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(getCustomerAttributeDefinition))
+ http4sPartialFunction = Some(getCustomerAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAccountAttributeDefinition), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAccountAttributeDefinition),
+ "GET",
"/banks/BANK_ID/attribute-definitions/account",
"Get Account Attribute Definition",
- s"""Get Account Attribute Definition
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, accountAttributeDefinitionsResponseJsonV400,
+ s""" Get Account Attribute Definition
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ accountAttributeDefinitionsResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagAccount, apiTagAccountAttribute, apiTagAttribute),
Some(List(canGetAccountAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(getAccountAttributeDefinition))
+ http4sPartialFunction = Some(getAccountAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getTransactionAttributeDefinition), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getTransactionAttributeDefinition),
+ "GET",
"/banks/BANK_ID/attribute-definitions/transaction",
"Get Transaction Attribute Definition",
- s"""Get Transaction Attribute Definition
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, transactionAttributeDefinitionsResponseJsonV400,
+ s""" Get Transaction Attribute Definition
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ transactionAttributeDefinitionsResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagTransaction, apiTagTransactionAttribute, apiTagAttribute),
Some(List(canGetTransactionAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(getTransactionAttributeDefinition))
+ http4sPartialFunction = Some(getTransactionAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCardAttributeDefinition), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCardAttributeDefinition),
+ "GET",
"/banks/BANK_ID/attribute-definitions/card",
"Get Card Attribute Definition",
- s"""Get Card Attribute Definition
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, cardAttributeDefinitionsResponseJsonV400,
+ s""" Get Card Attribute Definition
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ cardAttributeDefinitionsResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCard, apiTagCardAttribute, apiTagAttribute),
Some(List(canGetCardAttributeDefinitionAtOneBank)),
- http4sPartialFunction = Some(getCardAttributeDefinition))
+ http4sPartialFunction = Some(getCardAttributeDefinition)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getJsonSchemaValidation), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getJsonSchemaValidation),
+ "GET",
"/management/json-schema-validations/OPERATION_ID",
"Get a JSON Schema Validation",
- s"""Get a JSON Schema Validation by operation_id.""",
- EmptyBody, responseJsonSchema,
+ s"""Get a JSON Schema Validation by operation_id.
+ |
+ |""",
+ EmptyBody,
+ responseJsonSchema,
List(InvalidJsonFormat, UnknownError),
List(apiTagJsonSchemaValidation),
Some(List(canGetJsonSchemaValidation)),
- http4sPartialFunction = Some(getJsonSchemaValidation))
+ http4sPartialFunction = Some(getJsonSchemaValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllJsonSchemaValidations), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllJsonSchemaValidations),
+ "GET",
"/management/json-schema-validations",
"Get all JSON Schema Validations",
- s"""Get all JSON Schema Validations.""",
+ s"""Get all JSON Schema Validations.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("json_schema_validations", responseJsonSchema :: Nil),
+ ListResult("json_schema_validations", responseJsonSchema :: Nil),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagJsonSchemaValidation),
Some(List(canGetJsonSchemaValidation)),
- http4sPartialFunction = Some(getAllJsonSchemaValidations))
+ http4sPartialFunction = Some(getAllJsonSchemaValidations)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAuthenticationTypeValidation), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAuthenticationTypeValidation),
+ "GET",
"/management/authentication-type-validations/OPERATION_ID",
"Get an Authentication Type Validation",
- s"""Get an Authentication Type Validation by operation_id.""",
- EmptyBody, JsonAuthTypeValidation("OBPv4.0.0-updateXxx", List.empty),
+ s"""Get an Authentication Type Validation by operation_id.
+ |
+ |""",
+ EmptyBody,
+ JsonAuthTypeValidation("OBPv4.0.0-updateXxx", allowedAuthTypes),
List(InvalidJsonFormat, UnknownError),
List(apiTagAuthenticationTypeValidation),
Some(List(canGetAuthenticationTypeValidation)),
- http4sPartialFunction = Some(getAuthenticationTypeValidation))
+ http4sPartialFunction = Some(getAuthenticationTypeValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllAuthenticationTypeValidations), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllAuthenticationTypeValidations),
+ "GET",
"/management/authentication-type-validations",
"Get all Authentication Type Validations",
- s"""Get all Authentication Type Validations.""",
+ s"""Get all Authentication Type Validations.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult(
+ ListResult(
"authentication_types_validations",
- List(JsonAuthTypeValidation("OBPv4.0.0-updateXxx", List.empty))),
+ List(JsonAuthTypeValidation("OBPv4.0.0-updateXxx", allowedAuthTypes))
+ ),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagAuthenticationTypeValidation),
Some(List(canGetAuthenticationTypeValidation)),
- http4sPartialFunction = Some(getAllAuthenticationTypeValidations))
+ http4sPartialFunction = Some(getAllAuthenticationTypeValidations)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getConnectorMethod), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getConnectorMethod),
+ "GET",
"/management/connector-methods/CONNECTOR_METHOD_ID",
"Get Connector Method by Id",
- s"""Get an internal connector by CONNECTOR_METHOD_ID.""",
- EmptyBody, jsonScalaConnectorMethod,
+ s"""Get an internal connector by CONNECTOR_METHOD_ID.
+ |
+ |""",
+ EmptyBody,
+ jsonScalaConnectorMethod,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagConnectorMethod),
Some(List(canGetConnectorMethod)),
- http4sPartialFunction = Some(getConnectorMethod))
+ http4sPartialFunction = Some(getConnectorMethod)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllConnectorMethods), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllConnectorMethods),
+ "GET",
"/management/connector-methods",
"Get all Connector Methods",
- s"""Get all Connector Methods.""",
+ s"""Get all Connector Methods.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("connectors_methods", jsonScalaConnectorMethod :: Nil),
+ ListResult("connectors_methods", jsonScalaConnectorMethod :: Nil),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagConnectorMethod),
Some(List(canGetAllConnectorMethods)),
- http4sPartialFunction = Some(getAllConnectorMethods))
+ http4sPartialFunction = Some(getAllConnectorMethods)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserCustomerLinksByUserId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserCustomerLinksByUserId),
+ "GET",
"/banks/BANK_ID/user_customer_links/users/USER_ID",
"Get User Customer Links by User",
- s"""Get User Customer Links by USER_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userCustomerLinksJson,
+ s""" Get User Customer Links by USER_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ userCustomerLinksJson,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCustomer),
Some(List(canGetUserCustomerLink)),
- http4sPartialFunction = Some(getUserCustomerLinksByUserId))
+ http4sPartialFunction = Some(getUserCustomerLinksByUserId)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getUserCustomerLinksByCustomerId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getUserCustomerLinksByCustomerId),
+ "GET",
"/banks/BANK_ID/user_customer_links/customers/CUSTOMER_ID",
"Get User Customer Links by Customer",
- s"""Get User Customer Links by CUSTOMER_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userCustomerLinksJson,
+ s""" Get User Customer Links by CUSTOMER_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ userCustomerLinksJson,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagCustomer),
Some(List(canGetUserCustomerLink)),
- http4sPartialFunction = Some(getUserCustomerLinksByCustomerId))
+ http4sPartialFunction = Some(getUserCustomerLinksByCustomerId)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCustomerMessages), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCustomerMessages),
+ "GET",
"/banks/BANK_ID/customers/CUSTOMER_ID/messages",
"Get Messages for Customer",
- s"""Get messages for the logged in customer
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, customerMessagesJson,
+ s"""Get messages for the customer specified by CUSTOMER_ID
+ ${userAuthenticationMessage(true)}
+ """,
+ EmptyBody,
+ customerMessagesJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UnknownError),
List(apiTagMessage, apiTagCustomer),
Some(List(canGetCustomerMessages)),
- http4sPartialFunction = Some(getCustomerMessages))
+ http4sPartialFunction = Some(getCustomerMessages)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createCustomerMessage), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createCustomerMessage),
+ "POST",
"/banks/BANK_ID/customers/CUSTOMER_ID/messages",
"Create Customer Message",
- s"""Create a message for the customer specified by CUSTOMER_ID
- |${userAuthenticationMessage(true)}""".stripMargin,
- createMessageJsonV400, successMessage,
+ s"""
+ |Create a message for the customer specified by CUSTOMER_ID
+ |${userAuthenticationMessage(true)}
+ |
+ |""".stripMargin,
+ createMessageJsonV400,
+ successMessage,
List($AuthenticatedUserIsRequired, $BankNotFound),
List(apiTagMessage, apiTagCustomer, apiTagPerson),
Some(List(canCreateCustomerMessage)),
- http4sPartialFunction = Some(createCustomerMessage))
+ http4sPartialFunction = Some(createCustomerMessage)
+ )
}
initBatch2ResourceDocs()
private def initBatch1ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCallContext), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCallContext),
+ "GET",
"/development/call_context",
"Get the Call Context of a current call",
- s"""Get the Call Context of the current call.""",
- EmptyBody, EmptyBody,
+ s"""Get the Call Context of the current call.
+ |
+ """.stripMargin,
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, UnknownError),
List(apiTagApi),
Some(List(canGetCallContext)),
- http4sPartialFunction = Some(getCallContext))
+ http4sPartialFunction = Some(getCallContext)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(verifyRequestSignResponse), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(verifyRequestSignResponse),
+ "GET",
"/development/echo/jws-verified-request-jws-signed-response",
"Verify Request and Sign Response of a current call",
- s"""Verify Request and Sign Response of a current call.""",
- EmptyBody, EmptyBody,
+ s"""Verify Request and Sign Response of a current call.
+ |
+ """.stripMargin,
+ EmptyBody,
+ EmptyBody,
List($AuthenticatedUserIsRequired, UnknownError),
List(apiTagApi),
Some(Nil),
- http4sPartialFunction = Some(verifyRequestSignResponse))
+ http4sPartialFunction = Some(verifyRequestSignResponse)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getCurrentUserId), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getCurrentUserId),
+ "GET",
"/users/current/user_id",
"Get User Id (Current)",
s"""Get the USER_ID of the logged in user
|
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, userIdJsonV400,
+ |${userAuthenticationMessage(true)}
+ """.stripMargin,
+ EmptyBody,
+ userIdJsonV400,
List(AuthenticatedUserIsRequired, UnknownError),
- List(apiTagUser), None,
- http4sPartialFunction = Some(getCurrentUserId))
+ List(apiTagUser),
+ None,
+ http4sPartialFunction = Some(getCurrentUserId)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getScannedApiVersions), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getScannedApiVersions),
+ "GET",
"/api/versions",
"Get scanned API Versions",
s"""Get all the scanned API Versions.""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("scanned_api_versions",
- List(net.liftweb.json.Extraction.decompose(ApiVersion.v3_1_0))),
+ ListResult(
+ "scanned_api_versions",
+ List(Extraction.decompose(ApiVersion.v3_1_0))
+ ),
List(UnknownError),
List(apiTagDocumentation, apiTagApi),
Some(Nil),
- http4sPartialFunction = Some(getScannedApiVersions))
+ http4sPartialFunction = Some(getScannedApiVersions)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getMySpaces), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getMySpaces),
+ "GET",
"/my/spaces",
"Get My Spaces",
s"""Get My Spaces.""",
- EmptyBody, code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.mySpaces,
+ EmptyBody,
+ mySpaces,
List($AuthenticatedUserIsRequired, UnknownError),
- List(apiTagUser), None,
- http4sPartialFunction = Some(getMySpaces))
+ List(apiTagUser),
+ None,
+ http4sPartialFunction = Some(getMySpaces)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankAttributes), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankAttributes),
+ "GET",
"/banks/BANK_ID/attributes",
"Get Bank Attributes",
- s"""Get Bank Attributes
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, bankAttributesResponseJsonV400,
+ s""" Get Bank Attributes
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ bankAttributesResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagBank, apiTagBankAttribute, apiTagAttribute),
Some(List(canGetBankAttribute)),
- http4sPartialFunction = Some(getBankAttributes))
+ http4sPartialFunction = Some(getBankAttributes)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankAttribute), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankAttribute),
+ "GET",
"/banks/BANK_ID/attributes/BANK_ATTRIBUTE_ID",
"Get Bank Attribute By BANK_ATTRIBUTE_ID",
- s"""Get Bank Attribute By BANK_ATTRIBUTE_ID
- |
- |${userAuthenticationMessage(true)}""".stripMargin,
- EmptyBody, bankAttributeResponseJsonV400,
+ s""" Get Bank Attribute By BANK_ATTRIBUTE_ID
+ |
+ |${userAuthenticationMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ bankAttributeResponseJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, InvalidJsonFormat, UnknownError),
List(apiTagBank, apiTagBankAttribute, apiTagAttribute),
Some(List(canGetBankAttribute)),
- http4sPartialFunction = Some(getBankAttribute))
+ http4sPartialFunction = Some(getBankAttribute)
+ )
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, nameOf(getSystemLevelEndpointTags), "GET",
@@ -6463,50 +8218,82 @@ object Http4s400 {
http4sPartialFunction = Some(getBankLevelEndpointTags))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getEndpointMapping), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getEndpointMapping),
+ "GET",
"/management/endpoint-mappings/ENDPOINT_MAPPING_ID",
"Get Endpoint Mapping by Id",
- s"""Get an Endpoint Mapping by ENDPOINT_MAPPING_ID.""",
- EmptyBody, endpointMappingResponseBodyExample,
+ s"""Get an Endpoint Mapping by ENDPOINT_MAPPING_ID.
+ |
+ |""",
+ EmptyBody,
+ endpointMappingResponseBodyExample,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagEndpointMapping),
Some(List(canGetEndpointMapping)),
- http4sPartialFunction = Some(getEndpointMapping))
+ http4sPartialFunction = Some(getEndpointMapping)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankLevelEndpointMapping), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankLevelEndpointMapping),
+ "GET",
"/management/banks/BANK_ID/endpoint-mappings/ENDPOINT_MAPPING_ID",
"Get Bank Level Endpoint Mapping",
- s"""Get an Bank Level Endpoint Mapping by ENDPOINT_MAPPING_ID.""",
- EmptyBody, endpointMappingResponseBodyExample,
+ s"""Get an Bank Level Endpoint Mapping by ENDPOINT_MAPPING_ID.
+ |
+ |""",
+ EmptyBody,
+ endpointMappingResponseBodyExample,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagEndpointMapping),
Some(List(canGetBankLevelEndpointMapping, canGetEndpointMapping)),
- http4sPartialFunction = Some(getBankLevelEndpointMapping))
+ http4sPartialFunction = Some(getBankLevelEndpointMapping)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllEndpointMappings), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllEndpointMappings),
+ "GET",
"/management/endpoint-mappings",
"Get all Endpoint Mappings",
- s"""Get all Endpoint Mappings.""",
+ s"""Get all Endpoint Mappings.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("endpoint-mappings", endpointMappingResponseBodyExample :: Nil),
+ ListResult(
+ "endpoint-mappings",
+ endpointMappingResponseBodyExample :: Nil
+ ),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagEndpointMapping),
Some(List(canGetAllEndpointMappings)),
- http4sPartialFunction = Some(getAllEndpointMappings))
+ http4sPartialFunction = Some(getAllEndpointMappings)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllBankLevelEndpointMappings), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllBankLevelEndpointMappings),
+ "GET",
"/management/banks/BANK_ID/endpoint-mappings",
"Get all Bank Level Endpoint Mappings",
- s"""Get all Bank Level Endpoint Mappings.""",
+ s"""Get all Bank Level Endpoint Mappings.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("endpoint-mappings", endpointMappingResponseBodyExample :: Nil),
+ ListResult(
+ "endpoint-mappings",
+ endpointMappingResponseBodyExample :: Nil
+ ),
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagEndpointMapping),
Some(List(canGetAllBankLevelEndpointMappings, canGetAllEndpointMappings)),
- http4sPartialFunction = Some(getAllBankLevelEndpointMappings))
+ http4sPartialFunction = Some(getAllBankLevelEndpointMappings)
+ )
}
initBatch1ResourceDocs()
@@ -6588,54 +8375,76 @@ object Http4s400 {
private def initBatch13ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createEndpointMapping), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createEndpointMapping),
+ "POST",
"/management/endpoint-mappings",
"Create Endpoint Mapping",
s"""Create an Endpoint Mapping.
- |
- |Note: at moment only support the dynamic endpoints
- |""",
- endpointMappingRequestBodyExample, endpointMappingResponseBodyExample,
+ |
+ |Note: at moment only support the dynamic endpoints
+ |""",
+ endpointMappingRequestBodyExample,
+ endpointMappingResponseBodyExample,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagEndpointMapping),
Some(List(canCreateEndpointMapping)),
- http4sPartialFunction = Some(createEndpointMapping))
+ http4sPartialFunction = Some(createEndpointMapping)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateEndpointMapping), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateEndpointMapping),
+ "PUT",
"/management/endpoint-mappings/ENDPOINT_MAPPING_ID",
"Update Endpoint Mapping",
- s"""Update an Endpoint Mapping.""",
- endpointMappingRequestBodyExample, endpointMappingResponseBodyExample,
+ s"""Update an Endpoint Mapping.
+ |""",
+ endpointMappingRequestBodyExample,
+ endpointMappingResponseBodyExample,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagEndpointMapping),
Some(List(canUpdateEndpointMapping)),
- http4sPartialFunction = Some(updateEndpointMapping))
+ http4sPartialFunction = Some(updateEndpointMapping)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankLevelEndpointMapping), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankLevelEndpointMapping),
+ "POST",
"/management/banks/BANK_ID/endpoint-mappings",
"Create Bank Level Endpoint Mapping",
s"""Create an Bank Level Endpoint Mapping.
- |
- |Note: at moment only support the dynamic endpoints
- |""",
- endpointMappingRequestBodyExample, endpointMappingResponseBodyExample,
+ |
+ |Note: at moment only support the dynamic endpoints
+ |""",
+ endpointMappingRequestBodyExample,
+ endpointMappingResponseBodyExample,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagEndpointMapping),
Some(List(canCreateBankLevelEndpointMapping, canCreateEndpointMapping)),
- http4sPartialFunction = Some(createBankLevelEndpointMapping))
+ http4sPartialFunction = Some(createBankLevelEndpointMapping)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBankLevelEndpointMapping), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBankLevelEndpointMapping),
+ "PUT",
"/management/banks/BANK_ID/endpoint-mappings/ENDPOINT_MAPPING_ID",
"Update Bank Level Endpoint Mapping",
- s"""Update an Bank Level Endpoint Mapping.""",
- endpointMappingRequestBodyExample, endpointMappingResponseBodyExample,
+ s"""Update an Bank Level Endpoint Mapping.
+ |""",
+ endpointMappingRequestBodyExample,
+ endpointMappingResponseBodyExample,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagEndpointMapping),
Some(List(canUpdateBankLevelEndpointMapping, canUpdateEndpointMapping)),
- http4sPartialFunction = Some(updateBankLevelEndpointMapping))
+ http4sPartialFunction = Some(updateBankLevelEndpointMapping)
+ )
}
initBatch13ResourceDocs()
@@ -6757,48 +8566,85 @@ object Http4s400 {
private def initBatch14ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createSystemLevelEndpointTag), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createSystemLevelEndpointTag),
+ "POST",
"/management/endpoints/OPERATION_ID/tags",
"Create System Level Endpoint Tag",
- s"""Create System Level Endpoint Tag.""",
- endpointTagJson400, bankLevelEndpointTagResponseJson400,
+ s"""Create System Level Endpoint Tag
+ |
+ |Note: Resource Docs are cached, TTL is ${CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL} seconds
+ |
+ |""".stripMargin,
+ endpointTagJson400,
+ bankLevelEndpointTagResponseJson400,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, EndpointTagAlreadyExists, InvalidJsonFormat, UnknownError),
List(apiTagApi),
Some(List(canCreateSystemLevelEndpointTag)),
- http4sPartialFunction = Some(createSystemLevelEndpointTag))
+ http4sPartialFunction = Some(createSystemLevelEndpointTag)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateSystemLevelEndpointTag), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateSystemLevelEndpointTag),
+ "PUT",
"/management/endpoints/OPERATION_ID/tags/ENDPOINT_TAG_ID",
"Update System Level Endpoint Tag",
- s"""Update System Level Endpoint Tag, you can only update the tag_name here, operation_id can not be updated.""",
- endpointTagJson400, bankLevelEndpointTagResponseJson400,
+ s"""Update System Level Endpoint Tag, you can only update the tag_name here, operation_id can not be updated.
+ |
+ |Note: Resource Docs are cached, TTL is ${CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL} seconds
+ |
+ |""".stripMargin,
+ endpointTagJson400,
+ bankLevelEndpointTagResponseJson400,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, EndpointTagNotFoundByEndpointTagId, InvalidJsonFormat, UnknownError),
List(apiTagApi),
Some(List(canUpdateSystemLevelEndpointTag)),
- http4sPartialFunction = Some(updateSystemLevelEndpointTag))
+ http4sPartialFunction = Some(updateSystemLevelEndpointTag)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankLevelEndpointTag), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankLevelEndpointTag),
+ "POST",
"/management/banks/BANK_ID/endpoints/OPERATION_ID/tags",
"Create Bank Level Endpoint Tag",
- s"""Create Bank Level Endpoint Tag""",
- endpointTagJson400, bankLevelEndpointTagResponseJson400,
+ s"""Create Bank Level Endpoint Tag
+ |
+ |Note: Resource Docs are cached, TTL is ${CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL} seconds
+ |
+ |
+ |""".stripMargin,
+ endpointTagJson400,
+ bankLevelEndpointTagResponseJson400,
List($AuthenticatedUserIsRequired, $BankNotFound, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagApi),
Some(List(canCreateBankLevelEndpointTag)),
- http4sPartialFunction = Some(createBankLevelEndpointTag))
+ http4sPartialFunction = Some(createBankLevelEndpointTag)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBankLevelEndpointTag), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBankLevelEndpointTag),
+ "PUT",
"/management/banks/BANK_ID/endpoints/OPERATION_ID/tags/ENDPOINT_TAG_ID",
"Update Bank Level Endpoint Tag",
- s"""Update Endpoint Tag, you can only update the tag_name here, operation_id can not be updated.""",
- endpointTagJson400, bankLevelEndpointTagResponseJson400,
+ s"""Update Endpoint Tag, you can only update the tag_name here, operation_id can not be updated.
+ |
+ |Note: Resource Docs are cached, TTL is ${CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL} seconds
+ |
+ |""".stripMargin,
+ endpointTagJson400,
+ bankLevelEndpointTagResponseJson400,
List($AuthenticatedUserIsRequired, $BankNotFound, UserHasMissingRoles, EndpointTagNotFoundByEndpointTagId, InvalidJsonFormat, UnknownError),
List(apiTagApi),
Some(List(canUpdateBankLevelEndpointTag)),
- http4sPartialFunction = Some(updateBankLevelEndpointTag))
+ http4sPartialFunction = Some(updateBankLevelEndpointTag)
+ )
}
initBatch14ResourceDocs()
@@ -6943,92 +8789,127 @@ object Http4s400 {
private def initBatch15ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createJsonSchemaValidation), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createJsonSchemaValidation),
+ "POST",
"/management/json-schema-validations/OPERATION_ID",
"Create a JSON Schema Validation",
s"""Create a JSON Schema Validation.
- |
- |Introduction:
- |${Glossary.getGlossaryItemSimple("JSON Schema Validation")}
- |
- |To use this endpoint, please supply a valid json-schema in the request body.
- |""",
- postOrPutJsonSchemaV400, responseJsonSchema,
+ |
+ |Introduction:
+ |${Glossary.getGlossaryItemSimple("JSON Schema Validation")}
+ |
+ |To use this endpoint, please supply a valid json-schema in the request body.
+ |
+ |Note: It might take a few minutes for the newly created JSON Schema to take effect!
+ |""",
+ postOrPutJsonSchemaV400,
+ responseJsonSchema,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagJsonSchemaValidation),
Some(List(canCreateJsonSchemaValidation)),
- http4sPartialFunction = Some(createJsonSchemaValidation))
+ http4sPartialFunction = Some(createJsonSchemaValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateJsonSchemaValidation), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateJsonSchemaValidation),
+ "PUT",
"/management/json-schema-validations/OPERATION_ID",
"Update a JSON Schema Validation",
s"""Update a JSON Schema Validation.
- |
- |Introduction:
- |${Glossary.getGlossaryItemSimple("JSON Schema Validation")}
- |
- |To use this endpoint, please supply a valid json-schema in the request body.
- |""",
- postOrPutJsonSchemaV400, responseJsonSchema,
+ |
+ |Introduction:
+ |${Glossary.getGlossaryItemSimple("JSON Schema Validation")}
+ |
+ |To use this endpoint, please supply a valid json-schema in the request body.
+ |
+ |""",
+ postOrPutJsonSchemaV400,
+ responseJsonSchema,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagJsonSchemaValidation),
Some(List(canUpdateJsonSchemaValidation)),
- http4sPartialFunction = Some(updateJsonSchemaValidation))
+ http4sPartialFunction = Some(updateJsonSchemaValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createAuthenticationTypeValidation), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createAuthenticationTypeValidation),
+ "POST",
"/management/authentication-type-validations/OPERATION_ID",
"Create an Authentication Type Validation",
s"""Create an Authentication Type Validation.
- |
- |Please supply allowed authentication types.""",
+ |
+ |Please supply allowed authentication types.
+ |""",
allowedAuthTypes,
JsonAuthTypeValidation("OBPv4.0.0-updateXxx", allowedAuthTypes),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagAuthenticationTypeValidation),
Some(List(canCreateAuthenticationTypeValidation)),
- http4sPartialFunction = Some(createAuthenticationTypeValidation))
+ http4sPartialFunction = Some(createAuthenticationTypeValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateAuthenticationTypeValidation), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateAuthenticationTypeValidation),
+ "PUT",
"/management/authentication-type-validations/OPERATION_ID",
"Update an Authentication Type Validation",
s"""Update an Authentication Type Validation.
- |
- |Please supply allowed authentication types.""",
+ |
+ |Please supply allowed authentication types.
+ |""",
allowedAuthTypes,
JsonAuthTypeValidation("OBPv4.0.0-updateXxx", allowedAuthTypes),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagAuthenticationTypeValidation),
Some(List(canUpdateAuthenticationTypeValidation)),
- http4sPartialFunction = Some(updateAuthenticationTypeValidation))
+ http4sPartialFunction = Some(updateAuthenticationTypeValidation)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createConnectorMethod), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createConnectorMethod),
+ "POST",
"/management/connector-methods",
"Create Connector Method",
s"""Create an internal connector.
- |
- |The method_body is URL-encoded format String""",
- jsonScalaConnectorMethod.copy(connectorMethodId = None), jsonScalaConnectorMethod,
+ |
+ |The method_body is URL-encoded format String
+ |""",
+ jsonScalaConnectorMethod.copy(connectorMethodId = None),
+ jsonScalaConnectorMethod,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagConnectorMethod),
Some(List(canCreateConnectorMethod)),
- http4sPartialFunction = Some(createConnectorMethod))
+ http4sPartialFunction = Some(createConnectorMethod)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateConnectorMethod), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateConnectorMethod),
+ "PUT",
"/management/connector-methods/CONNECTOR_METHOD_ID",
"Update Connector Method",
s"""Update an internal connector.
- |
- |The method_body is URL-encoded format String""",
- jsonScalaConnectorMethodMethodBody, jsonScalaConnectorMethod,
+ |
+ |The method_body is URL-encoded format String
+ |""",
+ jsonScalaConnectorMethodMethodBody,
+ jsonScalaConnectorMethod,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagConnectorMethod),
Some(List(canUpdateConnectorMethod)),
- http4sPartialFunction = Some(updateConnectorMethod))
+ http4sPartialFunction = Some(updateConnectorMethod)
+ )
}
initBatch15ResourceDocs()
@@ -7190,124 +9071,186 @@ object Http4s400 {
private def initBatch16ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createDynamicResourceDoc), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createDynamicResourceDoc),
+ "POST",
"/management/dynamic-resource-docs",
"Create Dynamic Resource Doc",
s"""Create a Dynamic Resource Doc.
- |
- |The connector_method_body is URL-encoded format String""",
- jsonDynamicResourceDoc.copy(dynamicResourceDocId = None), jsonDynamicResourceDoc,
+ |
+ |The connector_method_body is URL-encoded format String
+ |""",
+ jsonDynamicResourceDoc.copy(dynamicResourceDocId = None),
+ jsonDynamicResourceDoc,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canCreateDynamicResourceDoc)),
- http4sPartialFunction = Some(createDynamicResourceDoc))
+ http4sPartialFunction = Some(createDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateDynamicResourceDoc), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateDynamicResourceDoc),
+ "PUT",
"/management/dynamic-resource-docs/DYNAMIC_RESOURCE_DOC_ID",
"Update Dynamic Resource Doc",
s"""Update a Dynamic Resource Doc.
- |
- |The connector_method_body is URL-encoded format String""",
- jsonDynamicResourceDoc.copy(dynamicResourceDocId = None), jsonDynamicResourceDoc,
+ |
+ |The connector_method_body is URL-encoded format String
+ |""",
+ jsonDynamicResourceDoc.copy(dynamicResourceDocId = None),
+ jsonDynamicResourceDoc,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canUpdateDynamicResourceDoc)),
- http4sPartialFunction = Some(updateDynamicResourceDoc))
+ http4sPartialFunction = Some(updateDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteDynamicResourceDoc), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteDynamicResourceDoc),
+ "DELETE",
"/management/dynamic-resource-docs/DYNAMIC_RESOURCE_DOC_ID",
"Delete Dynamic Resource Doc",
- s"""Delete a Dynamic Resource Doc.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a Dynamic Resource Doc.
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canDeleteDynamicResourceDoc)),
- http4sPartialFunction = Some(deleteDynamicResourceDoc))
+ http4sPartialFunction = Some(deleteDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getDynamicResourceDoc), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getDynamicResourceDoc),
+ "GET",
"/management/dynamic-resource-docs/DYNAMIC_RESOURCE_DOC_ID",
"Get Dynamic Resource Doc by Id",
- s"""Get a Dynamic Resource Doc by DYNAMIC_RESOURCE_DOC_ID.""",
- EmptyBody, jsonDynamicResourceDoc,
+ s"""Get a Dynamic Resource Doc by DYNAMIC-RESOURCE-DOC-ID.
+ |
+ |""",
+ EmptyBody,
+ jsonDynamicResourceDoc,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canGetDynamicResourceDoc)),
- http4sPartialFunction = Some(getDynamicResourceDoc))
+ http4sPartialFunction = Some(getDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllDynamicResourceDocs), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllDynamicResourceDocs),
+ "GET",
"/management/dynamic-resource-docs",
"Get all Dynamic Resource Docs",
- s"""Get all Dynamic Resource Docs.""",
+ s"""Get all Dynamic Resource Docs.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("dynamic-resource-docs", jsonDynamicResourceDoc :: Nil),
+ ListResult("dynamic-resource-docs", jsonDynamicResourceDoc :: Nil),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canGetAllDynamicResourceDocs)),
- http4sPartialFunction = Some(getAllDynamicResourceDocs))
+ http4sPartialFunction = Some(getAllDynamicResourceDocs)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankLevelDynamicResourceDoc), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankLevelDynamicResourceDoc),
+ "POST",
"/management/banks/BANK_ID/dynamic-resource-docs",
"Create Bank Level Dynamic Resource Doc",
s"""Create a Bank Level Dynamic Resource Doc.
- |
- |The connector_method_body is URL-encoded format String""",
- jsonDynamicResourceDoc.copy(dynamicResourceDocId = None), jsonDynamicResourceDoc,
+ |
+ |The connector_method_body is URL-encoded format String
+ |""",
+ jsonDynamicResourceDoc.copy(dynamicResourceDocId = None),
+ jsonDynamicResourceDoc,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canCreateBankLevelDynamicResourceDoc)),
- http4sPartialFunction = Some(createBankLevelDynamicResourceDoc))
+ http4sPartialFunction = Some(createBankLevelDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBankLevelDynamicResourceDoc), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBankLevelDynamicResourceDoc),
+ "PUT",
"/management/banks/BANK_ID/dynamic-resource-docs/DYNAMIC_RESOURCE_DOC_ID",
"Update Bank Level Dynamic Resource Doc",
s"""Update a Bank Level Dynamic Resource Doc.
- |
- |The connector_method_body is URL-encoded format String""",
- jsonDynamicResourceDoc.copy(dynamicResourceDocId = None), jsonDynamicResourceDoc,
+ |
+ |The connector_method_body is URL-encoded format String
+ |""",
+ jsonDynamicResourceDoc.copy(dynamicResourceDocId = None),
+ jsonDynamicResourceDoc,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canUpdateBankLevelDynamicResourceDoc)),
- http4sPartialFunction = Some(updateBankLevelDynamicResourceDoc))
+ http4sPartialFunction = Some(updateBankLevelDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankLevelDynamicResourceDoc), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankLevelDynamicResourceDoc),
+ "DELETE",
"/management/banks/BANK_ID/dynamic-resource-docs/DYNAMIC_RESOURCE_DOC_ID",
"Delete Bank Level Dynamic Resource Doc",
- s"""Delete a Bank Level Dynamic Resource Doc.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a Bank Level Dynamic Resource Doc.
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canDeleteBankLevelDynamicResourceDoc)),
- http4sPartialFunction = Some(deleteBankLevelDynamicResourceDoc))
+ http4sPartialFunction = Some(deleteBankLevelDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankLevelDynamicResourceDoc), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankLevelDynamicResourceDoc),
+ "GET",
"/management/banks/BANK_ID/dynamic-resource-docs/DYNAMIC_RESOURCE_DOC_ID",
"Get Bank Level Dynamic Resource Doc by Id",
- s"""Get a Bank Level Dynamic Resource Doc by DYNAMIC_RESOURCE_DOC_ID.""",
- EmptyBody, jsonDynamicResourceDoc,
+ s"""Get a Bank Level Dynamic Resource Doc by DYNAMIC-RESOURCE-DOC-ID.
+ |
+ |""",
+ EmptyBody,
+ jsonDynamicResourceDoc,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canGetBankLevelDynamicResourceDoc)),
- http4sPartialFunction = Some(getBankLevelDynamicResourceDoc))
+ http4sPartialFunction = Some(getBankLevelDynamicResourceDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllBankLevelDynamicResourceDocs), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllBankLevelDynamicResourceDocs),
+ "GET",
"/management/banks/BANK_ID/dynamic-resource-docs",
"Get all Bank Level Dynamic Resource Docs",
- s"""Get all Bank Level Dynamic Resource Docs.""",
+ s"""Get all Bank Level Dynamic Resource Docs.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("dynamic-resource-docs", jsonDynamicResourceDoc :: Nil),
+ ListResult("dynamic-resource-docs", jsonDynamicResourceDoc :: Nil),
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicResourceDoc),
Some(List(canGetAllBankLevelDynamicResourceDocs)),
- http4sPartialFunction = Some(getAllBankLevelDynamicResourceDocs))
+ http4sPartialFunction = Some(getAllBankLevelDynamicResourceDocs)
+ )
}
initBatch16ResourceDocs()
@@ -7446,116 +9389,178 @@ object Http4s400 {
private def initBatch17ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createDynamicMessageDoc), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createDynamicMessageDoc),
+ "POST",
"/management/dynamic-message-docs",
"Create Dynamic Message Doc",
- s"""Create a Dynamic Message Doc.""",
- jsonDynamicMessageDoc.copy(dynamicMessageDocId = None), jsonDynamicMessageDoc,
+ s"""Create a Dynamic Message Doc.
+ |""",
+ jsonDynamicMessageDoc.copy(dynamicMessageDocId = None),
+ jsonDynamicMessageDoc,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canCreateDynamicMessageDoc)),
- http4sPartialFunction = Some(createDynamicMessageDoc))
+ http4sPartialFunction = Some(createDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateDynamicMessageDoc), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateDynamicMessageDoc),
+ "PUT",
"/management/dynamic-message-docs/DYNAMIC_MESSAGE_DOC_ID",
"Update Dynamic Message Doc",
- s"""Update a Dynamic Message Doc.""",
- jsonDynamicMessageDoc.copy(dynamicMessageDocId = None), jsonDynamicMessageDoc,
+ s"""Update a Dynamic Message Doc.
+ |""",
+ jsonDynamicMessageDoc.copy(dynamicMessageDocId = None),
+ jsonDynamicMessageDoc,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canUpdateDynamicMessageDoc)),
- http4sPartialFunction = Some(updateDynamicMessageDoc))
+ http4sPartialFunction = Some(updateDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteDynamicMessageDoc), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteDynamicMessageDoc),
+ "DELETE",
"/management/dynamic-message-docs/DYNAMIC_MESSAGE_DOC_ID",
"Delete Dynamic Message Doc",
- s"""Delete a Dynamic Message Doc.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a Dynamic Message Doc.
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canDeleteDynamicMessageDoc)),
- http4sPartialFunction = Some(deleteDynamicMessageDoc))
+ http4sPartialFunction = Some(deleteDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getDynamicMessageDoc), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getDynamicMessageDoc),
+ "GET",
"/management/dynamic-message-docs/DYNAMIC_MESSAGE_DOC_ID",
"Get Dynamic Message Doc",
- s"""Get a Dynamic Message Doc by DYNAMIC_MESSAGE_DOC_ID.""",
- EmptyBody, jsonDynamicMessageDoc,
+ s"""Get a Dynamic Message Doc by DYNAMIC_MESSAGE_DOC_ID.
+ |
+ |""",
+ EmptyBody,
+ jsonDynamicMessageDoc,
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canGetDynamicMessageDoc)),
- http4sPartialFunction = Some(getDynamicMessageDoc))
+ http4sPartialFunction = Some(getDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllDynamicMessageDocs), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllDynamicMessageDocs),
+ "GET",
"/management/dynamic-message-docs",
"Get all Dynamic Message Docs",
- s"""Get all Dynamic Message Docs.""",
+ s"""Get all Dynamic Message Docs.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("dynamic-message-docs", jsonDynamicMessageDoc :: Nil),
+ ListResult("dynamic-message-docs", jsonDynamicMessageDoc :: Nil),
List($AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canGetAllDynamicMessageDocs)),
- http4sPartialFunction = Some(getAllDynamicMessageDocs))
+ http4sPartialFunction = Some(getAllDynamicMessageDocs)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createBankLevelDynamicMessageDoc), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createBankLevelDynamicMessageDoc),
+ "POST",
"/management/banks/BANK_ID/dynamic-message-docs",
"Create Bank Level Dynamic Message Doc",
- s"""Create a Bank Level Dynamic Message Doc.""",
- jsonDynamicMessageDoc.copy(dynamicMessageDocId = None), jsonDynamicMessageDoc,
+ s"""Create a Bank Level Dynamic Message Doc.
+ |""",
+ jsonDynamicMessageDoc.copy(dynamicMessageDocId = None),
+ jsonDynamicMessageDoc,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canCreateBankLevelDynamicMessageDoc)),
- http4sPartialFunction = Some(createBankLevelDynamicMessageDoc))
+ http4sPartialFunction = Some(createBankLevelDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(updateBankLevelDynamicMessageDoc), "PUT",
+ null,
+ implementedInApiVersion,
+ nameOf(updateBankLevelDynamicMessageDoc),
+ "PUT",
"/management/banks/BANK_ID/dynamic-message-docs/DYNAMIC_MESSAGE_DOC_ID",
"Update Bank Level Dynamic Message Doc",
- s"""Update a Bank Level Dynamic Message Doc.""",
- jsonDynamicMessageDoc.copy(dynamicMessageDocId = None), jsonDynamicMessageDoc,
+ s"""Update a Bank Level Dynamic Message Doc.
+ |""",
+ jsonDynamicMessageDoc.copy(dynamicMessageDocId = None),
+ jsonDynamicMessageDoc,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canUpdateDynamicMessageDoc)),
- http4sPartialFunction = Some(updateBankLevelDynamicMessageDoc))
+ http4sPartialFunction = Some(updateBankLevelDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(deleteBankLevelDynamicMessageDoc), "DELETE",
+ null,
+ implementedInApiVersion,
+ nameOf(deleteBankLevelDynamicMessageDoc),
+ "DELETE",
"/management/banks/BANK_ID/dynamic-message-docs/DYNAMIC_MESSAGE_DOC_ID",
"Delete Bank Level Dynamic Message Doc",
- s"""Delete a Bank Level Dynamic Message Doc.""",
- EmptyBody, BooleanBody(true),
+ s"""Delete a Bank Level Dynamic Message Doc.
+ |""",
+ EmptyBody,
+ BooleanBody(true),
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, InvalidJsonFormat, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canDeleteBankLevelDynamicMessageDoc)),
- http4sPartialFunction = Some(deleteBankLevelDynamicMessageDoc))
+ http4sPartialFunction = Some(deleteBankLevelDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getBankLevelDynamicMessageDoc), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getBankLevelDynamicMessageDoc),
+ "GET",
"/management/banks/BANK_ID/dynamic-message-docs/DYNAMIC_MESSAGE_DOC_ID",
"Get Bank Level Dynamic Message Doc",
- s"""Get a Bank Level Dynamic Message Doc by DYNAMIC_MESSAGE_DOC_ID.""",
- EmptyBody, jsonDynamicMessageDoc,
+ s"""Get a Bank Level Dynamic Message Doc by DYNAMIC_MESSAGE_DOC_ID.
+ |
+ |""",
+ EmptyBody,
+ jsonDynamicMessageDoc,
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canGetBankLevelDynamicMessageDoc)),
- http4sPartialFunction = Some(getBankLevelDynamicMessageDoc))
+ http4sPartialFunction = Some(getBankLevelDynamicMessageDoc)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(getAllBankLevelDynamicMessageDocs), "GET",
+ null,
+ implementedInApiVersion,
+ nameOf(getAllBankLevelDynamicMessageDocs),
+ "GET",
"/management/banks/BANK_ID/dynamic-message-docs",
"Get all Bank Level Dynamic Message Docs",
- s"""Get all Bank Level Dynamic Message Docs.""",
+ s"""Get all Bank Level Dynamic Message Docs.
+ |
+ |""",
EmptyBody,
- com.openbankproject.commons.model.ListResult("dynamic-message-docs", jsonDynamicMessageDoc :: Nil),
+ ListResult("dynamic-message-docs", jsonDynamicMessageDoc :: Nil),
List($BankNotFound, $AuthenticatedUserIsRequired, UserHasMissingRoles, UnknownError),
List(apiTagDynamicMessageDoc),
Some(List(canGetAllDynamicMessageDocs)),
- http4sPartialFunction = Some(getAllBankLevelDynamicMessageDocs))
+ http4sPartialFunction = Some(getAllBankLevelDynamicMessageDocs)
+ )
}
initBatch17ResourceDocs()
@@ -7595,14 +9600,26 @@ object Http4s400 {
private def initBatch18ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(buildDynamicEndpointTemplate), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(buildDynamicEndpointTemplate),
+ "POST",
"/management/dynamic-resource-docs/endpoint-code",
"Create Dynamic Resource Doc endpoint code",
- s"""Create a Dynamic Resource Doc endpoint code.""",
- jsonResourceDocFragment, jsonCodeTemplateJson,
+ s"""Create a Dynamic Resource Doc endpoint code.
+ |
+ |copy the response and past to ${nameOf(
+ PractiseEndpoint
+ )}, So you can have the benefits of
+ |auto compilation and debug
+ |""",
+ jsonResourceDocFragment,
+ jsonCodeTemplateJson,
List($AuthenticatedUserIsRequired, InvalidJsonFormat, UnknownError),
- List(apiTagDynamicResourceDoc), None,
- http4sPartialFunction = Some(buildDynamicEndpointTemplate))
+ List(apiTagDynamicResourceDoc),
+ None,
+ http4sPartialFunction = Some(buildDynamicEndpointTemplate)
+ )
}
initBatch18ResourceDocs()
@@ -8120,41 +10137,72 @@ object Http4s400 {
private def initBatch19ResourceDocs(): Unit = {
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(addAccount), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(addAccount),
+ "POST",
"/banks/BANK_ID/accounts",
"Create Account (POST)",
"""Create Account at bank specified by BANK_ID.
- |
- |The User can create an Account for themself - or - the User that has the USER_ID specified in the POST body.
- |
- |If the POST body USER_ID *is* specified, the logged in user must have the Role CanCreateAccount. Once created, the Account will be owned by the User specified by USER_ID.
- |
- |If the POST body USER_ID is *not* specified, the account will be owned by the logged in User.
- |
- |The 'product_code' field SHOULD be a product_code from Product.
- |If the product_code matches a product_code from Product, account attributes will be created that match the Product Attributes.
- |
- |Note: The Amount MUST be zero.""".stripMargin,
- createAccountRequestJsonV310, createAccountResponseJsonV310,
+ |
+ |The User can create an Account for themself - or - the User that has the USER_ID specified in the POST body.
+ |
+ |If the POST body USER_ID *is* specified, the logged in user must have the Role CanCreateAccount. Once created, the Account will be owned by the User specified by USER_ID.
+ |
+ |If the POST body USER_ID is *not* specified, the account will be owned by the logged in User.
+ |
+ |The 'product_code' field SHOULD be a product_code from Product.
+ |If the product_code matches a product_code from Product, account attributes will be created that match the Product Attributes.
+ |
+ |Note: The Amount MUST be zero.""".stripMargin,
+ createAccountRequestJsonV310,
+ createAccountResponseJsonV310,
List(InvalidJsonFormat, $AuthenticatedUserIsRequired, UserHasMissingRoles,
- InvalidAccountBalanceAmount, InvalidAccountInitialBalance, InitialBalanceMustBeZero,
- InvalidAccountBalanceCurrency, UnknownError),
+ InvalidAccountBalanceAmount, InvalidAccountInitialBalance, InitialBalanceMustBeZero,
+ InvalidAccountBalanceCurrency, UnknownError),
List(apiTagAccount),
Some(List(canCreateAccount)),
- http4sPartialFunction = Some(addAccount))
+ http4sPartialFunction = Some(addAccount)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createSettlementAccount), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createSettlementAccount),
+ "POST",
"/banks/BANK_ID/settlement-accounts",
"Create Settlement Account",
- s"""Create a new settlement account at a bank.""",
- settlementAccountRequestJson, settlementAccountResponseJson,
+ s"""Create a new settlement account at a bank.
+ |
+ |The created settlement account id will be the concatenation of the payment system and the account currency.
+ |For examples: SEPA_SETTLEMENT_ACCOUNT_EUR, CARD_SETTLEMENT_ACCOUNT_USD
+ |
+ |By default, when you create a new bank, two settlements accounts are created automatically: OBP_DEFAULT_INCOMING_ACCOUNT_ID and OBP_DEFAULT_OUTGOING_ACCOUNT_ID
+ |Those two accounts have EUR as default currency.
+ |
+ |If you want to create default settlement account for a specific currency, you can fill the `payment_system` field with the `DEFAULT` value.
+ |
+ |When a transaction is saved in OBP through the mapped connector, OBP-API look for the account to save the double-entry transaction.
+ |If no OBP account can be found from the counterparty, the double-entry transaction will be saved on a bank settlement account.
+ |- First, the mapped connector looks for a settlement account specific to the payment system and currency. E.g SEPA_SETTLEMENT_ACCOUNT_EUR.
+ |- If we don't find any specific settlement account with the payment system, we look for a default settlement account for the counterparty currency. E.g DEFAULT_SETTLEMENT_ACCOUNT_EUR.
+ |- Else, we select one of the two OBP default settlement accounts (OBP_DEFAULT_INCOMING_ACCOUNT_ID/OBP_DEFAULT_OUTGOING_ACCOUNT_ID) according to the transaction direction.
+ |
+ |If the POST body USER_ID *is* specified, the logged in user must have the Role CanCreateAccount. Once created, the Account will be owned by the User specified by USER_ID.
+ |
+ |If the POST body USER_ID is *not* specified, the account will be owned by the logged in User.
+ |
+ |Note: The Amount MUST be zero.
+ |""".stripMargin,
+ settlementAccountRequestJson,
+ settlementAccountResponseJson,
List(InvalidJsonFormat, $AuthenticatedUserIsRequired, UserHasMissingRoles,
- $BankNotFound, InvalidAccountInitialBalance, InitialBalanceMustBeZero,
- InvalidISOCurrencyCode, UnknownError),
+ $BankNotFound, InvalidAccountInitialBalance, InitialBalanceMustBeZero,
+ InvalidISOCurrencyCode, UnknownError),
List(apiTagBank),
Some(List(canCreateSettlementAccountAtOneBank)),
- http4sPartialFunction = Some(createSettlementAccount))
+ http4sPartialFunction = Some(createSettlementAccount)
+ )
staticResourceDocs += ResourceDoc(
null, implementedInApiVersion, "createConsumer", "POST",
@@ -8186,52 +10234,157 @@ object Http4s400 {
http4sPartialFunction = Some(createCounterpartyForAnyAccount))
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createHistoricalTransactionAtBank), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createHistoricalTransactionAtBank),
+ "POST",
"/banks/BANK_ID/management/historical/transactions",
"Create Historical Transactions ",
- s"""Create historical transactions at one Bank.""",
- postHistoricalTransactionAtBankJson, postHistoricalTransactionResponseJson,
+ s"""
+ |Create historical transactions at one Bank
+ |
+ |Use this endpoint to create transactions between any two accounts at the same bank.
+ |From account and to account must be at the same bank.
+ |Example:
+ |{
+ | "from_account_id": "1ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
+ | "to_account_id": "2ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
+ | "value": {
+ | "currency": "GBP",
+ | "amount": "10"
+ | },
+ | "description": "this is for work",
+ | "posted": "2017-09-19T02:31:05Z",
+ | "completed": "2017-09-19T02:31:05Z",
+ | "type": "SANDBOX_TAN",
+ | "charge_policy": "SHARED"
+ |}
+ |
+ |This call is experimental.
+ """.stripMargin,
+ postHistoricalTransactionAtBankJson,
+ postHistoricalTransactionResponseJson,
List(InvalidJsonFormat, BankNotFound, AccountNotFound, CounterpartyNotFoundByCounterpartyId,
- InvalidNumber, NotPositiveAmount, InvalidTransactionRequestCurrency, UnknownError),
+ InvalidNumber, NotPositiveAmount, InvalidTransactionRequestCurrency, UnknownError),
List(apiTagTransactionRequest),
Some(List(canCreateHistoricalTransactionAtBank)),
- http4sPartialFunction = Some(createHistoricalTransactionAtBank))
+ http4sPartialFunction = Some(createHistoricalTransactionAtBank)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createUserWithRoles), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createUserWithRoles),
+ "POST",
"/user-entitlements",
"Create (DAuth) User with Roles",
- s"""Create (DAuth) User with Roles.""",
- postCreateUserWithRolesJsonV400, entitlementsJsonV400,
+ s"""
+ |This endpoint is used as part of the DAuth solution to grant Entitlements for Roles to a smart contract on the blockchain.
+ |
+ |Put the smart contract address in username
+ |
+ |For provider use "dauth"
+ |
+ |This endpoint will create the User with username and provider if the User does not already exist.
+ |
+ |Then it will create Entitlements i.e. grant Roles to the User.
+ |
+ |Entitlements are used to grant System or Bank level roles to Users. (For Account level privileges, see Views)
+ |
+ |i.e. Entitlements are used to create / consume system or bank level resources where as views / account access are used to consume / create customer level resources.
+ |
+ |For a System level Role (.e.g CanGetAnyUser), set bank_id to an empty string i.e. "bank_id":""
+ |
+ |For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
+ |
+ |Note: The Roles actually granted will depend on the Roles that the calling user has.
+ |
+ |If you try to grant Entitlements to a user that already exist (duplicate entitilements) you will get an error.
+ |
+ |For information about DAuth see below:
+ |
+ |${getGlossaryItem("DAuth")}
+ |
+ |""",
+ postCreateUserWithRolesJsonV400,
+ entitlementsJsonV400,
List(AuthenticatedUserIsRequired, InvalidJsonFormat, IncorrectRoleName,
- EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementAlreadyExists,
- InvalidUserProvider, UnknownError),
+ EntitlementIsBankRole, EntitlementIsSystemRole, EntitlementAlreadyExists,
+ InvalidUserProvider, UnknownError),
List(apiTagRole, apiTagEntitlement, apiTagUser, apiTagDAuth),
None,
- http4sPartialFunction = Some(createUserWithRoles))
+ http4sPartialFunction = Some(createUserWithRoles)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createUserWithAccountAccess), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createUserWithAccountAccess),
+ "POST",
"/banks/BANK_ID/accounts/ACCOUNT_ID/user-account-access",
"Create (DAuth) User with Account Access",
- s"""Create (DAuth) User with Account Access.""",
- postCreateUserAccountAccessJsonV400, List(viewJsonV300),
+ s"""This endpoint is used as part of the DAuth solution to grant access to account and transaction data to a smart contract on the blockchain.
+ |
+ |Put the smart contract address in username
+ |
+ |For provider use "dauth"
+ |
+ |This endpoint will create the (DAuth) User with username and provider if the User does not already exist.
+ |
+ |${userAuthenticationMessage(
+ true
+ )} and the logged in user needs to be account holder.
+ |
+ |For information about DAuth see below:
+ |
+ |${getGlossaryItem("DAuth")}
+ |
+ |""",
+ postCreateUserAccountAccessJsonV400,
+ List(viewJsonV300),
List($AuthenticatedUserIsRequired, UserLacksPermissionCanGrantAccessToViewForTargetAccount,
- InvalidJsonFormat, SystemViewNotFound, ViewNotFound, CannotGrantAccountAccess, UnknownError),
+ InvalidJsonFormat, SystemViewNotFound, ViewNotFound, CannotGrantAccountAccess, UnknownError),
List(apiTagAccountAccess, apiTagView, apiTagAccount, apiTagUser, apiTagOwnerRequired, apiTagDAuth),
None,
- http4sPartialFunction = Some(createUserWithAccountAccess))
+ http4sPartialFunction = Some(createUserWithAccountAccess)
+ )
staticResourceDocs += ResourceDoc(
- null, implementedInApiVersion, nameOf(createUserInvitation), "POST",
+ null,
+ implementedInApiVersion,
+ nameOf(createUserInvitation),
+ "POST",
"/banks/BANK_ID/user-invitation",
"Create User Invitation",
- s"""Create User Invitation.""",
- userInvitationPostJsonV400, userInvitationJsonV400,
+ s"""Create User Invitation.
+ |
+ | This endpoint will send an invitation email to the developers, then they can use the link to create the obp user.
+ |
+ | purpose filed only support:${UserInvitationPurpose.values
+ .toString()}.
+ |
+ | You can customise the email details use the following webui props:
+ |
+ | when purpose == ${UserInvitationPurpose.DEVELOPER.toString}
+ | webui_developer_user_invitation_email_subject
+ | webui_developer_user_invitation_email_from
+ | webui_developer_user_invitation_email_text
+ | webui_developer_user_invitation_email_html_text
+ |
+ | when purpose = == ${UserInvitationPurpose.CUSTOMER.toString}
+ | webui_customer_user_invitation_email_subject
+ | webui_customer_user_invitation_email_from
+ | webui_customer_user_invitation_email_text
+ | webui_customer_user_invitation_email_html_text
+ |
+ |""",
+ userInvitationPostJsonV400,
+ userInvitationJsonV400,
List($AuthenticatedUserIsRequired, $BankNotFound, UserCustomerLinksNotFoundForUser, UnknownError),
List(apiTagUserInvitation, apiTagKyc),
Some(canCreateUserInvitation :: Nil),
- http4sPartialFunction = Some(createUserInvitation))
+ http4sPartialFunction = Some(createUserInvitation)
+ )
}
initBatch19ResourceDocs()
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
index 2914600963..5f8de5517b 100644
--- 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
@@ -32,9 +32,6 @@ import code.api.util.APIUtil.OBPEndpoint
import code.api.util.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.Http4s300
import code.api.v3_1_0.{APIMethods310, Http4s310}
import code.api.v4_0_0.{APIMethods400, Http4s400}
@@ -51,9 +48,6 @@ only for resource-doc aggregation and the Lift dispatch registry.
object OBPAPI5_1_0 extends OBPRestHelper
with APIMethods130
with APIMethods140
- with APIMethods200
- with APIMethods210
- with APIMethods220
with APIMethods310
with APIMethods400
with APIMethods500
diff --git a/obp-api/src/main/scala/code/api/v6_0_0/OBPAPI6_0_0.scala b/obp-api/src/main/scala/code/api/v6_0_0/OBPAPI6_0_0.scala
index 0765b498bb..a6c0d2d73b 100644
--- a/obp-api/src/main/scala/code/api/v6_0_0/OBPAPI6_0_0.scala
+++ b/obp-api/src/main/scala/code/api/v6_0_0/OBPAPI6_0_0.scala
@@ -33,9 +33,6 @@ import code.api.util.APIUtil.OBPEndpoint
import code.api.util.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.Http4s300
import code.api.v3_1_0.{APIMethods310, Http4s310}
import code.api.v4_0_0.{APIMethods400, Http4s400}
@@ -53,9 +50,6 @@ only for resource-doc aggregation and the Lift dispatch registry.
object OBPAPI6_0_0 extends OBPRestHelper
with APIMethods130
with APIMethods140
- with APIMethods200
- with APIMethods210
- with APIMethods220
with APIMethods310
with APIMethods400
with APIMethods500
diff --git a/obp-api/src/test/resources/frozen_type_meta_data b/obp-api/src/test/resources/frozen_type_meta_data
index c62cefe820..a315e131a3 100644
Binary files a/obp-api/src/test/resources/frozen_type_meta_data and b/obp-api/src/test/resources/frozen_type_meta_data differ
diff --git a/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala b/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala
index e40777fdbb..845f6fc6bd 100644
--- a/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala
+++ b/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala
@@ -8,7 +8,7 @@ import code.api.util.{APIUtil, ExampleValue}
import code.api.util.CustomJsonFormats
import code.api.v1_4_0.JSONFactory1_4_0.ResourceDocJson
import code.api.v3_0_0.OBPAPI3_0_0
-import code.api.v2_2_0.OBPAPI2_2_0
+import code.api.v1_4_0.OBPAPI1_4_0
import net.liftweb.json.Extraction.decompose
import net.liftweb.json._
import org.everit.json.schema.loader.SchemaLoader
@@ -128,7 +128,7 @@ class JSONFactory1_4_0Test extends code.setup.ServerSetup {
scenario("Technology field should be None unless includeTechnology=true") {
// allResourceDocs(0) is now an http4s doc (v3.0.0 sorts above v2.2.0); use a v2.2.0 Lift doc instead.
- val liftDoc: ResourceDoc = OBPAPI2_2_0.allResourceDocs.head
+ val liftDoc: ResourceDoc = OBPAPI1_4_0.allResourceDocs.head
val json1 = JSONFactory1_4_0.createLocalisedResourceDocJson(liftDoc, false, None, includeTechnology = false, urlParameters, "JSON request body fields:", "JSON response body fields:")
json1.implemented_by.technology shouldBe None
diff --git a/obp-api/src/test/scala/code/api/v2_1_0/EntitlementTests.scala b/obp-api/src/test/scala/code/api/v2_1_0/EntitlementTests.scala
index 8360d43692..91c0291c86 100644
--- a/obp-api/src/test/scala/code/api/v2_1_0/EntitlementTests.scala
+++ b/obp-api/src/test/scala/code/api/v2_1_0/EntitlementTests.scala
@@ -1,6 +1,6 @@
package code.api.v2_1_0
-import code.api.ResourceDocs1_4_0.ResourceDocs220
+import code.api.v2_1_0.Http4s210
import com.openbankproject.commons.model.ErrorMessage
import code.api.util.APIUtil.OAuth._
import code.api.util.ApiRole.{CanGetEntitlementsForAnyUserAtAnyBank, CanGetEntitlementsForAnyUserAtOneBank}
@@ -23,8 +23,8 @@ class EntitlementTests extends V210ServerSetup with DefaultUsers {
* This is made possible by the scalatest maven plugin
*/
object VersionOfApi extends Tag(ApiVersion.v2_1_0.toString)
- object ApiEndpoint1 extends Tag(nameOf(ResourceDocs220.Implementations2_1_0.getEntitlementsByBankAndUser))
- object ApiEndpoint2 extends Tag(nameOf(ResourceDocs220.Implementations2_1_0.getRoles))
+ object ApiEndpoint1 extends Tag(nameOf(Http4s210.Implementations2_1_0.getEntitlementsByBankAndUser))
+ object ApiEndpoint2 extends Tag(nameOf(Http4s210.Implementations2_1_0.getRoles))
feature("Assuring that endpoint getRoles works as expected - v2.1.0") {
diff --git a/scripts/rehydrate_resource_docs.py b/scripts/rehydrate_resource_docs.py
index 6b7f08c3c1..ec6ae15ebb 100755
--- a/scripts/rehydrate_resource_docs.py
+++ b/scripts/rehydrate_resource_docs.py
@@ -264,7 +264,7 @@ def collect_liftweb_full(source: str) -> dict[str, tuple[str, str, str]]:
while i < n:
line = lines[i]
stripped = line.lstrip()
- if stripped.startswith("//") and "staticResourceDocs += ResourceDoc(" in stripped:
+ if stripped.startswith("//") and "resourceDocs += ResourceDoc(" in stripped:
depth = 0
collected: list[str] = []
end = i