diff --git a/.github/workflows/build_container_develop_branch.yml b/.github/workflows/build_container_develop_branch.yml index c9355f523..a7f68daa9 100644 --- a/.github/workflows/build_container_develop_branch.yml +++ b/.github/workflows/build_container_develop_branch.yml @@ -69,9 +69,6 @@ jobs: echo COUNTERPARTY_OTP_INSTRUCTION_TRANSPORT=dummy >> obp-api/src/main/resources/props/test.default.props echo SEPA_CREDIT_TRANSFERS_OTP_INSTRUCTION_TRANSPORT=dummy >> obp-api/src/main/resources/props/test.default.props - echo kafka.akka.timeout = 9 >> obp-api/src/main/resources/props/test.default.props - echo remotedata.timeout = 10 >> obp-api/src/main/resources/props/test.default.props - echo allow_oauth2_login=true >> obp-api/src/main/resources/props/test.default.props echo oauth2.jwk_set.url=https://www.googleapis.com/oauth2/v3/certs >> obp-api/src/main/resources/props/test.default.props diff --git a/.github/workflows/build_container_non_develop_branch.yml b/.github/workflows/build_container_non_develop_branch.yml index 0a3a1e608..7978496c3 100644 --- a/.github/workflows/build_container_non_develop_branch.yml +++ b/.github/workflows/build_container_non_develop_branch.yml @@ -69,9 +69,6 @@ jobs: echo COUNTERPARTY_OTP_INSTRUCTION_TRANSPORT=dummy >> obp-api/src/main/resources/props/test.default.props echo SEPA_CREDIT_TRANSFERS_OTP_INSTRUCTION_TRANSPORT=dummy >> obp-api/src/main/resources/props/test.default.props - echo kafka.akka.timeout = 9 >> obp-api/src/main/resources/props/test.default.props - echo remotedata.timeout = 10 >> obp-api/src/main/resources/props/test.default.props - echo allow_oauth2_login=true >> obp-api/src/main/resources/props/test.default.props echo oauth2.jwk_set.url=https://www.googleapis.com/oauth2/v3/certs >> obp-api/src/main/resources/props/test.default.props diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 3398184a2..24500a23b 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -65,8 +65,6 @@ jobs: echo COUNTERPARTY_OTP_INSTRUCTION_TRANSPORT=dummy >> obp-api/src/main/resources/props/test.default.props echo SEPA_CREDIT_TRANSFERS_OTP_INSTRUCTION_TRANSPORT=dummy >> obp-api/src/main/resources/props/test.default.props - echo kafka.akka.timeout = 9 >> obp-api/src/main/resources/props/test.default.props - echo remotedata.timeout = 10 >> obp-api/src/main/resources/props/test.default.props echo allow_oauth2_login=true >> obp-api/src/main/resources/props/test.default.props echo oauth2.jwk_set.url=https://www.googleapis.com/oauth2/v3/certs >> obp-api/src/main/resources/props/test.default.props diff --git a/README.kafka.md b/README.kafka.md deleted file mode 100644 index f552fd725..000000000 --- a/README.kafka.md +++ /dev/null @@ -1,26 +0,0 @@ -## Kafka Quickstart - - Note that obp with kafka connector will also need a bank backend connected to the kafka that implements the following: https://apiexplorersandbox.openbankproject.com/glossary#Adapter.Kafka.Intro - - Otherwise obp will display anything but adapter errors. - -#####Configuration - -* Edit the OBP-API/obp-api/src/main/resources/props/default.props so that it contains the following lines: - - connector=kafka_vMay2019 - # kafka server location, plaintext for quickstart - kafka.host=localhost:9092 - # next 2 lines for legacy resons - kafka.request_topic=Request - kafka.response_topic=Response - # number of partitions available on kafka. Must match the kafka configuration!!!!!!. - kafka.partitions=1 - # no ssl for quickstart - kafka.use.ssl=false - # start with 1 for the first instance, set to 2 for the second instance etc - api_instance_id=1 - - - - diff --git a/README.md b/README.md index 4e4e8d6c9..d5f0de10e 100644 --- a/README.md +++ b/README.md @@ -374,17 +374,6 @@ We use 9 to run the API in production mode. Most internal OBP model data access now occurs over Akka. This is so the machine that has JDBC access to the OBP database can be physically separated from the OBP API layer. In this configuration we run two instances of OBP-API on two different machines and they communicate over Akka. Please see README.Akka.md for instructions. -## Using SSL Encryption with kafka - -For SSL encryption we use JKS keystores. Note that both the keystore and the truststore (and all keys within) must have the same password for unlocking, for which the API will stop at boot up and ask for. - -* Edit your props file(s) to contain: - - ``` - kafka.use.ssl=true - keystore.path=/path/to/api.keystore.jks - truststore.path=/path/to/api.truststore.jks - ``` ## Using SSL Encryption with RabbitMq diff --git a/cheat_sheet.md b/cheat_sheet.md index 94c6b4006..cc57deef9 100644 --- a/cheat_sheet.md +++ b/cheat_sheet.md @@ -24,8 +24,6 @@ [Access Control](https://apiexplorersandbox.openbankproject.com/glossary#API.Access-Control) -[OBP Kafka](https://apiexplorersandbox.openbankproject.com/glossary#Adapter.Kafka.Intro) - [OBP Akka](https://apiexplorersandbox.openbankproject.com/glossary#Adapter.Akka.Intro) [API Explorer](https://github.com/OpenBankProject/API-Explorer/blob/develop/README.md) diff --git a/completed_developments.md b/completed_developments.md index 7d63acb47..314d55f1a 100644 --- a/completed_developments.md +++ b/completed_developments.md @@ -278,10 +278,6 @@ Support for on premise OAuth2 provider e.g. MitreId. See the glossary. ### Message Docs (for Akka) Message Docs (which define Core Banking System Akka messages) are now available independent of the connector being used on the API instance. See [here](https://apiexplorersandbox.openbankproject.com/?ignoredefcat=true&tags=#v2_2_0-getMessageDocs) - -### Message Docs (for Kafka) -Message Docs (which define Core Banking System Kafka messages) are now available independent of the connector being used on the API instance. See [here](https://apiexplorersandbox.openbankproject.com/?ignoredefcat=true&tags=#v2_2_0-getMessageDocs) - ### Endpoint config and cleanup Endpoints can now be enabled / disabled explicitly using Props file. We removed old versions including v1.0, v1.1 and v.1.2. @@ -302,15 +298,11 @@ We added Custom code folders so that bank specific forks can more easily git mer ### API Tester -API Tester is a Python/Djano App for testing an OBP API instance from the outside. Partiularly useful when using a non-sandbox (e.g. kafka) connector. It supports a variety of authentication methods so you can test outside a gateway. You can configure different data profiles for specifying parameters such as bank_id, account_id etc. See [here](https://github.com/OpenBankProject/API-Tester) for the source code and installation instructions. +API Tester is a Python/Djano App for testing an OBP API instance from the outside. Partiularly useful when using a non-sandbox (e.g. RabbitMq) connector. It supports a variety of authentication methods so you can test outside a gateway. You can configure different data profiles for specifying parameters such as bank_id, account_id etc. See [here](https://github.com/OpenBankProject/API-Tester) for the source code and installation instructions. ### Extend Swagger support We improved the information contained in the Swagger (and Resource Doc) endpoints. They are also available from the API Explorer. See [here](https://apiexplorersandbox.openbankproject.com/?ignoredefcat=true&tags=#v1_4_0-getResourceDocsSwagger) - -### Kafka versioning -The built in kafka connectors now provide message versioning - ### Akka Remote data (Three tier architechture) Most OBP data access now happens over Akka. This allows the API layer to be physically separated from the storage layer with the API layer only able to call a specified set of data access functions with only the storage layer having JDBC / SQL access. @@ -428,13 +420,6 @@ is used to explore and interact with the OBP API. See [API Explorer on Sandbox]( See [Resource Docs endpoint](https://api.openbankproject.com/obp/v1.4.0/resource-docs/obp) -### Kafka connector - -* Get transactions via Kafka bus and language neutral connector on the south side of the MQ - -See [Docker obp-full-kafka](https://hub.docker.com/r/openbankproject/obp-full-kafka/) - - ### Version 1.4.0 This version is stable. For the spec see [here](https://github.com/OpenBankProject/OBP-API/wiki/REST-API-V1.4.0) or [here](https://apiexplorersandbox.openbankproject.com/?version=1.4.0&list-all-banks=false&core=&psd2=&obwg=&ignoredefcat=true) diff --git a/obp-api/pom.xml b/obp-api/pom.xml index a7e656118..69e3c2790 100644 --- a/obp-api/pom.xml +++ b/obp-api/pom.xml @@ -79,16 +79,6 @@ org.slf4j 1.7.26 - - org.apache.kafka - kafka-clients - ${kafka.version} - - - org.apache.kafka - connect-json - ${kafka.version} - org.bouncycastle bcpg-jdk15on @@ -253,11 +243,6 @@ akka-remote_${scala.version} ${akka.version} - - com.typesafe.akka - akka-stream-kafka_${scala.version} - ${akka-streams-kafka.version} - com.sksamuel.avro4s avro4s-core_${scala.version} @@ -512,14 +497,6 @@ 1.20.3 test - - - org.testcontainers - kafka - 1.20.3 - test - - diff --git a/obp-api/src/main/resources/i18n/lift-core_es_ES.properties b/obp-api/src/main/resources/i18n/lift-core_es_ES.properties index a9982ff42..56f866cc0 100644 --- a/obp-api/src/main/resources/i18n/lift-core_es_ES.properties +++ b/obp-api/src/main/resources/i18n/lift-core_es_ES.properties @@ -947,15 +947,11 @@ Este error no puede ser mostrado al usuario, sólo para depuración. OBP-50004 = método (AuthUser.getCurrentUser) no puede encontrar el usuario actual en el contexto actual! OBP-50005 = ha producido un error interno o no especificado. OBP-50006 = interrumpió la excepción. -OBP-50007 = de ejecución de Kafka. -OBP-50008 = de tiempo de espera del flujo Kafka de Akka. -OBP-50009 = desconocido de Kafka. OBP-50010 = devuelve la caja vacía a Liftweb. OBP-50012 = se puede obtener el objeto CallContext aquí. OBP-50013 = sistema bancario central devolvió un error o una respuesta no especificada. OBP-50014 = se puede actualizar el usuario. OBP-50015 = servidor encontró una condición inesperada que le impidió cumplir con la solicitud. -OBP-50016 = servidor kafka no está disponible. OBP-50017 = punto final está prohibido en esta instancia de la API. OBP-50018 = de construcción. OBP-50019 = se puede conectar a la base de datos OBP. @@ -981,7 +977,6 @@ OBP-50217 = no devolvió la transacción que solicitamos. OBP-50218 = conector no devolvió el conjunto de etiquetas de punto final que solicitamos. OBP-50219 = no devolvió las cuentas bancarias que solicitamos. #Excepciones del adaptador (OBP-6XXXX) -#Reservado para mensajes del adaptador (al sur de Kafka) #También se utiliza para el conector == mapeado, y mostrarlo como los errores internos. OBP-60001 = excepción de transacción. OBP-60002 = la Excepción de Valor de Carga. diff --git a/obp-api/src/main/resources/props/sample.props.template b/obp-api/src/main/resources/props/sample.props.template index 385f196ea..a3ecc27fd 100644 --- a/obp-api/src/main/resources/props/sample.props.template +++ b/obp-api/src/main/resources/props/sample.props.template @@ -31,7 +31,7 @@ connector=star #hikari.keepaliveTime= #hikari.maxLifetime= -## if connector = star, then need to set which connectors will be used. For now, obp support rest, akka, kafka. If you set kafka, then you need to start the kafka server. +## if connector = star, then need to set which connectors will be used. For now, obp support rest, akka. starConnector_supported_types=mapped,internal ## whether export LocalMappedConnector methods as endpoints, it is just for develop, default is false @@ -125,24 +125,6 @@ long_endpoint_timeout = 55000 ## Scheduler will be disabled if delay is not set. #transaction_status_scheduler_delay=300 -## If using kafka, set the brokers -#kafka.bootstrap_hosts=localhost:9092 -# WARNING: if this number does not match the partitions in Kafka config, you will SUFFER ! -#kafka.partitions=3 - -#This is the api instance, we create kafka topic based on this number, each instance should have each own id. use it in load balancing + Kafka setup -#This is also used for scheduler. -#OBP set the default as the non-persistent UUID string. -#api_instance_id=7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh -#If a value is set, OBP will concatenate the UUID string with the value. -#api_instance_id=1 -#When the value is set to conclude with "final," OBP will preserve that value. -#api_instance_id=1_final - -## DEPRECATED -## Enable user authentication via kafka -#kafka.user.authentication=true - ## Enable user authentication via the connector #connector.user.authentication=true @@ -150,9 +132,6 @@ long_endpoint_timeout = 55000 ## Enable SSL for JWT, if set to true must set paths for the keystore locations jwt.use.ssl=false -## Enable SSL for kafka, if set to true must set paths for the keystore locations -#kafka.use.ssl=true - ## Enable SSL for rabbitmq, if set to true must set paths for the keystore locations #rabbitmq.use.ssl=false @@ -710,9 +689,6 @@ autocomplete_at_login_form_enabled=false # To BYPASS this security features (for local development only), set this property to true to skip the email address validation. #authUser.skipEmailValidation=false -# If using Kafka but want to get counterparties from OBP, set this to true -#get_counterparties_from_OBP_DB=true - # control the create and access to public views. # allow_public_views=false @@ -756,7 +732,7 @@ dauth.host=127.0.0.1 # } # When is enabled we show all messages in a chain. For instance: # { -# "error": "OBP-30001: Bank not found. Please specify a valid value for BANK_ID. <- Full(Kafka_TimeoutExceptionjava.util.concurrent.TimeoutException: The stream has not been completed in 1550 milliseconds.)" +# "error": "OBP-30001: Bank not found. Please specify a valid value for BANK_ID. <- Full(TimeoutExceptionjava.util.concurrent.TimeoutException: The stream has not been completed in 1550 milliseconds.)" # } display_internal_errors=false # -------------------------------------- Display internal errors -- diff --git a/obp-api/src/main/resources/props/test.default.props.template b/obp-api/src/main/resources/props/test.default.props.template index 64308d35d..fc6228b8e 100644 --- a/obp-api/src/main/resources/props/test.default.props.template +++ b/obp-api/src/main/resources/props/test.default.props.template @@ -18,7 +18,6 @@ #which data connector to use #connector=rest -#connector=kafka #connector=obpjvm ## proxy connector get data from LocalMappedConnector, and set the follow corresponding fields to be null: @optional, inbound.optional.fields props, outbound.optional.fields props #connector=proxy @@ -28,17 +27,6 @@ starConnector_supported_types = mapped,internal # Connector cache time-to-live in seconds, caching disabled if not set #connector.cache.ttl.seconds=3 -# OBP-JVM transport type. currently supported: kafka, mock -#obpjvm.transport=kafka - -#if using kafka, set zookeeper host and brokers -#defaults to "localhost:2181" if not set -#kafka.zookeeper_host=localhost:2181 -#kafka.bootstrap_hosts=localhost:9092 - -#if using kafka, the following is mandatory -#kafka.request_topic=Request -#kafka.response_topic=Response #this is needed for oauth to work. it's important to access the api over this url, e.g. # if this is 127.0.0.1 don't use localhost to access it. diff --git a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala index e097bd7b7..394d9d13f 100644 --- a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala @@ -80,7 +80,6 @@ import code.endpointTag.EndpointTag import code.entitlement.{Entitlement, MappedEntitlement} import code.entitlementrequest.MappedEntitlementRequest import code.fx.{MappedCurrency, MappedFXRate} -import code.kafka.{KafkaHelperActors, OBPKafkaConsumer} import code.kycchecks.MappedKycCheck import code.kycdocuments.MappedKycDocument import code.kycmedias.MappedKycMedia @@ -540,13 +539,6 @@ class Boot extends MdcLoggable { } - if (connector.startsWith("kafka") || (connector == "star" && APIUtil.getPropsValue("starConnector_supported_types","").split(",").contains("kafka"))) { - logger.info(s"KafkaHelperActors.startLocalKafkaHelperWorkers( ${actorSystem} ) starting") - KafkaHelperActors.startLocalKafkaHelperWorkers(actorSystem) - // Start North Side Consumer if it's not already started - OBPKafkaConsumer.primaryConsumer.start() - } - // API Metrics (logs of API calls) // If set to true we will write each URL with params to a datastore / log file if (APIUtil.getPropsAsBoolValue("write_metrics", false)) { diff --git a/obp-api/src/main/scala/code/actorsystem/ObpActorInit.scala b/obp-api/src/main/scala/code/actorsystem/ObpActorInit.scala deleted file mode 100644 index 5e40fde3e..000000000 --- a/obp-api/src/main/scala/code/actorsystem/ObpActorInit.scala +++ /dev/null @@ -1,53 +0,0 @@ -package code.actorsystem - -import akka.util.Timeout -import code.api.APIFailure -import code.api.util.APIUtil -import code.util.Helper.MdcLoggable -import net.liftweb.common._ - -import com.openbankproject.commons.ExecutionContext.Implicits.global -import scala.concurrent.duration._ -import scala.concurrent.{Await, Future} -import scala.reflect.ClassTag - -trait ObpActorInit extends MdcLoggable{ - // Default is 3 seconds, which should be more than enough for slower systems - val ACTOR_TIMEOUT: Long = APIUtil.getPropsAsLongValue("remotedata.timeout").openOr(3) - - val actorName = CreateActorNameFromClassName(this.getClass.getName) - val actor = ObpLookupSystem.getActor(actorName) - logger.debug(s"Create this Actor: $actorName: ${actor}") - val TIMEOUT = (ACTOR_TIMEOUT seconds) - implicit val timeout = Timeout(ACTOR_TIMEOUT * (1000 milliseconds)) - - /** - * This function extracts the payload from Future and wraps it to Box. - * It is used for Old Style Endpoints at Kafka connector. - * @param f The payload wrapped into Future - * @tparam T The type of the payload - * @return The payload wrapped into Box - */ - def extractFutureToBox[T: ClassTag](f: Future[Any]): Box[T] = { - val r: Future[Box[T]] = f.map { - case f@ (_: ParamFailure[_] | _: APIFailure) => Empty ~> f - case f: Failure => f - case Empty => Empty - case t: T => Full(t) - case _ => Empty ~> APIFailure("future extraction to box failed", 501) - } - - Await.result(r, TIMEOUT) - - } - - def getValueFromFuture[T](f: Future[T]): T = { - Await.result(f, TIMEOUT) - } - - def CreateActorNameFromClassName(c: String): String = { - val n = c.replaceFirst("^.*Remotedata", "").replaceAll("\\$.*", "") - Character.toLowerCase(n.charAt(0)) + n.substring(1) - } - -} \ No newline at end of file diff --git a/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala b/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala index 2b9a0bf2b..a847b4f89 100644 --- a/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala +++ b/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala @@ -28,34 +28,6 @@ trait ObpLookupSystem extends MdcLoggable { obpLookupSystem } - def getKafkaActor(actorName: String) = { - - val actorPath: String = { - val hostname = ObpActorConfig.localHostname - val port = ObpActorConfig.localPort - val props_hostname = Helper.getHostname - if (port == 0) { - logger.error("Failed to connect to local Kafka actor") - } - s"akka.tcp://ObpActorSystem_${props_hostname}@${hostname}:${port}/user/${actorName}" - } - - this.obpLookupSystem.actorSelection(actorPath) - } - - def getKafkaActorChild(actorName: String, actorChildName: String) = { - val actorPath: String = { - val hostname = ObpActorConfig.localHostname - val port = ObpActorConfig.localPort - val props_hostname = Helper.getHostname - if (port == 0) { - logger.error("Failed to connect to local Kafka actor") - } - s"akka.tcp://ObpActorSystem_${props_hostname}@${hostname}:${port}/user/${actorName}/${actorChildName}" - } - this.obpLookupSystem.actorSelection(actorPath) - } - def getActor(actorName: String) = { val actorPath: String = { diff --git a/obp-api/src/main/scala/code/api/OBPRestHelper.scala b/obp-api/src/main/scala/code/api/OBPRestHelper.scala index 36063c008..f707e265b 100644 --- a/obp-api/src/main/scala/code/api/OBPRestHelper.scala +++ b/obp-api/src/main/scala/code/api/OBPRestHelper.scala @@ -246,7 +246,7 @@ trait OBPRestHelper extends RestHelper with MdcLoggable { # } # When is enabled we show all messages in a chain. For instance: # { - # "error": "OBP-30001: Bank not found. Please specify a valid value for BANK_ID. <- Full(Kafka_TimeoutExceptionjava.util.concurrent.TimeoutException: The stream has not been completed in 1550 milliseconds.)" + # "error": "OBP-30001: Bank not found. Please specify a valid value for BANK_ID. <- Full(TimeoutExceptionjava.util.concurrent.TimeoutException: The stream has not been completed in 1550 milliseconds.)" # } */ implicit def jsonResponseBoxToJsonResponse(box: Box[JsonResponse]): JsonResponse = { 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 ff0d92a9a..98865ed6a 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 @@ -421,8 +421,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth val (tags, partialFunctions, locale, contentParam, apiCollectionIdParam) = ResourceDocsAPIMethodsUtil.getParams() cc => implicit val ec = EndpointContext(Some(cc)) - val resourceDocs = getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,false) - resourceDocs + getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,false) } } @@ -446,8 +445,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth val (tags, partialFunctions, locale, contentParam, apiCollectionIdParam) = ResourceDocsAPIMethodsUtil.getParams() cc => implicit val ec = EndpointContext(Some(cc)) - val resourceDocs = getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,true) - resourceDocs + getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,true) } } @@ -492,61 +490,63 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth Some(isVersion4OrHigher) ) json <- locale match { - case _ if (apiCollectionIdParam.isDefined) => - val operationIds = MappedApiCollectionEndpointsProvider.getApiCollectionEndpoints(apiCollectionIdParam.getOrElse("")).map(_.operationId).map(getObpFormatOperationId) - val resourceDocs = ResourceDoc.getResourceDocs(operationIds) - val resourceDocsJson = JSONFactory1_4_0.createResourceDocsJson(resourceDocs, isVersion4OrHigher, locale) - val resourceDocsJsonJValue = Full(resourceDocsJsonToJsonResponse(resourceDocsJson)) - Future(resourceDocsJsonJValue.map(successJsonResponse(_))) + case _ if (apiCollectionIdParam.isDefined) => + NewStyle.function.tryons(s"$UnknownError Can not prepare OBP resource docs.", 500, callContext) { + val operationIds = MappedApiCollectionEndpointsProvider.getApiCollectionEndpoints(apiCollectionIdParam.getOrElse("")).map(_.operationId).map(getObpFormatOperationId) + val resourceDocs = ResourceDoc.getResourceDocs(operationIds) + val resourceDocsJson = JSONFactory1_4_0.createResourceDocsJson(resourceDocs, isVersion4OrHigher, locale) + val resourceDocsJsonJValue = Full(resourceDocsJsonToJsonResponse(resourceDocsJson)) + resourceDocsJsonJValue.map(successJsonResponse(_)) + } case _ => contentParam match { case Some(DYNAMIC) =>{ - val cacheValueFromRedis = Caching.getDynamicResourceDocCache(cacheKey) - val dynamicDocs: Box[JValue] = - if (cacheValueFromRedis.isDefined) { - Full(json.parse(cacheValueFromRedis.get)) - } else { - val resourceDocJson = getResourceDocsObpDynamicCached(tags, partialFunctions, locale, None, false) - val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head - val jsonString = json.compactRender(resourceDocJsonJValue) - Caching.setDynamicResourceDocCache(cacheKey, jsonString) - Full(resourceDocJsonJValue) - } - - Future(dynamicDocs.map(successJsonResponse(_))) + NewStyle.function.tryons(s"$UnknownError Can not prepare OBP resource docs.", 500, callContext) { + val cacheValueFromRedis = Caching.getDynamicResourceDocCache(cacheKey) + val dynamicDocs: Box[JValue] = + if (cacheValueFromRedis.isDefined) { + Full(json.parse(cacheValueFromRedis.get)) + } else { + val resourceDocJson = getResourceDocsObpDynamicCached(tags, partialFunctions, locale, None, false) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head + val jsonString = json.compactRender(resourceDocJsonJValue) + Caching.setDynamicResourceDocCache(cacheKey, jsonString) + Full(resourceDocJsonJValue) + } + dynamicDocs.map(successJsonResponse(_)) + } } - case Some(STATIC) => { - val cacheValueFromRedis = Caching.getStaticResourceDocCache(cacheKey) - - val staticDocs: Box[JValue] = - if (cacheValueFromRedis.isDefined) { - Full(json.parse(cacheValueFromRedis.get)) - } else { - val resourceDocJson = getStaticResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, isVersion4OrHigher) - val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head - val jsonString = json.compactRender(resourceDocJsonJValue) - Caching.setStaticResourceDocCache(cacheKey, jsonString) - Full(resourceDocJsonJValue) - } - - Future(staticDocs.map(successJsonResponse(_))) + NewStyle.function.tryons(s"$UnknownError Can not prepare OBP resource docs.", 500, callContext) { + val cacheValueFromRedis = Caching.getStaticResourceDocCache(cacheKey) + val staticDocs: Box[JValue] = + if (cacheValueFromRedis.isDefined) { + Full(json.parse(cacheValueFromRedis.get)) + } else { + val resourceDocJson = getStaticResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, isVersion4OrHigher) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head + val jsonString = json.compactRender(resourceDocJsonJValue) + Caching.setStaticResourceDocCache(cacheKey, jsonString) + Full(resourceDocJsonJValue) + } + staticDocs.map(successJsonResponse(_)) + } } case _ => { - val cacheValueFromRedis = Caching.getAllResourceDocCache(cacheKey) - - val bothStaticAndDyamicDocs: Box[JValue] = - if (cacheValueFromRedis.isDefined) { - Full(json.parse(cacheValueFromRedis.get)) - } else { - val resourceDocJson = getAllResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, contentParam, isVersion4OrHigher) - val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head - val jsonString = json.compactRender(resourceDocJsonJValue) - Caching.setAllResourceDocCache(cacheKey, jsonString) - Full(resourceDocJsonJValue) - } - - Future(bothStaticAndDyamicDocs.map(successJsonResponse(_))) + NewStyle.function.tryons(s"$UnknownError Can not prepare OBP resource docs.", 500, callContext) { + val cacheValueFromRedis = Caching.getAllResourceDocCache(cacheKey) + val bothStaticAndDyamicDocs: Box[JValue] = + if (cacheValueFromRedis.isDefined) { + Full(json.parse(cacheValueFromRedis.get)) + } else { + val resourceDocJson = getAllResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, contentParam, isVersion4OrHigher) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head + val jsonString = json.compactRender(resourceDocJsonJValue) + Caching.setAllResourceDocCache(cacheKey, jsonString) + Full(resourceDocJsonJValue) + } + bothStaticAndDyamicDocs.map(successJsonResponse(_)) + } } } } @@ -681,27 +681,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth } else { Future.successful(true) } - isVersion4OrHigher = true - resourceDocsJsonFiltered <- locale match { - case _ if (apiCollectionIdParam.isDefined) => - val operationIds = MappedApiCollectionEndpointsProvider.getApiCollectionEndpoints(apiCollectionIdParam.getOrElse("")).map(_.operationId).map(getObpFormatOperationId) - val resourceDocs = ResourceDoc.getResourceDocs(operationIds) - val resourceDocsJson = JSONFactory1_4_0.createResourceDocsJson(resourceDocs, isVersion4OrHigher, locale) - Future(resourceDocsJson.resource_docs) - case _ => - contentParam match { - case Some(DYNAMIC) => - Future(getResourceDocsObpDynamicCached(resourceDocTags, partialFunctions, locale, None, isVersion4OrHigher).head.resource_docs) - case Some(STATIC) => { - Future(getStaticResourceDocsObpCached(requestedApiVersionString, resourceDocTags, partialFunctions, locale, isVersion4OrHigher).head.resource_docs) - } - case _ => { - Future(getAllResourceDocsObpCached(requestedApiVersionString, resourceDocTags, partialFunctions, locale, contentParam, isVersion4OrHigher).head.resource_docs) - } - } - } - cacheKey = APIUtil.createResourceDocCacheKey( None, requestedApiVersionString, @@ -710,14 +690,32 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth locale, contentParam, apiCollectionIdParam, - None + Some(isVersion4OrHigher) ) - swaggerJValue <- NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { - val cacheValueFromRedis = Caching.getStaticSwaggerDocCache(cacheKey) - - if (cacheValueFromRedis.isDefined) { - json.parse(cacheValueFromRedis.get) - } else { + cacheValueFromRedis = Caching.getStaticSwaggerDocCache(cacheKey) + + swaggerJValue <- if (cacheValueFromRedis.isDefined) { + NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file from cache.", 400, cc.callContext) {json.parse(cacheValueFromRedis.get)} + } else { + NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { + val resourceDocsJsonFiltered = locale match { + case _ if (apiCollectionIdParam.isDefined) => + val operationIds = MappedApiCollectionEndpointsProvider.getApiCollectionEndpoints(apiCollectionIdParam.getOrElse("")).map(_.operationId).map(getObpFormatOperationId) + val resourceDocs = ResourceDoc.getResourceDocs(operationIds) + val resourceDocsJson = JSONFactory1_4_0.createResourceDocsJson(resourceDocs, isVersion4OrHigher, locale) + resourceDocsJson.resource_docs + case _ => + contentParam match { + case Some(DYNAMIC) => + getResourceDocsObpDynamicCached(resourceDocTags, partialFunctions, locale, None, isVersion4OrHigher).head.resource_docs + case Some(STATIC) => { + getStaticResourceDocsObpCached(requestedApiVersionString, resourceDocTags, partialFunctions, locale, isVersion4OrHigher).head.resource_docs + } + case _ => { + getAllResourceDocsObpCached(requestedApiVersionString, resourceDocTags, partialFunctions, locale, contentParam, isVersion4OrHigher).head.resource_docs + } + } + } convertResourceDocsToSwaggerJvalueAndSetCache(cacheKey, requestedApiVersionString, resourceDocsJsonFiltered) } } diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala index a646dc4b6..b1a267792 100644 --- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala +++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala @@ -618,7 +618,7 @@ object SwaggerDefinitionsJSON { val messageDocJson = MessageDocJson( process = "getAccounts", - message_format = "KafkaV2017", + message_format = "rest_vMar2019", inbound_topic = Some("from.obp.api.1.to.adapter.mf.caseclass.OutboundGetAccounts"), outbound_topic = Some("to.obp.api.1.caseclass.OutboundGetAccounts"), description = "get Banks", @@ -4020,7 +4020,7 @@ object SwaggerDefinitionsJSON { user_auth_contexts = List(userAuthContextJson) ) - val obpApiLoopbackJson = ObpApiLoopbackJson("kafka_vSept2018","f0acd4be14cdcb94be3433ec95c1ad65228812a0","10 ms") + val obpApiLoopbackJson = ObpApiLoopbackJson("rest_vMar2019","f0acd4be14cdcb94be3433ec95c1ad65228812a0","10 ms") val refresUserJson = RefreshUserJson("10 ms") diff --git a/obp-api/src/main/scala/code/api/cache/Caching.scala b/obp-api/src/main/scala/code/api/cache/Caching.scala index 268bf9708..4ac7663cb 100644 --- a/obp-api/src/main/scala/code/api/cache/Caching.scala +++ b/obp-api/src/main/scala/code/api/cache/Caching.scala @@ -57,14 +57,6 @@ object Caching extends MdcLoggable { } } - def getLocalisedResourceDocCache(key: String) = { - use(JedisMethod.GET, (LOCALISED_RESOURCE_DOC_PREFIX + key).intern(), Some(CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL)) - } - - def setLocalisedResourceDocCache(key:String, value: String)= { - use(JedisMethod.SET, (LOCALISED_RESOURCE_DOC_PREFIX+key).intern(), Some(CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL), Some(value)) - } - def getDynamicResourceDocCache(key: String) = { use(JedisMethod.GET, (DYNAMIC_RESOURCE_DOC_CACHE_KEY_PREFIX + key).intern(), Some(GET_DYNAMIC_RESOURCE_DOCS_TTL)) } diff --git a/obp-api/src/main/scala/code/api/cache/InMemory.scala b/obp-api/src/main/scala/code/api/cache/InMemory.scala index 2b45437cf..ba86bbfa6 100644 --- a/obp-api/src/main/scala/code/api/cache/InMemory.scala +++ b/obp-api/src/main/scala/code/api/cache/InMemory.scala @@ -13,7 +13,7 @@ import com.openbankproject.commons.ExecutionContext.Implicits.global object InMemory extends MdcLoggable { - val underlyingGuavaCache = CacheBuilder.newBuilder().maximumSize(10000L).build[String, Object] + val underlyingGuavaCache = CacheBuilder.newBuilder().maximumSize(100000L).build[String, Object] implicit val scalaCache = ScalaCache(GuavaCache(underlyingGuavaCache)) def memoizeSyncWithInMemory[A](cacheKey: Option[String])(@cacheKeyExclude ttl: Duration)(@cacheKeyExclude f: => A): A = { diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala index b6ffc5304..af0006dac 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -2057,7 +2057,6 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ Glossary.glossaryItems.toList.sortBy(_.title) } - // Used to document the KafkaMessage calls case class MessageDoc( process: String, messageFormat: String, @@ -3389,7 +3388,6 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ /** * This method is used for cache in connector level. - * eg: KafkaMappedConnector_vJune2017.bankTTL * The default cache time unit is second. */ def getSecondsCache(cacheType: String) : Int = { diff --git a/obp-api/src/main/scala/code/api/util/DynamicUtil.scala b/obp-api/src/main/scala/code/api/util/DynamicUtil.scala index 108a776a8..dbe790ebb 100644 --- a/obp-api/src/main/scala/code/api/util/DynamicUtil.scala +++ b/obp-api/src/main/scala/code/api/util/DynamicUtil.scala @@ -256,7 +256,6 @@ object DynamicUtil extends MdcLoggable{ |import code.api.dynamic.endpoint.helper.MockResponseHolder |import code.bankconnectors._ |import code.customer.internalMapping.MappedCustomerIdMappingProvider - |import code.kafka.KafkaHelper |import code.model.dataAccess.internalMapping.MappedAccountIdMappingProvider |import code.util.AkkaHttpClient._ |import code.util.Helper.MdcLoggable diff --git a/obp-api/src/main/scala/code/api/util/ErrorMessages.scala b/obp-api/src/main/scala/code/api/util/ErrorMessages.scala index e26c48520..8e28a23ab 100644 --- a/obp-api/src/main/scala/code/api/util/ErrorMessages.scala +++ b/obp-api/src/main/scala/code/api/util/ErrorMessages.scala @@ -682,21 +682,15 @@ object ErrorMessages { // Exceptions (OBP-50XXX) val UnknownError = "OBP-50000: Unknown Error." val FutureTimeoutException = "OBP-50001: Future Timeout Exception." - val KafkaMessageClassCastException = "OBP-50002: Kafka Response Message Class Cast Exception." val AdapterOrCoreBankingSystemException = "OBP-50003: Adapter Or Core Banking System Exception. Failed to get a valid response from the south side Adapter or Core Banking System." // This error may not be shown to user, just for debugging. val CurrentUserNotFoundException = "OBP-50004: Method (AuthUser.getCurrentUser) can not find the current user in the current context!" val AnUnspecifiedOrInternalErrorOccurred = "OBP-50005: An unspecified or internal error occurred." - val KafkaInterruptedException = "OBP-50006: Kafka interrupted exception." - val KafkaExecutionException = "OBP-50007: Kafka execution exception." - val KafkaStreamTimeoutException = "OBP-50008: Akka Kafka stream timeout exception." - val KafkaUnknownError = "OBP-50009: Kafka Unknown Error." val ScalaEmptyBoxToLiftweb = "OBP-50010: Scala return Empty box to Liftweb." val NoCallContext = "OBP-50012: Can not get the CallContext object here." val UnspecifiedCbsError = "OBP-50013: The Core Banking System returned an unspecified error or response." val RefreshUserError = "OBP-50014: Can not refresh User." val InternalServerError = "OBP-50015: The server encountered an unexpected condition which prevented it from fulfilling the request." - val KafkaServerUnavailable = "OBP-50016: The kafka server is unavailable." val NotAllowedEndpoint = "OBP-50017: The endpoint is forbidden at this API instance." val UnderConstructionError = "OBP-50018: Under Construction Error." val DatabaseConnectionClosedError = "OBP-50019: Cannot connect to the OBP database." @@ -727,7 +721,6 @@ object ErrorMessages { val InvalidConnectorResponseForGetStatus = "OBP-50222: Connector method getStatus did not return the data we requested." // Adapter Exceptions (OBP-6XXXX) - // Reserved for adapter (south of Kafka) messages // Also used for connector == mapped, and show it as the Internal errors. val GetStatusException = "OBP-60001: Save Transaction Exception. " val GetChargeValueException = "OBP-60002: Get ChargeValue Exception. " diff --git a/obp-api/src/main/scala/code/api/util/Glossary.scala b/obp-api/src/main/scala/code/api/util/Glossary.scala index 425a97c92..357a15c75 100644 --- a/obp-api/src/main/scala/code/api/util/Glossary.scala +++ b/obp-api/src/main/scala/code/api/util/Glossary.scala @@ -129,10 +129,10 @@ object Glossary extends MdcLoggable { // NOTE! Some glossary items are defined in ExampleValue.scala - val latestKafkaConnector : String = "kafka_vSept2018" + val latestConnector : String = "rest_vMar2019" def messageDocLink(process: String) : String = { - s"""$process""" + s"""$process""" } val latestAkkaConnector : String = "akka_vDec2018" @@ -171,8 +171,6 @@ object Glossary extends MdcLoggable { | |[Access Control](/glossary#API.Access-Control) | - |[OBP Kafka](/glossary#Adapter.Kafka.Intro) - | |[OBP Akka](/glossary#Adapter.Akka.Intro) | |[API Explorer](https://github.com/OpenBankProject/API-Explorer/blob/develop/README.md) @@ -289,159 +287,6 @@ object Glossary extends MdcLoggable { | """) - - - glossaryItems += GlossaryItem( - title = "Adapter.Kafka.Intro", - description = - s""" - |## Use Kafka as an interface between OBP and your Core Banking System (CBS). -| -| -|For an introduction to Kafka see [here](https://kafka.apache.org/) -| - |### Installation Prerequisites - | - | - |* You have OBP-API running and it is connected to a Kafka installation. - | You can check OBP -> Kafka connectivity using the "loopback" endpoint. - | - |* Ideally you have API Explorer running (the application serving this page) but its not necessary - you could use any other REST client. - |* You might want to also run API Manager as it makes it easier to grant yourself roles, but its not necessary - you could use the API Explorer / any REST client instead. - | -|### Create a Customer User and an Admin User -| -|* Register a User who will use the API as a Customer. -|* Register another User that will use the API as an Admin. The Admin user will need some Roles. See [here](/index#OBPv2_0_0-addEntitlement). You can bootstrap an Admin user by editing the Props file. See the README for that. -| -|### Add some authentication context to the Customer User -| -|* As the Admin User, use the [Create Auth Context](/index#OBPv3_1_0-createUserAuthContext) endpoint to add one or more attributes to the Customer User. -|For instance you could add the name/value pair CUSTOMER_NUMBER/889763 and this will be sent to the Adapter / CBS inside the AuthInfo object. -| -| -|Now you should be able to use the [Get Auth Contexts](/index#OBPv3_1_0-getUserAuthContexts) endpoint to see the data you added. -| -|### Write or Build an Adapter to respond to the following messages. -| -| When getting started, we suggest that you implement the messages in the following order: -| - |1) Core (Prerequisites) - Get Adapter, Get Banks, Get Bank - | - |* ${messageDocLink("obp.getAdapterInfo")} - | - |Now you should be able to use the [Adapter Info](/index#OBPv3_1_0-getAdapterInfo) endpoint - | - |* ${messageDocLink("obp.getBanks")} - | - |Now you should be able to use the [Get Banks](/index#OBPv3_0_0-getBanks) endpoint - | - |* ${messageDocLink("obp.getBank")} - | - |Now you should be able to use the [Get Bank](/index#OBPv3_0_0-bankById) endpoint - | - | - |2) Core (Authentications) -The step1 Apis are all anonymous access. If you need to link bank customer data to the obp user, - | Then you need link OBP user with Bank user/customer using the [Create User Auth Context]((/index#OBPv3_1_0-createUserAuthContext)). Also - | check the description for this endpoint. Once you create the user-auth-context for one user, then these user-auth-context key value pair - | can be propagated over connector message. Than the Adapter can use it to map OBP user and Bank user/customer. - | - |* ${messageDocLink("obp.getBankAccountsForUser")} - | - |Now you should be able to use the [Refresh User](/index#OBPv3_1_0-refreshUser) endpoint - | - |3) Customers for logged in User - | - |* ${messageDocLink("obp.getCustomersByUserIdBox")} - | - |Now you should be able to use the [Get Customers](/index#OBPv3_0_0-getCustomersForUser) endpoint. - | - | - |4) Get Accounts - | - |Now you should already be able to use the [Get Accounts at Bank (IDs only).](/index#OBPv3_0_0-getPrivateAccountIdsbyBankId) endpoint. - | - |* ${messageDocLink("obp.getCoreBankAccounts")} - | - | The above messages should enable at least the following endpoints: - | - |* [Get Accounts at Bank (Minimal).](/index#OBPv3_0_0-privateAccountsAtOneBank) - |* [Get Accounts at all Banks (private)](/index#OBPv3_0_0-corePrivateAccountsAllBanks) - | - |5) Get Account - | - |* ${messageDocLink("obp.checkBankAccountExists")} - |* ${messageDocLink("obp.getBankAccount")} - | - | The above message should enable at least the following endpoints: - | - |* [Get Account by Id - Core](/index#OBPv3_0_0-getCoreAccountById) - |* [Get Account by Id - Full](/index#OBPv3_0_0-getPrivateAccountById) - | - |6) Get Transactions - | - |* ${messageDocLink("obp.getTransactions")} - |* ${messageDocLink("obp.getTransaction")} - | - |7) Manage Counterparties - | - |* ${messageDocLink("obp.getCounterparties")} - |* ${messageDocLink("obp.getCounterpartyByCounterpartyId")} - |* ${messageDocLink("obp.createCounterparty")} - | - |8) Get Transaction Request Types - | - |* This is configured using OBP Props - No messages required - | - |9) Get Challenge Threshold (CBS) - | - |* ${messageDocLink("obp.getChallengeThreshold")} - | - |10) Make Payment (used by Create Transaction Request) - | - |* ${messageDocLink("obp.makePaymentv210")} - |* This also requires 8,9,10 for high value payments. - | - |11) Get Transaction Requests. - | - |* ${messageDocLink("obp.getTransactionRequests210")} - | - |12) Generate Security Challenges (CBS) - | - |* ${messageDocLink("obp.createChallenge")} - | - |13) Answer Security Challenges (Validate) - | - |* Optional / Internal OBP (No additional messages required) - | - |14) Manage Counterparty Metadata - | - |* Internal OBP (No additional messages required) - | - |15) Get Entitlements - | - |* Internal OBP (No additional messages required) - | - |16) Manage Roles - | - |* Internal OBP (No additional messages required) - | - |17) Manage Entitlements - | - |* Internal OBP (No additional messages required) - | - |18) Manage Views - | - |* Internal OBP (No additional messages required) - | - |19) Manage Transaction Metadata - | - |* Internal OBP (No additional messages required) - | - |""" - ) - - glossaryItems += GlossaryItem( title = "Adapter.Stored_Procedure.Intro", description = @@ -488,14 +333,14 @@ object Glossary extends MdcLoggable { | |However, there are multiple available connector implementations - and you can also mix and create your own.| | - |E.g. Kafka + |E.g. RabbitMq | |
 				 |[=============]                              [============]       [============]     [============]       [============]
 				 |[             ]                              [            ]       [            ]     [            ]       [            ]
-				 |[   OBP API   ] ===> Kafka Connector   ===>  [  Kafka     ] ===>  [  Kafka     ]     [  OBP Kafka ]  ===> [  CBS       ]
+				 |[   OBP API   ] ===> RabbitMq Connector ===> [  RabbitMq  ] ===>  [  RabbitMq  ]     [ OBP RabbitMq] ===> [     CBS    ]
 				 |[             ]      Puts OBP Messages       [  Connector ]       [  Cluster   ]     [  Adapter   ]       [            ]
-				 |[=============]       onto a Kafka           [============]       [============]     [============]       [============]
+				 |[=============]       onto a RabbitMq           [============]       [============]     [============]       [============]
 				 |
 				 |
| @@ -691,7 +536,7 @@ object Glossary extends MdcLoggable { |It SHOULD be a UUID. It MUST be unique in combination with the BANK_ID. ACCOUNT_ID is used in many URLS so it should be considered public. |(We do NOT use account number in URLs since URLs are cached and logged all over the internet.) |In local / sandbox mode, ACCOUNT_ID is generated as a UUID and stored in the database. - |In non sandbox modes (Kafka etc.), ACCOUNT_ID is mapped to core banking account numbers / identifiers at the South Side Adapter level. + |In non sandbox modes (RabbitMq etc.), ACCOUNT_ID is mapped to core banking account numbers / identifiers at the South Side Adapter level. |ACCOUNT_ID is used to link Metadata and Views so it must be persistant and known to the North Side (OBP-API). | | Example value: ${accountIdExample.value} @@ -3172,7 +3017,7 @@ object Glossary extends MdcLoggable { | |The OBP Connector is a core part of the OBP-API and is written in Scala / Java and potentially other JVM languages. | -|The OBP Connector implements multiple functions / methods in a style that satisfies a particular transport / protocol such as HTTP REST, Akka or Kafka. +|The OBP Connector implements multiple functions / methods in a style that satisfies a particular transport / protocol such as HTTP REST, Akka or RabbitMq. | |An OBP Adapter is a separate software component written in any programming language that responds to requests from the OBP Connector. | @@ -3193,7 +3038,7 @@ object Glossary extends MdcLoggable { | 1) The Name of the internal OBP function / method e.g. getAccountsForUser | 2) The Outbound Message structure. | 3) The Inbound Message structure. -| 4) The Connector name which denotes the protocol / transport used (e.g. REST, Akka, Kafka etc) +| 4) The Connector name which denotes the protocol / transport used (e.g. REST, Akka, RabbitMq etc) | 5) Outbound / Inbound Topic | 6) A list of required Inbound fields | 7) A list of dependent endpoints. @@ -3233,7 +3078,7 @@ object Glossary extends MdcLoggable { |This contains the named fields and their values which are specific to each Function / Message Doc. | | -|The Outbound / Inbound Topics are used for routing in multi OBP instance / Kafka installations. (so OBP nodes only listen only to the correct Topics). +|The Outbound / Inbound Topics are used for routing in multi OBP instance / RabbitMq installations. (so OBP nodes only listen only to the correct Topics). | |The dependent endpoints are listed to facilitate navigation in the API Explorer so integrators can test endpoints during integration. | @@ -3247,7 +3092,7 @@ object Glossary extends MdcLoggable { s""" | | Open Bank Project can have different connectors, to connect difference data sources. - | We support several sources at the moment, eg: databases, rest services, stored procedures and kafka. + | We support several sources at the moment, eg: databases, rest services, stored procedures and RabbitMq. | | If OBP set connector=star, then you can use this method routing to switch the sources. | And we also provide the fields mapping in side the endpoints. If the fields in the source are different from connector, diff --git a/obp-api/src/main/scala/code/api/util/NewStyle.scala b/obp-api/src/main/scala/code/api/util/NewStyle.scala index 2f12450ba..84d31cccb 100644 --- a/obp-api/src/main/scala/code/api/util/NewStyle.scala +++ b/obp-api/src/main/scala/code/api/util/NewStyle.scala @@ -1385,7 +1385,7 @@ object NewStyle extends MdcLoggable{ def getTransactionRequestImpl(transactionRequestId: TransactionRequestId, callContext: Option[CallContext]): OBPReturnType[TransactionRequest] = { - //Note: this method is not over kafka yet, so use Future here. + //Note: this method is not over CBS yet, so use Future here. Future{ Connector.connector.vend.getTransactionRequestImpl(transactionRequestId, callContext)} map { unboxFullOrFail(_, callContext, s"$InvalidTransactionRequestId Current TransactionRequestId($transactionRequestId) ") } diff --git a/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala b/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala index 43d3ea870..a93e711de 100644 --- a/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala +++ b/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala @@ -135,7 +135,7 @@ object WriteMetricUtil extends MdcLoggable { Empty } - // TODO This should use Elastic Search or Kafka not an RDBMS + // TODO This should use Elastic Search not an RDBMS val u: User = user.orNull val userId = if (u != null) u.userId else "null" val userName = if (u != null) u.name else "null" diff --git a/obp-api/src/main/scala/code/api/v1_4_0/JSONFactory1_4_0.scala b/obp-api/src/main/scala/code/api/v1_4_0/JSONFactory1_4_0.scala index 92816ac80..bc2701364 100644 --- a/obp-api/src/main/scala/code/api/v1_4_0/JSONFactory1_4_0.scala +++ b/obp-api/src/main/scala/code/api/v1_4_0/JSONFactory1_4_0.scala @@ -1,5 +1,6 @@ package code.api.v1_4_0 +import code.api.Constant.{CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL, LOCALISED_RESOURCE_DOC_PREFIX} import code.api.berlin.group.v1_3.JvalueCaseClass import code.api.cache.Caching import java.util.Date @@ -519,17 +520,17 @@ object JSONFactory1_4_0 extends MdcLoggable{ jsonFieldsDescription.mkString(jsonTitleType,"","\n") } - //cache key will only contain "operationId + locale" - def createLocalisedResourceDocJsonCached( operationId: String, // this will be in the cacheKey locale: Option[String],// this will be in the cacheKey resourceDocUpdatedTags: ResourceDoc, - isVersion4OrHigher:Boolean, + isVersion4OrHigher:Boolean,// this will be in the cacheKey urlParametersI18n:String , jsonRequestBodyFieldsI18n:String, jsonResponseBodyFieldsI18n:String ): ResourceDocJson = { + val cacheKey = LOCALISED_RESOURCE_DOC_PREFIX + s"operationId:${operationId}-locale:$locale- isVersion4OrHigher:$isVersion4OrHigher".intern() + Caching.memoizeSyncWithImMemory(Some(cacheKey))(CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL seconds) { val fieldsDescription = if (resourceDocUpdatedTags.tags.toString.contains("Dynamic-Entity") || resourceDocUpdatedTags.tags.toString.contains("Dynamic-Endpoint") @@ -588,7 +589,7 @@ object JSONFactory1_4_0 extends MdcLoggable{ logger.trace(s"createLocalisedResourceDocJsonCached value is $resourceDoc") resourceDoc - } + }} def createLocalisedResourceDocJson(rd: ResourceDoc, isVersion4OrHigher:Boolean, locale: Option[String], urlParametersI18n:String ,jsonRequestBodyFieldsI18n:String, jsonResponseBodyFieldsI18n:String) : ResourceDocJson = { @@ -596,26 +597,15 @@ object JSONFactory1_4_0 extends MdcLoggable{ val userDefinedEndpointTags = getAllEndpointTagsBox(rd.operationId).map(endpointTag =>ResourceDocTag(endpointTag.tagName)) val resourceDocWithUserDefinedEndpointTags: ResourceDoc = rd.copy(tags = userDefinedEndpointTags++ rd.tags) - val cacheKey = s"operationId:${resourceDocWithUserDefinedEndpointTags.operationId}-locale:$locale- isVersion4OrHigher:$isVersion4OrHigher".intern() - val cacheValueFromRedis = Caching.getLocalisedResourceDocCache(cacheKey) - - if(cacheValueFromRedis.isDefined){ - json.parse(cacheValueFromRedis.get).extract[ResourceDocJson] - }else{ - val resourceDocJson = createLocalisedResourceDocJsonCached( - resourceDocWithUserDefinedEndpointTags.operationId, - locale: Option[String], - resourceDocWithUserDefinedEndpointTags, - isVersion4OrHigher: Boolean, - urlParametersI18n: String, - jsonRequestBodyFieldsI18n: String, - jsonResponseBodyFieldsI18n: String - ) - val jsonString = json.compactRender(Extraction.decompose(resourceDocJson)) - Caching.setLocalisedResourceDocCache(cacheKey,jsonString) - - resourceDocJson - } + createLocalisedResourceDocJsonCached( + resourceDocWithUserDefinedEndpointTags.operationId, + locale: Option[String], + resourceDocWithUserDefinedEndpointTags, + isVersion4OrHigher: Boolean, + urlParametersI18n: String, + jsonRequestBodyFieldsI18n: String, + jsonResponseBodyFieldsI18n: String + ) } 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 784862f63..99f19d601 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 @@ -438,12 +438,12 @@ trait APIMethods220 { "GET", "/message-docs/CONNECTOR", "Get Message Docs", - """These message docs provide example messages sent by OBP to the (Kafka) message queue for processing by the Core Banking / Payment system Adapter - together with an example expected response and possible error codes. + """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`: kafka_vSept2018, stored_procedure_vDec2019 ... + | `CONNECTOR`: rest_vMar2019, stored_procedure_vDec2019 ... """.stripMargin, EmptyBody, messageDocsJson, @@ -457,7 +457,7 @@ trait APIMethods220 { 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: kafka_vSept2018..." + val msg = s"$InvalidConnector Current Input is $connector. It should be eg: rest_vMar2019..." unboxFullOrFail(i, cc.callContext, msg) } } yield { diff --git a/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala b/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala index c49557fdd..2436afd8c 100644 --- a/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala +++ b/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala @@ -32,7 +32,6 @@ import code.consent.{ConsentRequests, ConsentStatus, Consents, MappedConsent} import code.consumer.Consumers import code.context.UserAuthContextUpdateProvider import code.entitlement.Entitlement -import code.kafka.KafkaHelper import code.loginattempts.LoginAttempt import code.methodrouting.{MethodRouting, MethodRoutingCommons, MethodRoutingParam, MethodRoutingT} import code.metrics.APIMetrics @@ -1862,14 +1861,7 @@ trait APIMethods310 { "GET", "/connector/loopback", "Get Connector Status (Loopback)", - s"""This endpoint makes a call to the Connector to check the backend transport (e.g. Kafka) is reachable. - | - |Currently this is only implemented for Kafka based connectors. - | - |For Kafka based connectors, this endpoint writes a message to Kafka and reads it again. - | - |In the future, this endpoint may also return information about database connections etc. - | + s"""This endpoint makes a call to the Connector to check the backend transport is reachable. (WIP) | |${userAuthenticationMessage(true)} | @@ -1888,12 +1880,13 @@ trait APIMethods310 { (_, callContext) <- anonymousAccess(cc) connectorVersion = APIUtil.getPropsValue("connector").openOrThrowException("connector props field `connector` not set") starConnectorProps = APIUtil.getPropsValue("starConnector_supported_types").openOr("notfound") - obpApiLoopback <- connectorVersion.contains("kafka") || (connectorVersion.contains("star") && starConnectorProps.contains("kafka")) match { - case false => throw new IllegalStateException(s"${NotImplemented}for connector ${connectorVersion}") - case true => KafkaHelper.echoKafkaServer.recover { - case e: Throwable => throw new IllegalStateException(s"${KafkaServerUnavailable} Timeout error, because kafka do not return message to OBP-API. ${e.getMessage}") - } - } + //TODO we need to decide what kind of connector should we use. + obpApiLoopback = ObpApiLoopback( + connectorVersion ="Unknown", + gitCommit ="Unknown", + durationTime ="Unknown" + ) + _ = throw new IllegalStateException(s"${NotImplemented}") } yield { (createObpApiLoopbackJson(obpApiLoopback), HttpCode.`200`(callContext)) } @@ -3181,14 +3174,6 @@ trait APIMethods310 { implicit val ec = EndpointContext(Some(cc)) for { (_, callContext) <- anonymousAccess(cc) - convertedToResourceDocs = RestConnector_vMar2019.messageDocs.map(toResourceDoc).toList - resourceDocListFiltered = ResourceDocsAPIMethodsUtil.filterResourceDocs(convertedToResourceDocs, resourceDocTags, partialFunctions) - resourceDocJsonList = JSONFactory1_4_0.createResourceDocsJson(resourceDocListFiltered, true, None).resource_docs - swaggerResourceDoc <- Future {SwaggerJSONFactory.createSwaggerResourceDoc(resourceDocJsonList, ApiVersion.v3_1_0)} - //For this connector swagger, it shares some basic fields with api swagger, eg: BankId, AccountId. So it need to merge here. - allSwaggerDefinitionCaseClasses = MessageDocsSwaggerDefinitions.allFields++SwaggerDefinitionsJSON.allFields - - cacheKey = APIUtil.createResourceDocCacheKey( None, restConnectorVersion, @@ -3199,11 +3184,19 @@ trait APIMethods310 { apiCollectionIdParam, None ) - swaggerJValue <- NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { - val cacheValueFromRedis = Caching.getStaticSwaggerDocCache(cacheKey) - if (cacheValueFromRedis.isDefined) { + cacheValueFromRedis = Caching.getStaticSwaggerDocCache(cacheKey) + swaggerJValue <- if (cacheValueFromRedis.isDefined) { + NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file from cache.", 400, cc.callContext) { json.parse(cacheValueFromRedis.get) - } else { + } + } else { + NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { + val convertedToResourceDocs = RestConnector_vMar2019.messageDocs.map(toResourceDoc).toList + val resourceDocListFiltered = ResourceDocsAPIMethodsUtil.filterResourceDocs(convertedToResourceDocs, resourceDocTags, partialFunctions) + val resourceDocJsonList = JSONFactory1_4_0.createResourceDocsJson(resourceDocListFiltered, true, None).resource_docs + val swaggerResourceDoc = SwaggerJSONFactory.createSwaggerResourceDoc(resourceDocJsonList, ApiVersion.v3_1_0) + //For this connector swagger, it shares some basic fields with api swagger, eg: BankId, AccountId. So it need to merge here. + val allSwaggerDefinitionCaseClasses = MessageDocsSwaggerDefinitions.allFields ++ SwaggerDefinitionsJSON.allFields val jsonAST = SwaggerJSONFactory.loadDefinitions(resourceDocJsonList, allSwaggerDefinitionCaseClasses) val swaggerDocJsonJValue = Extraction.decompose(swaggerResourceDoc) merge jsonAST val jsonString = json.compactRender(swaggerDocJsonJValue) @@ -3211,7 +3204,6 @@ trait APIMethods310 { swaggerDocJsonJValue } } - } yield { // Merge both results and return (swaggerJValue, HttpCode.`200`(callContext)) diff --git a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala index a88a67daf..a7709c9b0 100644 --- a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala +++ b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala @@ -1043,7 +1043,7 @@ trait APIMethods400 extends MdcLoggable { |4) `answer` : must be `123` in case that Strong Customer Authentication method for OTP challenge is dummy. | For instance: SANDBOX_TAN_OTP_INSTRUCTION_TRANSPORT=dummy | Possible values are dummy,email and sms - | In kafka mode, the answer can be got by phone message or other SCA methods. + | In CBS mode, the answer can be got by phone message or other SCA methods. | |Note that each Transaction Request Type can have its own OTP_INSTRUCTION_TRANSPORT method. |OTP_INSTRUCTION_TRANSPORT methods are set in Props. See sample.props.template for instructions. diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index 8ac672533..61c483d00 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -12,8 +12,6 @@ import code.bankconnectors.akka.AkkaConnector_vDec2018 import code.bankconnectors.rabbitmq.RabbitMQConnector_vOct2024 import code.bankconnectors.rest.RestConnector_vMar2019 import code.bankconnectors.storedprocedure.StoredProcedureConnector_vDec2019 -import code.bankconnectors.vMay2019.KafkaMappedConnector_vMay2019 -import code.bankconnectors.vSept2018.KafkaMappedConnector_vSept2018 import com.openbankproject.commons.model.CounterpartyLimitTrait import com.openbankproject.commons.model.CustomerAccountLinkTrait import com.openbankproject.commons.model.EndpointTagT @@ -46,7 +44,7 @@ import scala.reflect.runtime.universe.{MethodSymbol, typeOf} So we can switch between different sources of resources e.g. - Mapper ORM for connecting to RDBMS (via JDBC) https://www.assembla.com/wiki/show/liftweb/Mapper - MongoDB -- KafkaMQ +- RabbitMq etc. Note: We also have individual providers for resources like Branches and Products. @@ -64,8 +62,6 @@ object Connector extends SimpleInjector { val nameToConnector: Map[String, Connector] = Map( "mapped" -> LocalMappedConnector, "akka_vDec2018" -> AkkaConnector_vDec2018, - "kafka_vSept2018" -> KafkaMappedConnector_vSept2018, - "kafka_vMay2019" -> KafkaMappedConnector_vMay2019, "rest_vMar2019" -> RestConnector_vMar2019, "stored_procedure_vDec2019" -> StoredProcedureConnector_vDec2019, "rabbitmq_vOct2024" -> RabbitMQConnector_vOct2024, @@ -695,8 +691,6 @@ trait Connector extends MdcLoggable { callContext: Option[CallContext] ): OBPReturnType[Box[PhysicalCardTrait]] = Future{(Failure{setUnimplementedError(nameOf(updatePhysicalCard _))}, callContext)} - - //Note: introduce v210 here, is for kafka connectors, use callContext and return Future. def makePaymentv210(fromAccount: BankAccount, toAccount: BankAccount, transactionRequestId: TransactionRequestId, diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index bcf354ea2..caffed20b 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -1311,7 +1311,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { /** - * This is used for create or update the special bankAccount for COUNTERPARTY stuff (toAccountProvider != "OBP") and (Connector = Kafka) + * This is used for create or update the special bankAccount for COUNTERPARTY stuff (toAccountProvider != "OBP") and (Connector = RabbitMq) * details in createTransactionRequest - V210 ,case COUNTERPARTY.toString * */ diff --git a/obp-api/src/main/scala/code/bankconnectors/generator/ConnectorBuilderUtil.scala b/obp-api/src/main/scala/code/bankconnectors/generator/ConnectorBuilderUtil.scala index d1302d8bd..d3cbd332a 100644 --- a/obp-api/src/main/scala/code/bankconnectors/generator/ConnectorBuilderUtil.scala +++ b/obp-api/src/main/scala/code/bankconnectors/generator/ConnectorBuilderUtil.scala @@ -3,7 +3,6 @@ package code.bankconnectors.generator import code.api.util.CodeGenerateUtils.createDocExample import code.api.util.{APIUtil, CallContext} import code.bankconnectors.{Connector, LocalMappedConnector} -import code.bankconnectors.vSept2018.KafkaMappedConnector_vSept2018 import com.openbankproject.commons.util.ReflectUtils import org.apache.commons.io.FileUtils import org.apache.commons.lang3.StringUtils.uncapitalize @@ -192,7 +191,7 @@ object ConnectorBuilderUtil { private[this] val cacheMethodName = if(resultType.startsWith("Box[")) "memoizeSyncWithProvider" else "memoizeWithProvider" private[this] val timeoutFieldName = uncapitalize(methodName.replaceFirst("^[a-z]+", "")) + "TTL" - private[this] val cacheTimeout = ReflectUtils.findMethod(ru.typeOf[KafkaMappedConnector_vSept2018], timeoutFieldName)(_ => true) + private[this] val cacheTimeout = ReflectUtils.findMethod(ru.typeOf[code.bankconnectors.rabbitmq.RabbitMQConnector_vOct2024], timeoutFieldName)(_ => true) .map(_.name.toString) .getOrElse("accountTTL") diff --git a/obp-api/src/main/scala/code/bankconnectors/rabbitmq/RabbitMQConnector_vOct2024.scala b/obp-api/src/main/scala/code/bankconnectors/rabbitmq/RabbitMQConnector_vOct2024.scala index 05cb4fb57..bb0fa04be 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rabbitmq/RabbitMQConnector_vOct2024.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rabbitmq/RabbitMQConnector_vOct2024.scala @@ -54,12 +54,12 @@ trait RabbitMQConnector_vOct2024 extends Connector with MdcLoggable { implicit override val nameOfConnector = RabbitMQConnector_vOct2024.toString // "Versioning" of the messages sent by this or similar connector works like this: - // Use Case Classes (e.g. KafkaInbound... KafkaOutbound... as below to describe the message structures. + // Use Case Classes (e.g. Inbound... Outbound... as below to describe the message structures. // Each connector has a separate file like this one. // Once the message format is STABLE, freeze the key/value pair names there. For now, new keys may be added but none modified. // If we want to add a new message format, create a new file e.g. March2017_messages.scala - // Then add a suffix to the connector value i.e. instead of kafka we might have kafka_march_2017. - // Then in this file, populate the different case classes depending on the connector name and send to Kafka + // Then add a suffix to the connector value i.e. instead of RabbitMq we might have rest_vMar2019. + // Then in this file, populate the different case classes depending on the connector name and send to CBS val messageFormat: String = "Oct2024" override val messageDocs = ArrayBuffer[MessageDoc]() diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index 7055b0fb9..92343ceb1 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -42,7 +42,6 @@ import code.api.util.{APIUtil, CallContext, OBPQueryParam} import code.bankconnectors._ import code.context.UserAuthContextProvider import code.customer.internalMapping.MappedCustomerIdMappingProvider -import code.kafka.KafkaHelper import code.model.dataAccess.internalMapping.MappedAccountIdMappingProvider import code.util.AkkaHttpClient._ import code.util.Helper @@ -72,19 +71,19 @@ import scala.language.postfixOps import scala.reflect.runtime.universe._ -trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable { +trait RestConnector_vMar2019 extends Connector with MdcLoggable { //this one import is for implicit convert, don't delete import com.openbankproject.commons.model.{AmountOfMoney, CreditLimit, CreditRating, CustomerFaceImage} implicit override val nameOfConnector = RestConnector_vMar2019.toString // "Versioning" of the messages sent by this or similar connector works like this: - // Use Case Classes (e.g. KafkaInbound... KafkaOutbound... as below to describe the message structures. + // Use Case Classes (e.g. Inbound... Outbound... as below to describe the message structures. // Each connector has a separate file like this one. // Once the message format is STABLE, freeze the key/value pair names there. For now, new keys may be added but none modified. // If we want to add a new message format, create a new file e.g. March2017_messages.scala - // Then add a suffix to the connector value i.e. instead of kafka we might have kafka_march_2017. - // Then in this file, populate the different case classes depending on the connector name and send to Kafka + // Then add a suffix to the connector value i.e. instead of Rest we might have rest_vMar2019. + // Then in this file, populate the different case classes depending on the connector name and send to rest_vMar2019 val messageFormat: String = "March2019" override val messageDocs = ArrayBuffer[MessageDoc]() diff --git a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala index 51c166960..b1675d8b5 100644 --- a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala @@ -59,12 +59,12 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { implicit override val nameOfConnector = StoredProcedureConnector_vDec2019.toString // "Versioning" of the messages sent by this or similar connector works like this: - // Use Case Classes (e.g. KafkaInbound... KafkaOutbound... as below to describe the message structures. + // Use Case Classes (e.g. Inbound... Outbound... as below to describe the message structures. // Each connector has a separate file like this one. // Once the message format is STABLE, freeze the key/value pair names there. For now, new keys may be added but none modified. // If we want to add a new message format, create a new file e.g. March2017_messages.scala - // Then add a suffix to the connector value i.e. instead of kafka we might have kafka_march_2017. - // Then in this file, populate the different case classes depending on the connector name and send to Kafka + // Then add a suffix to the connector value i.e. instead of Rest we might have rest_vMar2019. + // Then in this file, populate the different case classes depending on the connector name and send to rest_vMar2019 val messageFormat: String = "Dec2019" override val messageDocs = ArrayBuffer[MessageDoc]() diff --git a/obp-api/src/main/scala/code/bankconnectors/vMay2019/KafkaConnectorBuilder.scala b/obp-api/src/main/scala/code/bankconnectors/vMay2019/KafkaConnectorBuilder.scala deleted file mode 100644 index d5d877994..000000000 --- a/obp-api/src/main/scala/code/bankconnectors/vMay2019/KafkaConnectorBuilder.scala +++ /dev/null @@ -1,31 +0,0 @@ -package code.bankconnectors.vMay2019 - -import code.bankconnectors.generator.ConnectorBuilderUtil._ - -import scala.collection.immutable.List -import scala.language.postfixOps - -object KafkaConnectorBuilder extends App { - - val genMethodNames = List( - "getAdapterInfo", - "getBank", - "getBanks", - "getBankAccountsBalances", - "getBranch", - "getBranches", - "getAtm", - "getAtms", - "getCustomersByUserId", - "getCustomerByCustomerId", - "getCustomerByCustomerNumber" - ) - - generateMethods(commonMethodNames, - "src/main/scala/code/bankconnectors/vMay2019/KafkaMappedConnector_vMay2019.scala", - "processRequest[InBound](req)", true) -} - - - - diff --git a/obp-api/src/main/scala/code/bankconnectors/vMay2019/KafkaMappedConnector_vMay2019.scala b/obp-api/src/main/scala/code/bankconnectors/vMay2019/KafkaMappedConnector_vMay2019.scala deleted file mode 100644 index bd373df61..000000000 --- a/obp-api/src/main/scala/code/bankconnectors/vMay2019/KafkaMappedConnector_vMay2019.scala +++ /dev/null @@ -1,6980 +0,0 @@ -package code.bankconnectors.vMay2019 - -/* -Open Bank Project - API -Copyright (C) 2011-2019, TESOBE GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see http://www.gnu.org/licenses/. - -Email: contact@tesobe.com -TESOBE GmbH -Osloerstrasse 16/17 -Berlin 13359, Germany -*/ - -import java.text.SimpleDateFormat -import java.util.Date -import java.util.UUID.randomUUID -import code.api.APIFailure -import code.api.JSONFactoryGateway.PayloadOfJwtJSON -import code.api.ResourceDocs1_4_0.{MessageDocsSwaggerDefinitions, SwaggerDefinitionsJSON} -import code.api.cache.Caching -import code.api.util.APIUtil._ -import code.api.util.ErrorMessages._ -import code.api.util.ExampleValue._ -import code.api.util._ -import code.api.v2_1_0.TransactionRequestBodyCommonJSON -import code.bankconnectors._ -import code.bankconnectors.vSept2018.KafkaMappedConnector_vSept2018 -import code.customer._ -import code.kafka.{KafkaHelper, Topics} -import code.model._ -import code.model.dataAccess._ -import code.users.Users -import code.util.Helper.MdcLoggable -import code.views.Views -import com.openbankproject.commons.dto._ -import com.openbankproject.commons.model._ -import com.sksamuel.avro4s.SchemaFor -import com.tesobe.{CacheKeyFromArguments, CacheKeyOmit} -import net.liftweb -import net.liftweb.common._ -import net.liftweb.json.{MappingException, parse} -import net.liftweb.util.Helpers.tryo -import com.openbankproject.commons.ExecutionContext.Implicits.global -import com.openbankproject.commons.dto.{InBoundTrait, _} -import com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.SCAStatus -import com.openbankproject.commons.model.enums._ -import scala.collection.immutable.{List, Nil} -import com.openbankproject.commons.ExecutionContext.Implicits.global - -import scala.concurrent.{Await, Future} -import scala.concurrent.duration._ -import scala.language.postfixOps -import com.github.dwickern.macros.NameOf.nameOf -import com.openbankproject.commons.model.enums.{AccountAttributeType, CardAttributeType, ProductAttributeType, StrongCustomerAuthentication} -import com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SCA -import com.openbankproject.commons.util.{ApiVersion, RequiredFieldValidation} -import com.openbankproject.commons.ExecutionContext.Implicits.global -import com.openbankproject.commons.dto.{InBoundTrait, _} -import com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.SCAStatus -import com.openbankproject.commons.model.enums._ -import scala.reflect.runtime.universe._ - -trait KafkaMappedConnector_vMay2019 extends Connector with KafkaHelper with MdcLoggable { - //this one import is for implicit convert, don't delete - import com.openbankproject.commons.model.{CustomerFaceImage, CreditLimit, CreditRating, AmountOfMoney} - - implicit override val nameOfConnector = KafkaMappedConnector_vMay2019.toString - - // "Versioning" of the messages sent by this or similar connector works like this: - // Use Case Classes (e.g. KafkaInbound... KafkaOutbound...) are defined below to describe the message structures. - // Each connector has a separate file like this one. - // Once the message format is STABLE, freeze the key/value pair names there. For now, new keys may be added but none modified. - // If we want to add a new message format, create a new file e.g. March2017_messages.scala - // Then add a suffix to the connector value i.e. instead of kafka we might have kafka_march_2017. - // Then in this file, populate the different case classes depending on the connector name and send to Kafka - val messageFormat: String = "May2019" - - -//---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-10-30T11:52:35Z - - messageDocs += getAdapterInfoDoc - def getAdapterInfoDoc = MessageDoc( - process = "obp.getAdapterInfo", - messageFormat = messageFormat, - description = "Get Adapter Info", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAdapterInfo").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAdapterInfo").request), - exampleOutboundMessage = ( - OutBoundGetAdapterInfo(MessageDocsSwaggerDefinitions.outboundAdapterCallContext) - ), - exampleInboundMessage = ( - InBoundGetAdapterInfo(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= InboundAdapterInfoInternal(errorCode=inboundAdapterInfoInternalErrorCodeExample.value, - backendMessages=List( InboundStatusMessage(source=sourceExample.value, - status=inboundStatusMessageStatusExample.value, - errorCode=inboundStatusMessageErrorCodeExample.value, - text=inboundStatusMessageTextExample.value, - duration=Some(BigDecimal(durationExample.value)))), - name=inboundAdapterInfoInternalNameExample.value, - version=inboundAdapterInfoInternalVersionExample.value, - git_commit=inboundAdapterInfoInternalGit_commitExample.value, - date=inboundAdapterInfoInternalDateExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAdapterInfo(callContext: Option[CallContext]): Future[Box[(InboundAdapterInfoInternal, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetAdapterInfo => InBound, OutBoundGetAdapterInfo => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[InboundAdapterInfoInternal](callContext)) - } - - messageDocs += validateAndCheckIbanNumberDoc - def validateAndCheckIbanNumberDoc = MessageDoc( - process = "obp.validateAndCheckIbanNumber", - messageFormat = messageFormat, - description = "Validate And Check Iban Number", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateAndCheckIbanNumber").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateAndCheckIbanNumber").request), - exampleOutboundMessage = ( - OutBoundValidateAndCheckIbanNumber(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - iban=ibanExample.value) - ), - exampleInboundMessage = ( - InBoundValidateAndCheckIbanNumber(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= IbanChecker(isValid=true, - details=Some( IbanDetails(bic=bicExample.value, - bank=bankExample.value, - branch="string", - address=addressExample.value, - city=cityExample.value, - zip="string", - phone=phoneExample.value, - country=countryExample.value, - countryIso="string", - sepaCreditTransfer=sepaCreditTransferExample.value, - sepaDirectDebit=sepaDirectDebitExample.value, - sepaSddCore=sepaSddCoreExample.value, - sepaB2b=sepaB2bExample.value, - sepaCardClearing=sepaCardClearingExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateAndCheckIbanNumber(iban: String, callContext: Option[CallContext]): OBPReturnType[Box[IbanChecker]] = { - import com.openbankproject.commons.dto.{InBoundValidateAndCheckIbanNumber => InBound, OutBoundValidateAndCheckIbanNumber => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, iban) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[IbanChecker](callContext)) - } - - messageDocs += getChallengeThresholdDoc - def getChallengeThresholdDoc = MessageDoc( - process = "obp.getChallengeThreshold", - messageFormat = messageFormat, - description = "Get Challenge Threshold", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengeThreshold").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengeThreshold").request), - exampleOutboundMessage = ( - OutBoundGetChallengeThreshold(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - accountId=accountIdExample.value, - viewId=viewIdExample.value, - transactionRequestType=transactionRequestTypeExample.value, - currency=currencyExample.value, - userId=userIdExample.value, - username=usernameExample.value) - ), - exampleInboundMessage = ( - InBoundGetChallengeThreshold(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChallengeThreshold(bankId: String, accountId: String, viewId: String, transactionRequestType: String, currency: String, userId: String, username: String, callContext: Option[CallContext]): OBPReturnType[Box[AmountOfMoney]] = { - import com.openbankproject.commons.dto.{InBoundGetChallengeThreshold => InBound, OutBoundGetChallengeThreshold => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, viewId, transactionRequestType, currency, userId, username) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AmountOfMoney](callContext)) - } - - messageDocs += getChargeLevelDoc - def getChargeLevelDoc = MessageDoc( - process = "obp.getChargeLevel", - messageFormat = messageFormat, - description = "Get Charge Level", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChargeLevel").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChargeLevel").request), - exampleOutboundMessage = ( - OutBoundGetChargeLevel(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - viewId=ViewId(viewIdExample.value), - userId=userIdExample.value, - username=usernameExample.value, - transactionRequestType=transactionRequestTypeExample.value, - currency=currencyExample.value) - ), - exampleInboundMessage = ( - InBoundGetChargeLevel(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChargeLevel(bankId: BankId, accountId: AccountId, viewId: ViewId, userId: String, username: String, transactionRequestType: String, currency: String, callContext: Option[CallContext]): OBPReturnType[Box[AmountOfMoney]] = { - import com.openbankproject.commons.dto.{InBoundGetChargeLevel => InBound, OutBoundGetChargeLevel => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, viewId, userId, username, transactionRequestType, currency) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AmountOfMoney](callContext)) - } - - messageDocs += getChargeLevelC2Doc - def getChargeLevelC2Doc = MessageDoc( - process = "obp.getChargeLevelC2", - messageFormat = messageFormat, - description = "Get Charge Level C2", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChargeLevelC2").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChargeLevelC2").request), - exampleOutboundMessage = ( - OutBoundGetChargeLevelC2(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - viewId=ViewId(viewIdExample.value), - userId=userIdExample.value, - username=usernameExample.value, - transactionRequestType=transactionRequestTypeExample.value, - currency=currencyExample.value, - amount=amountExample.value, - toAccountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - customAttributes=List( CustomAttribute(name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.AttributeType.example, - value=valueExample.value))) - ), - exampleInboundMessage = ( - InBoundGetChargeLevelC2(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChargeLevelC2(bankId: BankId, accountId: AccountId, viewId: ViewId, userId: String, username: String, transactionRequestType: String, currency: String, amount: String, toAccountRoutings: List[AccountRouting], customAttributes: List[CustomAttribute], callContext: Option[CallContext]): OBPReturnType[Box[AmountOfMoney]] = { - import com.openbankproject.commons.dto.{InBoundGetChargeLevelC2 => InBound, OutBoundGetChargeLevelC2 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, viewId, userId, username, transactionRequestType, currency, amount, toAccountRoutings, customAttributes) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AmountOfMoney](callContext)) - } - - messageDocs += createChallengeDoc - def createChallengeDoc = MessageDoc( - process = "obp.createChallenge", - messageFormat = messageFormat, - description = "Create Challenge", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallenge").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallenge").request), - exampleOutboundMessage = ( - OutBoundCreateChallenge(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - userId=userIdExample.value, - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - transactionRequestId=transactionRequestIdExample.value, - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS)) - ), - exampleInboundMessage = ( - InBoundCreateChallenge(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data="string") - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createChallenge(bankId: BankId, accountId: AccountId, userId: String, transactionRequestType: TransactionRequestType, transactionRequestId: String, scaMethod: Option[StrongCustomerAuthentication.SCA], callContext: Option[CallContext]): OBPReturnType[Box[String]] = { - import com.openbankproject.commons.dto.{InBoundCreateChallenge => InBound, OutBoundCreateChallenge => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, userId, transactionRequestType, transactionRequestId, scaMethod) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[String](callContext)) - } - - messageDocs += createChallengesDoc - def createChallengesDoc = MessageDoc( - process = "obp.createChallenges", - messageFormat = messageFormat, - description = "Create Challenges", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallenges").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallenges").request), - exampleOutboundMessage = ( - OutBoundCreateChallenges(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - userIds=listExample.value.replace("[","").replace("]","").split(",").toList, - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - transactionRequestId=transactionRequestIdExample.value, - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS)) - ), - exampleInboundMessage = ( - InBoundCreateChallenges(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=listExample.value.replace("[","").replace("]","").split(",").toList) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createChallenges(bankId: BankId, accountId: AccountId, userIds: List[String], transactionRequestType: TransactionRequestType, transactionRequestId: String, scaMethod: Option[StrongCustomerAuthentication.SCA], callContext: Option[CallContext]): OBPReturnType[Box[List[String]]] = { - import com.openbankproject.commons.dto.{InBoundCreateChallenges => InBound, OutBoundCreateChallenges => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, userIds, transactionRequestType, transactionRequestId, scaMethod) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[String]](callContext)) - } - - messageDocs += createChallengesC2Doc - def createChallengesC2Doc = MessageDoc( - process = "obp.createChallengesC2", - messageFormat = messageFormat, - description = "Create Challenges C2", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallengesC2").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallengesC2").request), - exampleOutboundMessage = ( - OutBoundCreateChallengesC2(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userIds=listExample.value.replace("[","").replace("]","").split(",").toList, - challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, - transactionRequestId=Some(transactionRequestIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - consentId=Some(consentIdExample.value), - authenticationMethodId=Some("string")) - ), - exampleInboundMessage = ( - InBoundCreateChallengesC2(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createChallengesC2(userIds: List[String], challengeType: ChallengeType.Value, transactionRequestId: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], scaStatus: Option[SCAStatus], consentId: Option[String], authenticationMethodId: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { - import com.openbankproject.commons.dto.{InBoundCreateChallengesC2 => InBound, OutBoundCreateChallengesC2 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userIds, challengeType, transactionRequestId, scaMethod, scaStatus, consentId, authenticationMethodId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ChallengeCommons]](callContext)) - } - - messageDocs += createChallengesC3Doc - def createChallengesC3Doc = MessageDoc( - process = "obp.createChallengesC3", - messageFormat = messageFormat, - description = "Create Challenges C3", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallengesC3").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateChallengesC3").request), - exampleOutboundMessage = ( - OutBoundCreateChallengesC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userIds=listExample.value.replace("[","").replace("]","").split(",").toList, - challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, - transactionRequestId=Some(transactionRequestIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - authenticationMethodId=Some("string")) - ), - exampleInboundMessage = ( - InBoundCreateChallengesC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createChallengesC3(userIds: List[String], challengeType: ChallengeType.Value, transactionRequestId: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], scaStatus: Option[SCAStatus], consentId: Option[String], basketId: Option[String], authenticationMethodId: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { - import com.openbankproject.commons.dto.{InBoundCreateChallengesC3 => InBound, OutBoundCreateChallengesC3 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userIds, challengeType, transactionRequestId, scaMethod, scaStatus, consentId, basketId, authenticationMethodId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ChallengeCommons]](callContext)) - } - - messageDocs += validateChallengeAnswerDoc - def validateChallengeAnswerDoc = MessageDoc( - process = "obp.validateChallengeAnswer", - messageFormat = messageFormat, - description = "Validate Challenge Answer", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswer").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswer").request), - exampleOutboundMessage = ( - OutBoundValidateChallengeAnswer(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - challengeId=challengeIdExample.value, - hashOfSuppliedAnswer=hashOfSuppliedAnswerExample.value) - ), - exampleInboundMessage = ( - InBoundValidateChallengeAnswer(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateChallengeAnswer(challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswer => InBound, OutBoundValidateChallengeAnswer => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, challengeId, hashOfSuppliedAnswer) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += validateChallengeAnswerV2Doc - def validateChallengeAnswerV2Doc = MessageDoc( - process = "obp.validateChallengeAnswerV2", - messageFormat = messageFormat, - description = "Validate Challenge Answer V2", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerV2").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerV2").request), - exampleOutboundMessage = ( - OutBoundValidateChallengeAnswerV2(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - challengeId=challengeIdExample.value, - suppliedAnswer=suppliedAnswerExample.value, - suppliedAnswerType=com.openbankproject.commons.model.enums.SuppliedAnswerType.example) - ), - exampleInboundMessage = ( - InBoundValidateChallengeAnswerV2(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateChallengeAnswerV2(challengeId: String, suppliedAnswer: String, suppliedAnswerType: SuppliedAnswerType.Value, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerV2 => InBound, OutBoundValidateChallengeAnswerV2 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, challengeId, suppliedAnswer, suppliedAnswerType) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += validateChallengeAnswerC2Doc - def validateChallengeAnswerC2Doc = MessageDoc( - process = "obp.validateChallengeAnswerC2", - messageFormat = messageFormat, - description = "Validate Challenge Answer C2", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC2").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC2").request), - exampleOutboundMessage = ( - OutBoundValidateChallengeAnswerC2(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=Some(transactionRequestIdExample.value), - consentId=Some(consentIdExample.value), - challengeId=challengeIdExample.value, - hashOfSuppliedAnswer=hashOfSuppliedAnswerExample.value) - ), - exampleInboundMessage = ( - InBoundValidateChallengeAnswerC2(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateChallengeAnswerC2(transactionRequestId: Option[String], consentId: Option[String], challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { - import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC2 => InBound, OutBoundValidateChallengeAnswerC2 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, challengeId, hashOfSuppliedAnswer) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ChallengeCommons](callContext)) - } - - messageDocs += validateChallengeAnswerC3Doc - def validateChallengeAnswerC3Doc = MessageDoc( - process = "obp.validateChallengeAnswerC3", - messageFormat = messageFormat, - description = "Validate Challenge Answer C3", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC3").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC3").request), - exampleOutboundMessage = ( - OutBoundValidateChallengeAnswerC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=Some(transactionRequestIdExample.value), - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - challengeId=challengeIdExample.value, - hashOfSuppliedAnswer=hashOfSuppliedAnswerExample.value) - ), - exampleInboundMessage = ( - InBoundValidateChallengeAnswerC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateChallengeAnswerC3(transactionRequestId: Option[String], consentId: Option[String], basketId: Option[String], challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { - import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC3 => InBound, OutBoundValidateChallengeAnswerC3 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, basketId, challengeId, hashOfSuppliedAnswer) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ChallengeCommons](callContext)) - } - - messageDocs += validateChallengeAnswerC4Doc - def validateChallengeAnswerC4Doc = MessageDoc( - process = "obp.validateChallengeAnswerC4", - messageFormat = messageFormat, - description = "Validate Challenge Answer C4", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC4").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC4").request), - exampleOutboundMessage = ( - OutBoundValidateChallengeAnswerC4(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=Some(transactionRequestIdExample.value), - consentId=Some(consentIdExample.value), - challengeId=challengeIdExample.value, - suppliedAnswer=suppliedAnswerExample.value, - suppliedAnswerType=com.openbankproject.commons.model.enums.SuppliedAnswerType.example) - ), - exampleInboundMessage = ( - InBoundValidateChallengeAnswerC4(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateChallengeAnswerC4(transactionRequestId: Option[String], consentId: Option[String], challengeId: String, suppliedAnswer: String, suppliedAnswerType: SuppliedAnswerType.Value, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { - import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC4 => InBound, OutBoundValidateChallengeAnswerC4 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, challengeId, suppliedAnswer, suppliedAnswerType) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ChallengeCommons](callContext)) - } - - messageDocs += validateChallengeAnswerC5Doc - def validateChallengeAnswerC5Doc = MessageDoc( - process = "obp.validateChallengeAnswerC5", - messageFormat = messageFormat, - description = "Validate Challenge Answer C5", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC5").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundValidateChallengeAnswerC5").request), - exampleOutboundMessage = ( - OutBoundValidateChallengeAnswerC5(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=Some(transactionRequestIdExample.value), - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - challengeId=challengeIdExample.value, - suppliedAnswer=suppliedAnswerExample.value, - suppliedAnswerType=com.openbankproject.commons.model.enums.SuppliedAnswerType.example) - ), - exampleInboundMessage = ( - InBoundValidateChallengeAnswerC5(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def validateChallengeAnswerC5(transactionRequestId: Option[String], consentId: Option[String], basketId: Option[String], challengeId: String, suppliedAnswer: String, suppliedAnswerType: SuppliedAnswerType.Value, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { - import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC5 => InBound, OutBoundValidateChallengeAnswerC5 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, basketId, challengeId, suppliedAnswer, suppliedAnswerType) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ChallengeCommons](callContext)) - } - - messageDocs += getChallengesByTransactionRequestIdDoc - def getChallengesByTransactionRequestIdDoc = MessageDoc( - process = "obp.getChallengesByTransactionRequestId", - messageFormat = messageFormat, - description = "Get Challenges By Transaction Request Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengesByTransactionRequestId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengesByTransactionRequestId").request), - exampleOutboundMessage = ( - OutBoundGetChallengesByTransactionRequestId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=transactionRequestIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetChallengesByTransactionRequestId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChallengesByTransactionRequestId(transactionRequestId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { - import com.openbankproject.commons.dto.{InBoundGetChallengesByTransactionRequestId => InBound, OutBoundGetChallengesByTransactionRequestId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ChallengeCommons]](callContext)) - } - - messageDocs += getChallengesByConsentIdDoc - def getChallengesByConsentIdDoc = MessageDoc( - process = "obp.getChallengesByConsentId", - messageFormat = messageFormat, - description = "Get Challenges By Consent Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengesByConsentId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengesByConsentId").request), - exampleOutboundMessage = ( - OutBoundGetChallengesByConsentId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - consentId=consentIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetChallengesByConsentId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChallengesByConsentId(consentId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { - import com.openbankproject.commons.dto.{InBoundGetChallengesByConsentId => InBound, OutBoundGetChallengesByConsentId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, consentId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ChallengeCommons]](callContext)) - } - - messageDocs += getChallengesByBasketIdDoc - def getChallengesByBasketIdDoc = MessageDoc( - process = "obp.getChallengesByBasketId", - messageFormat = messageFormat, - description = "Get Challenges By Basket Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengesByBasketId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallengesByBasketId").request), - exampleOutboundMessage = ( - OutBoundGetChallengesByBasketId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - basketId=basketIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetChallengesByBasketId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChallengesByBasketId(basketId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { - import com.openbankproject.commons.dto.{InBoundGetChallengesByBasketId => InBound, OutBoundGetChallengesByBasketId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, basketId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ChallengeCommons]](callContext)) - } - - messageDocs += getChallengeDoc - def getChallengeDoc = MessageDoc( - process = "obp.getChallenge", - messageFormat = messageFormat, - description = "Get Challenge", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallenge").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChallenge").request), - exampleOutboundMessage = ( - OutBoundGetChallenge(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - challengeId=challengeIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetChallenge(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ChallengeCommons(challengeId=challengeIdExample.value, - transactionRequestId=transactionRequestIdExample.value, - expectedAnswer="string", - expectedUserId="string", - salt="string", - successful=true, - challengeType=challengeTypeExample.value, - consentId=Some(consentIdExample.value), - basketId=Some(basketIdExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"), - attemptCounter=123)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChallenge(challengeId: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { - import com.openbankproject.commons.dto.{InBoundGetChallenge => InBound, OutBoundGetChallenge => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, challengeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ChallengeCommons](callContext)) - } - - messageDocs += getBankDoc - def getBankDoc = MessageDoc( - process = "obp.getBank", - messageFormat = messageFormat, - description = "Get Bank", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBank").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBank").request), - exampleOutboundMessage = ( - OutBoundGetBank(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetBank(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankCommons(bankId=BankId(bankIdExample.value), - shortName=bankShortNameExample.value, - fullName=bankFullNameExample.value, - logoUrl=bankLogoUrlExample.value, - websiteUrl=bankWebsiteUrlExample.value, - bankRoutingScheme=bankRoutingSchemeExample.value, - bankRoutingAddress=bankRoutingAddressExample.value, - swiftBic=bankSwiftBicExample.value, - nationalIdentifier=bankNationalIdentifierExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBank(bankId: BankId, callContext: Option[CallContext]): Future[Box[(Bank, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetBank => InBound, OutBoundGetBank => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankCommons](callContext)) - } - - messageDocs += getBanksDoc - def getBanksDoc = MessageDoc( - process = "obp.getBanks", - messageFormat = messageFormat, - description = "Get Banks", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBanks").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBanks").request), - exampleOutboundMessage = ( - OutBoundGetBanks(MessageDocsSwaggerDefinitions.outboundAdapterCallContext) - ), - exampleInboundMessage = ( - InBoundGetBanks(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( BankCommons(bankId=BankId(bankIdExample.value), - shortName=bankShortNameExample.value, - fullName=bankFullNameExample.value, - logoUrl=bankLogoUrlExample.value, - websiteUrl=bankWebsiteUrlExample.value, - bankRoutingScheme=bankRoutingSchemeExample.value, - bankRoutingAddress=bankRoutingAddressExample.value, - swiftBic=bankSwiftBicExample.value, - nationalIdentifier=bankNationalIdentifierExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBanks(callContext: Option[CallContext]): Future[Box[(List[Bank], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetBanks => InBound, OutBoundGetBanks => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[BankCommons]](callContext)) - } - - messageDocs += getBankAccountsForUserDoc - def getBankAccountsForUserDoc = MessageDoc( - process = "obp.getBankAccountsForUser", - messageFormat = messageFormat, - description = "Get Bank Accounts For User", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountsForUser").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountsForUser").request), - exampleOutboundMessage = ( - OutBoundGetBankAccountsForUser(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - provider=providerExample.value, - username=usernameExample.value) - ), - exampleInboundMessage = ( - InBoundGetBankAccountsForUser(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( InboundAccountCommons(bankId=bankIdExample.value, - branchId=branchIdExample.value, - accountId=accountIdExample.value, - accountNumber=accountNumberExample.value, - accountType=accountTypeExample.value, - balanceAmount=balanceAmountExample.value, - balanceCurrency=balanceCurrencyExample.value, - owners=inboundAccountOwnersExample.value.replace("[","").replace("]","").split(",").toList, - viewsToGenerate=inboundAccountViewsToGenerateExample.value.replace("[","").replace("]","").split(",").toList, - bankRoutingScheme=bankRoutingSchemeExample.value, - bankRoutingAddress=bankRoutingAddressExample.value, - branchRoutingScheme=branchRoutingSchemeExample.value, - branchRoutingAddress=branchRoutingAddressExample.value, - accountRoutingScheme=accountRoutingSchemeExample.value, - accountRoutingAddress=accountRoutingAddressExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccountsForUser(provider: String, username: String, callContext: Option[CallContext]): Future[Box[(List[InboundAccount], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccountsForUser => InBound, OutBoundGetBankAccountsForUser => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, provider, username) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[InboundAccountCommons]](callContext)) - } - - messageDocs += getBankAccountByIbanDoc - def getBankAccountByIbanDoc = MessageDoc( - process = "obp.getBankAccountByIban", - messageFormat = messageFormat, - description = "Get Bank Account By Iban", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountByIban").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountByIban").request), - exampleOutboundMessage = ( - OutBoundGetBankAccountByIban(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - iban=ibanExample.value) - ), - exampleInboundMessage = ( - InBoundGetBankAccountByIban(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccountByIban(iban: String, callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccountByIban => InBound, OutBoundGetBankAccountByIban => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, iban) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankAccountCommons](callContext)) - } - - messageDocs += getBankAccountByRoutingDoc - def getBankAccountByRoutingDoc = MessageDoc( - process = "obp.getBankAccountByRouting", - messageFormat = messageFormat, - description = "Get Bank Account By Routing", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountByRouting").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountByRouting").request), - exampleOutboundMessage = ( - OutBoundGetBankAccountByRouting(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=Some(BankId(bankIdExample.value)), - scheme=schemeExample.value, - address=addressExample.value) - ), - exampleInboundMessage = ( - InBoundGetBankAccountByRouting(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccountByRouting(bankId: Option[BankId], scheme: String, address: String, callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccountByRouting => InBound, OutBoundGetBankAccountByRouting => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, scheme, address) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankAccountCommons](callContext)) - } - - messageDocs += getBankAccountsDoc - def getBankAccountsDoc = MessageDoc( - process = "obp.getBankAccounts", - messageFormat = messageFormat, - description = "Get Bank Accounts", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccounts").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccounts").request), - exampleOutboundMessage = ( - OutBoundGetBankAccounts(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankIdAccountIds=List( BankIdAccountId(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)))) - ), - exampleInboundMessage = ( - InBoundGetBankAccounts(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccounts(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]): OBPReturnType[Box[List[BankAccount]]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccounts => InBound, OutBoundGetBankAccounts => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankIdAccountIds) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[BankAccountCommons]](callContext)) - } - - messageDocs += getBankAccountsBalancesDoc - def getBankAccountsBalancesDoc = MessageDoc( - process = "obp.getBankAccountsBalances", - messageFormat = messageFormat, - description = "Get Bank Accounts Balances", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountsBalances").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountsBalances").request), - exampleOutboundMessage = ( - OutBoundGetBankAccountsBalances(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankIdAccountIds=List( BankIdAccountId(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)))) - ), - exampleInboundMessage = ( - InBoundGetBankAccountsBalances(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountsBalances(accounts=List( AccountBalance(id=idExample.value, - label=labelExample.value, - bankId=bankIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - balance= AmountOfMoney(currency=balanceCurrencyExample.value, - amount=balanceAmountExample.value))), - overallBalance= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - overallBalanceDate=toDate(overallBalanceDateExample))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccountsBalances(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]): OBPReturnType[Box[AccountsBalances]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccountsBalances => InBound, OutBoundGetBankAccountsBalances => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankIdAccountIds) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountsBalances](callContext)) - } - - messageDocs += getBankAccountBalancesDoc - def getBankAccountBalancesDoc = MessageDoc( - process = "obp.getBankAccountBalances", - messageFormat = messageFormat, - description = "Get Bank Account Balances", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountBalances").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountBalances").request), - exampleOutboundMessage = ( - OutBoundGetBankAccountBalances(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankIdAccountId= BankIdAccountId(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value))) - ), - exampleInboundMessage = ( - InBoundGetBankAccountBalances(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountBalances(id=idExample.value, - label=labelExample.value, - bankId=bankIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - balances=List( BankAccountBalance(balance= AmountOfMoney(currency=balanceCurrencyExample.value, - amount=balanceAmountExample.value), - balanceType="string")), - overallBalance= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - overallBalanceDate=toDate(overallBalanceDateExample))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccountBalances(bankIdAccountId: BankIdAccountId, callContext: Option[CallContext]): OBPReturnType[Box[AccountBalances]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccountBalances => InBound, OutBoundGetBankAccountBalances => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankIdAccountId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountBalances](callContext)) - } - - messageDocs += getCoreBankAccountsDoc - def getCoreBankAccountsDoc = MessageDoc( - process = "obp.getCoreBankAccounts", - messageFormat = messageFormat, - description = "Get Core Bank Accounts", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCoreBankAccounts").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCoreBankAccounts").request), - exampleOutboundMessage = ( - OutBoundGetCoreBankAccounts(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankIdAccountIds=List( BankIdAccountId(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)))) - ), - exampleInboundMessage = ( - InBoundGetCoreBankAccounts(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CoreAccount(id=accountIdExample.value, - label=labelExample.value, - bankId=bankIdExample.value, - accountType=accountTypeExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCoreBankAccounts(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]): Future[Box[(List[CoreAccount], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetCoreBankAccounts => InBound, OutBoundGetCoreBankAccounts => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankIdAccountIds) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CoreAccount]](callContext)) - } - - messageDocs += getBankAccountsHeldDoc - def getBankAccountsHeldDoc = MessageDoc( - process = "obp.getBankAccountsHeld", - messageFormat = messageFormat, - description = "Get Bank Accounts Held", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountsHeld").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBankAccountsHeld").request), - exampleOutboundMessage = ( - OutBoundGetBankAccountsHeld(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankIdAccountIds=List( BankIdAccountId(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)))) - ), - exampleInboundMessage = ( - InBoundGetBankAccountsHeld(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( AccountHeld(id=idExample.value, - label=labelExample.value, - bankId=bankIdExample.value, - number=numberExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBankAccountsHeld(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]): OBPReturnType[Box[List[AccountHeld]]] = { - import com.openbankproject.commons.dto.{InBoundGetBankAccountsHeld => InBound, OutBoundGetBankAccountsHeld => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankIdAccountIds) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[AccountHeld]](callContext)) - } - - messageDocs += checkBankAccountExistsDoc - def checkBankAccountExistsDoc = MessageDoc( - process = "obp.checkBankAccountExists", - messageFormat = messageFormat, - description = "Check Bank Account Exists", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCheckBankAccountExists").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCheckBankAccountExists").request), - exampleOutboundMessage = ( - OutBoundCheckBankAccountExists(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)) - ), - exampleInboundMessage = ( - InBoundCheckBankAccountExists(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def checkBankAccountExists(bankId: BankId, accountId: AccountId, callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { - import com.openbankproject.commons.dto.{InBoundCheckBankAccountExists => InBound, OutBoundCheckBankAccountExists => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankAccountCommons](callContext)) - } - - messageDocs += getCounterpartyTraitDoc - def getCounterpartyTraitDoc = MessageDoc( - process = "obp.getCounterpartyTrait", - messageFormat = messageFormat, - description = "Get Counterparty Trait", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyTrait").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyTrait").request), - exampleOutboundMessage = ( - OutBoundGetCounterpartyTrait(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - couterpartyId="string") - ), - exampleInboundMessage = ( - InBoundGetCounterpartyTrait(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCounterpartyTrait(bankId: BankId, accountId: AccountId, couterpartyId: String, callContext: Option[CallContext]): OBPReturnType[Box[CounterpartyTrait]] = { - import com.openbankproject.commons.dto.{InBoundGetCounterpartyTrait => InBound, OutBoundGetCounterpartyTrait => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, couterpartyId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CounterpartyTraitCommons](callContext)) - } - - messageDocs += getCounterpartyByCounterpartyIdDoc - def getCounterpartyByCounterpartyIdDoc = MessageDoc( - process = "obp.getCounterpartyByCounterpartyId", - messageFormat = messageFormat, - description = "Get Counterparty By Counterparty Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyByCounterpartyId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyByCounterpartyId").request), - exampleOutboundMessage = ( - OutBoundGetCounterpartyByCounterpartyId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - counterpartyId=CounterpartyId(counterpartyIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetCounterpartyByCounterpartyId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCounterpartyByCounterpartyId(counterpartyId: CounterpartyId, callContext: Option[CallContext]): OBPReturnType[Box[CounterpartyTrait]] = { - import com.openbankproject.commons.dto.{InBoundGetCounterpartyByCounterpartyId => InBound, OutBoundGetCounterpartyByCounterpartyId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, counterpartyId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CounterpartyTraitCommons](callContext)) - } - - messageDocs += getCounterpartyByIbanDoc - def getCounterpartyByIbanDoc = MessageDoc( - process = "obp.getCounterpartyByIban", - messageFormat = messageFormat, - description = "Get Counterparty By Iban", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyByIban").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyByIban").request), - exampleOutboundMessage = ( - OutBoundGetCounterpartyByIban(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - iban=ibanExample.value) - ), - exampleInboundMessage = ( - InBoundGetCounterpartyByIban(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCounterpartyByIban(iban: String, callContext: Option[CallContext]): OBPReturnType[Box[CounterpartyTrait]] = { - import com.openbankproject.commons.dto.{InBoundGetCounterpartyByIban => InBound, OutBoundGetCounterpartyByIban => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, iban) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CounterpartyTraitCommons](callContext)) - } - - messageDocs += getCounterpartyByIbanAndBankAccountIdDoc - def getCounterpartyByIbanAndBankAccountIdDoc = MessageDoc( - process = "obp.getCounterpartyByIbanAndBankAccountId", - messageFormat = messageFormat, - description = "Get Counterparty By Iban And Bank Account Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyByIbanAndBankAccountId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterpartyByIbanAndBankAccountId").request), - exampleOutboundMessage = ( - OutBoundGetCounterpartyByIbanAndBankAccountId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - iban=ibanExample.value, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetCounterpartyByIbanAndBankAccountId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCounterpartyByIbanAndBankAccountId(iban: String, bankId: BankId, accountId: AccountId, callContext: Option[CallContext]): OBPReturnType[Box[CounterpartyTrait]] = { - import com.openbankproject.commons.dto.{InBoundGetCounterpartyByIbanAndBankAccountId => InBound, OutBoundGetCounterpartyByIbanAndBankAccountId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, iban, bankId, accountId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CounterpartyTraitCommons](callContext)) - } - - messageDocs += getCounterpartiesDoc - def getCounterpartiesDoc = MessageDoc( - process = "obp.getCounterparties", - messageFormat = messageFormat, - description = "Get Counterparties", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterparties").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCounterparties").request), - exampleOutboundMessage = ( - OutBoundGetCounterparties(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - thisBankId=BankId(thisBankIdExample.value), - thisAccountId=AccountId(thisAccountIdExample.value), - viewId=ViewId(viewIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetCounterparties(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCounterparties(thisBankId: BankId, thisAccountId: AccountId, viewId: ViewId, callContext: Option[CallContext]): OBPReturnType[Box[List[CounterpartyTrait]]] = { - import com.openbankproject.commons.dto.{InBoundGetCounterparties => InBound, OutBoundGetCounterparties => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, thisBankId, thisAccountId, viewId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CounterpartyTraitCommons]](callContext)) - } - - messageDocs += getTransactionsDoc - def getTransactionsDoc = MessageDoc( - process = "obp.getTransactions", - messageFormat = messageFormat, - description = "Get Transactions", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactions").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactions").request), - exampleOutboundMessage = ( - OutBoundGetTransactions(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - limit=limitExample.value.toInt, - offset=offsetExample.value.toInt, - fromDate=outBoundGetTransactionsFromDateExample.value, - toDate=outBoundGetTransactionsToDateExample.value) - ), - exampleInboundMessage = ( - InBoundGetTransactions(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( Transaction(uuid=transactionUuidExample.value, - id=TransactionId(transactionIdExample.value), - thisAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - otherAccount= Counterparty(nationalIdentifier=counterpartyNationalIdentifierExample.value, - kind=counterpartyKindExample.value, - counterpartyId=counterpartyIdExample.value, - counterpartyName=counterpartyNameExample.value, - thisBankId=BankId(thisBankIdExample.value), - thisAccountId=AccountId(thisAccountIdExample.value), - otherBankRoutingScheme=counterpartyOtherBankRoutingSchemeExample.value, - otherBankRoutingAddress=Some(counterpartyOtherBankRoutingAddressExample.value), - otherAccountRoutingScheme=counterpartyOtherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=Some(counterpartyOtherAccountRoutingAddressExample.value), - otherAccountProvider=counterpartyOtherAccountProviderExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean), - transactionType=transactionTypeExample.value, - amount=BigDecimal(transactionAmountExample.value), - currency=currencyExample.value, - description=Some(transactionDescriptionExample.value), - startDate=toDate(transactionStartDateExample), - finishDate=toDate(transactionFinishDateExample), - balance=BigDecimal(balanceExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactions(bankId: BankId, accountId: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]): OBPReturnType[Box[List[Transaction]]] = { - import com.openbankproject.commons.dto.{InBoundGetTransactions => InBound, OutBoundGetTransactions => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[Transaction]](callContext)) - } - - messageDocs += getTransactionsCoreDoc - def getTransactionsCoreDoc = MessageDoc( - process = "obp.getTransactionsCore", - messageFormat = messageFormat, - description = "Get Transactions Core", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionsCore").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionsCore").request), - exampleOutboundMessage = ( - OutBoundGetTransactionsCore(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - limit=limitExample.value.toInt, - offset=offsetExample.value.toInt, - fromDate=fromDateExample.value, - toDate=toDateExample.value) - ), - exampleInboundMessage = ( - InBoundGetTransactionsCore(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( TransactionCore(id=TransactionId(idExample.value), - thisAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - otherAccount= CounterpartyCore(kind=kindExample.value, - counterpartyId=counterpartyIdExample.value, - counterpartyName=counterpartyNameExample.value, - thisBankId=BankId(thisBankIdExample.value), - thisAccountId=AccountId(thisAccountIdExample.value), - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=Some(otherBankRoutingAddressExample.value), - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=Some(otherAccountRoutingAddressExample.value), - otherAccountProvider=otherAccountProviderExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean), - transactionType=transactionTypeExample.value, - amount=BigDecimal(amountExample.value), - currency=currencyExample.value, - description=Some(descriptionExample.value), - startDate=toDate(startDateExample), - finishDate=toDate(finishDateExample), - balance=BigDecimal(balanceExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionCore]]] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionsCore => InBound, OutBoundGetTransactionsCore => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[TransactionCore]](callContext)) - } - - messageDocs += getTransactionDoc - def getTransactionDoc = MessageDoc( - process = "obp.getTransaction", - messageFormat = messageFormat, - description = "Get Transaction", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransaction").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransaction").request), - exampleOutboundMessage = ( - OutBoundGetTransaction(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - transactionId=TransactionId(transactionIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetTransaction(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= Transaction(uuid=transactionUuidExample.value, - id=TransactionId(transactionIdExample.value), - thisAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - otherAccount= Counterparty(nationalIdentifier=counterpartyNationalIdentifierExample.value, - kind=counterpartyKindExample.value, - counterpartyId=counterpartyIdExample.value, - counterpartyName=counterpartyNameExample.value, - thisBankId=BankId(thisBankIdExample.value), - thisAccountId=AccountId(thisAccountIdExample.value), - otherBankRoutingScheme=counterpartyOtherBankRoutingSchemeExample.value, - otherBankRoutingAddress=Some(counterpartyOtherBankRoutingAddressExample.value), - otherAccountRoutingScheme=counterpartyOtherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=Some(counterpartyOtherAccountRoutingAddressExample.value), - otherAccountProvider=counterpartyOtherAccountProviderExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean), - transactionType=transactionTypeExample.value, - amount=BigDecimal(transactionAmountExample.value), - currency=currencyExample.value, - description=Some(transactionDescriptionExample.value), - startDate=toDate(transactionStartDateExample), - finishDate=toDate(transactionFinishDateExample), - balance=BigDecimal(balanceExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Transaction]] = { - import com.openbankproject.commons.dto.{InBoundGetTransaction => InBound, OutBoundGetTransaction => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, transactionId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Transaction](callContext)) - } - - messageDocs += getPhysicalCardsForUserDoc - def getPhysicalCardsForUserDoc = MessageDoc( - process = "obp.getPhysicalCardsForUser", - messageFormat = messageFormat, - description = "Get Physical Cards For User", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetPhysicalCardsForUser").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetPhysicalCardsForUser").request), - exampleOutboundMessage = ( - OutBoundGetPhysicalCardsForUser(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - user= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample)))) - ), - exampleInboundMessage = ( - InBoundGetPhysicalCardsForUser(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( PhysicalCard(cardId=cardIdExample.value, - bankId=bankIdExample.value, - bankCardNumber=bankCardNumberExample.value, - cardType=cardTypeExample.value, - nameOnCard=nameOnCardExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=List(com.openbankproject.commons.model.CardAction.DEBIT), - account= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=accountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value, - cvv=Some(cvvExample.value), - brand=Some(brandExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getPhysicalCardsForUser(user: User, callContext: Option[CallContext]): OBPReturnType[Box[List[PhysicalCard]]] = { - import com.openbankproject.commons.dto.{InBoundGetPhysicalCardsForUser => InBound, OutBoundGetPhysicalCardsForUser => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, user) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[PhysicalCard]](callContext)) - } - - messageDocs += getPhysicalCardForBankDoc - def getPhysicalCardForBankDoc = MessageDoc( - process = "obp.getPhysicalCardForBank", - messageFormat = messageFormat, - description = "Get Physical Card For Bank", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetPhysicalCardForBank").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetPhysicalCardForBank").request), - exampleOutboundMessage = ( - OutBoundGetPhysicalCardForBank(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - cardId=cardIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetPhysicalCardForBank(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= PhysicalCard(cardId=cardIdExample.value, - bankId=bankIdExample.value, - bankCardNumber=bankCardNumberExample.value, - cardType=cardTypeExample.value, - nameOnCard=nameOnCardExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=List(com.openbankproject.commons.model.CardAction.DEBIT), - account= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=accountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value, - cvv=Some(cvvExample.value), - brand=Some(brandExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getPhysicalCardForBank(bankId: BankId, cardId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = { - import com.openbankproject.commons.dto.{InBoundGetPhysicalCardForBank => InBound, OutBoundGetPhysicalCardForBank => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, cardId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[PhysicalCard](callContext)) - } - - messageDocs += deletePhysicalCardForBankDoc - def deletePhysicalCardForBankDoc = MessageDoc( - process = "obp.deletePhysicalCardForBank", - messageFormat = messageFormat, - description = "Delete Physical Card For Bank", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeletePhysicalCardForBank").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeletePhysicalCardForBank").request), - exampleOutboundMessage = ( - OutBoundDeletePhysicalCardForBank(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - cardId=cardIdExample.value) - ), - exampleInboundMessage = ( - InBoundDeletePhysicalCardForBank(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deletePhysicalCardForBank(bankId: BankId, cardId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeletePhysicalCardForBank => InBound, OutBoundDeletePhysicalCardForBank => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, cardId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += getPhysicalCardsForBankDoc - def getPhysicalCardsForBankDoc = MessageDoc( - process = "obp.getPhysicalCardsForBank", - messageFormat = messageFormat, - description = "Get Physical Cards For Bank", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetPhysicalCardsForBank").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetPhysicalCardsForBank").request), - exampleOutboundMessage = ( - OutBoundGetPhysicalCardsForBank(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bank= BankCommons(bankId=BankId(bankIdExample.value), - shortName=bankShortNameExample.value, - fullName=bankFullNameExample.value, - logoUrl=bankLogoUrlExample.value, - websiteUrl=bankWebsiteUrlExample.value, - bankRoutingScheme=bankRoutingSchemeExample.value, - bankRoutingAddress=bankRoutingAddressExample.value, - swiftBic=bankSwiftBicExample.value, - nationalIdentifier=bankNationalIdentifierExample.value), - user= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - limit=limitExample.value.toInt, - offset=offsetExample.value.toInt, - fromDate=fromDateExample.value, - toDate=toDateExample.value) - ), - exampleInboundMessage = ( - InBoundGetPhysicalCardsForBank(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( PhysicalCard(cardId=cardIdExample.value, - bankId=bankIdExample.value, - bankCardNumber=bankCardNumberExample.value, - cardType=cardTypeExample.value, - nameOnCard=nameOnCardExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=List(com.openbankproject.commons.model.CardAction.DEBIT), - account= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=accountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value, - cvv=Some(cvvExample.value), - brand=Some(brandExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getPhysicalCardsForBank(bank: Bank, user: User, queryParams: List[OBPQueryParam], callContext: Option[CallContext]): OBPReturnType[Box[List[PhysicalCard]]] = { - import com.openbankproject.commons.dto.{InBoundGetPhysicalCardsForBank => InBound, OutBoundGetPhysicalCardsForBank => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bank, user, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[PhysicalCard]](callContext)) - } - - messageDocs += createPhysicalCardDoc - def createPhysicalCardDoc = MessageDoc( - process = "obp.createPhysicalCard", - messageFormat = messageFormat, - description = "Create Physical Card", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreatePhysicalCard").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreatePhysicalCard").request), - exampleOutboundMessage = ( - OutBoundCreatePhysicalCard(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankCardNumber=bankCardNumberExample.value, - nameOnCard=nameOnCardExample.value, - cardType=cardTypeExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=allowsExample.value.replace("[","").replace("]","").split(",").toList, - accountId=accountIdExample.value, - bankId=bankIdExample.value, - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value, - cvv=cvvExample.value, - brand=brandExample.value) - ), - exampleInboundMessage = ( - InBoundCreatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= PhysicalCard(cardId=cardIdExample.value, - bankId=bankIdExample.value, - bankCardNumber=bankCardNumberExample.value, - cardType=cardTypeExample.value, - nameOnCard=nameOnCardExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=List(com.openbankproject.commons.model.CardAction.DEBIT), - account= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=accountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value, - cvv=Some(cvvExample.value), - brand=Some(brandExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = { - import com.openbankproject.commons.dto.{InBoundCreatePhysicalCard => InBound, OutBoundCreatePhysicalCard => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[PhysicalCard](callContext)) - } - - messageDocs += updatePhysicalCardDoc - def updatePhysicalCardDoc = MessageDoc( - process = "obp.updatePhysicalCard", - messageFormat = messageFormat, - description = "Update Physical Card", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdatePhysicalCard").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdatePhysicalCard").request), - exampleOutboundMessage = ( - OutBoundUpdatePhysicalCard(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - cardId=cardIdExample.value, - bankCardNumber=bankCardNumberExample.value, - nameOnCard=nameOnCardExample.value, - cardType=cardTypeExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=allowsExample.value.replace("[","").replace("]","").split(",").toList, - accountId=accountIdExample.value, - bankId=bankIdExample.value, - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundUpdatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= PhysicalCard(cardId=cardIdExample.value, - bankId=bankIdExample.value, - bankCardNumber=bankCardNumberExample.value, - cardType=cardTypeExample.value, - nameOnCard=nameOnCardExample.value, - issueNumber=issueNumberExample.value, - serialNumber=serialNumberExample.value, - validFrom=toDate(validFromExample), - expires=toDate(expiresDateExample), - enabled=enabledExample.value.toBoolean, - cancelled=cancelledExample.value.toBoolean, - onHotList=onHotListExample.value.toBoolean, - technology=technologyExample.value, - networks=networksExample.value.replace("[","").replace("]","").split(",").toList, - allows=List(com.openbankproject.commons.model.CardAction.DEBIT), - account= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=accountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.CardReplacementReason.FIRST)), - pinResets=List( PinResetInfo(requestedDate=toDate(requestedDateExample), - reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), - collected=Some(CardCollectionInfo(toDate(collectedExample))), - posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value, - cvv=Some(cvvExample.value), - brand=Some(brandExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = { - import com.openbankproject.commons.dto.{InBoundUpdatePhysicalCard => InBound, OutBoundUpdatePhysicalCard => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[PhysicalCard](callContext)) - } - - messageDocs += makePaymentv210Doc - def makePaymentv210Doc = MessageDoc( - process = "obp.makePaymentv210", - messageFormat = messageFormat, - description = "Make Paymentv210", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundMakePaymentv210").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundMakePaymentv210").request), - exampleOutboundMessage = ( - OutBoundMakePaymentv210(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - transactionRequestId=TransactionRequestId(transactionRequestIdExample.value), - transactionRequestCommonBody= TransactionRequestCommonBodyJSONCommons(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - amount=BigDecimal(amountExample.value), - description=descriptionExample.value, - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - chargePolicy=chargePolicyExample.value) - ), - exampleInboundMessage = ( - InBoundMakePaymentv210(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=TransactionId(transactionIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def makePaymentv210(fromAccount: BankAccount, toAccount: BankAccount, transactionRequestId: TransactionRequestId, transactionRequestCommonBody: TransactionRequestCommonBodyJSON, amount: BigDecimal, description: String, transactionRequestType: TransactionRequestType, chargePolicy: String, callContext: Option[CallContext]): OBPReturnType[Box[TransactionId]] = { - import com.openbankproject.commons.dto.{InBoundMakePaymentv210 => InBound, OutBoundMakePaymentv210 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, fromAccount, toAccount, transactionRequestId, transactionRequestCommonBody, amount, description, transactionRequestType, chargePolicy) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionId](callContext)) - } - - messageDocs += getChargeValueDoc - def getChargeValueDoc = MessageDoc( - process = "obp.getChargeValue", - messageFormat = messageFormat, - description = "Get Charge Value", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChargeValue").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetChargeValue").request), - exampleOutboundMessage = ( - OutBoundGetChargeValue(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - chargeLevelAmount=BigDecimal("123.321"), - transactionRequestCommonBodyAmount=BigDecimal("123.321")) - ), - exampleInboundMessage = ( - InBoundGetChargeValue(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data="string") - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getChargeValue(chargeLevelAmount: BigDecimal, transactionRequestCommonBodyAmount: BigDecimal, callContext: Option[CallContext]): OBPReturnType[Box[String]] = { - import com.openbankproject.commons.dto.{InBoundGetChargeValue => InBound, OutBoundGetChargeValue => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, chargeLevelAmount, transactionRequestCommonBodyAmount) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[String](callContext)) - } - - messageDocs += createTransactionRequestv210Doc - def createTransactionRequestv210Doc = MessageDoc( - process = "obp.createTransactionRequestv210", - messageFormat = messageFormat, - description = "Create Transaction Requestv210", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestv210").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestv210").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionRequestv210(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - viewId=ViewId(viewIdExample.value), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - transactionRequestCommonBody= TransactionRequestCommonBodyJSONCommons(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - detailsPlain="string", - chargePolicy=chargePolicyExample.value, - challengeType=Some(challengeTypeExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS)) - ), - exampleInboundMessage = ( - InBoundCreateTransactionRequestv210(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionRequestv210(initiator: User, viewId: ViewId, fromAccount: BankAccount, toAccount: BankAccount, transactionRequestType: TransactionRequestType, transactionRequestCommonBody: TransactionRequestCommonBodyJSON, detailsPlain: String, chargePolicy: String, challengeType: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], callContext: Option[CallContext]): OBPReturnType[Box[TransactionRequest]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionRequestv210 => InBound, OutBoundCreateTransactionRequestv210 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, viewId, fromAccount, toAccount, transactionRequestType, transactionRequestCommonBody, detailsPlain, chargePolicy, challengeType, scaMethod) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequest](callContext)) - } - - messageDocs += createTransactionRequestv400Doc - def createTransactionRequestv400Doc = MessageDoc( - process = "obp.createTransactionRequestv400", - messageFormat = messageFormat, - description = "Create Transaction Requestv400", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestv400").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestv400").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionRequestv400(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - viewId=ViewId(viewIdExample.value), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - transactionRequestCommonBody= TransactionRequestCommonBodyJSONCommons(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - detailsPlain="string", - chargePolicy=chargePolicyExample.value, - challengeType=Some(challengeTypeExample.value), - scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), - reasons=Some(List( TransactionRequestReason(code=codeExample.value, - documentNumber=Some(documentNumberExample.value), - amount=Some(amountExample.value), - currency=Some(currencyExample.value), - description=Some(descriptionExample.value))))) - ), - exampleInboundMessage = ( - InBoundCreateTransactionRequestv400(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionRequestv400(initiator: User, viewId: ViewId, fromAccount: BankAccount, toAccount: BankAccount, transactionRequestType: TransactionRequestType, transactionRequestCommonBody: TransactionRequestCommonBodyJSON, detailsPlain: String, chargePolicy: String, challengeType: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], reasons: Option[List[TransactionRequestReason]], callContext: Option[CallContext]): OBPReturnType[Box[TransactionRequest]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionRequestv400 => InBound, OutBoundCreateTransactionRequestv400 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, viewId, fromAccount, toAccount, transactionRequestType, transactionRequestCommonBody, detailsPlain, chargePolicy, challengeType, scaMethod, reasons) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequest](callContext)) - } - - messageDocs += createTransactionRequestSepaCreditTransfersBGV1Doc - def createTransactionRequestSepaCreditTransfersBGV1Doc = MessageDoc( - process = "obp.createTransactionRequestSepaCreditTransfersBGV1", - messageFormat = messageFormat, - description = "Create Transaction Request Sepa Credit Transfers BG V1", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestSepaCreditTransfersBGV1").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestSepaCreditTransfersBGV1").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionRequestSepaCreditTransfersBGV1(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - paymentServiceType=com.openbankproject.commons.model.enums.PaymentServiceTypes.example, - transactionRequestType=com.openbankproject.commons.model.enums.TransactionRequestTypes.example, - transactionRequestBody= SepaCreditTransfersBerlinGroupV13(endToEndIdentification=Some("string"), - instructionIdentification=Some("string"), - debtorName=Some("string"), - debtorAccount=PaymentAccount("string"), - debtorId=Some("string"), - ultimateDebtor=Some("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - currencyOfTransfer=Some("string"), - exchangeRateInformation=Some("string"), - creditorAccount=PaymentAccount("string"), - creditorAgent=Some("string"), - creditorAgentName=Some("string"), - creditorName="string", - creditorId=Some("string"), - creditorAddress=Some("string"), - creditorNameAndAddress=Some("string"), - ultimateCreditor=Some("string"), - purposeCode=Some("string"), - chargeBearer=Some("string"), - serviceLevel=Some("string"), - remittanceInformationUnstructured=Some("string"), - remittanceInformationUnstructuredArray=Some("string"), - remittanceInformationStructured=Some("string"), - remittanceInformationStructuredArray=Some("string"), - requestedExecutionDate=Some("string"), - requestedExecutionTime=Some("string"))) - ), - exampleInboundMessage = ( - InBoundCreateTransactionRequestSepaCreditTransfersBGV1(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequestBGV1(id=TransactionRequestId(idExample.value), - status=statusExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionRequestSepaCreditTransfersBGV1(initiator: User, paymentServiceType: PaymentServiceTypes, transactionRequestType: TransactionRequestTypes, transactionRequestBody: SepaCreditTransfersBerlinGroupV13, callContext: Option[CallContext]): OBPReturnType[Box[TransactionRequestBGV1]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionRequestSepaCreditTransfersBGV1 => InBound, OutBoundCreateTransactionRequestSepaCreditTransfersBGV1 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, paymentServiceType, transactionRequestType, transactionRequestBody) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequestBGV1](callContext)) - } - - messageDocs += createTransactionRequestPeriodicSepaCreditTransfersBGV1Doc - def createTransactionRequestPeriodicSepaCreditTransfersBGV1Doc = MessageDoc( - process = "obp.createTransactionRequestPeriodicSepaCreditTransfersBGV1", - messageFormat = messageFormat, - description = "Create Transaction Request Periodic Sepa Credit Transfers BG V1", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestPeriodicSepaCreditTransfersBGV1").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestPeriodicSepaCreditTransfersBGV1").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionRequestPeriodicSepaCreditTransfersBGV1(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - paymentServiceType=com.openbankproject.commons.model.enums.PaymentServiceTypes.example, - transactionRequestType=com.openbankproject.commons.model.enums.TransactionRequestTypes.example, - transactionRequestBody= PeriodicSepaCreditTransfersBerlinGroupV13(endToEndIdentification=Some("string"), - instructionIdentification=Some("string"), - debtorName=Some("string"), - debtorAccount=PaymentAccount("string"), - debtorId=Some("string"), - ultimateDebtor=Some("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - currencyOfTransfer=Some("string"), - exchangeRateInformation=Some("string"), - creditorAccount=PaymentAccount("string"), - creditorAgent=Some("string"), - creditorAgentName=Some("string"), - creditorName="string", - creditorId=Some("string"), - creditorAddress=Some("string"), - creditorNameAndAddress=Some("string"), - ultimateCreditor=Some("string"), - purposeCode=Some("string"), - chargeBearer=Some("string"), - serviceLevel=Some("string"), - remittanceInformationUnstructured=Some("string"), - remittanceInformationUnstructuredArray=Some("string"), - remittanceInformationStructured=Some("string"), - remittanceInformationStructuredArray=Some("string"), - requestedExecutionDate=Some("string"), - requestedExecutionTime=Some("string"), - startDate=startDateExample.value, - executionRule=Some("string"), - endDate=Some(endDateExample.value), - frequency=frequencyExample.value, - dayOfExecution=Some("string"))) - ), - exampleInboundMessage = ( - InBoundCreateTransactionRequestPeriodicSepaCreditTransfersBGV1(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequestBGV1(id=TransactionRequestId(idExample.value), - status=statusExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionRequestPeriodicSepaCreditTransfersBGV1(initiator: User, paymentServiceType: PaymentServiceTypes, transactionRequestType: TransactionRequestTypes, transactionRequestBody: PeriodicSepaCreditTransfersBerlinGroupV13, callContext: Option[CallContext]): OBPReturnType[Box[TransactionRequestBGV1]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionRequestPeriodicSepaCreditTransfersBGV1 => InBound, OutBoundCreateTransactionRequestPeriodicSepaCreditTransfersBGV1 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, paymentServiceType, transactionRequestType, transactionRequestBody) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequestBGV1](callContext)) - } - - messageDocs += saveTransactionRequestTransactionDoc - def saveTransactionRequestTransactionDoc = MessageDoc( - process = "obp.saveTransactionRequestTransaction", - messageFormat = messageFormat, - description = "Save Transaction Request Transaction", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundSaveTransactionRequestTransaction").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundSaveTransactionRequestTransaction").request), - exampleOutboundMessage = ( - OutBoundSaveTransactionRequestTransaction(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=TransactionRequestId(transactionRequestIdExample.value), - transactionId=TransactionId(transactionIdExample.value)) - ), - exampleInboundMessage = ( - InBoundSaveTransactionRequestTransaction(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def saveTransactionRequestTransaction(transactionRequestId: TransactionRequestId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundSaveTransactionRequestTransaction => InBound, OutBoundSaveTransactionRequestTransaction => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, transactionId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += saveTransactionRequestChallengeDoc - def saveTransactionRequestChallengeDoc = MessageDoc( - process = "obp.saveTransactionRequestChallenge", - messageFormat = messageFormat, - description = "Save Transaction Request Challenge", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundSaveTransactionRequestChallenge").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundSaveTransactionRequestChallenge").request), - exampleOutboundMessage = ( - OutBoundSaveTransactionRequestChallenge(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=TransactionRequestId(transactionRequestIdExample.value), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string")) - ), - exampleInboundMessage = ( - InBoundSaveTransactionRequestChallenge(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def saveTransactionRequestChallenge(transactionRequestId: TransactionRequestId, challenge: TransactionRequestChallenge, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundSaveTransactionRequestChallenge => InBound, OutBoundSaveTransactionRequestChallenge => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, challenge) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += saveTransactionRequestStatusImplDoc - def saveTransactionRequestStatusImplDoc = MessageDoc( - process = "obp.saveTransactionRequestStatusImpl", - messageFormat = messageFormat, - description = "Save Transaction Request Status Impl", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundSaveTransactionRequestStatusImpl").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundSaveTransactionRequestStatusImpl").request), - exampleOutboundMessage = ( - OutBoundSaveTransactionRequestStatusImpl(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=TransactionRequestId(transactionRequestIdExample.value), - status=statusExample.value) - ), - exampleInboundMessage = ( - InBoundSaveTransactionRequestStatusImpl(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def saveTransactionRequestStatusImpl(transactionRequestId: TransactionRequestId, status: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundSaveTransactionRequestStatusImpl => InBound, OutBoundSaveTransactionRequestStatusImpl => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, status) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += getTransactionRequests210Doc - def getTransactionRequests210Doc = MessageDoc( - process = "obp.getTransactionRequests210", - messageFormat = messageFormat, - description = "Get Transaction Requests210", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequests210").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequests210").request), - exampleOutboundMessage = ( - OutBoundGetTransactionRequests210(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - exampleInboundMessage = ( - InBoundGetTransactionRequests210(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string")))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionRequests210(initiator: User, fromAccount: BankAccount, callContext: Option[CallContext]): Box[(List[TransactionRequest], Option[CallContext])] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionRequests210 => InBound, OutBoundGetTransactionRequests210 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, fromAccount) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[TransactionRequest]](callContext)) - } - - messageDocs += getTransactionRequestImplDoc - def getTransactionRequestImplDoc = MessageDoc( - process = "obp.getTransactionRequestImpl", - messageFormat = messageFormat, - description = "Get Transaction Request Impl", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequestImpl").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequestImpl").request), - exampleOutboundMessage = ( - OutBoundGetTransactionRequestImpl(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequestId=TransactionRequestId(transactionRequestIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetTransactionRequestImpl(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionRequestImpl(transactionRequestId: TransactionRequestId, callContext: Option[CallContext]): Box[(TransactionRequest, Option[CallContext])] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionRequestImpl => InBound, OutBoundGetTransactionRequestImpl => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequest](callContext)) - } - - messageDocs += getTransactionRequestTypesDoc - def getTransactionRequestTypesDoc = MessageDoc( - process = "obp.getTransactionRequestTypes", - messageFormat = messageFormat, - description = "Get Transaction Request Types", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequestTypes").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequestTypes").request), - exampleOutboundMessage = ( - OutBoundGetTransactionRequestTypes(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - exampleInboundMessage = ( - InBoundGetTransactionRequestTypes(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List(TransactionRequestType(transactionRequestTypeExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionRequestTypes(initiator: User, fromAccount: BankAccount, callContext: Option[CallContext]): Box[(List[TransactionRequestType], Option[CallContext])] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionRequestTypes => InBound, OutBoundGetTransactionRequestTypes => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, fromAccount) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[TransactionRequestType]](callContext)) - } - - messageDocs += createTransactionAfterChallengeV210Doc - def createTransactionAfterChallengeV210Doc = MessageDoc( - process = "obp.createTransactionAfterChallengeV210", - messageFormat = messageFormat, - description = "Create Transaction After Challenge V210", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionAfterChallengeV210").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionAfterChallengeV210").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionAfterChallengeV210(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - transactionRequest= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - exampleInboundMessage = ( - InBoundCreateTransactionAfterChallengeV210(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionAfterChallengeV210(fromAccount: BankAccount, transactionRequest: TransactionRequest, callContext: Option[CallContext]): OBPReturnType[Box[TransactionRequest]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionAfterChallengeV210 => InBound, OutBoundCreateTransactionAfterChallengeV210 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, fromAccount, transactionRequest) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequest](callContext)) - } - - messageDocs += updateBankAccountDoc - def updateBankAccountDoc = MessageDoc( - process = "obp.updateBankAccount", - messageFormat = messageFormat, - description = "Update Bank Account", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateBankAccount").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateBankAccount").request), - exampleOutboundMessage = ( - OutBoundUpdateBankAccount(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - accountLabel="string", - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value))) - ), - exampleInboundMessage = ( - InBoundUpdateBankAccount(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateBankAccount(bankId: BankId, accountId: AccountId, accountType: String, accountLabel: String, branchId: String, accountRoutings: List[AccountRouting], callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { - import com.openbankproject.commons.dto.{InBoundUpdateBankAccount => InBound, OutBoundUpdateBankAccount => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, accountType, accountLabel, branchId, accountRoutings) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankAccountCommons](callContext)) - } - - messageDocs += createBankAccountDoc - def createBankAccountDoc = MessageDoc( - process = "obp.createBankAccount", - messageFormat = messageFormat, - description = "Create Bank Account", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateBankAccount").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateBankAccount").request), - exampleOutboundMessage = ( - OutBoundCreateBankAccount(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - accountLabel="string", - currency=currencyExample.value, - initialBalance=BigDecimal("123.321"), - accountHolderName="string", - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value))) - ), - exampleInboundMessage = ( - InBoundCreateBankAccount(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createBankAccount(bankId: BankId, accountId: AccountId, accountType: String, accountLabel: String, currency: String, initialBalance: BigDecimal, accountHolderName: String, branchId: String, accountRoutings: List[AccountRouting], callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { - import com.openbankproject.commons.dto.{InBoundCreateBankAccount => InBound, OutBoundCreateBankAccount => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, accountType, accountLabel, currency, initialBalance, accountHolderName, branchId, accountRoutings) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankAccountCommons](callContext)) - } - - messageDocs += updateAccountLabelDoc - def updateAccountLabelDoc = MessageDoc( - process = "obp.updateAccountLabel", - messageFormat = messageFormat, - description = "Update Account Label", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateAccountLabel").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateAccountLabel").request), - exampleOutboundMessage = ( - OutBoundUpdateAccountLabel(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - label=labelExample.value) - ), - exampleInboundMessage = ( - InBoundUpdateAccountLabel(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateAccountLabel(bankId: BankId, accountId: AccountId, label: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundUpdateAccountLabel => InBound, OutBoundUpdateAccountLabel => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, label) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += getProductsDoc - def getProductsDoc = MessageDoc( - process = "obp.getProducts", - messageFormat = messageFormat, - description = "Get Products", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProducts").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProducts").request), - exampleOutboundMessage = ( - OutBoundGetProducts(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - params=List( GetProductsParam(name=nameExample.value, - value=valueExample.value.replace("[","").replace("]","").split(",").toList))) - ), - exampleInboundMessage = ( - InBoundGetProducts(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductCommons(bankId=BankId(bankIdExample.value), - code=ProductCode(productCodeExample.value), - parentProductCode=ProductCode(parentProductCodeExample.value), - name=productNameExample.value, - category=categoryExample.value, - family=familyExample.value, - superFamily=superFamilyExample.value, - moreInfoUrl=moreInfoUrlExample.value, - termsAndConditionsUrl=termsAndConditionsUrlExample.value, - details=detailsExample.value, - description=descriptionExample.value, - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProducts(bankId: BankId, params: List[GetProductsParam], callContext: Option[CallContext]): OBPReturnType[Box[List[Product]]] = { - import com.openbankproject.commons.dto.{InBoundGetProducts => InBound, OutBoundGetProducts => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, params) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductCommons]](callContext)) - } - - messageDocs += getProductDoc - def getProductDoc = MessageDoc( - process = "obp.getProduct", - messageFormat = messageFormat, - description = "Get Product", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProduct").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProduct").request), - exampleOutboundMessage = ( - OutBoundGetProduct(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value)) - ), - exampleInboundMessage = ( - InBoundGetProduct(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ProductCommons(bankId=BankId(bankIdExample.value), - code=ProductCode(productCodeExample.value), - parentProductCode=ProductCode(parentProductCodeExample.value), - name=productNameExample.value, - category=categoryExample.value, - family=familyExample.value, - superFamily=superFamilyExample.value, - moreInfoUrl=moreInfoUrlExample.value, - termsAndConditionsUrl=termsAndConditionsUrlExample.value, - details=detailsExample.value, - description=descriptionExample.value, - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProduct(bankId: BankId, productCode: ProductCode, callContext: Option[CallContext]): OBPReturnType[Box[Product]] = { - import com.openbankproject.commons.dto.{InBoundGetProduct => InBound, OutBoundGetProduct => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, productCode) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ProductCommons](callContext)) - } - - messageDocs += getBranchDoc - def getBranchDoc = MessageDoc( - process = "obp.getBranch", - messageFormat = messageFormat, - description = "Get Branch", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBranch").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBranch").request), - exampleOutboundMessage = ( - OutBoundGetBranch(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - branchId=BranchId(branchIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetBranch(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BranchTCommons(branchId=BranchId(branchIdExample.value), - bankId=BankId(bankIdExample.value), - name=nameExample.value, - address= Address(line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=Some(countyExample.value), - state=stateExample.value, - postCode=postCodeExample.value, - countryCode=countryCodeExample.value), - location= Location(latitude=latitudeExample.value.toDouble, - longitude=longitudeExample.value.toDouble, - date=Some(toDate(dateExample)), - user=Some( BasicResourceUser(userId=userIdExample.value, - provider=providerExample.value, - username=usernameExample.value))), - lobbyString=Some(LobbyString("string")), - driveUpString=Some(DriveUpString("string")), - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value)), - branchRouting=Some( Routing(scheme=branchRoutingSchemeExample.value, - address=branchRoutingAddressExample.value)), - lobby=Some( Lobby(monday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - tuesday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - wednesday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - thursday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - friday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - saturday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - sunday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)))), - driveUp=Some( DriveUp(monday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - tuesday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - wednesday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - thursday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - friday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - saturday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - sunday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value))), - isAccessible=Some(isAccessibleExample.value.toBoolean), - accessibleFeatures=Some("string"), - branchType=Some(branchTypeExample.value), - moreInfo=Some(moreInfoExample.value), - phoneNumber=Some(phoneNumberExample.value), - isDeleted=Some(true))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBranch(bankId: BankId, branchId: BranchId, callContext: Option[CallContext]): Future[Box[(BranchT, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetBranch => InBound, OutBoundGetBranch => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, branchId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BranchTCommons](callContext)) - } - - messageDocs += getBranchesDoc - def getBranchesDoc = MessageDoc( - process = "obp.getBranches", - messageFormat = messageFormat, - description = "Get Branches", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBranches").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetBranches").request), - exampleOutboundMessage = ( - OutBoundGetBranches(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - limit=limitExample.value.toInt, - offset=offsetExample.value.toInt, - fromDate=fromDateExample.value, - toDate=toDateExample.value) - ), - exampleInboundMessage = ( - InBoundGetBranches(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( BranchTCommons(branchId=BranchId(branchIdExample.value), - bankId=BankId(bankIdExample.value), - name=nameExample.value, - address= Address(line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=Some(countyExample.value), - state=stateExample.value, - postCode=postCodeExample.value, - countryCode=countryCodeExample.value), - location= Location(latitude=latitudeExample.value.toDouble, - longitude=longitudeExample.value.toDouble, - date=Some(toDate(dateExample)), - user=Some( BasicResourceUser(userId=userIdExample.value, - provider=providerExample.value, - username=usernameExample.value))), - lobbyString=Some(LobbyString("string")), - driveUpString=Some(DriveUpString("string")), - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value)), - branchRouting=Some( Routing(scheme=branchRoutingSchemeExample.value, - address=branchRoutingAddressExample.value)), - lobby=Some( Lobby(monday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - tuesday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - wednesday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - thursday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - friday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - saturday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)), - sunday=List( OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value)))), - driveUp=Some( DriveUp(monday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - tuesday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - wednesday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - thursday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - friday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - saturday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value), - sunday= OpeningTimes(openingTime=openingTimeExample.value, - closingTime=closingTimeExample.value))), - isAccessible=Some(isAccessibleExample.value.toBoolean), - accessibleFeatures=Some("string"), - branchType=Some(branchTypeExample.value), - moreInfo=Some(moreInfoExample.value), - phoneNumber=Some(phoneNumberExample.value), - isDeleted=Some(true)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getBranches(bankId: BankId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]): Future[Box[(List[BranchT], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetBranches => InBound, OutBoundGetBranches => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[BranchTCommons]](callContext)) - } - - messageDocs += getAtmDoc - def getAtmDoc = MessageDoc( - process = "obp.getAtm", - messageFormat = messageFormat, - description = "Get Atm", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAtm").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAtm").request), - exampleOutboundMessage = ( - OutBoundGetAtm(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - atmId=AtmId(atmIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetAtm(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AtmTCommons(atmId=AtmId(atmIdExample.value), - bankId=BankId(bankIdExample.value), - name=nameExample.value, - address= Address(line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=Some(countyExample.value), - state=stateExample.value, - postCode=postCodeExample.value, - countryCode=countryCodeExample.value), - location= Location(latitude=latitudeExample.value.toDouble, - longitude=longitudeExample.value.toDouble, - date=Some(toDate(dateExample)), - user=Some( BasicResourceUser(userId=userIdExample.value, - provider=providerExample.value, - username=usernameExample.value))), - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value)), - OpeningTimeOnMonday=Some("string"), - ClosingTimeOnMonday=Some("string"), - OpeningTimeOnTuesday=Some("string"), - ClosingTimeOnTuesday=Some("string"), - OpeningTimeOnWednesday=Some("string"), - ClosingTimeOnWednesday=Some("string"), - OpeningTimeOnThursday=Some("string"), - ClosingTimeOnThursday=Some("string"), - OpeningTimeOnFriday=Some("string"), - ClosingTimeOnFriday=Some("string"), - OpeningTimeOnSaturday=Some("string"), - ClosingTimeOnSaturday=Some("string"), - OpeningTimeOnSunday=Some("string"), - ClosingTimeOnSunday=Some("string"), - isAccessible=Some(isAccessibleExample.value.toBoolean), - locatedAt=Some(locatedAtExample.value), - moreInfo=Some(moreInfoExample.value), - hasDepositCapability=Some(hasDepositCapabilityExample.value.toBoolean), - supportedLanguages=Some(supportedLanguagesExample.value.replace("[","").replace("]","").split(",").toList), - services=Some(listExample.value.replace("[","").replace("]","").split(",").toList), - accessibilityFeatures=Some(accessibilityFeaturesExample.value.replace("[","").replace("]","").split(",").toList), - supportedCurrencies=Some(supportedCurrenciesExample.value.replace("[","").replace("]","").split(",").toList), - notes=Some(listExample.value.replace("[","").replace("]","").split(",").toList), - locationCategories=Some(listExample.value.replace("[","").replace("]","").split(",").toList), - minimumWithdrawal=Some("string"), - branchIdentification=Some("string"), - siteIdentification=Some(siteIdentification.value), - siteName=Some("string"), - cashWithdrawalNationalFee=Some(cashWithdrawalNationalFeeExample.value), - cashWithdrawalInternationalFee=Some(cashWithdrawalInternationalFeeExample.value), - balanceInquiryFee=Some(balanceInquiryFeeExample.value), - atmType=Some(atmTypeExample.value), - phone=Some(phoneExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAtm(bankId: BankId, atmId: AtmId, callContext: Option[CallContext]): Future[Box[(AtmT, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetAtm => InBound, OutBoundGetAtm => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, atmId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AtmTCommons](callContext)) - } - - messageDocs += getAtmsDoc - def getAtmsDoc = MessageDoc( - process = "obp.getAtms", - messageFormat = messageFormat, - description = "Get Atms", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAtms").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAtms").request), - exampleOutboundMessage = ( - OutBoundGetAtms(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - limit=limitExample.value.toInt, - offset=offsetExample.value.toInt, - fromDate=fromDateExample.value, - toDate=toDateExample.value) - ), - exampleInboundMessage = ( - InBoundGetAtms(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( AtmTCommons(atmId=AtmId(atmIdExample.value), - bankId=BankId(bankIdExample.value), - name=nameExample.value, - address= Address(line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=Some(countyExample.value), - state=stateExample.value, - postCode=postCodeExample.value, - countryCode=countryCodeExample.value), - location= Location(latitude=latitudeExample.value.toDouble, - longitude=longitudeExample.value.toDouble, - date=Some(toDate(dateExample)), - user=Some( BasicResourceUser(userId=userIdExample.value, - provider=providerExample.value, - username=usernameExample.value))), - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value)), - OpeningTimeOnMonday=Some("string"), - ClosingTimeOnMonday=Some("string"), - OpeningTimeOnTuesday=Some("string"), - ClosingTimeOnTuesday=Some("string"), - OpeningTimeOnWednesday=Some("string"), - ClosingTimeOnWednesday=Some("string"), - OpeningTimeOnThursday=Some("string"), - ClosingTimeOnThursday=Some("string"), - OpeningTimeOnFriday=Some("string"), - ClosingTimeOnFriday=Some("string"), - OpeningTimeOnSaturday=Some("string"), - ClosingTimeOnSaturday=Some("string"), - OpeningTimeOnSunday=Some("string"), - ClosingTimeOnSunday=Some("string"), - isAccessible=Some(isAccessibleExample.value.toBoolean), - locatedAt=Some(locatedAtExample.value), - moreInfo=Some(moreInfoExample.value), - hasDepositCapability=Some(hasDepositCapabilityExample.value.toBoolean), - supportedLanguages=Some(supportedLanguagesExample.value.replace("[","").replace("]","").split(",").toList), - services=Some(listExample.value.replace("[","").replace("]","").split(",").toList), - accessibilityFeatures=Some(accessibilityFeaturesExample.value.replace("[","").replace("]","").split(",").toList), - supportedCurrencies=Some(supportedCurrenciesExample.value.replace("[","").replace("]","").split(",").toList), - notes=Some(listExample.value.replace("[","").replace("]","").split(",").toList), - locationCategories=Some(listExample.value.replace("[","").replace("]","").split(",").toList), - minimumWithdrawal=Some("string"), - branchIdentification=Some("string"), - siteIdentification=Some(siteIdentification.value), - siteName=Some("string"), - cashWithdrawalNationalFee=Some(cashWithdrawalNationalFeeExample.value), - cashWithdrawalInternationalFee=Some(cashWithdrawalInternationalFeeExample.value), - balanceInquiryFee=Some(balanceInquiryFeeExample.value), - atmType=Some(atmTypeExample.value), - phone=Some(phoneExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAtms(bankId: BankId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]): Future[Box[(List[AtmT], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetAtms => InBound, OutBoundGetAtms => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[AtmTCommons]](callContext)) - } - - messageDocs += createTransactionAfterChallengev300Doc - def createTransactionAfterChallengev300Doc = MessageDoc( - process = "obp.createTransactionAfterChallengev300", - messageFormat = messageFormat, - description = "Create Transaction After Challengev300", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionAfterChallengev300").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionAfterChallengev300").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionAfterChallengev300(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - transReqId=TransactionRequestId(transactionRequestIdExample.value), - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value)) - ), - exampleInboundMessage = ( - InBoundCreateTransactionAfterChallengev300(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionAfterChallengev300(initiator: User, fromAccount: BankAccount, transReqId: TransactionRequestId, transactionRequestType: TransactionRequestType, callContext: Option[CallContext]): OBPReturnType[Box[TransactionRequest]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionAfterChallengev300 => InBound, OutBoundCreateTransactionAfterChallengev300 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, fromAccount, transReqId, transactionRequestType) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequest](callContext)) - } - - messageDocs += makePaymentv300Doc - def makePaymentv300Doc = MessageDoc( - process = "obp.makePaymentv300", - messageFormat = messageFormat, - description = "Make Paymentv300", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundMakePaymentv300").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundMakePaymentv300").request), - exampleOutboundMessage = ( - OutBoundMakePaymentv300(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toCounterparty= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=counterpartyNameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=counterpartyOtherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=counterpartyOtherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=counterpartyOtherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=counterpartyOtherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=counterpartyOtherBankRoutingSchemeExample.value, - otherBankRoutingAddress=counterpartyOtherBankRoutingAddressExample.value, - otherBranchRoutingScheme=counterpartyOtherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=counterpartyOtherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value))), - transactionRequestCommonBody= TransactionRequestCommonBodyJSONCommons(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - chargePolicy=chargePolicyExample.value) - ), - exampleInboundMessage = ( - InBoundMakePaymentv300(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=TransactionId(transactionIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def makePaymentv300(initiator: User, fromAccount: BankAccount, toAccount: BankAccount, toCounterparty: CounterpartyTrait, transactionRequestCommonBody: TransactionRequestCommonBodyJSON, transactionRequestType: TransactionRequestType, chargePolicy: String, callContext: Option[CallContext]): Future[Box[(TransactionId, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundMakePaymentv300 => InBound, OutBoundMakePaymentv300 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, fromAccount, toAccount, toCounterparty, transactionRequestCommonBody, transactionRequestType, chargePolicy) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionId](callContext)) - } - - messageDocs += createTransactionRequestv300Doc - def createTransactionRequestv300Doc = MessageDoc( - process = "obp.createTransactionRequestv300", - messageFormat = messageFormat, - description = "Create Transaction Requestv300", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestv300").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTransactionRequestv300").request), - exampleOutboundMessage = ( - OutBoundCreateTransactionRequestv300(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - initiator= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - viewId=ViewId(viewIdExample.value), - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toCounterparty= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=counterpartyNameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=counterpartyOtherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=counterpartyOtherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=counterpartyOtherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=counterpartyOtherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=counterpartyOtherBankRoutingSchemeExample.value, - otherBankRoutingAddress=counterpartyOtherBankRoutingAddressExample.value, - otherBranchRoutingScheme=counterpartyOtherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=counterpartyOtherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value))), - transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), - transactionRequestCommonBody= TransactionRequestCommonBodyJSONCommons(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - detailsPlain="string", - chargePolicy=chargePolicyExample.value) - ), - exampleInboundMessage = ( - InBoundCreateTransactionRequestv300(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTransactionRequestv300(initiator: User, viewId: ViewId, fromAccount: BankAccount, toAccount: BankAccount, toCounterparty: CounterpartyTrait, transactionRequestType: TransactionRequestType, transactionRequestCommonBody: TransactionRequestCommonBodyJSON, detailsPlain: String, chargePolicy: String, callContext: Option[CallContext]): Future[Box[(TransactionRequest, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundCreateTransactionRequestv300 => InBound, OutBoundCreateTransactionRequestv300 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, initiator, viewId, fromAccount, toAccount, toCounterparty, transactionRequestType, transactionRequestCommonBody, detailsPlain, chargePolicy) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionRequest](callContext)) - } - - messageDocs += makePaymentV400Doc - def makePaymentV400Doc = MessageDoc( - process = "obp.makePaymentV400", - messageFormat = messageFormat, - description = "Make Payment V400", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundMakePaymentV400").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundMakePaymentV400").request), - exampleOutboundMessage = ( - OutBoundMakePaymentV400(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionRequest= TransactionRequest(id=TransactionRequestId(transactionRequestIdExample.value), - `type`=transactionRequestTypeExample.value, - from= TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value), - body= TransactionRequestBodyAllTypes(to_sandbox_tan=Some( TransactionRequestAccount(bank_id=bank_idExample.value, - account_id=account_idExample.value)), - to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), - to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), - to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), - to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to=ToAccountTransferToPhone(toExample.value))), - to_transfer_to_atm=Some( TransactionRequestTransferToAtm(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - message=messageExample.value, - from= FromAccountTransfer(mobile_phone_number="string", - nickname=nicknameExample.value), - to= ToAccountTransferToAtm(legal_name="string", - date_of_birth="string", - mobile_phone_number="string", - kyc_document= ToAccountTransferToAtmKycDocument(`type`=typeExample.value, - number=numberExample.value)))), - to_transfer_to_account=Some( TransactionRequestTransferToAccount(value= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value, - transfer_type="string", - future_date="string", - to= ToAccountTransferToAccount(name=nameExample.value, - bank_code="string", - branch_number="string", - account= ToAccountTransferToAccountAccount(number=accountNumberExample.value, - iban=ibanExample.value)))), - to_sepa_credit_transfers=Some( SepaCreditTransfers(debtorAccount=PaymentAccount("string"), - instructedAmount= AmountOfMoneyJsonV121(currency=currencyExample.value, - amount=amountExample.value), - creditorAccount=PaymentAccount("string"), - creditorName="string")), - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value), - description=descriptionExample.value), - transaction_ids="string", - status=statusExample.value, - start_date=toDate(transactionRequestStartDateExample), - end_date=toDate(transactionRequestEndDateExample), - challenge= TransactionRequestChallenge(id=challengeIdExample.value, - allowed_attempts=123, - challenge_type="string"), - charge= TransactionRequestCharge(summary=summaryExample.value, - value= AmountOfMoney(currency=currencyExample.value, - amount=amountExample.value)), - charge_policy="string", - counterparty_id=CounterpartyId(transactionRequestCounterpartyIdExample.value), - name=nameExample.value, - this_bank_id=BankId(bankIdExample.value), - this_account_id=AccountId(accountIdExample.value), - this_view_id=ViewId(viewIdExample.value), - other_account_routing_scheme="string", - other_account_routing_address="string", - other_bank_routing_scheme="string", - other_bank_routing_address="string", - is_beneficiary=true, - future_date=Some("string"), - payment_start_date=Some(toDate(dateExample)), - payment_end_date=Some(toDate(dateExample)), - payment_execution_Rule=Some("string"), - payment_frequency=Some("string"), - payment_day_of_execution=Some("string")), - reasons=Some(List( TransactionRequestReason(code=codeExample.value, - documentNumber=Some(documentNumberExample.value), - amount=Some(amountExample.value), - currency=Some(currencyExample.value), - description=Some(descriptionExample.value))))) - ), - exampleInboundMessage = ( - InBoundMakePaymentV400(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=TransactionId(transactionIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def makePaymentV400(transactionRequest: TransactionRequest, reasons: Option[List[TransactionRequestReason]], callContext: Option[CallContext]): Future[Box[(TransactionId, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundMakePaymentV400 => InBound, OutBoundMakePaymentV400 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequest, reasons) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionId](callContext)) - } - - messageDocs += cancelPaymentV400Doc - def cancelPaymentV400Doc = MessageDoc( - process = "obp.cancelPaymentV400", - messageFormat = messageFormat, - description = "Cancel Payment V400", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCancelPaymentV400").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCancelPaymentV400").request), - exampleOutboundMessage = ( - OutBoundCancelPaymentV400(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionId=TransactionId(transactionIdExample.value)) - ), - exampleInboundMessage = ( - InBoundCancelPaymentV400(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CancelPayment(canBeCancelled=true, - startSca=Some(true))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def cancelPaymentV400(transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[CancelPayment]] = { - import com.openbankproject.commons.dto.{InBoundCancelPaymentV400 => InBound, OutBoundCancelPaymentV400 => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CancelPayment](callContext)) - } - - messageDocs += getTransactionRequestTypeChargesDoc - def getTransactionRequestTypeChargesDoc = MessageDoc( - process = "obp.getTransactionRequestTypeCharges", - messageFormat = messageFormat, - description = "Get Transaction Request Type Charges", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequestTypeCharges").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionRequestTypeCharges").request), - exampleOutboundMessage = ( - OutBoundGetTransactionRequestTypeCharges(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - viewId=ViewId(viewIdExample.value), - transactionRequestTypes=List(TransactionRequestType(transactionRequestTypesExample.value))) - ), - exampleInboundMessage = ( - InBoundGetTransactionRequestTypeCharges(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( TransactionRequestTypeChargeCommons(transactionRequestTypeId="string", - bankId=bankIdExample.value, - chargeCurrency="string", - chargeAmount="string", - chargeSummary="string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionRequestTypeCharges(bankId: BankId, accountId: AccountId, viewId: ViewId, transactionRequestTypes: List[TransactionRequestType], callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionRequestTypeCharge]]] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionRequestTypeCharges => InBound, OutBoundGetTransactionRequestTypeCharges => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, viewId, transactionRequestTypes) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[TransactionRequestTypeChargeCommons]](callContext)) - } - - messageDocs += createCounterpartyDoc - def createCounterpartyDoc = MessageDoc( - process = "obp.createCounterparty", - messageFormat = messageFormat, - description = "Create Counterparty", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateCounterparty").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateCounterparty").request), - exampleOutboundMessage = ( - OutBoundCreateCounterparty(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - createdByUserId=createdByUserIdExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value))) - ), - exampleInboundMessage = ( - InBoundCreateCounterparty(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CounterpartyTraitCommons(createdByUserId=createdByUserIdExample.value, - name=nameExample.value, - description=descriptionExample.value, - currency=currencyExample.value, - thisBankId=thisBankIdExample.value, - thisAccountId=thisAccountIdExample.value, - thisViewId=thisViewIdExample.value, - counterpartyId=counterpartyIdExample.value, - otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, - otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, - otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, - otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value, - otherBankRoutingScheme=otherBankRoutingSchemeExample.value, - otherBankRoutingAddress=otherBankRoutingAddressExample.value, - otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, - otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, - isBeneficiary=isBeneficiaryExample.value.toBoolean, - bespoke=List( CounterpartyBespoke(key=keyExample.value, - value=valueExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createCounterparty(name: String, description: String, currency: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = { - import com.openbankproject.commons.dto.{InBoundCreateCounterparty => InBound, OutBoundCreateCounterparty => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, name, description, currency, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CounterpartyTraitCommons](callContext)) - } - - messageDocs += checkCustomerNumberAvailableDoc - def checkCustomerNumberAvailableDoc = MessageDoc( - process = "obp.checkCustomerNumberAvailable", - messageFormat = messageFormat, - description = "Check Customer Number Available", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCheckCustomerNumberAvailable").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCheckCustomerNumberAvailable").request), - exampleOutboundMessage = ( - OutBoundCheckCustomerNumberAvailable(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - customerNumber=customerNumberExample.value) - ), - exampleInboundMessage = ( - InBoundCheckCustomerNumberAvailable(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def checkCustomerNumberAvailable(bankId: BankId, customerNumber: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundCheckCustomerNumberAvailable => InBound, OutBoundCheckCustomerNumberAvailable => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerNumber) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += createCustomerDoc - def createCustomerDoc = MessageDoc( - process = "obp.createCustomer", - messageFormat = messageFormat, - description = "Create Customer", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateCustomer").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateCustomer").request), - exampleOutboundMessage = ( - OutBoundCreateCustomer(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(outBoundCreateCustomerLastOkDateExample), - creditRating=Some( CreditRating(rating=ratingExample.value, - source=sourceExample.value)), - creditLimit=Some( AmountOfMoney(currency=currencyExample.value, - amount=creditLimitAmountExample.value)), - title=titleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value) - ), - exampleInboundMessage = ( - InBoundCreateCustomer(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createCustomer(bankId: BankId, legalName: String, mobileNumber: String, email: String, faceImage: CustomerFaceImageTrait, dateOfBirth: Date, relationshipStatus: String, dependents: Int, dobOfDependents: List[Date], highestEducationAttained: String, employmentStatus: String, kycStatus: Boolean, lastOkDate: Date, creditRating: Option[CreditRatingTrait], creditLimit: Option[AmountOfMoneyTrait], title: String, branchId: String, nameSuffix: String, callContext: Option[CallContext]): OBPReturnType[Box[Customer]] = { - import com.openbankproject.commons.dto.{InBoundCreateCustomer => InBound, OutBoundCreateCustomer => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, legalName, mobileNumber, email, faceImage, dateOfBirth, relationshipStatus, dependents, dobOfDependents, highestEducationAttained, employmentStatus, kycStatus, lastOkDate, creditRating, creditLimit, title, branchId, nameSuffix) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerCommons](callContext)) - } - - messageDocs += updateCustomerScaDataDoc - def updateCustomerScaDataDoc = MessageDoc( - process = "obp.updateCustomerScaData", - messageFormat = messageFormat, - description = "Update Customer Sca Data", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerScaData").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerScaData").request), - exampleOutboundMessage = ( - OutBoundUpdateCustomerScaData(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value, - mobileNumber=Some(mobileNumberExample.value), - email=Some(emailExample.value), - customerNumber=Some(customerNumberExample.value)) - ), - exampleInboundMessage = ( - InBoundUpdateCustomerScaData(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateCustomerScaData(customerId: String, mobileNumber: Option[String], email: Option[String], customerNumber: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[Customer]] = { - import com.openbankproject.commons.dto.{InBoundUpdateCustomerScaData => InBound, OutBoundUpdateCustomerScaData => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId, mobileNumber, email, customerNumber) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerCommons](callContext)) - } - - messageDocs += updateCustomerCreditDataDoc - def updateCustomerCreditDataDoc = MessageDoc( - process = "obp.updateCustomerCreditData", - messageFormat = messageFormat, - description = "Update Customer Credit Data", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerCreditData").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerCreditData").request), - exampleOutboundMessage = ( - OutBoundUpdateCustomerCreditData(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value, - creditRating=Some(creditRatingExample.value), - creditSource=Some("string"), - creditLimit=Some( AmountOfMoney(currency=currencyExample.value, - amount=creditLimitAmountExample.value))) - ), - exampleInboundMessage = ( - InBoundUpdateCustomerCreditData(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateCustomerCreditData(customerId: String, creditRating: Option[String], creditSource: Option[String], creditLimit: Option[AmountOfMoney], callContext: Option[CallContext]): OBPReturnType[Box[Customer]] = { - import com.openbankproject.commons.dto.{InBoundUpdateCustomerCreditData => InBound, OutBoundUpdateCustomerCreditData => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId, creditRating, creditSource, creditLimit) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerCommons](callContext)) - } - - messageDocs += updateCustomerGeneralDataDoc - def updateCustomerGeneralDataDoc = MessageDoc( - process = "obp.updateCustomerGeneralData", - messageFormat = messageFormat, - description = "Update Customer General Data", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerGeneralData").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerGeneralData").request), - exampleOutboundMessage = ( - OutBoundUpdateCustomerGeneralData(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value, - legalName=Some(legalNameExample.value), - faceImage=Some( CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value)), - dateOfBirth=Some(toDate(dateOfBirthExample)), - relationshipStatus=Some(relationshipStatusExample.value), - dependents=Some(dependentsExample.value.toInt), - highestEducationAttained=Some(highestEducationAttainedExample.value), - employmentStatus=Some(employmentStatusExample.value), - title=Some(titleExample.value), - branchId=Some(branchIdExample.value), - nameSuffix=Some(nameSuffixExample.value)) - ), - exampleInboundMessage = ( - InBoundUpdateCustomerGeneralData(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateCustomerGeneralData(customerId: String, legalName: Option[String], faceImage: Option[CustomerFaceImageTrait], dateOfBirth: Option[Date], relationshipStatus: Option[String], dependents: Option[Int], highestEducationAttained: Option[String], employmentStatus: Option[String], title: Option[String], branchId: Option[String], nameSuffix: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[Customer]] = { - import com.openbankproject.commons.dto.{InBoundUpdateCustomerGeneralData => InBound, OutBoundUpdateCustomerGeneralData => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId, legalName, faceImage, dateOfBirth, relationshipStatus, dependents, highestEducationAttained, employmentStatus, title, branchId, nameSuffix) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerCommons](callContext)) - } - - messageDocs += getCustomersByUserIdDoc - def getCustomersByUserIdDoc = MessageDoc( - process = "obp.getCustomersByUserId", - messageFormat = messageFormat, - description = "Get Customers By User Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomersByUserId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomersByUserId").request), - exampleOutboundMessage = ( - OutBoundGetCustomersByUserId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userId=userIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCustomersByUserId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomersByUserId(userId: String, callContext: Option[CallContext]): Future[Box[(List[Customer], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomersByUserId => InBound, OutBoundGetCustomersByUserId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CustomerCommons]](callContext)) - } - - messageDocs += getCustomerByCustomerIdDoc - def getCustomerByCustomerIdDoc = MessageDoc( - process = "obp.getCustomerByCustomerId", - messageFormat = messageFormat, - description = "Get Customer By Customer Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerByCustomerId").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerByCustomerId").request), - exampleOutboundMessage = ( - OutBoundGetCustomerByCustomerId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCustomerByCustomerId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerByCustomerId(customerId: String, callContext: Option[CallContext]): Future[Box[(Customer, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerByCustomerId => InBound, OutBoundGetCustomerByCustomerId => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerCommons](callContext)) - } - - messageDocs += getCustomerByCustomerNumberDoc - def getCustomerByCustomerNumberDoc = MessageDoc( - process = "obp.getCustomerByCustomerNumber", - messageFormat = messageFormat, - description = "Get Customer By Customer Number", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerByCustomerNumber").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerByCustomerNumber").request), - exampleOutboundMessage = ( - OutBoundGetCustomerByCustomerNumber(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerNumber=customerNumberExample.value, - bankId=BankId(bankIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetCustomerByCustomerNumber(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerByCustomerNumber(customerNumber: String, bankId: BankId, callContext: Option[CallContext]): Future[Box[(Customer, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerByCustomerNumber => InBound, OutBoundGetCustomerByCustomerNumber => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerNumber, bankId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerCommons](callContext)) - } - - messageDocs += getCustomerAddressDoc - def getCustomerAddressDoc = MessageDoc( - process = "obp.getCustomerAddress", - messageFormat = messageFormat, - description = "Get Customer Address", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAddress").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAddress").request), - exampleOutboundMessage = ( - OutBoundGetCustomerAddress(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCustomerAddress(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CustomerAddressCommons(customerId=customerIdExample.value, - customerAddressId=customerAddressIdExample.value, - line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=countyExample.value, - state=stateExample.value, - postcode=postcodeExample.value, - countryCode=countryCodeExample.value, - status=statusExample.value, - tags=tagsExample.value, - insertDate=toDate(insertDateExample)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerAddress(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[CustomerAddress]]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerAddress => InBound, OutBoundGetCustomerAddress => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CustomerAddressCommons]](callContext)) - } - - messageDocs += createCustomerAddressDoc - def createCustomerAddressDoc = MessageDoc( - process = "obp.createCustomerAddress", - messageFormat = messageFormat, - description = "Create Customer Address", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateCustomerAddress").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateCustomerAddress").request), - exampleOutboundMessage = ( - OutBoundCreateCustomerAddress(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value, - line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=countyExample.value, - state=stateExample.value, - postcode=postcodeExample.value, - countryCode=countryCodeExample.value, - tags=tagsExample.value, - status=statusExample.value) - ), - exampleInboundMessage = ( - InBoundCreateCustomerAddress(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerAddressCommons(customerId=customerIdExample.value, - customerAddressId=customerAddressIdExample.value, - line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=countyExample.value, - state=stateExample.value, - postcode=postcodeExample.value, - countryCode=countryCodeExample.value, - status=statusExample.value, - tags=tagsExample.value, - insertDate=toDate(insertDateExample))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createCustomerAddress(customerId: String, line1: String, line2: String, line3: String, city: String, county: String, state: String, postcode: String, countryCode: String, tags: String, status: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAddress]] = { - import com.openbankproject.commons.dto.{InBoundCreateCustomerAddress => InBound, OutBoundCreateCustomerAddress => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId, line1, line2, line3, city, county, state, postcode, countryCode, tags, status) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerAddressCommons](callContext)) - } - - messageDocs += updateCustomerAddressDoc - def updateCustomerAddressDoc = MessageDoc( - process = "obp.updateCustomerAddress", - messageFormat = messageFormat, - description = "Update Customer Address", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerAddress").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateCustomerAddress").request), - exampleOutboundMessage = ( - OutBoundUpdateCustomerAddress(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerAddressId=customerAddressIdExample.value, - line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=countyExample.value, - state=stateExample.value, - postcode=postcodeExample.value, - countryCode=countryCodeExample.value, - tags=tagsExample.value, - status=statusExample.value) - ), - exampleInboundMessage = ( - InBoundUpdateCustomerAddress(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerAddressCommons(customerId=customerIdExample.value, - customerAddressId=customerAddressIdExample.value, - line1=line1Example.value, - line2=line2Example.value, - line3=line3Example.value, - city=cityExample.value, - county=countyExample.value, - state=stateExample.value, - postcode=postcodeExample.value, - countryCode=countryCodeExample.value, - status=statusExample.value, - tags=tagsExample.value, - insertDate=toDate(insertDateExample))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateCustomerAddress(customerAddressId: String, line1: String, line2: String, line3: String, city: String, county: String, state: String, postcode: String, countryCode: String, tags: String, status: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAddress]] = { - import com.openbankproject.commons.dto.{InBoundUpdateCustomerAddress => InBound, OutBoundUpdateCustomerAddress => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerAddressId, line1, line2, line3, city, county, state, postcode, countryCode, tags, status) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerAddressCommons](callContext)) - } - - messageDocs += deleteCustomerAddressDoc - def deleteCustomerAddressDoc = MessageDoc( - process = "obp.deleteCustomerAddress", - messageFormat = messageFormat, - description = "Delete Customer Address", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteCustomerAddress").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteCustomerAddress").request), - exampleOutboundMessage = ( - OutBoundDeleteCustomerAddress(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerAddressId=customerAddressIdExample.value) - ), - exampleInboundMessage = ( - InBoundDeleteCustomerAddress(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deleteCustomerAddress(customerAddressId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeleteCustomerAddress => InBound, OutBoundDeleteCustomerAddress => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerAddressId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += createTaxResidenceDoc - def createTaxResidenceDoc = MessageDoc( - process = "obp.createTaxResidence", - messageFormat = messageFormat, - description = "Create Tax Residence", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTaxResidence").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateTaxResidence").request), - exampleOutboundMessage = ( - OutBoundCreateTaxResidence(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value, - domain=domainExample.value, - taxNumber=taxNumberExample.value) - ), - exampleInboundMessage = ( - InBoundCreateTaxResidence(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TaxResidenceCommons(customerId=customerIdExample.value, - taxResidenceId=taxResidenceIdExample.value, - domain=domainExample.value, - taxNumber=taxNumberExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createTaxResidence(customerId: String, domain: String, taxNumber: String, callContext: Option[CallContext]): OBPReturnType[Box[TaxResidence]] = { - import com.openbankproject.commons.dto.{InBoundCreateTaxResidence => InBound, OutBoundCreateTaxResidence => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId, domain, taxNumber) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TaxResidenceCommons](callContext)) - } - - messageDocs += getTaxResidenceDoc - def getTaxResidenceDoc = MessageDoc( - process = "obp.getTaxResidence", - messageFormat = messageFormat, - description = "Get Tax Residence", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTaxResidence").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTaxResidence").request), - exampleOutboundMessage = ( - OutBoundGetTaxResidence(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetTaxResidence(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( TaxResidenceCommons(customerId=customerIdExample.value, - taxResidenceId=taxResidenceIdExample.value, - domain=domainExample.value, - taxNumber=taxNumberExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTaxResidence(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[TaxResidence]]] = { - import com.openbankproject.commons.dto.{InBoundGetTaxResidence => InBound, OutBoundGetTaxResidence => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[TaxResidenceCommons]](callContext)) - } - - messageDocs += deleteTaxResidenceDoc - def deleteTaxResidenceDoc = MessageDoc( - process = "obp.deleteTaxResidence", - messageFormat = messageFormat, - description = "Delete Tax Residence", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteTaxResidence").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteTaxResidence").request), - exampleOutboundMessage = ( - OutBoundDeleteTaxResidence(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - taxResourceId="string") - ), - exampleInboundMessage = ( - InBoundDeleteTaxResidence(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deleteTaxResidence(taxResourceId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeleteTaxResidence => InBound, OutBoundDeleteTaxResidence => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, taxResourceId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += getCustomersDoc - def getCustomersDoc = MessageDoc( - process = "obp.getCustomers", - messageFormat = messageFormat, - description = "Get Customers", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomers").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomers").request), - exampleOutboundMessage = ( - OutBoundGetCustomers(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - limit=limitExample.value.toInt, - offset=offsetExample.value.toInt, - fromDate=fromDateExample.value, - toDate=toDateExample.value) - ), - exampleInboundMessage = ( - InBoundGetCustomers(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomers(bankId: BankId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]): Future[Box[List[Customer]]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomers => InBound, OutBoundGetCustomers => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, OBPQueryParam.getLimit(queryParams), OBPQueryParam.getOffset(queryParams), OBPQueryParam.getFromDate(queryParams), OBPQueryParam.getToDate(queryParams)) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CustomerCommons]](callContext)) - } - - messageDocs += getCustomersByCustomerPhoneNumberDoc - def getCustomersByCustomerPhoneNumberDoc = MessageDoc( - process = "obp.getCustomersByCustomerPhoneNumber", - messageFormat = messageFormat, - description = "Get Customers By Customer Phone Number", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomersByCustomerPhoneNumber").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomersByCustomerPhoneNumber").request), - exampleOutboundMessage = ( - OutBoundGetCustomersByCustomerPhoneNumber(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - phoneNumber=phoneNumberExample.value) - ), - exampleInboundMessage = ( - InBoundGetCustomersByCustomerPhoneNumber(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomersByCustomerPhoneNumber(bankId: BankId, phoneNumber: String, callContext: Option[CallContext]): OBPReturnType[Box[List[Customer]]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomersByCustomerPhoneNumber => InBound, OutBoundGetCustomersByCustomerPhoneNumber => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, phoneNumber) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CustomerCommons]](callContext)) - } - - messageDocs += getCheckbookOrdersDoc - def getCheckbookOrdersDoc = MessageDoc( - process = "obp.getCheckbookOrders", - messageFormat = messageFormat, - description = "Get Checkbook Orders", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCheckbookOrders").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCheckbookOrders").request), - exampleOutboundMessage = ( - OutBoundGetCheckbookOrders(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - accountId=accountIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCheckbookOrders(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CheckbookOrdersJson(account= AccountV310Json(bank_id=bank_idExample.value, - account_id=account_idExample.value, - account_type="string", - account_routings=List( AccountRoutingJsonV121(scheme=schemeExample.value, - address=addressExample.value)), - branch_routings=List( BranchRoutingJsonV141(scheme=schemeExample.value, - address=addressExample.value))), - orders=List(OrderJson( OrderObjectJson(order_id="string", - order_date="string", - number_of_checkbooks="string", - distribution_channel="string", - status=statusExample.value, - first_check_number="string", - shipping_code="string"))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCheckbookOrders(bankId: String, accountId: String, callContext: Option[CallContext]): Future[Box[(CheckbookOrdersJson, Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetCheckbookOrders => InBound, OutBoundGetCheckbookOrders => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CheckbookOrdersJson](callContext)) - } - - messageDocs += getStatusOfCreditCardOrderDoc - def getStatusOfCreditCardOrderDoc = MessageDoc( - process = "obp.getStatusOfCreditCardOrder", - messageFormat = messageFormat, - description = "Get Status Of Credit Card Order", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetStatusOfCreditCardOrder").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetStatusOfCreditCardOrder").request), - exampleOutboundMessage = ( - OutBoundGetStatusOfCreditCardOrder(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - accountId=accountIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetStatusOfCreditCardOrder(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CardObjectJson(card_type="string", - card_description="string", - use_type="string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getStatusOfCreditCardOrder(bankId: String, accountId: String, callContext: Option[CallContext]): Future[Box[(List[CardObjectJson], Option[CallContext])]] = { - import com.openbankproject.commons.dto.{InBoundGetStatusOfCreditCardOrder => InBound, OutBoundGetStatusOfCreditCardOrder => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CardObjectJson]](callContext)) - } - - messageDocs += createUserAuthContextDoc - def createUserAuthContextDoc = MessageDoc( - process = "obp.createUserAuthContext", - messageFormat = messageFormat, - description = "Create User Auth Context", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateUserAuthContext").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateUserAuthContext").request), - exampleOutboundMessage = ( - OutBoundCreateUserAuthContext(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userId=userIdExample.value, - key=keyExample.value, - value=valueExample.value) - ), - exampleInboundMessage = ( - InBoundCreateUserAuthContext(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= UserAuthContextCommons(userAuthContextId=userAuthContextIdExample.value, - userId=userIdExample.value, - key=keyExample.value, - value=valueExample.value, - timeStamp=toDate(timeStampExample), - consumerId=consumerIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createUserAuthContext(userId: String, key: String, value: String, callContext: Option[CallContext]): OBPReturnType[Box[UserAuthContext]] = { - import com.openbankproject.commons.dto.{InBoundCreateUserAuthContext => InBound, OutBoundCreateUserAuthContext => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userId, key, value) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[UserAuthContextCommons](callContext)) - } - - messageDocs += createUserAuthContextUpdateDoc - def createUserAuthContextUpdateDoc = MessageDoc( - process = "obp.createUserAuthContextUpdate", - messageFormat = messageFormat, - description = "Create User Auth Context Update", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateUserAuthContextUpdate").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateUserAuthContextUpdate").request), - exampleOutboundMessage = ( - OutBoundCreateUserAuthContextUpdate(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userId=userIdExample.value, - key=keyExample.value, - value=valueExample.value) - ), - exampleInboundMessage = ( - InBoundCreateUserAuthContextUpdate(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= UserAuthContextUpdateCommons(userAuthContextUpdateId=userAuthContextUpdateIdExample.value, - userId=userIdExample.value, - key=keyExample.value, - value=valueExample.value, - challenge=challengeExample.value, - status=statusExample.value, - consumerId=consumerIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createUserAuthContextUpdate(userId: String, key: String, value: String, callContext: Option[CallContext]): OBPReturnType[Box[UserAuthContextUpdate]] = { - import com.openbankproject.commons.dto.{InBoundCreateUserAuthContextUpdate => InBound, OutBoundCreateUserAuthContextUpdate => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userId, key, value) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[UserAuthContextUpdateCommons](callContext)) - } - - messageDocs += deleteUserAuthContextsDoc - def deleteUserAuthContextsDoc = MessageDoc( - process = "obp.deleteUserAuthContexts", - messageFormat = messageFormat, - description = "Delete User Auth Contexts", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteUserAuthContexts").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteUserAuthContexts").request), - exampleOutboundMessage = ( - OutBoundDeleteUserAuthContexts(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userId=userIdExample.value) - ), - exampleInboundMessage = ( - InBoundDeleteUserAuthContexts(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deleteUserAuthContexts(userId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeleteUserAuthContexts => InBound, OutBoundDeleteUserAuthContexts => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += deleteUserAuthContextByIdDoc - def deleteUserAuthContextByIdDoc = MessageDoc( - process = "obp.deleteUserAuthContextById", - messageFormat = messageFormat, - description = "Delete User Auth Context By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteUserAuthContextById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteUserAuthContextById").request), - exampleOutboundMessage = ( - OutBoundDeleteUserAuthContextById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userAuthContextId=userAuthContextIdExample.value) - ), - exampleInboundMessage = ( - InBoundDeleteUserAuthContextById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deleteUserAuthContextById(userAuthContextId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeleteUserAuthContextById => InBound, OutBoundDeleteUserAuthContextById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userAuthContextId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += getUserAuthContextsDoc - def getUserAuthContextsDoc = MessageDoc( - process = "obp.getUserAuthContexts", - messageFormat = messageFormat, - description = "Get User Auth Contexts", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetUserAuthContexts").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetUserAuthContexts").request), - exampleOutboundMessage = ( - OutBoundGetUserAuthContexts(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userId=userIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetUserAuthContexts(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( UserAuthContextCommons(userAuthContextId=userAuthContextIdExample.value, - userId=userIdExample.value, - key=keyExample.value, - value=valueExample.value, - timeStamp=toDate(timeStampExample), - consumerId=consumerIdExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getUserAuthContexts(userId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[UserAuthContext]]] = { - import com.openbankproject.commons.dto.{InBoundGetUserAuthContexts => InBound, OutBoundGetUserAuthContexts => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[UserAuthContextCommons]](callContext)) - } - - messageDocs += createOrUpdateProductAttributeDoc - def createOrUpdateProductAttributeDoc = MessageDoc( - process = "obp.createOrUpdateProductAttribute", - messageFormat = messageFormat, - description = "Create Or Update Product Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateProductAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateProductAttribute").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateProductAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=Some(productAttributeIdExample.value), - name=nameExample.value, - productAttributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, - value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean)) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateProductAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ProductAttributeCommons(bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=productAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, - value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateProductAttribute(bankId: BankId, productCode: ProductCode, productAttributeId: Option[String], name: String, productAttributeType: ProductAttributeType.Value, value: String, isActive: Option[Boolean], callContext: Option[CallContext]): OBPReturnType[Box[ProductAttribute]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateProductAttribute => InBound, OutBoundCreateOrUpdateProductAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, productCode, productAttributeId, name, productAttributeType, value, isActive) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ProductAttributeCommons](callContext)) - } - - messageDocs += getProductAttributeByIdDoc - def getProductAttributeByIdDoc = MessageDoc( - process = "obp.getProductAttributeById", - messageFormat = messageFormat, - description = "Get Product Attribute By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductAttributeById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductAttributeById").request), - exampleOutboundMessage = ( - OutBoundGetProductAttributeById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - productAttributeId=productAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetProductAttributeById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= ProductAttributeCommons(bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=productAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, - value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProductAttributeById(productAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[ProductAttribute]] = { - import com.openbankproject.commons.dto.{InBoundGetProductAttributeById => InBound, OutBoundGetProductAttributeById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, productAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[ProductAttributeCommons](callContext)) - } - - messageDocs += getProductAttributesByBankAndCodeDoc - def getProductAttributesByBankAndCodeDoc = MessageDoc( - process = "obp.getProductAttributesByBankAndCode", - messageFormat = messageFormat, - description = "Get Product Attributes By Bank And Code", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductAttributesByBankAndCode").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductAttributesByBankAndCode").request), - exampleOutboundMessage = ( - OutBoundGetProductAttributesByBankAndCode(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bank=BankId(bankExample.value), - productCode=ProductCode(productCodeExample.value)) - ), - exampleInboundMessage = ( - InBoundGetProductAttributesByBankAndCode(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductAttributeCommons(bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=productAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, - value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProductAttributesByBankAndCode(bank: BankId, productCode: ProductCode, callContext: Option[CallContext]): OBPReturnType[Box[List[ProductAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundGetProductAttributesByBankAndCode => InBound, OutBoundGetProductAttributesByBankAndCode => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bank, productCode) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductAttributeCommons]](callContext)) - } - - messageDocs += deleteProductAttributeDoc - def deleteProductAttributeDoc = MessageDoc( - process = "obp.deleteProductAttribute", - messageFormat = messageFormat, - description = "Delete Product Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteProductAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteProductAttribute").request), - exampleOutboundMessage = ( - OutBoundDeleteProductAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - productAttributeId=productAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundDeleteProductAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deleteProductAttribute(productAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeleteProductAttribute => InBound, OutBoundDeleteProductAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, productAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - - messageDocs += getAccountAttributeByIdDoc - def getAccountAttributeByIdDoc = MessageDoc( - process = "obp.getAccountAttributeById", - messageFormat = messageFormat, - description = "Get Account Attribute By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAccountAttributeById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAccountAttributeById").request), - exampleOutboundMessage = ( - OutBoundGetAccountAttributeById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - accountAttributeId=accountAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetAccountAttributeById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountAttributeCommons(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - productCode=ProductCode(productCodeExample.value), - accountAttributeId=accountAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value, - productInstanceCode=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAccountAttributeById(accountAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[AccountAttribute]] = { - import com.openbankproject.commons.dto.{InBoundGetAccountAttributeById => InBound, OutBoundGetAccountAttributeById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, accountAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountAttributeCommons](callContext)) - } - - messageDocs += getTransactionAttributeByIdDoc - def getTransactionAttributeByIdDoc = MessageDoc( - process = "obp.getTransactionAttributeById", - messageFormat = messageFormat, - description = "Get Transaction Attribute By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionAttributeById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionAttributeById").request), - exampleOutboundMessage = ( - OutBoundGetTransactionAttributeById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - transactionAttributeId=transactionAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetTransactionAttributeById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionAttributeCommons(bankId=BankId(bankIdExample.value), - transactionId=TransactionId(transactionIdExample.value), - transactionAttributeId=transactionAttributeIdExample.value, - attributeType=com.openbankproject.commons.model.enums.TransactionAttributeType.example, - name=transactionAttributeNameExample.value, - value=transactionAttributeValueExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionAttributeById(transactionAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[TransactionAttribute]] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionAttributeById => InBound, OutBoundGetTransactionAttributeById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionAttributeCommons](callContext)) - } - - messageDocs += createOrUpdateAccountAttributeDoc - def createOrUpdateAccountAttributeDoc = MessageDoc( - process = "obp.createOrUpdateAccountAttribute", - messageFormat = messageFormat, - description = "Create Or Update Account Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateAccountAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateAccountAttribute").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateAccountAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=Some(productAttributeIdExample.value), - name=nameExample.value, - accountAttributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value, - productInstanceCode=Some("string")) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateAccountAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountAttributeCommons(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - productCode=ProductCode(productCodeExample.value), - accountAttributeId=accountAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value, - productInstanceCode=Some("string"))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateAccountAttribute(bankId: BankId, accountId: AccountId, productCode: ProductCode, productAttributeId: Option[String], name: String, accountAttributeType: AccountAttributeType.Value, value: String, productInstanceCode: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[AccountAttribute]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateAccountAttribute => InBound, OutBoundCreateOrUpdateAccountAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, productCode, productAttributeId, name, accountAttributeType, value, productInstanceCode) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountAttributeCommons](callContext)) - } - - messageDocs += createOrUpdateCustomerAttributeDoc - def createOrUpdateCustomerAttributeDoc = MessageDoc( - process = "obp.createOrUpdateCustomerAttribute", - messageFormat = messageFormat, - description = "Create Or Update Customer Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateCustomerAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateCustomerAttribute").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateCustomerAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - customerId=CustomerId(customerIdExample.value), - customerAttributeId=Some(customerAttributeIdExample.value), - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.CustomerAttributeType.example, - value=valueExample.value) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateCustomerAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerAttributeCommons(bankId=BankId(bankIdExample.value), - customerId=CustomerId(customerIdExample.value), - customerAttributeId=customerAttributeIdExample.value, - attributeType=com.openbankproject.commons.model.enums.CustomerAttributeType.example, - name=customerAttributeNameExample.value, - value=customerAttributeValueExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateCustomerAttribute(bankId: BankId, customerId: CustomerId, customerAttributeId: Option[String], name: String, attributeType: CustomerAttributeType.Value, value: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAttribute]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateCustomerAttribute => InBound, OutBoundCreateOrUpdateCustomerAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerId, customerAttributeId, name, attributeType, value) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerAttributeCommons](callContext)) - } - - messageDocs += createOrUpdateTransactionAttributeDoc - def createOrUpdateTransactionAttributeDoc = MessageDoc( - process = "obp.createOrUpdateTransactionAttribute", - messageFormat = messageFormat, - description = "Create Or Update Transaction Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateTransactionAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateTransactionAttribute").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateTransactionAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - transactionId=TransactionId(transactionIdExample.value), - transactionAttributeId=Some(transactionAttributeIdExample.value), - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.TransactionAttributeType.example, - value=valueExample.value) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateTransactionAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= TransactionAttributeCommons(bankId=BankId(bankIdExample.value), - transactionId=TransactionId(transactionIdExample.value), - transactionAttributeId=transactionAttributeIdExample.value, - attributeType=com.openbankproject.commons.model.enums.TransactionAttributeType.example, - name=transactionAttributeNameExample.value, - value=transactionAttributeValueExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateTransactionAttribute(bankId: BankId, transactionId: TransactionId, transactionAttributeId: Option[String], name: String, attributeType: TransactionAttributeType.Value, value: String, callContext: Option[CallContext]): OBPReturnType[Box[TransactionAttribute]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateTransactionAttribute => InBound, OutBoundCreateOrUpdateTransactionAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, transactionId, transactionAttributeId, name, attributeType, value) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionAttributeCommons](callContext)) - } - - messageDocs += createAccountAttributesDoc - def createAccountAttributesDoc = MessageDoc( - process = "obp.createAccountAttributes", - messageFormat = messageFormat, - description = "Create Account Attributes", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateAccountAttributes").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateAccountAttributes").request), - exampleOutboundMessage = ( - OutBoundCreateAccountAttributes(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - productCode=ProductCode(productCodeExample.value), - accountAttributes=List( ProductAttributeCommons(bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=productAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, - value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean))), - productInstanceCode=Some("string")) - ), - exampleInboundMessage = ( - InBoundCreateAccountAttributes(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( AccountAttributeCommons(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - productCode=ProductCode(productCodeExample.value), - accountAttributeId=accountAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value, - productInstanceCode=Some("string")))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createAccountAttributes(bankId: BankId, accountId: AccountId, productCode: ProductCode, accountAttributes: List[ProductAttribute], productInstanceCode: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[AccountAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundCreateAccountAttributes => InBound, OutBoundCreateAccountAttributes => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, productCode, accountAttributes, productInstanceCode) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[AccountAttributeCommons]](callContext)) - } - - messageDocs += getAccountAttributesByAccountDoc - def getAccountAttributesByAccountDoc = MessageDoc( - process = "obp.getAccountAttributesByAccount", - messageFormat = messageFormat, - description = "Get Account Attributes By Account", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAccountAttributesByAccount").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAccountAttributesByAccount").request), - exampleOutboundMessage = ( - OutBoundGetAccountAttributesByAccount(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetAccountAttributesByAccount(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( AccountAttributeCommons(bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - productCode=ProductCode(productCodeExample.value), - accountAttributeId=accountAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value, - productInstanceCode=Some("string")))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAccountAttributesByAccount(bankId: BankId, accountId: AccountId, callContext: Option[CallContext]): OBPReturnType[Box[List[AccountAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundGetAccountAttributesByAccount => InBound, OutBoundGetAccountAttributesByAccount => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[AccountAttributeCommons]](callContext)) - } - - messageDocs += getCustomerAttributesDoc - def getCustomerAttributesDoc = MessageDoc( - process = "obp.getCustomerAttributes", - messageFormat = messageFormat, - description = "Get Customer Attributes", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAttributes").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAttributes").request), - exampleOutboundMessage = ( - OutBoundGetCustomerAttributes(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - customerId=CustomerId(customerIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetCustomerAttributes(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CustomerAttributeCommons(bankId=BankId(bankIdExample.value), - customerId=CustomerId(customerIdExample.value), - customerAttributeId=customerAttributeIdExample.value, - attributeType=com.openbankproject.commons.model.enums.CustomerAttributeType.example, - name=customerAttributeNameExample.value, - value=customerAttributeValueExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerAttributes(bankId: BankId, customerId: CustomerId, callContext: Option[CallContext]): OBPReturnType[Box[List[CustomerAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerAttributes => InBound, OutBoundGetCustomerAttributes => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CustomerAttributeCommons]](callContext)) - } - - messageDocs += getCustomerIdsByAttributeNameValuesDoc - def getCustomerIdsByAttributeNameValuesDoc = MessageDoc( - process = "obp.getCustomerIdsByAttributeNameValues", - messageFormat = messageFormat, - description = "Get Customer Ids By Attribute Name Values", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerIdsByAttributeNameValues").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerIdsByAttributeNameValues").request), - exampleOutboundMessage = ( - OutBoundGetCustomerIdsByAttributeNameValues(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - nameValues=Map("some_name" -> List("name1", "name2"))) - ), - exampleInboundMessage = ( - InBoundGetCustomerIdsByAttributeNameValues(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=listExample.value.replace("[","").replace("]","").split(",").toList) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerIdsByAttributeNameValues(bankId: BankId, nameValues: Map[String,List[String]], callContext: Option[CallContext]): OBPReturnType[Box[List[String]]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerIdsByAttributeNameValues => InBound, OutBoundGetCustomerIdsByAttributeNameValues => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, nameValues) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[String]](callContext)) - } - - messageDocs += getCustomerAttributesForCustomersDoc - def getCustomerAttributesForCustomersDoc = MessageDoc( - process = "obp.getCustomerAttributesForCustomers", - messageFormat = messageFormat, - description = "Get Customer Attributes For Customers", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAttributesForCustomers").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAttributesForCustomers").request), - exampleOutboundMessage = ( - OutBoundGetCustomerAttributesForCustomers(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customers=List( CustomerCommons(customerId=customerIdExample.value, - bankId=bankIdExample.value, - number=customerNumberExample.value, - legalName=legalNameExample.value, - mobileNumber=mobileNumberExample.value, - email=emailExample.value, - faceImage= CustomerFaceImage(date=toDate(customerFaceImageDateExample), - url=urlExample.value), - dateOfBirth=toDate(dateOfBirthExample), - relationshipStatus=relationshipStatusExample.value, - dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.replace("[","").replace("]","").split(",").map(parseDate).flatMap(_.toSeq).toList, - highestEducationAttained=highestEducationAttainedExample.value, - employmentStatus=employmentStatusExample.value, - creditRating= CreditRating(rating=ratingExample.value, - source=sourceExample.value), - creditLimit= CreditLimit(currency=currencyExample.value, - amount=creditLimitAmountExample.value), - kycStatus=kycStatusExample.value.toBoolean, - lastOkDate=toDate(customerLastOkDateExample), - title=customerTitleExample.value, - branchId=branchIdExample.value, - nameSuffix=nameSuffixExample.value))) - ), - exampleInboundMessage = ( - InBoundGetCustomerAttributesForCustomers(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= List( - CustomerAndAttribute( - MessageDocsSwaggerDefinitions.customerCommons, - List(MessageDocsSwaggerDefinitions.customerAttribute) - ) - ) - ) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerAttributesForCustomers(customers: List[Customer], callContext: Option[CallContext]): OBPReturnType[Box[List[CustomerAndAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerAttributesForCustomers => InBound, OutBoundGetCustomerAttributesForCustomers => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customers) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CustomerAndAttribute]](callContext)) - } - - messageDocs += getTransactionIdsByAttributeNameValuesDoc - def getTransactionIdsByAttributeNameValuesDoc = MessageDoc( - process = "obp.getTransactionIdsByAttributeNameValues", - messageFormat = messageFormat, - description = "Get Transaction Ids By Attribute Name Values", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionIdsByAttributeNameValues").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionIdsByAttributeNameValues").request), - exampleOutboundMessage = ( - OutBoundGetTransactionIdsByAttributeNameValues(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - nameValues=Map("some_name" -> List("name1", "name2"))) - ), - exampleInboundMessage = ( - InBoundGetTransactionIdsByAttributeNameValues(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=listExample.value.replace("[","").replace("]","").split(",").toList) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionIdsByAttributeNameValues(bankId: BankId, nameValues: Map[String,List[String]], callContext: Option[CallContext]): OBPReturnType[Box[List[String]]] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionIdsByAttributeNameValues => InBound, OutBoundGetTransactionIdsByAttributeNameValues => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, nameValues) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[String]](callContext)) - } - - messageDocs += getTransactionAttributesDoc - def getTransactionAttributesDoc = MessageDoc( - process = "obp.getTransactionAttributes", - messageFormat = messageFormat, - description = "Get Transaction Attributes", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionAttributes").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetTransactionAttributes").request), - exampleOutboundMessage = ( - OutBoundGetTransactionAttributes(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - transactionId=TransactionId(transactionIdExample.value)) - ), - exampleInboundMessage = ( - InBoundGetTransactionAttributes(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( TransactionAttributeCommons(bankId=BankId(bankIdExample.value), - transactionId=TransactionId(transactionIdExample.value), - transactionAttributeId=transactionAttributeIdExample.value, - attributeType=com.openbankproject.commons.model.enums.TransactionAttributeType.example, - name=transactionAttributeNameExample.value, - value=transactionAttributeValueExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getTransactionAttributes(bankId: BankId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[List[TransactionAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundGetTransactionAttributes => InBound, OutBoundGetTransactionAttributes => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, transactionId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[TransactionAttributeCommons]](callContext)) - } - - messageDocs += getCustomerAttributeByIdDoc - def getCustomerAttributeByIdDoc = MessageDoc( - process = "obp.getCustomerAttributeById", - messageFormat = messageFormat, - description = "Get Customer Attribute By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAttributeById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCustomerAttributeById").request), - exampleOutboundMessage = ( - OutBoundGetCustomerAttributeById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerAttributeId=customerAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCustomerAttributeById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerAttributeCommons(bankId=BankId(bankIdExample.value), - customerId=CustomerId(customerIdExample.value), - customerAttributeId=customerAttributeIdExample.value, - attributeType=com.openbankproject.commons.model.enums.CustomerAttributeType.example, - name=customerAttributeNameExample.value, - value=customerAttributeValueExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCustomerAttributeById(customerAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAttribute]] = { - import com.openbankproject.commons.dto.{InBoundGetCustomerAttributeById => InBound, OutBoundGetCustomerAttributeById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerAttributeCommons](callContext)) - } - - messageDocs += createOrUpdateCardAttributeDoc - def createOrUpdateCardAttributeDoc = MessageDoc( - process = "obp.createOrUpdateCardAttribute", - messageFormat = messageFormat, - description = "Create Or Update Card Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateCardAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateCardAttribute").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateCardAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=Some(BankId(bankIdExample.value)), - cardId=Some(cardIdExample.value), - cardAttributeId=Some(cardAttributeIdExample.value), - name=nameExample.value, - cardAttributeType=com.openbankproject.commons.model.enums.CardAttributeType.example, - value=valueExample.value) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateCardAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CardAttributeCommons(bankId=Some(BankId(bankIdExample.value)), - cardId=Some(cardIdExample.value), - cardAttributeId=Some(cardAttributeIdExample.value), - name=cardAttributeNameExample.value, - attributeType=com.openbankproject.commons.model.enums.CardAttributeType.example, - value=cardAttributeValueExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateCardAttribute(bankId: Option[BankId], cardId: Option[String], cardAttributeId: Option[String], name: String, cardAttributeType: CardAttributeType.Value, value: String, callContext: Option[CallContext]): OBPReturnType[Box[CardAttribute]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateCardAttribute => InBound, OutBoundCreateOrUpdateCardAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, cardId, cardAttributeId, name, cardAttributeType, value) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CardAttributeCommons](callContext)) - } - - messageDocs += getCardAttributeByIdDoc - def getCardAttributeByIdDoc = MessageDoc( - process = "obp.getCardAttributeById", - messageFormat = messageFormat, - description = "Get Card Attribute By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCardAttributeById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCardAttributeById").request), - exampleOutboundMessage = ( - OutBoundGetCardAttributeById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - cardAttributeId=cardAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCardAttributeById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CardAttributeCommons(bankId=Some(BankId(bankIdExample.value)), - cardId=Some(cardIdExample.value), - cardAttributeId=Some(cardAttributeIdExample.value), - name=cardAttributeNameExample.value, - attributeType=com.openbankproject.commons.model.enums.CardAttributeType.example, - value=cardAttributeValueExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCardAttributeById(cardAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[CardAttribute]] = { - import com.openbankproject.commons.dto.{InBoundGetCardAttributeById => InBound, OutBoundGetCardAttributeById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CardAttributeCommons](callContext)) - } - - messageDocs += getCardAttributesFromProviderDoc - def getCardAttributesFromProviderDoc = MessageDoc( - process = "obp.getCardAttributesFromProvider", - messageFormat = messageFormat, - description = "Get Card Attributes From Provider", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCardAttributesFromProvider").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetCardAttributesFromProvider").request), - exampleOutboundMessage = ( - OutBoundGetCardAttributesFromProvider(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - cardId=cardIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetCardAttributesFromProvider(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( CardAttributeCommons(bankId=Some(BankId(bankIdExample.value)), - cardId=Some(cardIdExample.value), - cardAttributeId=Some(cardAttributeIdExample.value), - name=cardAttributeNameExample.value, - attributeType=com.openbankproject.commons.model.enums.CardAttributeType.example, - value=cardAttributeValueExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getCardAttributesFromProvider(cardId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[CardAttribute]]] = { - import com.openbankproject.commons.dto.{InBoundGetCardAttributesFromProvider => InBound, OutBoundGetCardAttributesFromProvider => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[CardAttributeCommons]](callContext)) - } - - messageDocs += createAccountApplicationDoc - def createAccountApplicationDoc = MessageDoc( - process = "obp.createAccountApplication", - messageFormat = messageFormat, - description = "Create Account Application", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateAccountApplication").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateAccountApplication").request), - exampleOutboundMessage = ( - OutBoundCreateAccountApplication(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - productCode=ProductCode(productCodeExample.value), - userId=Some(userIdExample.value), - customerId=Some(customerIdExample.value)) - ), - exampleInboundMessage = ( - InBoundCreateAccountApplication(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountApplicationCommons(accountApplicationId=accountApplicationIdExample.value, - productCode=ProductCode(productCodeExample.value), - userId=userIdExample.value, - customerId=customerIdExample.value, - dateOfApplication=toDate(dateOfApplicationExample), - status=statusExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createAccountApplication(productCode: ProductCode, userId: Option[String], customerId: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[AccountApplication]] = { - import com.openbankproject.commons.dto.{InBoundCreateAccountApplication => InBound, OutBoundCreateAccountApplication => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, productCode, userId, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountApplicationCommons](callContext)) - } - - messageDocs += getAllAccountApplicationDoc - def getAllAccountApplicationDoc = MessageDoc( - process = "obp.getAllAccountApplication", - messageFormat = messageFormat, - description = "Get All Account Application", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAllAccountApplication").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAllAccountApplication").request), - exampleOutboundMessage = ( - OutBoundGetAllAccountApplication(MessageDocsSwaggerDefinitions.outboundAdapterCallContext) - ), - exampleInboundMessage = ( - InBoundGetAllAccountApplication(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( AccountApplicationCommons(accountApplicationId=accountApplicationIdExample.value, - productCode=ProductCode(productCodeExample.value), - userId=userIdExample.value, - customerId=customerIdExample.value, - dateOfApplication=toDate(dateOfApplicationExample), - status=statusExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAllAccountApplication(callContext: Option[CallContext]): OBPReturnType[Box[List[AccountApplication]]] = { - import com.openbankproject.commons.dto.{InBoundGetAllAccountApplication => InBound, OutBoundGetAllAccountApplication => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[AccountApplicationCommons]](callContext)) - } - - messageDocs += getAccountApplicationByIdDoc - def getAccountApplicationByIdDoc = MessageDoc( - process = "obp.getAccountApplicationById", - messageFormat = messageFormat, - description = "Get Account Application By Id", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAccountApplicationById").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetAccountApplicationById").request), - exampleOutboundMessage = ( - OutBoundGetAccountApplicationById(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - accountApplicationId=accountApplicationIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetAccountApplicationById(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountApplicationCommons(accountApplicationId=accountApplicationIdExample.value, - productCode=ProductCode(productCodeExample.value), - userId=userIdExample.value, - customerId=customerIdExample.value, - dateOfApplication=toDate(dateOfApplicationExample), - status=statusExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAccountApplicationById(accountApplicationId: String, callContext: Option[CallContext]): OBPReturnType[Box[AccountApplication]] = { - import com.openbankproject.commons.dto.{InBoundGetAccountApplicationById => InBound, OutBoundGetAccountApplicationById => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, accountApplicationId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountApplicationCommons](callContext)) - } - - messageDocs += updateAccountApplicationStatusDoc - def updateAccountApplicationStatusDoc = MessageDoc( - process = "obp.updateAccountApplicationStatus", - messageFormat = messageFormat, - description = "Update Account Application Status", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateAccountApplicationStatus").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundUpdateAccountApplicationStatus").request), - exampleOutboundMessage = ( - OutBoundUpdateAccountApplicationStatus(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - accountApplicationId=accountApplicationIdExample.value, - status=statusExample.value) - ), - exampleInboundMessage = ( - InBoundUpdateAccountApplicationStatus(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= AccountApplicationCommons(accountApplicationId=accountApplicationIdExample.value, - productCode=ProductCode(productCodeExample.value), - userId=userIdExample.value, - customerId=customerIdExample.value, - dateOfApplication=toDate(dateOfApplicationExample), - status=statusExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def updateAccountApplicationStatus(accountApplicationId: String, status: String, callContext: Option[CallContext]): OBPReturnType[Box[AccountApplication]] = { - import com.openbankproject.commons.dto.{InBoundUpdateAccountApplicationStatus => InBound, OutBoundUpdateAccountApplicationStatus => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, accountApplicationId, status) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[AccountApplicationCommons](callContext)) - } - - messageDocs += getOrCreateProductCollectionDoc - def getOrCreateProductCollectionDoc = MessageDoc( - process = "obp.getOrCreateProductCollection", - messageFormat = messageFormat, - description = "Get Or Create Product Collection", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetOrCreateProductCollection").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetOrCreateProductCollection").request), - exampleOutboundMessage = ( - OutBoundGetOrCreateProductCollection(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - collectionCode=collectionCodeExample.value, - productCodes=listExample.value.replace("[","").replace("]","").split(",").toList) - ), - exampleInboundMessage = ( - InBoundGetOrCreateProductCollection(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductCollectionCommons(collectionCode=collectionCodeExample.value, - productCode=productCodeExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getOrCreateProductCollection(collectionCode: String, productCodes: List[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ProductCollection]]] = { - import com.openbankproject.commons.dto.{InBoundGetOrCreateProductCollection => InBound, OutBoundGetOrCreateProductCollection => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, collectionCode, productCodes) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductCollectionCommons]](callContext)) - } - - messageDocs += getProductCollectionDoc - def getProductCollectionDoc = MessageDoc( - process = "obp.getProductCollection", - messageFormat = messageFormat, - description = "Get Product Collection", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductCollection").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductCollection").request), - exampleOutboundMessage = ( - OutBoundGetProductCollection(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - collectionCode=collectionCodeExample.value) - ), - exampleInboundMessage = ( - InBoundGetProductCollection(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductCollectionCommons(collectionCode=collectionCodeExample.value, - productCode=productCodeExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProductCollection(collectionCode: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ProductCollection]]] = { - import com.openbankproject.commons.dto.{InBoundGetProductCollection => InBound, OutBoundGetProductCollection => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, collectionCode) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductCollectionCommons]](callContext)) - } - - messageDocs += getOrCreateProductCollectionItemDoc - def getOrCreateProductCollectionItemDoc = MessageDoc( - process = "obp.getOrCreateProductCollectionItem", - messageFormat = messageFormat, - description = "Get Or Create Product Collection Item", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetOrCreateProductCollectionItem").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetOrCreateProductCollectionItem").request), - exampleOutboundMessage = ( - OutBoundGetOrCreateProductCollectionItem(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - collectionCode=collectionCodeExample.value, - memberProductCodes=listExample.value.replace("[","").replace("]","").split(",").toList) - ), - exampleInboundMessage = ( - InBoundGetOrCreateProductCollectionItem(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductCollectionItemCommons(collectionCode=collectionCodeExample.value, - memberProductCode=memberProductCodeExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getOrCreateProductCollectionItem(collectionCode: String, memberProductCodes: List[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ProductCollectionItem]]] = { - import com.openbankproject.commons.dto.{InBoundGetOrCreateProductCollectionItem => InBound, OutBoundGetOrCreateProductCollectionItem => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, collectionCode, memberProductCodes) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductCollectionItemCommons]](callContext)) - } - - messageDocs += getProductCollectionItemDoc - def getProductCollectionItemDoc = MessageDoc( - process = "obp.getProductCollectionItem", - messageFormat = messageFormat, - description = "Get Product Collection Item", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductCollectionItem").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductCollectionItem").request), - exampleOutboundMessage = ( - OutBoundGetProductCollectionItem(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - collectionCode=collectionCodeExample.value) - ), - exampleInboundMessage = ( - InBoundGetProductCollectionItem(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductCollectionItemCommons(collectionCode=collectionCodeExample.value, - memberProductCode=memberProductCodeExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProductCollectionItem(collectionCode: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ProductCollectionItem]]] = { - import com.openbankproject.commons.dto.{InBoundGetProductCollectionItem => InBound, OutBoundGetProductCollectionItem => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, collectionCode) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductCollectionItemCommons]](callContext)) - } - - messageDocs += getProductCollectionItemsTreeDoc - def getProductCollectionItemsTreeDoc = MessageDoc( - process = "obp.getProductCollectionItemsTree", - messageFormat = messageFormat, - description = "Get Product Collection Items Tree", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductCollectionItemsTree").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetProductCollectionItemsTree").request), - exampleOutboundMessage = ( - OutBoundGetProductCollectionItemsTree(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - collectionCode=collectionCodeExample.value, - bankId=bankIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetProductCollectionItemsTree(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( ProductCollectionItemsTree(productCollectionItem= ProductCollectionItemCommons(collectionCode=collectionCodeExample.value, - memberProductCode=memberProductCodeExample.value), - product= ProductCommons(bankId=BankId(bankIdExample.value), - code=ProductCode(productCodeExample.value), - parentProductCode=ProductCode(parentProductCodeExample.value), - name=productNameExample.value, - category=categoryExample.value, - family=familyExample.value, - superFamily=superFamilyExample.value, - moreInfoUrl=moreInfoUrlExample.value, - termsAndConditionsUrl=termsAndConditionsUrlExample.value, - details=detailsExample.value, - description=descriptionExample.value, - meta=Meta( License(id=licenseIdExample.value, - name=licenseNameExample.value))), - attributes=List( ProductAttributeCommons(bankId=BankId(bankIdExample.value), - productCode=ProductCode(productCodeExample.value), - productAttributeId=productAttributeIdExample.value, - name=nameExample.value, - attributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, - value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean)))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getProductCollectionItemsTree(collectionCode: String, bankId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ProductCollectionItemsTree]]] = { - import com.openbankproject.commons.dto.{InBoundGetProductCollectionItemsTree => InBound, OutBoundGetProductCollectionItemsTree => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, collectionCode, bankId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[ProductCollectionItemsTree]](callContext)) - } - - messageDocs += createMeetingDoc - def createMeetingDoc = MessageDoc( - process = "obp.createMeeting", - messageFormat = messageFormat, - description = "Create Meeting", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateMeeting").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateMeeting").request), - exampleOutboundMessage = ( - OutBoundCreateMeeting(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - staffUser= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - customerUser= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - providerId=providerIdExample.value, - purposeId=purposeIdExample.value, - when=toDate(whenExample), - sessionId=sessionIdExample.value, - customerToken=customerTokenExample.value, - staffToken=staffTokenExample.value, - creator= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - invitees=List( Invitee(contactDetails= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - status=statusExample.value))) - ), - exampleInboundMessage = ( - InBoundCreateMeeting(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= MeetingCommons(meetingId=meetingIdExample.value, - providerId=providerIdExample.value, - purposeId=purposeIdExample.value, - bankId=bankIdExample.value, - present= MeetingPresent(staffUserId=staffUserIdExample.value, - customerUserId=customerUserIdExample.value), - keys= MeetingKeys(sessionId=sessionIdExample.value, - customerToken=customerTokenExample.value, - staffToken=staffTokenExample.value), - when=toDate(whenExample), - creator= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - invitees=List( Invitee(contactDetails= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - status=statusExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createMeeting(bankId: BankId, staffUser: User, customerUser: User, providerId: String, purposeId: String, when: Date, sessionId: String, customerToken: String, staffToken: String, creator: ContactDetails, invitees: List[Invitee], callContext: Option[CallContext]): OBPReturnType[Box[Meeting]] = { - import com.openbankproject.commons.dto.{InBoundCreateMeeting => InBound, OutBoundCreateMeeting => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, staffUser, customerUser, providerId, purposeId, when, sessionId, customerToken, staffToken, creator, invitees) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[MeetingCommons](callContext)) - } - - messageDocs += getMeetingsDoc - def getMeetingsDoc = MessageDoc( - process = "obp.getMeetings", - messageFormat = messageFormat, - description = "Get Meetings", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetMeetings").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetMeetings").request), - exampleOutboundMessage = ( - OutBoundGetMeetings(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - user= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample)))) - ), - exampleInboundMessage = ( - InBoundGetMeetings(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( MeetingCommons(meetingId=meetingIdExample.value, - providerId=providerIdExample.value, - purposeId=purposeIdExample.value, - bankId=bankIdExample.value, - present= MeetingPresent(staffUserId=staffUserIdExample.value, - customerUserId=customerUserIdExample.value), - keys= MeetingKeys(sessionId=sessionIdExample.value, - customerToken=customerTokenExample.value, - staffToken=staffTokenExample.value), - when=toDate(whenExample), - creator= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - invitees=List( Invitee(contactDetails= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - status=statusExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getMeetings(bankId: BankId, user: User, callContext: Option[CallContext]): OBPReturnType[Box[List[Meeting]]] = { - import com.openbankproject.commons.dto.{InBoundGetMeetings => InBound, OutBoundGetMeetings => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, user) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[MeetingCommons]](callContext)) - } - - messageDocs += getMeetingDoc - def getMeetingDoc = MessageDoc( - process = "obp.getMeeting", - messageFormat = messageFormat, - description = "Get Meeting", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetMeeting").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetMeeting").request), - exampleOutboundMessage = ( - OutBoundGetMeeting(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - user= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - meetingId=meetingIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetMeeting(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= MeetingCommons(meetingId=meetingIdExample.value, - providerId=providerIdExample.value, - purposeId=purposeIdExample.value, - bankId=bankIdExample.value, - present= MeetingPresent(staffUserId=staffUserIdExample.value, - customerUserId=customerUserIdExample.value), - keys= MeetingKeys(sessionId=sessionIdExample.value, - customerToken=customerTokenExample.value, - staffToken=staffTokenExample.value), - when=toDate(whenExample), - creator= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - invitees=List( Invitee(contactDetails= ContactDetails(name=nameExample.value, - phone=phoneExample.value, - email=emailExample.value), - status=statusExample.value)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getMeeting(bankId: BankId, user: User, meetingId: String, callContext: Option[CallContext]): OBPReturnType[Box[Meeting]] = { - import com.openbankproject.commons.dto.{InBoundGetMeeting => InBound, OutBoundGetMeeting => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, user, meetingId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[MeetingCommons](callContext)) - } - - messageDocs += createOrUpdateKycCheckDoc - def createOrUpdateKycCheckDoc = MessageDoc( - process = "obp.createOrUpdateKycCheck", - messageFormat = messageFormat, - description = "Create Or Update Kyc Check", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycCheck").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycCheck").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycCheck(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - customerId=customerIdExample.value, - id=idExample.value, - customerNumber=customerNumberExample.value, - date=toDate(dateExample), - how=howExample.value, - staffUserId=staffUserIdExample.value, - mStaffName="string", - mSatisfied=true, - comments=commentsExample.value) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycCheck(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= KycCheckCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - idKycCheck="string", - customerNumber=customerNumberExample.value, - date=toDate(dateExample), - how=howExample.value, - staffUserId=staffUserIdExample.value, - staffName=staffNameExample.value, - satisfied=satisfiedExample.value.toBoolean, - comments=commentsExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateKycCheck(bankId: String, customerId: String, id: String, customerNumber: String, date: Date, how: String, staffUserId: String, mStaffName: String, mSatisfied: Boolean, comments: String, callContext: Option[CallContext]): OBPReturnType[Box[KycCheck]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateKycCheck => InBound, OutBoundCreateOrUpdateKycCheck => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerId, id, customerNumber, date, how, staffUserId, mStaffName, mSatisfied, comments) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[KycCheckCommons](callContext)) - } - - messageDocs += createOrUpdateKycDocumentDoc - def createOrUpdateKycDocumentDoc = MessageDoc( - process = "obp.createOrUpdateKycDocument", - messageFormat = messageFormat, - description = "Create Or Update Kyc Document", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycDocument").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycDocument").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycDocument(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - customerId=customerIdExample.value, - id=idExample.value, - customerNumber=customerNumberExample.value, - `type`=typeExample.value, - number=numberExample.value, - issueDate=toDate(issueDateExample), - issuePlace=issuePlaceExample.value, - expiryDate=toDate(expiryDateExample)) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycDocument(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= KycDocumentCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - idKycDocument="string", - customerNumber=customerNumberExample.value, - `type`=typeExample.value, - number=numberExample.value, - issueDate=toDate(issueDateExample), - issuePlace=issuePlaceExample.value, - expiryDate=toDate(expiryDateExample))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateKycDocument(bankId: String, customerId: String, id: String, customerNumber: String, `type`: String, number: String, issueDate: Date, issuePlace: String, expiryDate: Date, callContext: Option[CallContext]): OBPReturnType[Box[KycDocument]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateKycDocument => InBound, OutBoundCreateOrUpdateKycDocument => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerId, id, customerNumber, `type`, number, issueDate, issuePlace, expiryDate) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[KycDocument](callContext)) - } - - messageDocs += createOrUpdateKycMediaDoc - def createOrUpdateKycMediaDoc = MessageDoc( - process = "obp.createOrUpdateKycMedia", - messageFormat = messageFormat, - description = "Create Or Update Kyc Media", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycMedia").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycMedia").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycMedia(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - customerId=customerIdExample.value, - id=idExample.value, - customerNumber=customerNumberExample.value, - `type`=typeExample.value, - url=urlExample.value, - date=toDate(dateExample), - relatesToKycDocumentId=relatesToKycDocumentIdExample.value, - relatesToKycCheckId=relatesToKycCheckIdExample.value) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycMedia(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= KycMediaCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - idKycMedia="string", - customerNumber=customerNumberExample.value, - `type`=typeExample.value, - url=urlExample.value, - date=toDate(dateExample), - relatesToKycDocumentId=relatesToKycDocumentIdExample.value, - relatesToKycCheckId=relatesToKycCheckIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateKycMedia(bankId: String, customerId: String, id: String, customerNumber: String, `type`: String, url: String, date: Date, relatesToKycDocumentId: String, relatesToKycCheckId: String, callContext: Option[CallContext]): OBPReturnType[Box[KycMedia]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateKycMedia => InBound, OutBoundCreateOrUpdateKycMedia => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerId, id, customerNumber, `type`, url, date, relatesToKycDocumentId, relatesToKycCheckId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[KycMediaCommons](callContext)) - } - - messageDocs += createOrUpdateKycStatusDoc - def createOrUpdateKycStatusDoc = MessageDoc( - process = "obp.createOrUpdateKycStatus", - messageFormat = messageFormat, - description = "Create Or Update Kyc Status", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycStatus").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateOrUpdateKycStatus").request), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycStatus(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - customerId=customerIdExample.value, - customerNumber=customerNumberExample.value, - ok=okExample.value.toBoolean, - date=toDate(dateExample)) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycStatus(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= KycStatusCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - customerNumber=customerNumberExample.value, - ok=okExample.value.toBoolean, - date=toDate(dateExample))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createOrUpdateKycStatus(bankId: String, customerId: String, customerNumber: String, ok: Boolean, date: Date, callContext: Option[CallContext]): OBPReturnType[Box[KycStatus]] = { - import com.openbankproject.commons.dto.{InBoundCreateOrUpdateKycStatus => InBound, OutBoundCreateOrUpdateKycStatus => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, customerId, customerNumber, ok, date) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[KycStatusCommons](callContext)) - } - - messageDocs += getKycChecksDoc - def getKycChecksDoc = MessageDoc( - process = "obp.getKycChecks", - messageFormat = messageFormat, - description = "Get Kyc Checks", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycChecks").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycChecks").request), - exampleOutboundMessage = ( - OutBoundGetKycChecks(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetKycChecks(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( KycCheckCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - idKycCheck="string", - customerNumber=customerNumberExample.value, - date=toDate(dateExample), - how=howExample.value, - staffUserId=staffUserIdExample.value, - staffName=staffNameExample.value, - satisfied=satisfiedExample.value.toBoolean, - comments=commentsExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getKycChecks(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[KycCheck]]] = { - import com.openbankproject.commons.dto.{InBoundGetKycChecks => InBound, OutBoundGetKycChecks => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[KycCheckCommons]](callContext)) - } - - messageDocs += getKycDocumentsDoc - def getKycDocumentsDoc = MessageDoc( - process = "obp.getKycDocuments", - messageFormat = messageFormat, - description = "Get Kyc Documents", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycDocuments").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycDocuments").request), - exampleOutboundMessage = ( - OutBoundGetKycDocuments(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetKycDocuments(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( KycDocumentCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - idKycDocument="string", - customerNumber=customerNumberExample.value, - `type`=typeExample.value, - number=numberExample.value, - issueDate=toDate(issueDateExample), - issuePlace=issuePlaceExample.value, - expiryDate=toDate(expiryDateExample)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getKycDocuments(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[KycDocument]]] = { - import com.openbankproject.commons.dto.{InBoundGetKycDocuments => InBound, OutBoundGetKycDocuments => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[KycDocumentCommons]](callContext)) - } - - messageDocs += getKycMediasDoc - def getKycMediasDoc = MessageDoc( - process = "obp.getKycMedias", - messageFormat = messageFormat, - description = "Get Kyc Medias", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycMedias").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycMedias").request), - exampleOutboundMessage = ( - OutBoundGetKycMedias(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetKycMedias(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( KycMediaCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - idKycMedia="string", - customerNumber=customerNumberExample.value, - `type`=typeExample.value, - url=urlExample.value, - date=toDate(dateExample), - relatesToKycDocumentId=relatesToKycDocumentIdExample.value, - relatesToKycCheckId=relatesToKycCheckIdExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getKycMedias(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[KycMedia]]] = { - import com.openbankproject.commons.dto.{InBoundGetKycMedias => InBound, OutBoundGetKycMedias => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[KycMediaCommons]](callContext)) - } - - messageDocs += getKycStatusesDoc - def getKycStatusesDoc = MessageDoc( - process = "obp.getKycStatuses", - messageFormat = messageFormat, - description = "Get Kyc Statuses", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycStatuses").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundGetKycStatuses").request), - exampleOutboundMessage = ( - OutBoundGetKycStatuses(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerId=customerIdExample.value) - ), - exampleInboundMessage = ( - InBoundGetKycStatuses(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=List( KycStatusCommons(bankId=bankIdExample.value, - customerId=customerIdExample.value, - customerNumber=customerNumberExample.value, - ok=okExample.value.toBoolean, - date=toDate(dateExample)))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getKycStatuses(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[KycStatus]]] = { - import com.openbankproject.commons.dto.{InBoundGetKycStatuses => InBound, OutBoundGetKycStatuses => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[List[KycStatusCommons]](callContext)) - } - - messageDocs += createMessageDoc - def createMessageDoc = MessageDoc( - process = "obp.createMessage", - messageFormat = messageFormat, - description = "Create Message", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateMessage").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateMessage").request), - exampleOutboundMessage = ( - OutBoundCreateMessage(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - user= UserCommons(userPrimaryKey=UserPrimaryKey(123), - userId=userIdExample.value, - idGivenByProvider="string", - provider=providerExample.value, - emailAddress=emailAddressExample.value, - name=userNameExample.value, - createdByConsentId=Some("string"), - createdByUserInvitationId=Some("string"), - isDeleted=Some(true), - lastMarketingAgreementSignedDate=Some(toDate(dateExample))), - bankId=BankId(bankIdExample.value), - message=messageExample.value, - fromDepartment=fromDepartmentExample.value, - fromPerson=fromPersonExample.value) - ), - exampleInboundMessage = ( - InBoundCreateMessage(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= CustomerMessageCommons(messageId="string", - date=toDate(dateExample), - message=messageExample.value, - fromDepartment=fromDepartmentExample.value, - fromPerson=fromPersonExample.value, - transport=Some(transportExample.value))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createMessage(user: User, bankId: BankId, message: String, fromDepartment: String, fromPerson: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerMessage]] = { - import com.openbankproject.commons.dto.{InBoundCreateMessage => InBound, OutBoundCreateMessage => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, user, bankId, message, fromDepartment, fromPerson) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[CustomerMessageCommons](callContext)) - } - - messageDocs += makeHistoricalPaymentDoc - def makeHistoricalPaymentDoc = MessageDoc( - process = "obp.makeHistoricalPayment", - messageFormat = messageFormat, - description = "Make Historical Payment", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundMakeHistoricalPayment").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundMakeHistoricalPayment").request), - exampleOutboundMessage = ( - OutBoundMakeHistoricalPayment(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - fromAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - toAccount= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value)))), - posted=toDate(postedExample), - completed=toDate(completedExample), - amount=BigDecimal(amountExample.value), - currency=currencyExample.value, - description=descriptionExample.value, - transactionRequestType=transactionRequestTypeExample.value, - chargePolicy=chargePolicyExample.value) - ), - exampleInboundMessage = ( - InBoundMakeHistoricalPayment(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=TransactionId(transactionIdExample.value)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def makeHistoricalPayment(fromAccount: BankAccount, toAccount: BankAccount, posted: Date, completed: Date, amount: BigDecimal, currency: String, description: String, transactionRequestType: String, chargePolicy: String, callContext: Option[CallContext]): OBPReturnType[Box[TransactionId]] = { - import com.openbankproject.commons.dto.{InBoundMakeHistoricalPayment => InBound, OutBoundMakeHistoricalPayment => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, fromAccount, toAccount, posted, completed, amount, currency, description, transactionRequestType, chargePolicy) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[TransactionId](callContext)) - } - - messageDocs += createDirectDebitDoc - def createDirectDebitDoc = MessageDoc( - process = "obp.createDirectDebit", - messageFormat = messageFormat, - description = "Create Direct Debit", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateDirectDebit").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateDirectDebit").request), - exampleOutboundMessage = ( - OutBoundCreateDirectDebit(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=bankIdExample.value, - accountId=accountIdExample.value, - customerId=customerIdExample.value, - userId=userIdExample.value, - counterpartyId=counterpartyIdExample.value, - dateSigned=toDate(dateSignedExample), - dateStarts=toDate(dateStartsExample), - dateExpires=Some(toDate(dateExpiresExample))) - ), - exampleInboundMessage = ( - InBoundCreateDirectDebit(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= DirectDebitTraitCommons(directDebitId=directDebitIdExample.value, - bankId=bankIdExample.value, - accountId=accountIdExample.value, - customerId=customerIdExample.value, - userId=userIdExample.value, - counterpartyId=counterpartyIdExample.value, - dateSigned=toDate(dateSignedExample), - dateCancelled=toDate(dateCancelledExample), - dateStarts=toDate(dateStartsExample), - dateExpires=toDate(dateExpiresExample), - active=activeExample.value.toBoolean)) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createDirectDebit(bankId: String, accountId: String, customerId: String, userId: String, counterpartyId: String, dateSigned: Date, dateStarts: Date, dateExpires: Option[Date], callContext: Option[CallContext]): OBPReturnType[Box[DirectDebitTrait]] = { - import com.openbankproject.commons.dto.{InBoundCreateDirectDebit => InBound, OutBoundCreateDirectDebit => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, customerId, userId, counterpartyId, dateSigned, dateStarts, dateExpires) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[DirectDebitTraitCommons](callContext)) - } - - messageDocs += deleteCustomerAttributeDoc - def deleteCustomerAttributeDoc = MessageDoc( - process = "obp.deleteCustomerAttribute", - messageFormat = messageFormat, - description = "Delete Customer Attribute", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteCustomerAttribute").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundDeleteCustomerAttribute").request), - exampleOutboundMessage = ( - OutBoundDeleteCustomerAttribute(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - customerAttributeId=customerAttributeIdExample.value) - ), - exampleInboundMessage = ( - InBoundDeleteCustomerAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data=true) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def deleteCustomerAttribute(customerAttributeId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = { - import com.openbankproject.commons.dto.{InBoundDeleteCustomerAttribute => InBound, OutBoundDeleteCustomerAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, customerAttributeId) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[Boolean](callContext)) - } - -// ---------- created on 2024-10-30T11:52:35Z -//---------------- dynamic end ---------------------please don't modify this line -} -object KafkaMappedConnector_vMay2019 extends KafkaMappedConnector_vMay2019{ - -} - - - - - diff --git a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaConnectorBuilder.scala b/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaConnectorBuilder.scala deleted file mode 100644 index 971c1c8b1..000000000 --- a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaConnectorBuilder.scala +++ /dev/null @@ -1,19 +0,0 @@ -package code.bankconnectors.vSept2018 - -import code.bankconnectors.generator.ConnectorBuilderUtil._ - -import scala.collection.immutable.List -import scala.language.postfixOps - -object KafkaConnectorBuilder extends App { - - - generateMethods(commonMethodNames, - "src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala", - "processRequest[InBound](req)", true) -} - - - - - diff --git a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaJsonFactory_vSept2018.scala b/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaJsonFactory_vSept2018.scala deleted file mode 100644 index 51ddb8265..000000000 --- a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaJsonFactory_vSept2018.scala +++ /dev/null @@ -1,457 +0,0 @@ -package code.bankconnectors.vSept2018 - -import java.util.Date - -import code.api.util.APIUtil -import code.branches.Branches.{DriveUpString, LobbyString} -import code.model.dataAccess.MappedBankAccountData -import com.openbankproject.commons.model.{CounterpartyTrait, Customer, UserAuthContext, _} -import net.liftweb.mapper.By -import net.liftweb.util.Helpers.today - -import scala.collection.immutable.List - -/** - * case classes used to define topics, these are outbound kafka messages - */ - -case class OutboundGetAdapterInfo(date: String) extends TopicTrait -case class OutboundGetBanks(authInfo: AuthInfo) extends TopicTrait -case class OutboundGetBank(authInfo: AuthInfo, bankId: String) extends TopicTrait -case class OutboundGetUserByUsernamePassword(authInfo: AuthInfo, password: String) extends TopicTrait -case class OutboundGetAccounts(authInfo: AuthInfo, customers:InternalBasicCustomers) extends TopicTrait -case class OutboundGetAccountbyAccountID(authInfo: AuthInfo, bankId: String, accountId: String)extends TopicTrait -case class OutboundCheckBankAccountExists(authInfo: AuthInfo, bankId: String, accountId: String)extends TopicTrait -case class OutboundGetCoreBankAccounts(authInfo: AuthInfo, bankIdAccountIds: List[BankIdAccountId])extends TopicTrait -case class OutboundGetBankAccountsHeld(authInfo: AuthInfo, bankIdAccountIds: List[BankIdAccountId])extends TopicTrait -case class OutboundGetTransactions(authInfo: AuthInfo,bankId: String, accountId: String, limit: Int, fromDate: String, toDate: String) extends TopicTrait -case class OutboundGetTransaction(authInfo: AuthInfo, bankId: String, accountId: String, transactionId: String) extends TopicTrait -case class OutboundGetBranches(authInfo: AuthInfo,bankId: String) extends TopicTrait -case class OutboundGetBranch(authInfo: AuthInfo, bankId: String, branchId: String)extends TopicTrait -case class OutboundGetAtms(authInfo: AuthInfo,bankId: String) extends TopicTrait -case class OutboundGetAtm(authInfo: AuthInfo,bankId: String, atmId: String) extends TopicTrait -case class OutboundGetChallengeThreshold( - authInfo: AuthInfo, - bankId: String, - accountId: String, - viewId: String, - transactionRequestType: String, - currency: String, - userId: String, - userName: String -) extends TopicTrait -case class OutboundCreateTransaction( - authInfo: AuthInfo, - - // fromAccount - fromAccountBankId : String, - fromAccountId : String, - - // transaction details - transactionRequestType: String, - transactionChargePolicy: String, - transactionRequestCommonBody: TransactionRequestCommonBodyJSON, - - // toAccount or toCounterparty - toCounterpartyId: String, - toCounterpartyName: String, - toCounterpartyCurrency: String, - toCounterpartyRoutingAddress: String, - toCounterpartyRoutingScheme: String, - toCounterpartyBankRoutingAddress: String, - toCounterpartyBankRoutingScheme: String - -) extends TopicTrait - -case class OutboundCreateChallengeSept2018( - authInfo: AuthInfo, - bankId: String, - accountId: String, - userId: String, - username: String, - transactionRequestType: String, - transactionRequestId: String -) extends TopicTrait - -case class OutboundCreateCounterparty( - authInfo: AuthInfo, - counterparty: OutboundCounterparty -) extends TopicTrait - -case class OutboundGetTransactionRequests210( - authInfo: AuthInfo, - counterparty: OutboundTransactionRequests -) extends TopicTrait - -case class OutboundGetCounterparties( - authInfo: AuthInfo, - counterparty: InternalOutboundGetCounterparties -) extends TopicTrait - -case class OutboundGetCounterpartyByCounterpartyId( - authInfo: AuthInfo, - counterparty: OutboundGetCounterpartyById -) extends TopicTrait -case class OutboundGetCounterparty(authInfo: AuthInfo, thisBankId: String, thisAccountId: String, counterpartyId: String) extends TopicTrait - -case class OutboundGetCustomersByUserId( - authInfo: AuthInfo -) extends TopicTrait - -case class OutboundGetCheckbookOrderStatus( - authInfo: AuthInfo, - bankId: String, - accountId: String, - originatorApplication: String, - originatorStationIP: String, - primaryAccount: String -)extends TopicTrait - -case class OutboundGetCreditCardOrderStatus( - authInfo: AuthInfo, - bankId: String, - accountId: String, - originatorApplication: String, - originatorStationIP: String, - primaryAccount: String -)extends TopicTrait - - - -/** - * case classes used in Kafka message, these are InBound Kafka messages - */ - -//AdapterInfo has no AuthInfo, because it just get data from Adapter, no need for AuthInfo -case class InboundAdapterInfo(data: InboundAdapterInfoInternal) -case class InboundGetUserByUsernamePassword(inboundAuthInfo: InboundAuthInfo, data: InboundValidatedUser) -case class InboundGetBanks(inboundAuthInfo: InboundAuthInfo, status: Status,data: List[InboundBank]) -case class InboundGetBank(inboundAuthInfo: InboundAuthInfo, status: Status, data: InboundBank) -case class InboundGetAccounts(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[InboundAccountSept2018]) -case class InboundGetAccountbyAccountID(inboundAuthInfo: InboundAuthInfo, status: Status, data: Option[InboundAccountSept2018]) -case class InboundGetBankAccountsHeld(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[AccountHeld]) -case class InboundCheckBankAccountExists(inboundAuthInfo: InboundAuthInfo, status: Status, data: Option[InboundAccountSept2018]) -case class InboundGetCoreBankAccounts(inboundAuthInfo: InboundAuthInfo, data: List[InternalInboundCoreAccount]) -case class InboundGetTransactions(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[InternalTransaction_vSept2018]) -case class InboundGetTransaction(inboundAuthInfo: InboundAuthInfo, status: Status, data: Option[InternalTransaction_vSept2018]) -case class InboundCreateChallengeSept2018(inboundAuthInfo: InboundAuthInfo, data: InternalCreateChallengeSept2018) -case class InboundCreateCounterparty(inboundAuthInfo: InboundAuthInfo, status: Status, data: Option[InternalCounterparty]) -case class InboundGetTransactionRequests210(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[TransactionRequest]) -case class InboundGetCounterparties(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[InternalCounterparty]) -case class InboundGetCounterparty(inboundAuthInfo: InboundAuthInfo, status: Status, data: Option[InternalCounterparty]) -case class InboundGetCustomersByUserId(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[InternalCustomer]) -case class InboundGetBranches(inboundAuthInfo: InboundAuthInfo,status: Status,data: List[InboundBranchVSept2018]) -case class InboundGetBranch(inboundAuthInfo: InboundAuthInfo,status: Status, data: Option[InboundBranchVSept2018]) -case class InboundGetAtms(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[InboundAtmSept2018]) -case class InboundGetAtm(inboundAuthInfo: InboundAuthInfo, status: Status, data: Option[InboundAtmSept2018]) -case class InboundGetChecksOrderStatus(inboundAuthInfo: InboundAuthInfo, status: Status, data: CheckbookOrdersJson) -case class InboundGetCreditCardOrderStatus(inboundAuthInfo: InboundAuthInfo, status: Status, data: List[InboundCardDetails]) -case class InboundGetChallengeThreshold(inboundAuthInfo: InboundAuthInfo, status: Status, data: AmountOfMoney) - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////// -// These are case classes, used in internal message mapping -case class InternalInboundCoreAccount( - errorCode: String, - backendMessages: List[InboundStatusMessage], - id : String, - label : String, - bankId : String, - accountType: String, - accountRoutings: List[AccountRouting] -) - -case class InboundAuthInfo( - cbsToken: String = "", - sessionId: String = "" -) - - -case class InboundAccountSept2018( - errorCode: String, - cbsToken: String, //TODO, this maybe move to AuthInfo, but it is used in GatewayLogin - bankId: String, - branchId: String, - accountId: String, - accountNumber: String, - accountType: String, - balanceAmount: String, - balanceCurrency: String, - owners: List[String], - viewsToGenerate: List[String], - bankRoutingScheme: String, - bankRoutingAddress: String, - branchRoutingScheme: String, - branchRoutingAddress: String, - accountRoutingScheme: String, - accountRoutingAddress: String, - accountRouting: List[AccountRouting], - accountRules: List[AccountRule] -) extends InboundMessageBase with InboundAccount - -case class BankAccountSept2018(r: InboundAccountSept2018) extends BankAccount { - - def accountId: AccountId = AccountId(r.accountId) - def accountType: String = r.accountType - def balance: BigDecimal = BigDecimal(r.balanceAmount) - def currency: String = r.balanceCurrency - def name: String = r.owners.head - // Note: swift_bic--> swiftBic, but it extends from BankAccount - def swift_bic: Option[String] = Some("swift_bic") - // Note: deprecated, extends from BankAccount - def iban: Option[String] = Some("iban") - def number: String = r.accountNumber - def bankId: BankId = BankId(r.bankId) - def lastUpdate: Date = APIUtil.DateWithMsFormat.parse(today.getTime.toString) - def accountHolder: String = r.owners.head - - // Fields modifiable from OBP are stored in mapper - def label: String = (for { - d <- MappedBankAccountData.find(By(MappedBankAccountData.accountId, r.accountId)) - } yield { - d.getLabel - }).getOrElse(r.accountNumber) - - def accountRoutingScheme: String = r.accountRoutingScheme - def accountRoutingAddress: String = r.accountRoutingAddress - def accountRoutings: List[AccountRouting] = List() - def branchId: String = r.branchId - - def accountRules: List[AccountRule] = r.accountRules - -} - -case class InternalCreateChallengeSept2018( - errorCode: String, - backendMessages: List[InboundStatusMessage], - answer : String -) - -case class InternalGetTransactionRequests( - errorCode: String, - backendMessages: List[InboundStatusMessage], - transactionRequests:List[TransactionRequest] -) - -case class OutboundCounterparty( - name: String, - description: String, - currency: String, - createdByUserId: String, - thisBankId: String, - thisAccountId: String, - thisViewId: String, - otherAccountRoutingScheme: String, - otherAccountRoutingAddress: String, - otherAccountSecondaryRoutingScheme: String, - otherAccountSecondaryRoutingAddress: String, - otherBankRoutingScheme: String, - otherBankRoutingAddress: String, - otherBranchRoutingScheme: String, - otherBranchRoutingAddress: String, - isBeneficiary:Boolean, - bespoke: List[CounterpartyBespoke] -) - -case class InternalOutboundGetCounterparties( - thisBankId: String, - thisAccountId: String, - viewId :String -) - -case class OutboundGetCounterpartyById( - counterpartyId : String -) - -case class OutboundTransactionRequests( - accountId: String, - accountType: String, - currency: String, - iban: String, - number: String, - bankId: String, - branchId: String, - accountRoutingScheme: String, - accountRoutingAddress: String -) - - -case class InternalCounterparty( - createdByUserId: String, - name: String, - thisBankId: String, - thisAccountId: String, - thisViewId: String, - counterpartyId: String, - otherAccountRoutingScheme: String, - otherAccountRoutingAddress: String, - otherBankRoutingScheme: String, - otherBankRoutingAddress: String, - otherBranchRoutingScheme: String, - otherBranchRoutingAddress: String, - isBeneficiary: Boolean, - description: String, - currency: String, - otherAccountSecondaryRoutingScheme: String, - otherAccountSecondaryRoutingAddress: String, - bespoke: List[CounterpartyBespoke]) extends CounterpartyTrait - - -case class InboundBranchVSept2018( - branchId: BranchId, - bankId: BankId, - name: String, - address: Address, - location: Location, - lobbyString: Option[LobbyString], - driveUpString: Option[DriveUpString], - meta: Meta, - branchRouting: Option[Routing], - lobby: Option[Lobby], - driveUp: Option[DriveUp], - // Easy access for people who use wheelchairs etc. - isAccessible : Option[Boolean], - accessibleFeatures: Option[String], - branchType : Option[String], - moreInfo : Option[String], - phoneNumber : Option[String], - isDeleted : Option[Boolean] - ) extends BranchT - -case class InboundAtmSept2018( - atmId : AtmId, - bankId : BankId, - name : String, - address : Address, - location : Location, - meta : Meta, - - OpeningTimeOnMonday : Option[String], - ClosingTimeOnMonday : Option[String], - - OpeningTimeOnTuesday : Option[String], - ClosingTimeOnTuesday : Option[String], - - OpeningTimeOnWednesday : Option[String], - ClosingTimeOnWednesday : Option[String], - - OpeningTimeOnThursday : Option[String], - ClosingTimeOnThursday: Option[String], - - OpeningTimeOnFriday : Option[String], - ClosingTimeOnFriday : Option[String], - - OpeningTimeOnSaturday : Option[String], - ClosingTimeOnSaturday : Option[String], - - OpeningTimeOnSunday: Option[String], - ClosingTimeOnSunday : Option[String], - - isAccessible : Option[Boolean], - - locatedAt : Option[String], - moreInfo : Option[String], - hasDepositCapability : Option[Boolean], - supportedLanguages: Option[List[String]]= None, - services: Option[List[String]] = None, - accessibilityFeatures: Option[List[String]] = None, - supportedCurrencies: Option[List[String]] = None, - notes: Option[List[String]] = None, - minimumWithdrawal: Option[String] = None, - branchIdentification: Option[String] = None, - locationCategories: Option[List[String]] = None, - siteIdentification: Option[String] = None, - siteName: Option[String] = None, - cashWithdrawalNationalFee: Option[String] = None, - cashWithdrawalInternationalFee: Option[String] = None, - balanceInquiryFee: Option[String] = None, - atmType: Option[String] = None, - phone: Option[String] = None, - ) extends AtmT - -case class InternalTransaction_vSept2018( - transactionId: String, - accountId: String, - amount: String, - bankId: String, - completedDate: String, - counterpartyId: String, - counterpartyName: String, - currency: String, - description: String, - newBalanceAmount: String, - newBalanceCurrency: String, - postedDate: String, - `type`: String, - userId: String - ) - -case class InboundCardDetails( - orderId: String, - creditCardType: String, - cardDescription: String, - useType: String, - orderDate: String, - deliveryStatus: String, - statusDate: String, - branch: String -) - -case class InternalTransactionId( - id : String -) -case class InboundCreateTransactionId(inboundAuthInfo: InboundAuthInfo, status: Status, data: InternalTransactionId) - -object JsonFactory_vSept2018 { - def createCustomerJson(customer : Customer) : InternalBasicCustomer = { - InternalBasicCustomer( - bankId=customer.bankId, - customerId = customer.customerId, - customerNumber = customer.number, - legalName = customer.legalName, - dateOfBirth = customer.dateOfBirth - ) - } - - def createUserJson(user : User) : InternalBasicUser = { - InternalBasicUser( - user.userId, - user.emailAddress, - user.name, - ) - } - - def createBasicCustomerJson(customer : Customer) : BasicCustomer = { - BasicCustomer( - customerId = customer.customerId, - customerNumber = customer.number, - legalName = customer.legalName, - ) - } - - def createBasicUserAuthContext(userAuthContest : UserAuthContext) : BasicUserAuthContext = { - BasicUserAuthContext( - key = userAuthContest.key, - value = userAuthContest.value - ) - } - - def createCustomersJson(customers : List[Customer]) : InternalBasicCustomers = { - InternalBasicCustomers(customers.map(createCustomerJson)) - } - - def createUsersJson(users : List[User]) : InternalBasicUsers = { - InternalBasicUsers(users.map(createUserJson)) - } - - def createBasicCustomerJson(customers : List[Customer]) : List[BasicCustomer] = { - customers.map(createBasicCustomerJson) - } - - - def createBasicUserAuthContextJson(userAuthContexts : List[UserAuthContext]) : List[BasicUserAuthContext] = { - userAuthContexts.map(createBasicUserAuthContext) - } - -} \ No newline at end of file diff --git a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala b/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala deleted file mode 100644 index d0960d832..000000000 --- a/obp-api/src/main/scala/code/bankconnectors/vSept2018/KafkaMappedConnector_vSept2018.scala +++ /dev/null @@ -1,3112 +0,0 @@ -package code.bankconnectors.vSept2018 - -/* -Open Bank Project - API -Copyright (C) 2011-2019, TESOBE GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see http://www.gnu.org/licenses/. - -Email: contact@tesobe.com -TESOBE GmbH -Osloerstrasse 16/17 -Berlin 13359, Germany -*/ - -import code.api.Constant - -import java.text.SimpleDateFormat -import java.util.Date -import java.util.UUID.randomUUID -import code.api.APIFailure -import code.api.Constant._ -import code.api.JSONFactoryGateway.PayloadOfJwtJSON -import code.api.ResourceDocs1_4_0.{MessageDocsSwaggerDefinitions, SwaggerDefinitionsJSON} -import code.api.cache.Caching -import code.api.util.APIUtil._ -import code.api.util.ErrorMessages._ -import code.api.util.ExampleValue._ -import com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SCA -import code.api.util._ -import code.api.v2_1_0.TransactionRequestBodyCommonJSON -import code.bankconnectors._ -import code.context.UserAuthContextProvider -import code.customer._ -import code.kafka.{KafkaHelper, Topics} -import code.model._ -import code.model.dataAccess._ -import code.transactionrequests.TransactionRequests -import code.users.Users -import code.util.Helper.MdcLoggable -import code.views.Views -import com.openbankproject.commons.dto._ -import com.openbankproject.commons.model._ -import com.sksamuel.avro4s.SchemaFor -import com.tesobe.{CacheKeyFromArguments, CacheKeyOmit} -import net.liftweb -import net.liftweb.common._ -import net.liftweb.json.{MappingException, parse} -import net.liftweb.util.Helpers.tryo - -import scala.collection.immutable.{List, Nil} -import com.openbankproject.commons.ExecutionContext.Implicits.global -import com.openbankproject.commons.model.enums.AccountRoutingScheme -import com.openbankproject.commons.util.{ApiVersion, RequiredFieldValidation} -import com.openbankproject.commons.ExecutionContext.Implicits.global -import com.openbankproject.commons.dto.{InBoundTrait, _} -import com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.SCAStatus -import com.openbankproject.commons.model.enums._ -import scala.concurrent.{Await, Future} -import scala.concurrent.duration._ -import scala.language.postfixOps -import scala.reflect.runtime.universe._ - -trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with MdcLoggable { - //this one import is for implicit convert, don't delete - import com.openbankproject.commons.model.{CustomerFaceImage, CreditLimit, CreditRating, AmountOfMoney} - - implicit override val nameOfConnector = KafkaMappedConnector_vSept2018.toString - - // "Versioning" of the messages sent by this or similar connector works like this: - // Use Case Classes (e.g. KafkaInbound... KafkaOutbound...) are defined below to describe the message structures. - // Each connector has a separate file like this one. - // Once the message format is STABLE, freeze the key/value pair names there. For now, new keys may be added but none modified. - // If we want to add a new message format, create a new file e.g. March2017_messages.scala - // Then add a suffix to the connector value i.e. instead of kafka we might have kafka_march_2017. - // Then in this file, populate the different case classes depending on the connector name and send to Kafka - val messageFormat: String = "Sept2018" - - // This is tricky for now. Because for GatewayLogin, we do not create any user for the first CBS Call. - // We get the username from gatewayLogin token -> call CBS (CBS checked the user and return the response) -> api create the users. - def getAuthInfoFirstCbsCall (provider: String, username:String, callContext: Option[CallContext]): Box[AuthInfo]= - for{ - cc <- tryo {callContext.get} ?~! NoCallContext - gatewayLoginRequestPayLoad <- cc.gatewayLoginRequestPayload orElse ( - Some(PayloadOfJwtJSON(login_user_name = "", - is_first = false, - app_id = "", - app_name = "", - time_stamp = "", - cbs_token = Some(""), - cbs_id = "", - session_id = Some("")))) - isFirst = gatewayLoginRequestPayLoad.is_first - correlationId = cc.correlationId - sessionId = cc.sessionId.getOrElse("") - //Here, need separate the GatewayLogin and other Types, because of for Gatewaylogin, there is no user here. Others, need sign up user in OBP side. - basicUserAuthContexts <- cc.gatewayLoginRequestPayload match { - case None => - for{ - user <- Users.users.vend.getUserByProviderAndUsername(provider,username) ?~! "getAuthInfoFirstCbsCall: can not get user object here." - userAuthContexts<- UserAuthContextProvider.userAuthContextProvider.vend.getUserAuthContextsBox(user.userId)?~! "getAuthInfoFirstCbsCall: can not get userAuthContexts object here." - basicUserAuthContexts = JsonFactory_vSept2018.createBasicUserAuthContextJson(userAuthContexts) - } yield - basicUserAuthContexts - case _ => Full(Nil) - } - } yield{ - AuthInfo("",username, "", isFirst, correlationId, sessionId, Nil, basicUserAuthContexts, Nil) - } - - def getAuthInfo (callContext: Option[CallContext]): Box[AuthInfo]= - for{ - cc <- tryo {callContext.get} ?~! s"$NoCallContext. inside the getAuthInfo method " - user <- cc.user ?~! "getAuthInfo: User is not in side CallContext!" - username =user.name - currentResourceUserId = user.userId - gatewayLoginPayLoad <- cc.gatewayLoginRequestPayload orElse ( - Some(PayloadOfJwtJSON(login_user_name = "", - is_first = false, - app_id = "", - app_name = "", - time_stamp = "", - cbs_token = Some(""), - cbs_id = "", - session_id = Some("")))) - cbs_token <- gatewayLoginPayLoad.cbs_token.orElse(Full("")) - isFirst <- tryo(gatewayLoginPayLoad.is_first) ?~! "getAuthInfo:is_first can not be got from gatewayLoginPayLoad!" - correlationId <- tryo(cc.correlationId) ?~! "getAuthInfo: User id can not be got from callContext!" - sessionId <- tryo(cc.sessionId.getOrElse(""))?~! "getAuthInfo: session id can not be got from callContext!" - permission <- Views.views.vend.getPermissionForUser(user)?~! "getAuthInfo: No permission for this user" - views <- tryo(permission.views)?~! "getAuthInfo: No views for this user" - linkedCustomers <- tryo(CustomerX.customerProvider.vend.getCustomersByUserId(user.userId))?~! "getAuthInfo: No linked customers for this user" - likedCustomersBasic = JsonFactory_vSept2018.createBasicCustomerJson(linkedCustomers) - userAuthContexts<- UserAuthContextProvider.userAuthContextProvider.vend.getUserAuthContextsBox(user.userId) ?~! "getAuthInfo: No userAuthContexts for this user" - basicUserAuthContexts = JsonFactory_vSept2018.createBasicUserAuthContextJson(userAuthContexts) - authViews<- tryo( - for{ - view <- views //TODO, need double check whether these data come from OBP side or Adapter. - (account, callContext )<- code.bankconnectors.LocalMappedConnector.getBankAccountLegacy(view.bankId, view.accountId, Some(cc)) ?~! {s"getAuthInfo: $BankAccountNotFound"} - internalCustomers = JsonFactory_vSept2018.createCustomersJson(account.customerOwners.toList) - internalUsers = JsonFactory_vSept2018.createUsersJson(account.userOwners.toList) - viewBasic = ViewBasic(view.viewId.value, view.name, view.description) - accountBasic = AccountBasic( - account.accountId.value, - account.accountRoutings, - internalCustomers.customers, - internalUsers.users) - }yield - AuthView(viewBasic, accountBasic) - )?~! "getAuthInfo: No authViews for this user" - } yield{ - AuthInfo(currentResourceUserId, username, cbs_token, isFirst, correlationId, sessionId, likedCustomersBasic, basicUserAuthContexts, authViews) - } - - - - val outboundAdapterCallContext = OutboundAdapterCallContext( - correlationId = "string", - sessionId = Option("string"), - consumerId = Option("string"), - generalContext = Option(List(BasicGeneralContext(key = "string", - value = "string"))), - outboundAdapterAuthInfo = Option(OutboundAdapterAuthInfo(userId = Option("string"), - username = Option("string"), - linkedCustomers = Option(List(BasicLinkedCustomer(customerId = "string", - customerNumber = "string", - legalName = "string"))), - userAuthContext = Option(List(BasicUserAuthContext(key = "string", - value = "string"))), - authViews = Option(List(AuthView(view = ViewBasic(id = "string", - name = "string", - description = "string"), - account = AccountBasic(id = "string", - accountRoutings = List(AccountRouting(scheme = "string", - address = "string")), - customerOwners = List(InternalBasicCustomer(bankId = "string", - customerId = "string", - customerNumber = "string", - legalName = "string", - dateOfBirth = new Date())), - userOwners = List(InternalBasicUser(userId = "string", - emailAddress = "string", - name = "string"))))))))) - - val inboundAdapterCallContext = InboundAdapterCallContext( - correlationId = "string", - sessionId = Option("string"), - generalContext = Option(List(BasicGeneralContext(key = "string", - value = "string")))) - - val viewBasicExample = ViewBasic(Constant.SYSTEM_OWNER_VIEW_ID,Constant.SYSTEM_OWNER_VIEW_ID, "This is the owner view") - - val internalBasicCustomerExample = InternalBasicCustomer( - bankId = ExampleValue.bankIdExample.value, - customerId = customerIdExample.value, - customerNumber = customerNumberExample.value, - legalName = legalNameExample.value, - dateOfBirth = DateWithSecondsExampleObject - ) - val internalBasicUserExample = InternalBasicUser( - userId = userIdExample.value, - emailAddress = emailExample.value, - name = legalNameExample.value // Assuming this is the legal name - ) - val accountBasicExample = AccountBasic( - id = accountIdExample.value, - List(AccountRouting("AccountNumber",accountNumberExample.value), - AccountRouting("IBAN",ibanExample.value)), - List(internalBasicCustomerExample), - List(internalBasicUserExample) - ) - val accountRoutingExample = AccountRouting("AccountNumber",accountNumberExample.value) - val authViewExample = AuthView(viewBasicExample, accountBasicExample) - val authViewsExample = List(authViewExample) - val basicCustomerExample = BasicCustomer(customerIdExample.value,customerNumberExample.value,legalNameExample.value) - val basicCustomersExample = List(basicCustomerExample) - val basicUserAuthContextExample1 = BasicUserAuthContext("CUSTOMER_NUMBER",customerNumberExample.value) - val basicUserAuthContextExample2 = BasicUserAuthContext("TOKEN","qieuriopwoir987ASYDUFISUYDF678u") - val BasicUserAuthContextsExample = List(basicUserAuthContextExample1, basicUserAuthContextExample2) - val authInfoExample = AuthInfo( - userId = userIdExample.value, - username = usernameExample.value, - cbsToken = cbsTokenExample.value, - isFirst = true, - correlationId = correlationIdExample.value, - sessionId = userIdExample.value, - basicCustomersExample, - BasicUserAuthContextsExample, - authViewsExample - ) - val inboundStatusMessagesExample = List(InboundStatusMessage("ESB", "Success", "0", "OK")) - val errorCodeExample = ""//This should be Empty String, mean no error in Adapter side. - val statusExample = Status(errorCodeExample, inboundStatusMessagesExample) - val inboundAuthInfoExample = InboundAuthInfo(cbsToken=cbsTokenExample.value, sessionId = sessionIdExample.value) - - - - val inboundAccountSept2018Example = InboundAccountSept2018( - cbsErrorCodeExample.value, - cbsToken = cbsTokenExample.value, - bankId = bankIdExample.value, - branchId = branchIdExample.value, - accountId = accountIdExample.value, - accountNumber = accountNumberExample.value, - accountType = accountTypeExample.value, - balanceAmount = balanceAmountExample.value, - balanceCurrency = currencyExample.value, - owners = owner1Example.value :: owner1Example.value :: Nil, - viewsToGenerate = "_Public" :: "Accountant" :: "Auditor" :: Nil, - bankRoutingScheme = bankRoutingSchemeExample.value, - bankRoutingAddress = bankRoutingAddressExample.value, - branchRoutingScheme = branchRoutingSchemeExample.value, - branchRoutingAddress = branchRoutingAddressExample.value, - accountRoutingScheme = accountRoutingSchemeExample.value, - accountRoutingAddress = accountRoutingAddressExample.value, - accountRouting = Nil, - accountRules = Nil) - - - - messageDocs += MessageDoc( - process = s"obp.getAdapterInfo", - messageFormat = messageFormat, - description = "Gets information about the active general (non bank specific) Adapter that is responding to messages sent by OBP.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetAdapterInfo.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetAdapterInfo.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetAdapterInfo(date = DateWithSecondsExampleString) - ), - exampleInboundMessage = ( - InboundAdapterInfo( - InboundAdapterInfoInternal( - errorCodeExample, - inboundStatusMessagesExample, - name = "Obp-Kafka-South", - version = "Sept2018", - git_commit = gitCommitExample.value, - date = DateWithSecondsExampleString - ) - ) - ), - outboundAvroSchema = Some(parse(SchemaFor[OutboundGetAdapterInfo]().toString(true))), - inboundAvroSchema = Some(parse(SchemaFor[InboundAdapterInfoInternal]().toString(true))), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def getAdapterInfo(callContext: Option[CallContext]): Future[Box[(InboundAdapterInfoInternal, Option[CallContext])]] = { - val req = OutboundGetAdapterInfo(DateWithSecondsExampleString) - processRequest[InboundAdapterInfo](req) map { inbound => - inbound.map(_.data).map(inboundAdapterInfoInternal =>(inboundAdapterInfoInternal, callContext)) - } - } - - messageDocs += MessageDoc( - process = s"obp.getBanks", - messageFormat = messageFormat, - description = "Gets the banks list on this OBP installation.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetBanks.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetBanks.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetBanks(authInfoExample) - ), - exampleInboundMessage = ( - InboundGetBanks( - inboundAuthInfoExample, - Status( - errorCode = errorCodeExample, - inboundStatusMessagesExample), - InboundBank( - bankId = bankIdExample.value, - name = "sushan", - logo = "TESOBE", - url = "https://tesobe.com/" - ) :: Nil - ) - ), - outboundAvroSchema = Some(parse(SchemaFor[OutboundGetBanks]().toString(true))), - inboundAvroSchema = Some(parse(SchemaFor[InboundGetBanks]().toString(true))), - adapterImplementation = Some(AdapterImplementation("- Core", 2)) - ) - override def getBanksLegacy(callContext: Option[CallContext]) = writeMetricEndpointTiming { - getValueFromFuture(getBanks(callContext: Option[CallContext])) - }("getBanks") - - override def getBanks(callContext: Option[CallContext]) = writeMetricEndpointTiming { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value field with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(banksTTL second){ - val req = OutboundGetBanks(AuthInfo()) - - logger.debug(s"Kafka getBanksFuture says: req is: $req") - - processRequest[InboundGetBanks](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full((inboundData.data.map((new Bank2(_))))) - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - - (boxedResult, callContext) - } - }}}("getBanks") - - messageDocs += MessageDoc( - process = "obp.getBank", - messageFormat = messageFormat, - description = "Get a specific Bank as specified by bankId", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetBank.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetBank.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetBank(authInfoExample,"bankId") - ), - exampleInboundMessage = ( - InboundGetBank( - inboundAuthInfoExample, - Status( - errorCodeExample, - inboundStatusMessagesExample), - InboundBank( - bankId = bankIdExample.value, - name = "sushan", - logo = "TESOBE", - url = "https://tesobe.com/" - ) - ) - ), - outboundAvroSchema = Some(parse(SchemaFor[OutboundGetBank]().toString(true))), - inboundAvroSchema = Some(parse(SchemaFor[InboundGetBank]().toString(true))), - adapterImplementation = Some(AdapterImplementation("- Core", 5)) - ) - override def getBankLegacy(bankId: BankId, callContext: Option[CallContext]) = writeMetricEndpointTiming { - getValueFromFuture(getBank(bankId: BankId, callContext: Option[CallContext])) - }("getBank") - - override def getBank(bankId: BankId, callContext: Option[CallContext]) = writeMetricEndpointTiming { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value field with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(bankTTL second) { - val req = OutboundGetBank( - authInfo = AuthInfo(), - bankId = bankId.toString - ) - logger.debug(s"Kafka getBank Req says: is: $req") - - processRequest[InboundGetBank](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full(new Bank2(inboundData.data)) - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - } - }("getBank") - - messageDocs += MessageDoc( - process = "obp.getBankAccountsForUser", - messageFormat = messageFormat, - description = "Gets the list of accounts available to the User. This call sends authInfo including username.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetAccounts.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(InboundGetAccounts.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetAccounts( - authInfoExample, - InternalBasicCustomers(customers =List(internalBasicCustomerExample))) - ), - exampleInboundMessage = ( - InboundGetAccounts( - inboundAuthInfoExample, - statusExample, - inboundAccountSept2018Example :: Nil) - ), - adapterImplementation = Some(AdapterImplementation("Accounts", 5)) - ) - override def getBankAccountsForUserLegacy(provider: String, username:String, callContext: Option[CallContext]): Box[(List[InboundAccount], Option[CallContext])] = writeMetricEndpointTiming{ - getValueFromFuture(getBankAccountsForUser(provider: String, username:String, callContext: Option[CallContext])) - }("getBankAccounts") - - override def getBankAccountsForUser(provider: String, username:String, callContext: Option[CallContext]): Future[Box[(List[InboundAccountSept2018], Option[CallContext])]] = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(accountsTTL second) { - - val req = OutboundGetAccounts( - getAuthInfoFirstCbsCall(provider: String, username:String, callContext).openOrThrowException(s"$attemptedToOpenAnEmptyBox getBankAccountsFuture.callContext is Empty !"), - InternalBasicCustomers(Nil) - ) - logger.debug(s"Kafka getBankAccountsFuture says: req is: $req") - - processRequest[InboundGetAccounts](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full(inboundData.data) - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - } - }("getBankAccountsFuture") - - messageDocs += MessageDoc( - process = "obp.getBankAccount", - messageFormat = messageFormat, - description = "Get a single Account as specified by the bankId and accountId.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetAccountbyAccountID.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetAccountbyAccountID.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetAccountbyAccountID( - authInfoExample, - "bankId", - "accountId" - ) - ), - exampleInboundMessage = ( - InboundGetAccountbyAccountID( - inboundAuthInfoExample, - statusExample, - Some(inboundAccountSept2018Example))), - adapterImplementation = Some(AdapterImplementation("Accounts", 7)) - ) - override def getBankAccountLegacy(bankId: BankId, accountId: AccountId, @CacheKeyOmit callContext: Option[CallContext]) = writeMetricEndpointTiming { - getValueFromFuture(checkBankAccountExists(bankId : BankId, accountId : AccountId, callContext: Option[CallContext]))._1.map(bankAccount =>(bankAccount, callContext)) - }("getBankAccount") - - messageDocs += MessageDoc( - process = "obp.getBankAccountsHeld", - messageFormat = messageFormat, - description = "Get Accounts held by the current User if even the User has not been assigned the owner View yet.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetBankAccountsHeld.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetBankAccountsHeld.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetBankAccountsHeld( - authInfoExample, - List( - BankIdAccountId(BankId(bankIdExample.value), - AccountId(accountIdExample.value)) - ) - )), - exampleInboundMessage = ( - InboundGetBankAccountsHeld( - inboundAuthInfoExample, - statusExample, - List(AccountHeld( - accountIdExample.value, - label = labelExample.value, - bankIdExample.value, - number = accountNumberExample.value, - accountRoutings =List(accountRoutingExample) - - )))), - adapterImplementation = Some(AdapterImplementation("Accounts", 1)) - ) - override def getBankAccountsHeld(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]) = { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(accountsTTL second){ - - val req = OutboundGetBankAccountsHeld( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - bankIdAccountIds - ) - logger.debug(s"Kafka getBankAccountsHeldFuture says: req is: $req") - - processRequest[InboundGetBankAccountsHeld](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full(inboundData.data) - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - } - } - - messageDocs += MessageDoc( - process = "obp.checkBankAccountExists", - messageFormat = messageFormat, - description = "Check a bank Account exists - as specified by bankId and accountId.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundCheckBankAccountExists.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundCheckBankAccountExists.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundCheckBankAccountExists( - authInfoExample, - bankIdExample.value, - accountIdExample.value - ) - ), - exampleInboundMessage = ( - InboundCheckBankAccountExists( - inboundAuthInfoExample, - statusExample, - Some(inboundAccountSept2018Example)) - ), - adapterImplementation = Some(AdapterImplementation("Accounts", 4)) - ) - override def checkBankAccountExistsLegacy(bankId: BankId, accountId: AccountId, @CacheKeyOmit callContext: Option[CallContext])= writeMetricEndpointTiming { - getValueFromFuture(checkBankAccountExists(bankId: BankId, accountId: AccountId, callContext: Option[CallContext]))._1.map(bankAccount =>(bankAccount, callContext)) - }("getBankAccount") - - override def checkBankAccountExists(bankId: BankId, accountId: AccountId, callContext: Option[CallContext]) = { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(accountTTL second){ - val req = OutboundCheckBankAccountExists( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - bankId = bankId.toString, - accountId = accountId.value - ) - - logger.debug(s"Kafka checkBankAccountExists says: req is: $req") - - processRequest[InboundCheckBankAccountExists](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full((new BankAccountSept2018(inboundData.data.head))) - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - - (boxedResult, callContext) - } - }}} - - messageDocs += MessageDoc( - process = "obp.getCoreBankAccounts", - messageFormat = messageFormat, - description = "Get bank Accounts available to the User (without Metadata)", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCoreBankAccounts.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCoreBankAccounts.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCoreBankAccounts( - authInfoExample, - List(BankIdAccountId(BankId(bankIdExample.value), - AccountId(accountIdExample.value)) - ) - )), - exampleInboundMessage = ( - InboundGetCoreBankAccounts( - inboundAuthInfoExample, - List(InternalInboundCoreAccount( - errorCodeExample, - inboundStatusMessagesExample, - accountIdExample.value, - labelExample.value, - bankIdExample.value, - accountTypeExample.value, - List(accountRoutingExample) - )))), - adapterImplementation = Some(AdapterImplementation("Accounts", 1)) - ) - override def getCoreBankAccountsLegacy(bankIdAccountIds: List[BankIdAccountId], @CacheKeyOmit callContext: Option[CallContext]) : Box[(List[CoreAccount], Option[CallContext])] = writeMetricEndpointTiming{ - getValueFromFuture(getCoreBankAccounts(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext])) - }("getBankAccounts") - - override def getCoreBankAccounts(bankIdAccountIds: List[BankIdAccountId], @CacheKeyOmit callContext: Option[CallContext]) : Future[Box[(List[CoreAccount], Option[CallContext])]] = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(accountTTL second){ - val authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext) - val req = OutboundGetCoreBankAccounts( - authInfo = authInfo, - bankIdAccountIds - ) - processRequest[InboundGetCoreBankAccounts](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.data.head.errorCode=="") => - Full(inboundData.data.map(x =>CoreAccount(x.id,x.label,x.bankId,x.accountType, x.accountRoutings))) - case Full(inboundData) if (inboundData.data.head.errorCode != "") => - Failure("INTERNAL-"+ inboundData.data.head.errorCode+". + CoreBank-Status:" + inboundData.data.head.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - } - }("getCoreBankAccountsFuture") - - - val exampleInternalTransactionSept2018 = InternalTransaction_vSept2018( - transactionId = transactionIdExample.value, - accountId = accountIdExample.value, - amount = transactionAmountExample.value, - bankId = bankIdExample.value, - completedDate = transactionCompletedDateExample.value, - counterpartyId = counterpartyIdExample.value, - counterpartyName = counterpartyNameExample.value, - currency = currencyExample.value, - description = transactionDescriptionExample.value, - newBalanceAmount = balanceAmountExample.value, - newBalanceCurrency = currencyExample.value, - postedDate = transactionPostedDateExample.value, - `type` = transactionTypeExample.value, - userId = userIdExample.value) - - - - messageDocs += MessageDoc( - process = "obp.getTransactions", - messageFormat = messageFormat, - description = "Get Transactions for an Account specified by bankId and accountId. Pagination is achieved with limit, fromDate and toDate.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetTransactions.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetTransactions.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetTransactions( - authInfo = authInfoExample, - bankId = bankIdExample.value, - accountId = accountIdExample.value, - limit =100, - fromDate="DateWithSecondsExampleObject", - toDate="DateWithSecondsExampleObject" - ) - ), - exampleInboundMessage = ( - InboundGetTransactions( - inboundAuthInfoExample, - statusExample, - exampleInternalTransactionSept2018::Nil)), - adapterImplementation = Some(AdapterImplementation("Transactions", 10)) - ) - // TODO Get rid on these param lookups and document. - override def getTransactionsLegacy(bankId: BankId, accountId: AccountId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]) = writeMetricEndpointTiming { - val limit = queryParams.collect { case OBPLimit(value) => value }.headOption.getOrElse(100) - val fromDate = queryParams.collect { case OBPFromDate(date) => date.toString }.headOption.getOrElse(APIUtil.theEpochTime.toString) - val toDate = queryParams.collect { case OBPToDate(date) => date.toString }.headOption.getOrElse(APIUtil.DefaultToDate.toString) - - // TODO What about offset? - val req = OutboundGetTransactions( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - bankId = bankId.toString, - accountId = accountId.value, - limit = limit, - fromDate = fromDate, - toDate = toDate - ) - - //Note: because there is `queryParams: List[OBPQueryParam]` in getTransactions, so create the getTransactionsCached to cache data. - def getTransactionsCached(req: OutboundGetTransactions): Future[(Box[List[Transaction]], Option[CallContext])] = { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(transactionsTTL second) { - logger.debug(s"Kafka getTransactions says: req is: $req") - - processRequest[InboundGetTransactions](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - val bankAccountAndCallContext = checkBankAccountExistsLegacy(BankId(inboundData.data.head.bankId), AccountId(inboundData.data.head.accountId), callContext) - - val res = for { - internalTransaction <- inboundData.data - thisBankAccount <- bankAccountAndCallContext.map(_._1) ?~! ErrorMessages.BankAccountNotFound - transaction <- createInMemoryTransaction(thisBankAccount, internalTransaction) - } yield { - transaction - } - Full(res) - case Full(inboundData) if (inboundData.status.hasError) => - Failure("INTERNAL-"+ inboundData.status.errorCode+". + CoreBank-Status:" + inboundData.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - } - } - getValueFromFuture(getTransactionsCached(req))._1.map(bankAccount =>(bankAccount, callContext)) - }("getTransactions") - - override def getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]) = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey {Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(transactionsTTL second) { - - val limit = queryParams.collect { case OBPLimit(value) => value}.headOption.getOrElse(100) - val fromDate = queryParams.collect { case OBPFromDate(date) => date.toString}.headOption.getOrElse(APIUtil.theEpochTime.toString) - val toDate = queryParams.collect { case OBPToDate(date) => date.toString}.headOption.getOrElse(APIUtil.DefaultToDate.toString) - - val req = OutboundGetTransactions( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - bankId = bankId.toString, - accountId = accountId.value, - limit = limit, - fromDate = fromDate, - toDate = toDate - ) - logger.debug(s"Kafka getTransactions says: req is: $req") - - processRequest[InboundGetTransactions](req) map { inbound => - val boxedResult: Box[List[TransactionCore]] = inbound match { - case Full(inboundGetTransactions) if (inboundGetTransactions.status.hasNoError) => - for{ - (thisBankAccount, callContext) <- checkBankAccountExistsLegacy(BankId(inboundGetTransactions.data.head.bankId), AccountId(inboundGetTransactions.data.head.accountId), callContext) ?~! ErrorMessages.BankAccountNotFound - transaction <- createInMemoryTransactionsCore(thisBankAccount, inboundGetTransactions.data) - } yield { - (transaction) - } - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - }}}}("getTransactions") - - messageDocs += MessageDoc( - process = "obp.getTransaction", - messageFormat = messageFormat, - description = "Get a single Transaction specified by bankId, accountId and transactionId", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetTransaction.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetTransaction.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetTransaction( - authInfoExample, - "bankId", - "accountId", - "transactionId" - ) - ), - exampleInboundMessage = ( - InboundGetTransaction(inboundAuthInfoExample, statusExample, Some(exampleInternalTransactionSept2018)) - ), - adapterImplementation = Some(AdapterImplementation("Transactions", 11)) - ) - override def getTransactionLegacy(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]) = writeMetricEndpointTiming{ - Await.result(getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]), TIMEOUT)._1.map(bankAccount =>(bankAccount, callContext)) - }("getTransaction") - - override def getTransaction(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]) = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(transactionTTL second) { - - val authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext) - val req = OutboundGetTransaction(authInfo, bankId.value, accountId.value, transactionId.value) - processRequest[InboundGetTransaction](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - for { - (bankAccount, callContext) <- checkBankAccountExistsLegacy(BankId(inboundData.data.get.bankId), AccountId(inboundData.data.get.accountId), callContext) ?~! ErrorMessages.BankAccountNotFound - transaction: Transaction <- createInMemoryTransaction(bankAccount, inboundData.data.get) - } yield { - (transaction, callContext) - } - case Full(inboundData) if (inboundData.status.hasError) => - Failure("INTERNAL-" + inboundData.status.errorCode + ". + CoreBank-Status:" + inboundData.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult) - } - } - }}("getTransaction") - - messageDocs += MessageDoc( - process = "obp.createChallenge", - messageFormat = messageFormat, - description = "Create a Security Challenge that may be used to complete a Transaction Request.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundCreateChallengeSept2018.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundCreateChallengeSept2018.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundCreateChallengeSept2018( - authInfoExample, - bankId = bankIdExample.value, - accountId = accountIdExample.value, - userId = userIdExample.value, - username = usernameExample.value, - transactionRequestType = "SANDBOX_TAN", - transactionRequestId = "1234567" - ) - ), - exampleInboundMessage = ( - InboundCreateChallengeSept2018( - inboundAuthInfoExample, - InternalCreateChallengeSept2018( - errorCodeExample, - inboundStatusMessagesExample, - "1234" - ) - ) - ), - outboundAvroSchema = Some(parse(SchemaFor[OutboundCreateChallengeSept2018]().toString(true))), - inboundAvroSchema = Some(parse(SchemaFor[InboundCreateChallengeSept2018]().toString(true))), - adapterImplementation = Some(AdapterImplementation("Payments", 20)) - ) - override def createChallenge(bankId: BankId, accountId: AccountId, userId: String, transactionRequestType: TransactionRequestType, transactionRequestId: String, scaMethod: Option[SCA], callContext: Option[CallContext]) = { - val authInfo = getAuthInfo(callContext).openOrThrowException(attemptedToOpenAnEmptyBox) - val req = OutboundCreateChallengeSept2018( - authInfo = authInfo, - bankId = bankId.value, - accountId = accountId.value, - userId = userId, - username = AuthUser.getCurrentUserUsername, - transactionRequestType = transactionRequestType.value, - transactionRequestId = transactionRequestId - ) - - logger.debug(s"Kafka createChallenge Req says: is: $req") - - val future = for { - res <- processToFuture[OutboundCreateChallengeSept2018](req) map { - f => - try { - f.extract[InboundCreateChallengeSept2018] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundCreateChallengeSept2018]().toString(false) - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundCreateChallengeSept2018 class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map { x => (x.inboundAuthInfo, x.data) } - } yield { - Full(res) - } - - val res = future map { - case Full((authInfo,x)) if (x.errorCode=="") => - (Full(x.answer), callContext) - case Full((authInfo, x)) if (x.errorCode!="") => - (Failure("INTERNAL-"+ x.errorCode+". + CoreBank-Status:"+ x.backendMessages), callContext) - case _ => - (Failure(ErrorMessages.UnknownError), callContext) - } - res - } - - messageDocs += MessageDoc( - process = "obp.createCounterparty", - messageFormat = messageFormat, - description = "Create Counterparty", - outboundTopic = Some(Topics.createTopicByClassName(OutboundCreateCounterparty.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundCreateCounterparty.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundCreateCounterparty( - authInfoExample, - OutboundCounterparty( - name = "name", - description = "description", - currency = "currency", - createdByUserId = "createdByUserId", - thisBankId = "thisBankId", - thisAccountId = "thisAccountId", - thisViewId = "thisViewId", - otherAccountRoutingScheme = "otherAccountRoutingScheme", - otherAccountRoutingAddress = "otherAccountRoutingAddress", - otherAccountSecondaryRoutingScheme = "otherAccountSecondaryRoutingScheme", - otherAccountSecondaryRoutingAddress = "otherAccountSecondaryRoutingAddress", - otherBankRoutingScheme = "otherBankRoutingScheme", - otherBankRoutingAddress = "otherBankRoutingAddress", - otherBranchRoutingScheme = "otherBranchRoutingScheme", - otherBranchRoutingAddress = "otherBranchRoutingAddress", - isBeneficiary = true, - // Why is this not a list as in inbound? - bespoke = CounterpartyBespoke("key","value") ::Nil - ) - ) - ), - exampleInboundMessage = ( - InboundCreateCounterparty( - inboundAuthInfoExample, - statusExample, - Some(InternalCounterparty( - createdByUserId= "String", - name= "String", - thisBankId= "String", - thisAccountId= "String", - thisViewId= "String", - counterpartyId= "String", - otherAccountRoutingScheme= "String", - otherAccountRoutingAddress= "String", - otherBankRoutingScheme= "String", - otherBankRoutingAddress= "String", - otherBranchRoutingScheme= "String", - otherBranchRoutingAddress= "String", - isBeneficiary = false, - description= "String", - currency= "String", - otherAccountSecondaryRoutingScheme= "String", - otherAccountSecondaryRoutingAddress= "String", - bespoke = List(CounterpartyBespoke( - key = "String", - value = "String" - ))))) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 5)) - ) - override def createCounterparty( - name: String, - description: String, - currency: String, - createdByUserId: String, - thisBankId: String, - thisAccountId: String, - thisViewId: String, - otherAccountRoutingScheme: String, - otherAccountRoutingAddress: String, - otherAccountSecondaryRoutingScheme: String, - otherAccountSecondaryRoutingAddress: String, - otherBankRoutingScheme: String, - otherBankRoutingAddress: String, - otherBranchRoutingScheme: String, - otherBranchRoutingAddress: String, - isBeneficiary:Boolean, - bespoke: List[CounterpartyBespoke], - callContext: Option[CallContext] = None) = { - - val authInfo = getAuthInfo(callContext).openOrThrowException(s"$NoCallContext for createCounterparty method") - val req = OutboundCreateCounterparty( - authInfo = authInfo, - counterparty = OutboundCounterparty( - name: String, - description: String, - currency: String, - createdByUserId: String, - thisBankId: String, - thisAccountId: String, - thisViewId: String, - otherAccountRoutingScheme: String, - otherAccountRoutingAddress: String, - otherAccountSecondaryRoutingScheme: String, - otherAccountSecondaryRoutingAddress: String, - otherBankRoutingScheme: String, - otherBankRoutingAddress: String, - otherBranchRoutingScheme: String, - otherBranchRoutingAddress: String, - isBeneficiary:Boolean, - bespoke: List[CounterpartyBespoke]) - ) - - val counterpartyFuture = processRequest[InboundCreateCounterparty](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundDate) if (inboundDate.status.hasNoError) => - Full(inboundDate.data.get) - case Full(inboundDate) if (inboundDate.status.hasError) => - Failure("INTERNAL-" + inboundDate.status.errorCode + ". + CoreBank-Status:" + inboundDate.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult) - } - getValueFromFuture(counterpartyFuture).map(counterparty => (counterparty, callContext)) - - } - - messageDocs += MessageDoc( - process = "obp.getTransactionRequests210", - messageFormat = messageFormat, - description = "Get Transaction Requests", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetTransactionRequests210.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetTransactionRequests210.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetTransactionRequests210( - authInfoExample, - OutboundTransactionRequests( - "accountId: String", - "accountType: String", - "currency: String", - "iban: String", - "number: String", - "bankId: BankId", - "branchId: String", - "accountRoutingScheme: String", - "accountRoutingAddress: String" - ) - ) - ), - exampleInboundMessage = ( - InboundGetTransactionRequests210( - inboundAuthInfoExample, - statusExample, - List( - TransactionRequest( - id = TransactionRequestId("id"), - `type` = "String", - from = TransactionRequestAccount("10", "12"), - body = SwaggerDefinitionsJSON.transactionRequestBodyAllTypes, - transaction_ids = "", - status = "COMPLETED", - start_date = DateWithSecondsExampleObject, - end_date = DateWithSecondsExampleObject, - challenge = TransactionRequestChallenge("", 0, ""), - charge = TransactionRequestCharge( - "", - AmountOfMoney( - currencyExample.value, - transactionAmountExample.value) - ), - charge_policy = "", - counterparty_id = CounterpartyId(""), - name = "name", - this_bank_id = BankId("10"), - this_account_id = AccountId("1"), - this_view_id = ViewId(""), - other_account_routing_scheme = "", - other_account_routing_address = "", - other_bank_routing_scheme = "", - other_bank_routing_address = "", - is_beneficiary = false) - ) - ) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 10)) - ) - override def getTransactionRequests210(user : User, fromAccount : BankAccount, callContext: Option[CallContext] = None) = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(transactionRequests210TTL second){ - - val box = for { - authInfo <- getAuthInfo(callContext) - req = OutboundGetTransactionRequests210( - authInfo = authInfo, - counterparty = OutboundTransactionRequests( - accountId = fromAccount.accountId.value, - accountType = fromAccount.accountType, - currency = fromAccount.currency, - iban = fromAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address).getOrElse(""), - number = fromAccount.number, - bankId = fromAccount.bankId.value, - branchId = fromAccount.bankId.value, - accountRoutingScheme = fromAccount.accountRoutings.headOption.map(_.scheme).getOrElse(""), - accountRoutingAddress= fromAccount.accountRoutings.headOption.map(_.address).getOrElse("")) - ) - _ <- Full(logger.debug(s"Kafka getTransactionRequests210 Req says: is: $req")) - kafkaMessage <- processToBox(req) - received = liftweb.json.compactRender(kafkaMessage) - expected = SchemaFor[InboundGetTransactionRequests210]().toString(false) - inboundGetTransactionRequests210 <- tryo{kafkaMessage.extract[InboundGetTransactionRequests210]} ?~! s"$InvalidConnectorResponseForGetTransactionRequests210, $InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetTransactionRequests210 class with the Message Doc : You received this ($received). We expected this ($expected)" - (internalGetTransactionRequests, status) <- Full(inboundGetTransactionRequests210.data, inboundGetTransactionRequests210.status) - } yield{ - (internalGetTransactionRequests, status) - } - logger.debug(s"Kafka getTransactionRequests210 Res says: is: $box") - - val res = box match { - case Full((data, status)) if (status.errorCode=="") => - //For consistency with sandbox mode, we need combine obp transactions in database and adapter transactions - val transactionRequest = for{ - adapterTransactionRequests <- Full(data) - //TODO, this will cause performance issue, we need limit the number of transaction requests. - obpTransactionRequests <- TransactionRequests.transactionRequestProvider.vend.getTransactionRequests(fromAccount.bankId, fromAccount.accountId) ?~! s"$InvalidConnectorResponse, error on TransactionRequests.transactionRequestProvider.vend.getTransactionRequests" - obpTransactionRequests <- TransactionRequests.transactionRequestProvider.vend.getTransactionRequests(fromAccount.bankId, fromAccount.accountId) ?~! s"$InvalidConnectorResponse, error on TransactionRequests.transactionRequestProvider.vend.getTransactionRequests" - } yield { - adapterTransactionRequests ::: obpTransactionRequests - } - transactionRequest.map(transactionRequests =>(transactionRequests, callContext)) - case Full((data, status)) if (status.errorCode!="") => - Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages) - case Empty => - Failure(ErrorMessages.InvalidConnectorResponse) - case Failure(msg, e, c) => - Failure(msg, e, c) - case _ => - Failure(ErrorMessages.UnknownError) - } - res - } - } - }("getTransactionRequests210") - - messageDocs += MessageDoc( - process = "obp.getCounterparties", - messageFormat = messageFormat, - description = "Get Counterparties available to the View on the Account specified by thisBankId, thisAccountId and viewId.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCounterparties.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCounterparties.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCounterparties( - authInfoExample, - InternalOutboundGetCounterparties( - thisBankId = "String", - thisAccountId = "String", - viewId = "String" - ) - ) - ), - exampleInboundMessage = ( - InboundGetCounterparties(inboundAuthInfoExample, statusExample, - InternalCounterparty( - createdByUserId = "", - name = "", - thisBankId = "", - thisAccountId = "", - thisViewId = "", - counterpartyId = "", - otherAccountRoutingScheme = "", - otherAccountRoutingAddress = "", - otherBankRoutingScheme = "", - otherBankRoutingAddress = "", - otherBranchRoutingScheme = "", - otherBranchRoutingAddress = "", - isBeneficiary = true, - description = "", - currency = "", - otherAccountSecondaryRoutingScheme = "", - otherAccountSecondaryRoutingAddress = "", - bespoke = List( - CounterpartyBespoke(key = "key", value = "value")) - ) :: Nil - ) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 0)) - ) - - override def getCounterpartiesLegacy(thisBankId: BankId, thisAccountId: AccountId, viewId :ViewId, callContext: Option[CallContext] = None) = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(counterpartiesTTL second){ - val box = for { - authInfo <- getAuthInfo(callContext) - req = OutboundGetCounterparties( - authInfo = authInfo, - counterparty = InternalOutboundGetCounterparties( - thisBankId = thisBankId.value, - thisAccountId = thisAccountId.value, - viewId = viewId.value) - ) - _<-Full(logger.debug(s"Kafka getCounterparties Req says: is: $req")) - kafkaMessage <- processToBox(req) - received = liftweb.json.compactRender(kafkaMessage) - expected = SchemaFor[InboundGetCounterparties]().toString(false) - inboundGetCounterparties <- tryo{kafkaMessage.extract[InboundGetCounterparties]} ?~! { - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetCounterparties class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - error - } - (internalCounterparties, status) <- Full(inboundGetCounterparties.data, inboundGetCounterparties.status) - } yield{ - (internalCounterparties, status) - } - logger.debug(s"Kafka getCounterparties Res says: is: $box") - - val res = box match { - case Full((data, status)) if (status.errorCode=="") => - Full((data,callContext)) - case Full((data, status)) if (status.errorCode!="") => - Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages) - case Empty => - Failure(ErrorMessages.InvalidConnectorResponse) - case Failure(msg, e, c) => - Failure(msg, e, c) - case _ => - Failure(ErrorMessages.UnknownError) - } - res - } - } - }("getCounterparties") - override def getCounterparties(thisBankId: BankId, thisAccountId: AccountId, viewId: ViewId, callContext: Option[CallContext] = None): OBPReturnType[Box[List[CounterpartyTrait]]] = Future { - (getCounterpartiesLegacy(thisBankId, thisAccountId, viewId, callContext) map (i => i._1), callContext) - } - - messageDocs += MessageDoc( - process = "obp.getCounterpartyByCounterpartyId", - messageFormat = messageFormat, - description = "Get a Counterparty by its counterpartyId.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCounterpartyByCounterpartyId.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCounterpartyByCounterpartyId.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCounterpartyByCounterpartyId( - authInfoExample, - OutboundGetCounterpartyById( - counterpartyId = "String" - ) - ) - ), - exampleInboundMessage = ( - InboundGetCounterparty(inboundAuthInfoExample, statusExample, Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", currency = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil))) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 1)) - ) - override def getCounterpartyByCounterpartyId(counterpartyId: CounterpartyId, callContext: Option[CallContext])= writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(counterpartyByCounterpartyIdTTL second) { - val req = OutboundGetCounterpartyByCounterpartyId(getAuthInfo(callContext).openOrThrowException(attemptedToOpenAnEmptyBox), OutboundGetCounterpartyById(counterpartyId.value)) - logger.debug(s"Kafka getCounterpartyByCounterpartyId Req says: is: $req") - - val future = for { - res <- processToFuture[OutboundGetCounterpartyByCounterpartyId](req) map { - f => - try { - f.extract[InboundGetCounterparty] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetCounterparty]().toString(false) - val err = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetCounterparty class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(err) - throw new MappingException(err, e) - } - } map { x => (x.inboundAuthInfo, x.data, x.status) } - } yield { - Full(res) - } - logger.debug(s"Kafka getCounterpartyByCounterpartyId Res says: is: $future") - - val res = future map { - case Full((authInfo, Some(data), status)) if (status.errorCode == "") => - (Full(data), callContext) - case Full((authInfo, data, status)) if (status.errorCode != "") => - (Failure("INTERNAL-" + status.errorCode + ". + CoreBank-Status:" + status.backendMessages), callContext) - case _ => - (Failure(ErrorMessages.UnknownError), callContext) - } - res - } - } - }("getCounterpartyByCounterpartyId") - - - messageDocs += MessageDoc( - process = "obp.getCounterpartyTrait", - messageFormat = messageFormat, - description = "Get a Counterparty by its bankId, accountId and counterpartyId", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCounterparty.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCounterparty.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCounterparty( - authInfoExample, - "BankId", - "AccountId", - "counterpartyId" - ) - ), - exampleInboundMessage = ( - InboundGetCounterparty(inboundAuthInfoExample, - statusExample, - Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", currency = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil))) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 1)) - ) - override def getCounterpartyTrait(thisBankId: BankId, thisAccountId: AccountId, counterpartyId: String, callContext: Option[CallContext]) = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - val req = OutboundGetCounterparty(getAuthInfo(callContext).openOrThrowException(attemptedToOpenAnEmptyBox), thisBankId.value, thisAccountId.value, counterpartyId) - logger.debug(s"Kafka getCounterpartyTrait Req says: is: $req") - - val future = for { - res <- processToFuture[OutboundGetCounterparty](req) map { - f => - try { - f.extract[InboundGetCounterparty] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetCounterparty]().toString(false) - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetCounterparty class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map { x => (x.inboundAuthInfo, x.data, x.status) } - } yield { - Full(res) - } - logger.debug(s"Kafka getCounterpartyTrait Res says: is: $future") - - val res = future map { - case Full((authInfo, Some(data), status)) if (status.errorCode=="") => - (Full(data), callContext) - case Full((authInfo, data, status)) if (status.errorCode!="") => - (Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages), callContext) - case _ => - (Failure(ErrorMessages.UnknownError), callContext) - } - res - }("getCounterpartyTrait") - - - messageDocs += MessageDoc( - process = "obp.getCustomersByUserIdFuture", - messageFormat = messageFormat, - description = "Get Customers represented by the User.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCustomersByUserId.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCustomersByUserId.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCustomersByUserId( - authInfoExample - ) - ), - exampleInboundMessage = ( - InboundGetCustomersByUserId( - inboundAuthInfoExample, - statusExample, - InternalCustomer( - customerId = "String", bankId = bankIdExample.value, number = "String", - legalName = "String", mobileNumber = "String", email = "String", - faceImage = CustomerFaceImage(date = DateWithSecondsExampleObject, url = "String"), - dateOfBirth = DateWithSecondsExampleObject, relationshipStatus = "String", - dependents = 1, dobOfDependents = List(DateWithSecondsExampleObject), - highestEducationAttained = "String", employmentStatus = "String", - creditRating = CreditRating(rating = "String", source = "String"), - creditLimit = CreditLimit(currency = "String", amount = "String"), - kycStatus = false, lastOkDate = DateWithSecondsExampleObject - ) :: Nil - ) - ), - outboundAvroSchema = None, - inboundAvroSchema = None, - adapterImplementation = Some(AdapterImplementation("Customer", 0)) - ) - - override def getCustomersByUserId(userId: String, @CacheKeyOmit callContext: Option[CallContext]): Future[Box[(List[Customer],Option[CallContext])]] = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(customersByUserIdTTL second) { - - val req = OutboundGetCustomersByUserId(getAuthInfo(callContext).openOrThrowException(NoCallContext)) - logger.debug(s"Kafka getCustomersByUserIdFuture Req says: is: $req") - - val future = processRequest[InboundGetCustomersByUserId](req) - logger.debug(s"Kafka getCustomersByUserIdFuture Res says: is: $future") - - future map { - case Full(inbound) if (inbound.status.hasNoError) => - Full(KafkaMappedConnector_vSept2018.createObpCustomers(inbound.data)) - case Full(inbound) if (inbound.status.hasError) => - Failure("INTERNAL-"+ inbound.status.errorCode+". + CoreBank-Status:" + inbound.status.backendMessages) - case failureOrEmpty => failureOrEmpty - } map {it => - (it.asInstanceOf[Box[List[Customer]]], callContext) - } - } - } - }("getCustomersByUserIdFuture") - - - messageDocs += MessageDoc( - process = "obp.getCheckbookOrdersFuture", - messageFormat = messageFormat, - description = "Get the status of CheckbookOrders for an Account.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCheckbookOrderStatus.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCheckbookOrderStatus.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCheckbookOrderStatus( - authInfoExample, - bankId = bankIdExample.value, - accountId ="accountId", - originatorApplication ="String", - originatorStationIP = "String", - primaryAccount =""//TODO not sure for now. - ) - ), - exampleInboundMessage = ( - InboundGetChecksOrderStatus( - inboundAuthInfoExample, - statusExample, - SwaggerDefinitionsJSON.checkbookOrdersJson - ) - ), - adapterImplementation = Some(AdapterImplementation("Misc", 1)) - ) - - override def getCheckbookOrders( - bankId: String, - accountId: String, - @CacheKeyOmit callContext: Option[CallContext] - )= writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(statusOfCheckbookOrders second) { - - val req = OutboundGetCheckbookOrderStatus( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - bankId = bankId, - accountId =accountId, - originatorApplication = "String", - originatorStationIP = "String", - primaryAccount = "" - ) - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCheckbookOrdersFuture Req says: is: $req") - - val future = for { - res <- processToFuture[OutboundGetCheckbookOrderStatus](req) map { - f => - try { - f.extract[InboundGetChecksOrderStatus] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetChecksOrderStatus]().toString(false) - val error = s"correlationId(${req.authInfo.correlationId}): $InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetCheckbookOrderStatus class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map {x => (x.data, x.status)} - } yield{ - res - } - - val res = future map { - case (checksOrderStatusResponseDetails, status) if (status.errorCode=="") => - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCheckbookOrdersFuture Res says: is: $checksOrderStatusResponseDetails") - Full(checksOrderStatusResponseDetails, callContext) - case (accountDetails, status) if (status.errorCode!="") => - val errorMessage = "INTERNAL-" + status.errorCode + ". + CoreBank-Status:" + status.backendMessages - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCheckbookOrdersFuture Res says: is: $errorMessage") - Failure(errorMessage) - case _ => - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCheckbookOrdersFuture Res says: is: $UnknownError") - Failure(UnknownError) - } - res - } - } - }("getCheckbookOrdersFuture") - - - messageDocs += MessageDoc( - process = "obp.getStatusOfCreditCardOrderFuture", - messageFormat = messageFormat, - description = "Get the status of CreditCardOrders", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetCreditCardOrderStatus.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetCreditCardOrderStatus.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetCreditCardOrderStatus( - authInfoExample, - bankId = bankIdExample.value, - accountId = accountIdExample.value, - originatorApplication = "String", - originatorStationIP = "String", - primaryAccount = "" - ) - ), - exampleInboundMessage = ( - InboundGetCreditCardOrderStatus( - inboundAuthInfoExample, - statusExample, - List(InboundCardDetails( - "OrderId", - "CreditCardType" , - "CardDescription", - "UseType", - "OrderDate", - "DeliveryStatus", - "StatusDate", - "Branch" - ) - ) - )), - adapterImplementation = Some(AdapterImplementation("Misc", 1)) - ) - - override def getStatusOfCreditCardOrder( - bankId: String, - accountId: String, - @CacheKeyOmit callContext: Option[CallContext] - ) = writeMetricEndpointTiming{ - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(statusOfCreditcardOrders second) { - - val req = OutboundGetCreditCardOrderStatus( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - bankId = bankId, - accountId =accountId, - originatorApplication ="String", - originatorStationIP = "String", - primaryAccount =""//TODO not sure for now. - ) - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCreditCardOrderFuture Req says: is: $req") - - val future = for { - res <- processToFuture[OutboundGetCreditCardOrderStatus](req) map { - f => - try { - f.extract[InboundGetCreditCardOrderStatus] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundCardDetails]().toString(false) - val error = s"correlationId(${req.authInfo.correlationId}): $InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetCreditCardOrderStatus class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map {x => (x.data, x.status)} - } yield{ - res - } - - val res = future map { - case (checksOrderStatusResponseDetails, status) if (status.errorCode=="") => - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCreditCardOrderFuture Res says: is: $checksOrderStatusResponseDetails") - Full(checksOrderStatusResponseDetails.map( - card =>CardObjectJson( - card_type= card.creditCardType, - card_description = card.cardDescription, - use_type= card.creditCardType - )), callContext) - case (accountDetails, status) if (status.errorCode!="") => - val errorMessage = "INTERNAL-" + status.errorCode + ". + CoreBank-Status:" + status.backendMessages - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCreditCardOrderFuture Res says: is: $errorMessage") - Failure(errorMessage) - case _ => - logger.debug(s"correlationId(${req.authInfo.correlationId}): Kafka getStatusOfCreditCardOrderFuture Res says: is: $UnknownError") - Failure(UnknownError) - } - res - } - } - }("getStatusOfCreditCardOrderFuture") - - ///////////////////////////////////////////////////////////////////////////// - // Helper for creating a transaction - def createInMemoryTransaction(bankAccount: BankAccount,internalTransaction: InternalTransaction_vSept2018): Box[Transaction] = { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(memoryTransactionTTL second) { - for { - datePosted <- tryo { - new SimpleDateFormat(DateWithDay2).parse(internalTransaction.postedDate) - } ?~! s"$InvalidConnectorResponseForGetTransaction Wrong posteDate format should be $DateWithDay2, current is ${internalTransaction.postedDate}" - dateCompleted <- tryo { - new SimpleDateFormat(DateWithDay2).parse(internalTransaction.completedDate) - } ?~! s"$InvalidConnectorResponseForGetTransaction Wrong completedDate format should be $DateWithDay2, current is ${internalTransaction.completedDate}" - - counterpartyName <- tryo { - internalTransaction.counterpartyName - } ?~! s"$InvalidConnectorResponseForGetTransaction. Can not get counterpartyName from Adapter. " - //2018-07-18, here we can not get enough data from Adapter, so we only use counterpartyName set to otherAccountRoutingScheme and otherAccountRoutingAddress. - counterpartyId <- Full(APIUtil.createImplicitCounterpartyId(bankAccount.bankId.value, bankAccount.accountId.value, counterpartyName,counterpartyName,counterpartyName)) - counterparty <- createInMemoryCounterparty(bankAccount, counterpartyName, counterpartyId) - - } yield { - // Create new transaction - new Transaction( - internalTransaction.transactionId, // uuid:String - TransactionId(internalTransaction.transactionId), // id:TransactionId - bankAccount, // thisAccount:BankAccount - counterparty, // otherAccount:OtherBankAccount - internalTransaction.`type`, // transactionType:String - BigDecimal(internalTransaction.amount), // val amount:BigDecimal - bankAccount.currency, // currency:String - Some(internalTransaction.description), // description:Option[String] - datePosted, // startDate:Date - dateCompleted, // finishDate:Date - BigDecimal(internalTransaction.newBalanceAmount) // balance:BigDecimal) - ) - } - } - } - } - - def createInMemoryTransactionsCore(bankAccount: BankAccount,internalTransactions: List[InternalTransaction_vSept2018]): Box[List[TransactionCore]] = { - //first loop all the items in the list, and return all the boxed back. it may contains the Full, Failure, Empty. - val transactionCoresBoxes: List[Box[TransactionCore]] = internalTransactions.map(createInMemoryTransactionCore(bankAccount, _)) - - //check the Failure in the List, if it contains any Failure, than throw the Failure back, it is 0. Then run the - transactionCoresBoxes.filter(_.isInstanceOf[Failure]).length match { - case 0 => - tryo {transactionCoresBoxes.filter(_.isDefined).map(_.openOrThrowException(attemptedToOpenAnEmptyBox))} - case _ => - transactionCoresBoxes.filter(_.isInstanceOf[Failure]).head.asInstanceOf[Failure] - } - } - def createInMemoryTransactionCore(bankAccount: BankAccount,internalTransaction: InternalTransaction_vSept2018): Box[TransactionCore] = { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(memoryTransactionTTL second) { - for { - datePosted <- tryo { - new SimpleDateFormat(DateWithDay2).parse(internalTransaction.postedDate) - } ?~! s"$InvalidConnectorResponseForGetTransaction Wrong posteDate format should be $DateWithDay2, current is ${internalTransaction.postedDate}" - dateCompleted <- tryo { - new SimpleDateFormat(DateWithDay2).parse(internalTransaction.completedDate) - } ?~! s"$InvalidConnectorResponseForGetTransaction Wrong completedDate format should be $DateWithDay2, current is ${internalTransaction.completedDate}" - counterpartyCore <- Full(CounterpartyCore( - //2018-07-18, here we can not get enough data from Adapter, so we only use counterpartyName set to otherAccountRoutingScheme and otherAccountRoutingAddress. - counterpartyId = APIUtil.createImplicitCounterpartyId(bankAccount.bankId.value, bankAccount.accountId.value, internalTransaction.counterpartyName, - internalTransaction.counterpartyName,internalTransaction.counterpartyName), - counterpartyName = internalTransaction.counterpartyName, - kind = null, - thisBankId = BankId(""), - thisAccountId = AccountId(""), - otherBankRoutingScheme = "", - otherBankRoutingAddress = None, - otherAccountRoutingScheme = "", - otherAccountRoutingAddress = None, - otherAccountProvider = "", - isBeneficiary = true - )) - } yield { - // Create new transaction - TransactionCore( - TransactionId(internalTransaction.transactionId), // id:TransactionId - bankAccount, // thisAccount:BankAccount - counterpartyCore, // otherAccount:OtherBankAccount - internalTransaction.`type`, // transactionType:String - BigDecimal(internalTransaction.amount), // val amount:BigDecimal - bankAccount.currency, // currency:String - Some(internalTransaction.description), // description:Option[String] - datePosted, // startDate:Date - dateCompleted, // finishDate:Date - BigDecimal(internalTransaction.newBalanceAmount) // balance:BigDecimal) - ) - } - } - } - } - - // Helper for creating other bank account, this will not create it in database, only in scala code. - //Note, we have a method called createCounterparty in this connector, so named it here. - def createInMemoryCounterparty(bankAccount: BankAccount, counterpartyName: String, counterpartyId: String): Box[Counterparty] = { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(memoryCounterpartyTTL second){ - Full( - Counterparty( - thisBankId = BankId(bankAccount.bankId.value), - thisAccountId = bankAccount.accountId, - counterpartyId = counterpartyId, - counterpartyName = counterpartyName, - - otherBankRoutingAddress = None, - otherAccountRoutingAddress = None, - otherBankRoutingScheme = null, - otherAccountRoutingScheme = null, - otherAccountProvider = null, - isBeneficiary = true, - - kind = null, - nationalIdentifier = null - ) - ) - } - } - } - - messageDocs += MessageDoc( - process = "obp.getBranches", - messageFormat = messageFormat, - description = "Get Branches fora Bank specified by bankId", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetBranches.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetBranches.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetBranches(authInfoExample,"bankid") - ), - exampleInboundMessage = ( - InboundGetBranches( - inboundAuthInfoExample, - Status("", - inboundStatusMessagesExample), - InboundBranchVSept2018( - branchId = BranchId(""), - bankId = BankId(bankIdExample.value), - name = "", - address = Address(line1 = "", - line2 = "", - line3 = "", - city = "", - county = Some(""), - state = "", - postCode = "", - //ISO_3166-1_alpha-2 - countryCode = ""), - location = Location(11,11, None,None), - lobbyString = None, - driveUpString = None, - meta = Meta(License("","")), - branchRouting = None, - lobby = Some(Lobby(monday = List(OpeningTimes("","")), - tuesday = List(OpeningTimes("","")), - wednesday = List(OpeningTimes("","")), - thursday = List(OpeningTimes("","")), - friday = List(OpeningTimes("","")), - saturday = List(OpeningTimes("","")), - sunday = List(OpeningTimes("","")) - )), - driveUp = None, - // Easy access for people who use wheelchairs etc. - isAccessible = Some(true), - accessibleFeatures = None, - branchType = Some(""), - moreInfo = Some(""), - phoneNumber = Some(""), - isDeleted = Some(false) - ) :: Nil - ) - - ), - adapterImplementation = Some(AdapterImplementation("Open Data", 1)) - ) - - override def getBranches(bankId: BankId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]) = writeMetricEndpointTiming { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(branchesTTL second){ - val req = OutboundGetBranches(AuthInfo(), bankId.toString) - logger.debug(s"Kafka getBranchesFuture Req is: $req") - - val future: Future[(List[InboundBranchVSept2018], Status)] = for { - res <- processToFuture[OutboundGetBranches](req) map { - f => - try { - f.extract[InboundGetBranches] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetBranches]().toString(false) - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetBranches class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map { - d => (d.data, d.status) - } - } yield { - res - } - - logger.debug(s"Kafka getBranchFuture Res says: is: $future") - future map { - case (branches, status) if (status.errorCode=="") => - Full(branches, callContext) - case (_, status) if (status.errorCode!="") => - Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages) - case _ => - Failure(ErrorMessages.UnknownError) - } - } - } - }("getBranchesFuture") - - messageDocs += MessageDoc( - process = "obp.getBranch", - messageFormat = messageFormat, - description = "Get a Branch as specified by bankId and branchId", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetBranch.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetBranch.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetBranch(authInfoExample,"bankid", "branchid") - ), - exampleInboundMessage = ( - InboundGetBranch( - inboundAuthInfoExample, - Status("", - inboundStatusMessagesExample), - Some(InboundBranchVSept2018( - branchId = BranchId(""), - bankId = BankId(bankIdExample.value), - name = "", - address = Address(line1 = "", - line2 = "", - line3 = "", - city = "", - county = Some(""), - state = "", - postCode = "", - //ISO_3166-1_alpha-2 - countryCode = ""), - location = Location(11,11, None,None), - lobbyString = None, - driveUpString = None, - meta = Meta(License("","")), - branchRouting = None, - lobby = Some(Lobby(monday = List(OpeningTimes("","")), - tuesday = List(OpeningTimes("","")), - wednesday = List(OpeningTimes("","")), - thursday = List(OpeningTimes("","")), - friday = List(OpeningTimes("","")), - saturday = List(OpeningTimes("","")), - sunday = List(OpeningTimes("","")) - )), - driveUp = None, - // Easy access for people who use wheelchairs etc. - isAccessible = Some(true), - accessibleFeatures = None, - branchType = Some(""), - moreInfo = Some(""), - phoneNumber = Some(""), - isDeleted = Some(false) - )) - ) - - ), - adapterImplementation = Some(AdapterImplementation("Open Data", 1)) - ) - - override def getBranch(bankId : BankId, branchId: BranchId, callContext: Option[CallContext]) = writeMetricEndpointTiming { - - logger.debug("Enter getBranch for: " + branchId) - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(branchTTL second){ - val req = OutboundGetBranch(AuthInfo(), bankId.toString, branchId.toString) - logger.debug(s"Kafka getBranchFuture Req is: $req") - - val future: Future[(Option[InboundBranchVSept2018], Status)] = for { - res <- processToFuture[OutboundGetBranch](req) map { - f => - try { - f.extract[InboundGetBranch] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetBranch]().toString(false) - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetBranch class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map { - d => (d.data, d.status) - } - } yield { - res - } - - logger.debug(s"Kafka getBranchFuture Res says: is: $future") - future map { - case (Some(branch), status) if (status.errorCode=="") => - Full(branch, callContext) - case (_, status) if (status.errorCode!="") => - Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages) - case _ => - Failure(ErrorMessages.UnknownError) - } - } - } - }("getBranchFuture") - - - messageDocs += MessageDoc( - process = "obp.getAtms", - messageFormat = messageFormat, - description = "Get ATMs for a bank specified by bankId", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetAtms.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetAtms.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetAtms(authInfoExample,"bankid") - ), - exampleInboundMessage = ( - InboundGetAtms( - inboundAuthInfoExample, - Status(errorCodeExample, inboundStatusMessagesExample), - InboundAtmSept2018( - atmId = AtmId("333"), - bankId = BankId(bankIdExample.value), - name = "", - address = Address(line1 = "", - line2 = "", - line3 = "", - city = "", - county = Some(""), - state = "", - postCode = "", - //ISO_3166-1_alpha-2 - countryCode = ""), - location = Location(11,11, None,None), - meta = Meta(License(id = "pddl", name = "Open Data Commons Public Domain Dedication and License (PDDL)")), - OpeningTimeOnMonday = Some(""), - ClosingTimeOnMonday = Some(""), - - OpeningTimeOnTuesday = Some(""), - ClosingTimeOnTuesday = Some(""), - - OpeningTimeOnWednesday = Some(""), - ClosingTimeOnWednesday = Some(""), - - OpeningTimeOnThursday = Some(""), - ClosingTimeOnThursday = Some(""), - - OpeningTimeOnFriday = Some(""), - ClosingTimeOnFriday = Some(""), - - OpeningTimeOnSaturday = Some(""), - ClosingTimeOnSaturday = Some(""), - - OpeningTimeOnSunday = Some(""), - ClosingTimeOnSunday = Some(""), - isAccessible = Some(true), - - locatedAt = Some(""), - moreInfo = Some(""), - hasDepositCapability = Some(true) - ) :: Nil - ) - - ), - adapterImplementation = Some(AdapterImplementation("Open Data", 1)) - ) - - override def getAtms(bankId: BankId, callContext: Option[CallContext], queryParams: List[OBPQueryParam]) = writeMetricEndpointTiming { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(atmsTTL second){ - val req = OutboundGetAtms(AuthInfo(), bankId.value) - logger.debug(s"Kafka getAtmsFuture Req is: $req") - - val future = for { - res <- processToFuture[OutboundGetAtms](req) map { - f => - try { - f.extract[InboundGetAtms] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetAtms]().toString(false) - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetAtms class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map { - d => (d.data, d.status) - } - } yield { - res - } - - logger.debug(s"Kafka getAtmsFuture Res says: is: $future") - future map { - case (atms, status) if (status.errorCode=="") => - Full(atms, callContext) - case (_, status) if (status.errorCode!="") => - Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages) - case _ => - Failure(ErrorMessages.UnknownError) - } - } - } - }("getAtmsFuture") - - messageDocs += MessageDoc( - process = "obp.getAtm", - messageFormat = messageFormat, - description = "Get an ATM as specified by bankId and atmId.", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetAtm.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetAtm.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundGetAtm(authInfoExample,"bankId", "atmId") - ), - exampleInboundMessage = ( - InboundGetAtm( - inboundAuthInfoExample, - Status(errorCodeExample, inboundStatusMessagesExample), - Some(InboundAtmSept2018( - atmId = AtmId("333"), - bankId = BankId(bankIdExample.value), - name = "", - address = Address(line1 = "", - line2 = "", - line3 = "", - city = "", - county = Some(""), - state = "", - postCode = "", - //ISO_3166-1_alpha-2 - countryCode = ""), - location = Location(11,11, None,None), - meta = Meta(License(id = "pddl", name = "Open Data Commons Public Domain Dedication and License (PDDL)")), - OpeningTimeOnMonday = Some(""), - ClosingTimeOnMonday = Some(""), - - OpeningTimeOnTuesday = Some(""), - ClosingTimeOnTuesday = Some(""), - - OpeningTimeOnWednesday = Some(""), - ClosingTimeOnWednesday = Some(""), - - OpeningTimeOnThursday = Some(""), - ClosingTimeOnThursday = Some(""), - - OpeningTimeOnFriday = Some(""), - ClosingTimeOnFriday = Some(""), - - OpeningTimeOnSaturday = Some(""), - ClosingTimeOnSaturday = Some(""), - - OpeningTimeOnSunday = Some(""), - ClosingTimeOnSunday = Some(""), - isAccessible = Some(true), - - locatedAt = Some(""), - moreInfo = Some(""), - hasDepositCapability = Some(true) - ) - )) - ), - adapterImplementation = Some(AdapterImplementation("Open Data", 1)) - ) - - override def getAtm(bankId : BankId, atmId: AtmId, callContext: Option[CallContext]) = writeMetricEndpointTiming { - /** - * Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)" - * is just a temporary value filed with UUID values in order to prevent any ambiguity. - * The real value will be assigned by Macro during compile time at this line of a code: - * https://github.com/OpenBankProject/scala-macros/blob/master/macros/src/main/scala/com/tesobe/CacheKeyFromArgumentsMacro.scala#L49 - */ - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(atmTTL second){ - val req = OutboundGetAtm(AuthInfo(), bankId.value, atmId.value) - logger.debug(s"Kafka getAtmFuture Req is: $req") - - val future: Future[(Option[InboundAtmSept2018], Status)] = for { - res <- processToFuture[OutboundGetAtm](req) map { - f => - try { - f.extract[InboundGetAtm] - } catch { - case e: Exception => - val received = liftweb.json.compactRender(f) - val expected = SchemaFor[InboundGetAtm]().toString(false) - val error = s"$InvalidConnectorResponse Please check your to.obp.api.1.caseclass.$OutboundGetAtm class with the Message Doc : You received this ($received). We expected this ($expected)" - sendOutboundAdapterError(error) - throw new MappingException(error, e) - } - } map { - d => (d.data, d.status) - } - } yield { - res - } - - logger.debug(s"Kafka getAtmFuture Res says: is: $future") - future map { - case (Some(atm), status) if (status.errorCode=="") => - Full(atm, callContext) - case (_, status) if (status.errorCode!="") => - Failure("INTERNAL-"+ status.errorCode+". + CoreBank-Status:"+ status.backendMessages) - case _ => - Failure(ErrorMessages.UnknownError) - } - } - } - }("getAtmFuture") - - messageDocs += MessageDoc( - process = "obp.getChallengeThreshold", - messageFormat = messageFormat, - description = "Get Challenge Threshold", - outboundTopic = Some(Topics.createTopicByClassName(OutboundGetChallengeThreshold.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundGetChallengeThreshold.getClass.getSimpleName).response), - exampleOutboundMessage = (OutboundGetChallengeThreshold( - authInfoExample, - bankId = bankIdExample.value, - accountId = accountIdExample.value, - viewId = SYSTEM_OWNER_VIEW_ID, - transactionRequestType = "SEPA", - currency ="EUR", - userId = userIdExample.value, - userName =usernameExample.value - )), - exampleInboundMessage = ( - InboundGetChallengeThreshold( - inboundAuthInfoExample, - Status(errorCodeExample, inboundStatusMessagesExample), - AmountOfMoney( - currencyExample.value, - transactionAmountExample.value) - ) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 1)) - ) - - override def getChallengeThreshold( - bankId: String, - accountId: String, - viewId: String, - transactionRequestType: String, - currency: String, - userId: String, - username: String, - callContext: Option[CallContext] - ): OBPReturnType[Box[AmountOfMoney]] = writeMetricEndpointTiming { - var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString) - CacheKeyFromArguments.buildCacheKey { - Caching.memoizeWithProvider(Some(cacheKey.toString()))(atmTTL second){ - val authInfo = getAuthInfo(callContext).openOrThrowException(attemptedToOpenAnEmptyBox) - val req = OutboundGetChallengeThreshold(authInfo, bankId, accountId, viewId, transactionRequestType, currency, userId, username) - logger.debug(s"Kafka getChallengeThresholdFuture Req is: $req") - - processRequest[InboundGetChallengeThreshold](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full(inboundData.data) - case Full(inboundData) if (inboundData.status.hasError) => - Failure("INTERNAL-"+ inboundData.status.errorCode+". + CoreBank-Status:" + inboundData.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - } - }("getChallengeThreshold") - - messageDocs += MessageDoc( - process = "obp.makePaymentv210", - messageFormat = messageFormat, - description = "Make payment (create transaction).", - outboundTopic = Some(Topics.createTopicByClassName(OutboundCreateTransaction.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutboundCreateTransaction.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutboundCreateTransaction( - authInfoExample, - // fromAccount - fromAccountBankId =bankIdExample.value, - fromAccountId =accountIdExample.value, - - // transaction details - transactionRequestType ="SEPA", - transactionChargePolicy ="SHARE", - transactionRequestCommonBody = TransactionRequestBodyCommonJSON( - AmountOfMoneyJsonV121( - currencyExample.value, - transactionAmountExample.value), - transactionDescriptionExample.value), - - // toAccount or toCounterparty - toCounterpartyId = counterpartyIdExample.value, - toCounterpartyName = counterpartyNameExample.value, - toCounterpartyCurrency = currencyExample.value, - toCounterpartyRoutingAddress = accountRoutingAddressExample.value, - toCounterpartyRoutingScheme = accountRoutingSchemeExample.value, - toCounterpartyBankRoutingAddress = bankRoutingSchemeExample.value, - toCounterpartyBankRoutingScheme = bankRoutingAddressExample.value)), - exampleInboundMessage = ( - InboundCreateTransactionId( - inboundAuthInfoExample, - Status(errorCodeExample, inboundStatusMessagesExample), - InternalTransactionId(transactionIdExample.value) - ) - ), - adapterImplementation = Some(AdapterImplementation("Payments", 1)) - ) - override def makePaymentv210( - fromAccount: BankAccount, - toAccount: BankAccount, - transactionRequestId: TransactionRequestId, - transactionRequestCommonBody: TransactionRequestCommonBodyJSON, - amount: BigDecimal, - description: String, - transactionRequestType: TransactionRequestType, - chargePolicy: String, - callContext: Option[CallContext] - ): OBPReturnType[Box[TransactionId]]= { - - val req = OutboundCreateTransaction( - authInfo = getAuthInfo(callContext).openOrThrowException(NoCallContext), - - // fromAccount - fromAccountId = fromAccount.accountId.value, - fromAccountBankId = fromAccount.bankId.value, - - // transaction details - transactionRequestType = transactionRequestType.value, - transactionChargePolicy = chargePolicy, - transactionRequestCommonBody = transactionRequestCommonBody, - - // toAccount or toCounterparty - toCounterpartyId = toAccount.accountId.value, - toCounterpartyName = toAccount.name, - toCounterpartyCurrency = toAccount.currency, - toCounterpartyRoutingAddress = toAccount.accountId.value, - toCounterpartyRoutingScheme = "OBP", - toCounterpartyBankRoutingAddress = toAccount.bankId.value, - toCounterpartyBankRoutingScheme = "OBP" - ) - - processRequest[InboundCreateTransactionId](req) map { inbound => - val boxedResult = inbound match { - case Full(inboundData) if (inboundData.status.hasNoError) => - Full(TransactionId(inboundData.data.id)) - case Full(inboundData) if (inboundData.status.hasError) => - Failure("INTERNAL-"+ inboundData.status.errorCode+". + CoreBank-Status:" + inboundData.status.backendMessages) - case failureOrEmpty: Failure => failureOrEmpty - } - (boxedResult, callContext) - } - } - - messageDocs += MessageDoc( - process = "obp.createMeeting", - messageFormat = messageFormat, - description = "Create Meeting", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateMeeting.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateMeeting.getClass.getSimpleName).request), - exampleOutboundMessage = ( - OutBoundCreateMeeting(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - bankId= BankId(value="string"), - staffUser= UserCommons(userPrimaryKey= UserPrimaryKey(value=123), - userId="string", - idGivenByProvider="string", - provider="string", - emailAddress="string", - name="string"), - customerUser= UserCommons(userPrimaryKey= UserPrimaryKey(value=123), - userId="string", - idGivenByProvider="string", - provider="string", - emailAddress="string", - name="string"), - providerId="string", - purposeId="string", - when=new Date(), - sessionId="string", - customerToken="string", - staffToken="string", - creator= ContactDetails(name="string", - phone="string", - email="string"), - invitees=List( Invitee(contactDetails= ContactDetails(name="string", - phone="string", - email="string"), - status="string"))) - ), - exampleInboundMessage = ( - InBoundCreateMeeting(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data= MeetingCommons(meetingId="string", - providerId="string", - purposeId="string", - bankId="string", - present= MeetingPresent(staffUserId="string", - customerUserId="string"), - keys= MeetingKeys(sessionId="string", - customerToken="string", - staffToken="string"), - when=new Date(), - creator= ContactDetails(name="string", - phone="string", - email="string"), - invitees=List( Invitee(contactDetails= ContactDetails(name="string", - phone="string", - email="string"), - status="string")))) - ), - adapterImplementation = Some(AdapterImplementation("- Meeting", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.createOrUpdateKycCheck", - messageFormat = messageFormat, - description = "Create Or Update Kyc Check", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycCheck.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycCheck.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycCheck(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - bankId="string", - customerId="string", - id="string", - customerNumber="string", - date=new Date(), - how="string", - staffUserId="string", - mStaffName="string", - mSatisfied=true, - comments="string") - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycCheck(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data= KycCheckCommons(bankId="string", - customerId="string", - idKycCheck="string", - customerNumber="string", - date=new Date(), - how="string", - staffUserId="string", - staffName="string", - satisfied=true, - comments="string")) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.createOrUpdateKycDocument", - messageFormat = messageFormat, - description = "Create Or Update KYC Document", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycDocument.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycDocument.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycDocument(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - bankId="string", - customerId="string", - id="string", - customerNumber="string", - `type`="string", - number="string", - issueDate=new Date(), - issuePlace="string", - expiryDate=new Date()) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycDocument(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data= KycDocumentCommons(bankId="string", - customerId="string", - idKycDocument="string", - customerNumber="string", - `type`="string", - number="string", - issueDate=new Date(), - issuePlace="string", - expiryDate=new Date())) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.createOrUpdateKycMedia", - messageFormat = messageFormat, - description = "Create Or Update KYC Media", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycMedia.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycMedia.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycMedia(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - bankId="string", - customerId="string", - id="string", - customerNumber="string", - `type`="string", - url="string", - date=new Date(), - relatesToKycDocumentId="string", - relatesToKycCheckId="string") - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycMedia(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data= KycMediaCommons(bankId="string", - customerId="string", - idKycMedia="string", - customerNumber="string", - `type`="string", - url="string", - date=new Date(), - relatesToKycDocumentId="string", - relatesToKycCheckId="string")) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.createOrUpdateKycStatus", - messageFormat = messageFormat, - description = "Create Or Update KYC Status", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycStatus.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateOrUpdateKycStatus.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundCreateOrUpdateKycStatus(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - bankId="string", - customerId="string", - customerNumber="string", - ok=true, - date=new Date()) - ), - exampleInboundMessage = ( - InBoundCreateOrUpdateKycStatus(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data= KycStatusCommons(bankId="string", - customerId="string", - customerNumber="string", - ok=true, - date=new Date())) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.getKycDocuments", - messageFormat = messageFormat, - description = "Get KYC Documents", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycDocuments.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycDocuments.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundGetKycDocuments(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - customerId="string") - ), - exampleInboundMessage = ( - InBoundGetKycDocuments(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data=List( KycDocumentCommons(bankId="string", - customerId="string", - idKycDocument="string", - customerNumber="string", - `type`="string", - number="string", - issueDate=new Date(), - issuePlace="string", - expiryDate=new Date()))) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.getKycMedias", - messageFormat = messageFormat, - description = "Get KYC Medias", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycMedias.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycMedias.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundGetKycMedias(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - customerId="string") - ), - exampleInboundMessage = ( - InBoundGetKycMedias(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data=List( KycMediaCommons(bankId="string", - customerId="string", - idKycMedia="string", - customerNumber="string", - `type`="string", - url="string", - date=new Date(), - relatesToKycDocumentId="string", - relatesToKycCheckId="string"))) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.getKycStatuses", - messageFormat = messageFormat, - description = "Get KYC Statuses", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycStatuses.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycStatuses.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundGetKycStatuses(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - customerId="string") - ), - exampleInboundMessage = ( - InBoundGetKycStatuses(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data=List( KycStatusCommons(bankId="string", - customerId="string", - customerNumber="string", - ok=true, - date=new Date()))) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.getKycChecks", - messageFormat = messageFormat, - description = "Get KYC Checks", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycChecks.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundGetKycChecks.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundGetKycChecks(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - customerId="string") - ), - exampleInboundMessage = ( - InBoundGetKycChecks(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data=List( KycCheckCommons(bankId="string", - customerId="string", - idKycCheck="string", - customerNumber="string", - date=new Date(), - how="string", - staffUserId="string", - staffName="string", - satisfied=true, - comments="string"))) - ), - adapterImplementation = Some(AdapterImplementation("- KYC", 1)) - ) - - messageDocs += MessageDoc( - process = "obp.createMessage", - messageFormat = messageFormat, - description = "Create Message", - outboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateMessage.getClass.getSimpleName).request), - inboundTopic = Some(Topics.createTopicByClassName(OutBoundCreateMessage.getClass.getSimpleName).response), - exampleOutboundMessage = ( - OutBoundCreateMessage(outboundAdapterCallContext= OutboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - consumerId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string"))), - outboundAdapterAuthInfo=Option( OutboundAdapterAuthInfo(userId=Option("string"), - username=Option("string"), - linkedCustomers=Option(List( BasicLinkedCustomer(customerId="string", - customerNumber="string", - legalName="string"))), - userAuthContext=Option(List( BasicUserAuthContext(key="string", - value="string"))), - authViews=Option(List( AuthView(view= ViewBasic(id="string", - name="string", - description="string"), - account= AccountBasic(id="string", - accountRoutings=List( AccountRouting(scheme="string", - address="string")), - customerOwners=List( InternalBasicCustomer(bankId="string", - customerId="string", - customerNumber="string", - legalName="string", - dateOfBirth=new Date())), - userOwners=List( InternalBasicUser(userId="string", - emailAddress="string", - name="string"))))))))), - user= UserCommons(userPrimaryKey= UserPrimaryKey(value=123), - userId="string", - idGivenByProvider="string", - provider="string", - emailAddress="string", - name="string"), - bankId= BankId(value="string"), - message="string", - fromDepartment="string", - fromPerson="string") - ), - exampleInboundMessage = ( - InBoundCreateMessage(inboundAdapterCallContext= InboundAdapterCallContext(correlationId="string", - sessionId=Option("string"), - generalContext=Option(List( BasicGeneralContext(key="string", - value="string")))), - status= Status(errorCode="", - backendMessages=List( InboundStatusMessage(source="string", - status="string", - errorCode="", - text="string"))), - data= CustomerMessageCommons(messageId="string", - date=new Date(), - message="string", - fromDepartment="string", - fromPerson="string")) - ), - adapterImplementation = Some(AdapterImplementation("- Customer", 1)) - ) - - - - - - - - - -//---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-10-30T12:18:17Z - - messageDocs += createBankAccountDoc - def createBankAccountDoc = MessageDoc( - process = "obp.createBankAccount", - messageFormat = messageFormat, - description = "Create Bank Account", - outboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateBankAccount").request), - inboundTopic = Some(Topics.createTopicByClassName("OutBoundCreateBankAccount").request), - exampleOutboundMessage = ( - OutBoundCreateBankAccount(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - bankId=BankId(bankIdExample.value), - accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - accountLabel="string", - currency=currencyExample.value, - initialBalance=BigDecimal("123.321"), - accountHolderName="string", - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value))) - ), - exampleInboundMessage = ( - InBoundCreateBankAccount(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, - status=MessageDocsSwaggerDefinitions.inboundStatus, - data= BankAccountCommons(accountId=AccountId(accountIdExample.value), - accountType=accountTypeExample.value, - balance=BigDecimal(balanceExample.value), - currency=currencyExample.value, - name=bankAccountNameExample.value, - label=labelExample.value, - number=bankAccountNumberExample.value, - bankId=BankId(bankIdExample.value), - lastUpdate=toDate(bankAccountLastUpdateExample), - branchId=branchIdExample.value, - accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value, - address=accountRoutingAddressExample.value)), - accountRules=List( AccountRule(scheme=accountRuleSchemeExample.value, - value=accountRuleValueExample.value)), - accountHolder=bankAccountAccountHolderExample.value, - attributes=Some(List( Attribute(name=attributeNameExample.value, - `type`=attributeTypeExample.value, - value=attributeValueExample.value))))) - ), - adapterImplementation = Some(AdapterImplementation("- Core", 1)) - ) - - override def createBankAccount(bankId: BankId, accountId: AccountId, accountType: String, accountLabel: String, currency: String, initialBalance: BigDecimal, accountHolderName: String, branchId: String, accountRoutings: List[AccountRouting], callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { - import com.openbankproject.commons.dto.{InBoundCreateBankAccount => InBound, OutBoundCreateBankAccount => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, accountType, accountLabel, currency, initialBalance, accountHolderName, branchId, accountRoutings) - val response: Future[Box[InBound]] = processRequest[InBound](req) - response.map(convertToTuple[BankAccountCommons](callContext)) - } - -// ---------- created on 2024-10-30T12:18:17Z -//---------------- dynamic end ---------------------please don't modify this line -} - - -object KafkaMappedConnector_vSept2018 extends KafkaMappedConnector_vSept2018{ - def createCustomerJson(customer : Customer) : InternalBasicCustomer = { - InternalBasicCustomer( - bankId=customer.bankId, - customerId = customer.customerId, - customerNumber = customer.number, - legalName = customer.legalName, - dateOfBirth = customer.dateOfBirth - ) - } - def createObpCustomer(customer : InternalCustomer) : Customer = { - CustomerCommons( - customerId = customer.customerId, - bankId = customer.bankId, - number = customer.number, - legalName = customer.legalName, - mobileNumber = customer.mobileNumber, - email = customer.email, - faceImage = CustomerFaceImage(customer.faceImage.date,customer.faceImage.url), - dateOfBirth = customer.dateOfBirth, - relationshipStatus = customer.relationshipStatus, - dependents = customer.dependents, - dobOfDependents = customer.dobOfDependents, - highestEducationAttained = customer.highestEducationAttained, - employmentStatus = customer.employmentStatus, - creditRating = CreditRating(customer.creditRating.rating, customer.creditRating.source), - creditLimit = CreditLimit(customer.creditLimit.amount,customer.creditLimit.currency), - kycStatus = customer.kycStatus, - lastOkDate = customer.lastOkDate, - title = "", - branchId = "", - nameSuffix = "" - ) - } - - def createCustomersJson(customers : List[Customer]) : InternalBasicCustomers = { - InternalBasicCustomers(customers.map(createCustomerJson)) - } - - def createObpCustomers(customers : List[InternalCustomer]) : List[Customer] = { - customers.map(createObpCustomer) - } -} - - diff --git a/obp-api/src/main/scala/code/kafka/KafkaConfig.scala b/obp-api/src/main/scala/code/kafka/KafkaConfig.scala deleted file mode 100644 index cecd155e4..000000000 --- a/obp-api/src/main/scala/code/kafka/KafkaConfig.scala +++ /dev/null @@ -1,22 +0,0 @@ -package code.kafka - -import code.api.Constant -import code.api.util.{APIUtil, ErrorMessages} -import scala.concurrent.duration.{FiniteDuration, MILLISECONDS} - -/** - * Basic kafka configuration utility - */ -trait KafkaConfig { - - val bootstrapServers = APIUtil.getPropsValue("kafka.bootstrap_hosts")openOr("localhost:9092") - val groupId = APIUtil.getPropsValue("kafka.group.id").openOr("obp-api") - val apiInstanceId = Constant.ApiInstanceId - val partitions = APIUtil.getPropsAsIntValue("kafka.partitions", 10) - - val clientId = s"obp.api.$apiInstanceId" - val autoOffsetResetConfig = "earliest" - val maxWakeups = 50 - //TODO should be less then container's timeout - val completionTimeout = FiniteDuration(APIUtil.getPropsAsIntValue("kafka.akka.timeout", 2)*1000 - 450, MILLISECONDS) -} \ No newline at end of file diff --git a/obp-api/src/main/scala/code/kafka/KafkaHelper.scala b/obp-api/src/main/scala/code/kafka/KafkaHelper.scala deleted file mode 100644 index d094f90ab..000000000 --- a/obp-api/src/main/scala/code/kafka/KafkaHelper.scala +++ /dev/null @@ -1,168 +0,0 @@ -package code.kafka - -import akka.pattern.{AskTimeoutException, ask} -import code.actorsystem.{ObpActorInit, ObpLookupSystem} -import code.api.APIFailureNewStyle -import code.api.util.APIUtil.{fullBoxOrException, gitCommit, unboxFull, unboxFullOrFail} -import code.api.util.{APIUtil, CallContext, CustomJsonFormats} -import code.api.util.ErrorMessages._ -import code.util.Helper.MdcLoggable -import com.openbankproject.commons.model.{ObpApiLoopback, TopicTrait} -import net.liftweb -import net.liftweb.common._ -import net.liftweb.json -import net.liftweb.json.JsonAST.JNull -import net.liftweb.json.{Extraction, JValue, MappingException} - -import scala.concurrent.Future -import net.liftweb.json.JsonParser.ParseException -import net.liftweb.util.Helpers -import org.apache.kafka.common.KafkaException -import org.apache.kafka.common.errors._ - -object KafkaHelper extends KafkaHelper - -trait KafkaHelper extends ObpActorInit with MdcLoggable { - - override val actorName = "KafkaStreamsHelperActor" //CreateActorNameFromClassName(this.getClass.getName) - override val actor = ObpLookupSystem.getKafkaActor(actorName) - - - /** - * Have this function just to keep compatibility for KafkaMappedConnector_vMar2017 and KafkaMappedConnector.scala - * In KafkaMappedConnector.scala, we use Map[String, String]. Now we change to case class - * eg: case class Company(name: String, address: String) --> - * Company("TESOBE","Berlin") - * Map(name->"TESOBE", address->"2") - * - * @param caseClassObject - * @return Map[String, String] - */ - def transferCaseClassToMap(caseClassObject: scala.Product) = - caseClassObject.getClass.getDeclaredFields.map(_.getName) // all field names - .zip(caseClassObject.productIterator.to).toMap.asInstanceOf[Map[String, String]] // zipped with all values - - def process(request: scala.Product): JValue = { - val mapRequest:Map[String, String] = transferCaseClassToMap(request) - process(mapRequest) - } - - /** - * This function is used for Old Style Endpoints. - * It processes Kafka's Outbound message to JValue. - * @param request The request we send to Kafka - * @return Kafka's Inbound message as JValue - */ - def process (request: Map[String, String]): JValue = { - val boxedJValue = processToBox(request) - fullBoxOrException(boxedJValue) - // fullBoxOrException(boxedJValue) already process Empty and Failure, So the follow throw exception message just a stub. - boxedJValue.openOrThrowException("future extraction to box failed") - } - - /** - * This function is used for Old Style Endpoints at Kafka connector. - * It processes Kafka's Outbound message to JValue wrapped into Box. - * @param request The request we send to Kafka - * @return Kafka's Inbound message as JValue wrapped into Box - */ - def processToBox(request: Any): Box[JValue] = { - extractFutureToBox[JValue](actor ? request) - } - - /** - * This function is used for Old Style Endpoints at Kafka connector. - * It processes Kafka's Outbound message to JValue wrapped into Box. - * @param request The request we send to Kafka - * @tparam T the type of the Outbound message - * @return Kafka's Inbound message as JValue wrapped into Future - */ - def processToFuture[T](request: T): Future[JValue] = { - (actor ? request).mapTo[JValue] - } - /** - * This function is used for send request to kafka, and get the result extract to Box result. - * It processes Kafka's Outbound message to JValue wrapped into Box. - * @param request The request we send to Kafka - * @tparam T the type of the Inbound message - * @return Kafka's Inbound message into Future - */ - def processRequest[T: Manifest](request: TopicTrait): Future[Box[T]] = { - import com.openbankproject.commons.ExecutionContext.Implicits.global - import liftweb.json.compactRender - implicit val formats = CustomJsonFormats.nullTolerateFormats - val tp = manifest[T].runtimeClass - - (actor ? request) - .mapTo[JValue] - .map {jvalue => - try { - if (jvalue == JNull) - throw new Exception("Adapter can not return `null` value to OBP-API!") - else - Full(jvalue.extract[T]) - } catch { - case e: Exception => { - val errorMsg = s"${InvalidConnectorResponse} extract response payload to type ${tp} fail. the payload content: ${compactRender(jvalue)}. $e" - sendOutboundAdapterError(errorMsg, request) - - Failure(errorMsg, Full(e), Empty) - } - } - } - .recoverWith { - case e: ParseException => { - val errorMsg = s"${InvalidConnectorResponse} parse response payload to JValue fail. ${e.getMessage}" - sendOutboundAdapterError(errorMsg, request) - - Future(Failure(errorMsg, Box !! (e.getCause) or Full(e), Empty)) - } - case e: AskTimeoutException => { - echoKafkaServer - .map { _ => { - val errorMsg = s"${AdapterUnknownError} Timeout error, because Adapter do not return proper message to Kafka. ${e.getMessage}" - sendOutboundAdapterError(errorMsg, request) - Failure(errorMsg, Full(e), Empty) - } - } - .recover{ - case e: Throwable => Failure(s"${KafkaServerUnavailable} Timeout error, because kafka do not return message to OBP-API. ${e.getMessage}", Full(e), Empty) - } - } - case e @ (_:AuthenticationException| _:AuthorizationException| - _:IllegalStateException| _:InterruptException| - _:SerializationException| _:TimeoutException| - _:KafkaException| _:ApiException) - => Future(Failure(s"${KafkaUnknownError} OBP-API send message to kafka server failed. ${e.getMessage}", Full(e), Empty)) - } - } - - def sendOutboundAdapterError(error: String): Unit = actor ! OutboundAdapterError(error) - - def sendOutboundAdapterError(error: String, request: TopicTrait): Unit = { - implicit val formats = CustomJsonFormats.formats - val requestJson =json.compactRender(Extraction.decompose(request)) - s"""$error - |The request is: ${requestJson} - """.stripMargin - } - - /** - * check Kafka server, where send and request success - * @return ObpApiLoopback with duration - */ - def echoKafkaServer: Future[ObpApiLoopback] = { - import com.openbankproject.commons.ExecutionContext.Implicits.global - implicit val formats = CustomJsonFormats.formats - for{ - connectorVersion <- Future {APIUtil.getPropsValue("connector").openOrThrowException("connector props field `connector` not set")} - startTime = Helpers.now - req = ObpApiLoopback(connectorVersion, gitCommit, "") - obpApiLoopbackRespons <- (actor ? req) - .map(_.asInstanceOf[JValue].extract[ObpApiLoopback]) - .map(_.copy(durationTime = (Helpers.now.getTime - startTime.getTime).toString)) - } yield { - obpApiLoopbackRespons - } - } -} diff --git a/obp-api/src/main/scala/code/kafka/KafkaHelperActors.scala b/obp-api/src/main/scala/code/kafka/KafkaHelperActors.scala deleted file mode 100644 index 727191156..000000000 --- a/obp-api/src/main/scala/code/kafka/KafkaHelperActors.scala +++ /dev/null @@ -1,27 +0,0 @@ -package code.kafka - -import akka.actor.{ActorSystem, Props => ActorProps} -import code.util.Helper -import code.util.Helper.MdcLoggable - -object KafkaHelperActors extends MdcLoggable with KafkaHelper{ - - val props_hostname = Helper.getHostname - - def startKafkaHelperActors(actorSystem: ActorSystem) = { - // List all the ActorSystems used in Kafka, for now, we have Kafka and KafkaStreams - val actorsKafkaHelper = Map( - //ActorProps[KafkaHelperActor] -> actorName //KafkaHelper.actorName, we use kafka-steam now. - ActorProps[KafkaStreamsHelperActor] -> actorName //KafkaHelper.actorName - ) - //Create the actorSystem for all up list Kafka - actorsKafkaHelper.foreach { a => logger.info(actorSystem.actorOf(a._1, name = a._2)) } - } - - //This method is called in Boot.scala, when the OBP-API start, if the connector is Kafka_*, it will create the ActorSystem for Kafka - def startLocalKafkaHelperWorkers(system: ActorSystem): Unit = { - logger.info("Starting local KafkaHelper workers") - startKafkaHelperActors(system) - } - -} diff --git a/obp-api/src/main/scala/code/kafka/MessageProcessorTrait.scala b/obp-api/src/main/scala/code/kafka/MessageProcessorTrait.scala deleted file mode 100644 index e4745f7a6..000000000 --- a/obp-api/src/main/scala/code/kafka/MessageProcessorTrait.scala +++ /dev/null @@ -1,7 +0,0 @@ -package code.kafka - -import org.apache.kafka.clients.consumer.ConsumerRecord - -trait MessageProcessorTrait[K, V] { - def processMessage(record: ConsumerRecord[K, V]): Unit -} diff --git a/obp-api/src/main/scala/code/kafka/MessageProcssor.scala b/obp-api/src/main/scala/code/kafka/MessageProcssor.scala deleted file mode 100644 index 916359943..000000000 --- a/obp-api/src/main/scala/code/kafka/MessageProcssor.scala +++ /dev/null @@ -1,20 +0,0 @@ -package code.kafka - -import code.actorsystem.ObpLookupSystem -import code.kafka.actor.RequestResponseActor.Response -import code.util.Helper.MdcLoggable -import org.apache.kafka.clients.consumer.ConsumerRecord - -/** - * This class implements behavior of North Side Consumer - * i.e. how the consumer processes a received Kafka message - */ -class NorthSideConsumerMessageProcessor extends MessageProcessorTrait[String, String] with MdcLoggable with KafkaHelper { - override def processMessage(record: ConsumerRecord[String, String]): Unit = { - val backendRequestId = record.key() - val payload = record.value() - logger.debug(s"kafka consumer :$record") - // Try to find a child actor of "KafkaStreamsHelperActor" with a name equal to value of backendRequestId - ObpLookupSystem.getKafkaActorChild(actorName, backendRequestId) ! Response(backendRequestId, payload) - } -} diff --git a/obp-api/src/main/scala/code/kafka/NorthSideConsumer.scala b/obp-api/src/main/scala/code/kafka/NorthSideConsumer.scala deleted file mode 100644 index e0132ee9d..000000000 --- a/obp-api/src/main/scala/code/kafka/NorthSideConsumer.scala +++ /dev/null @@ -1,124 +0,0 @@ -package code.kafka - - -import java.util.regex.Pattern - -import code.api.util.APIUtil -import code.util.ClassScanUtils -import code.util.Helper.MdcLoggable -import org.apache.kafka.clients.consumer.{ConsumerConfig, KafkaConsumer} -import org.apache.kafka.common.serialization.StringDeserializer - -object NorthSideConsumer { - - private[this] val outboundNamePattern= Pattern.compile("""com\.openbankproject\.commons\..*(OutBound.+)""") - - val listOfTopics : List[String] = (Set( - "OutboundGetAdapterInfo", - "OutboundGetBanks", - "OutboundGetBank", - "OutboundGetUserByUsernamePassword", - "OutboundGetAccounts", - "OutboundGetAccountbyAccountID", - "OutboundCheckBankAccountExists", - "OutboundGetCoreBankAccounts", - "OutboundGetCoreBankAccounts", - "OutboundGetTransactions", - "OutboundGetTransaction", - "OutboundCreateTransaction", - "OutboundGetBranches", - "OutboundGetBranch", - "OutboundGetAtms", - "OutboundGetAtm", - "OutboundCreateChallengeJune2017", - "OutboundCreateCounterparty", - "OutboundGetTransactionRequests210", - "OutboundGetCounterparties", - "OutboundGetCounterpartyByCounterpartyId", - "OutboundGetCounterparty", - "OutboundCounterparty", - "OutboundGetCounterpartyById", - "OutboundTransactionRequests", - "OutboundGetCustomersByUserId", - "OutboundGetCheckbookOrderStatus", - "OutboundGetCreditCardOrderStatus", - "OutboundGetBankAccountsHeld", - "OutboundGetChallengeThreshold", - "OutboundCreateChallengeSept2018", - "ObpApiLoopback" //This topic is tricky now, it is just used in api side: api produce and consumer it. Not used over adapter. Only for test api <--> kafka. - ) ++ ClassScanUtils.findTypes(classInfo => outboundNamePattern.matcher(classInfo.name).matches()) - .map(outboundNamePattern.matcher(_).replaceFirst("$1"))).toList - - def consumerProperties(brokers: String, group: String, keyDeserealizer: String, valueDeserealizer: String): Map[String, String] = { - if (APIUtil.getPropsValue("kafka.use.ssl").getOrElse("false") == "true") { - Map[String, String]( - ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG -> brokers, - ConsumerConfig.GROUP_ID_CONFIG -> group, - ConsumerConfig.AUTO_OFFSET_RESET_CONFIG -> OBPKafkaConsumer.autoOffsetResetConfig, - ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG -> keyDeserealizer, - ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG -> valueDeserealizer, - "security.protocol" -> "SSL", - "ssl.truststore.location" -> APIUtil.getPropsValue("truststore.path").getOrElse(""), - "ssl.truststore.password" -> APIUtil.getPropsValue("keystore.password").getOrElse(APIUtil.initPasswd), - "ssl.keystore.location" -> APIUtil.getPropsValue("keystore.path").getOrElse(""), - "ssl.keystore.password" -> APIUtil.getPropsValue("keystore.password").getOrElse(APIUtil.initPasswd) - ) - } else { - Map[String, String]( - ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG -> brokers, - ConsumerConfig.GROUP_ID_CONFIG -> group, - ConsumerConfig.AUTO_OFFSET_RESET_CONFIG -> OBPKafkaConsumer.autoOffsetResetConfig, - ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG -> keyDeserealizer, - ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG -> valueDeserealizer - ) - } - } - - def apply[K, V](brokers: String, topic: String, group: String, processor: MessageProcessorTrait[K, V]): NorthSideConsumer[K, V] = - new NorthSideConsumer[K, V](brokers, topic, group, classOf[StringDeserializer].getName, classOf[StringDeserializer].getName, processor) -} - -class NorthSideConsumer[K, V](brokers: String, topic: String, group: String, keyDeserealizer: String, valueDeserealizer: String, - processor: MessageProcessorTrait[K, V]) extends Runnable with MdcLoggable with KafkaConfig { - - import NorthSideConsumer._ - - import scala.collection.JavaConversions._ - - val consumer = new KafkaConsumer[K, V](consumerProperties(brokers, group, keyDeserealizer, valueDeserealizer)) - //The following topic is for loopback, only for testing api <--> kafka - val apiLoopbackTopic = s"from.${clientId}.to.adapter.mf.caseclass.ObpApiLoopback" - val allTopicsOverAdapter= listOfTopics.map(t => s"to.${clientId}.caseclass.$t") - //we use the same topic to send to Kakfa and listening the same topic to get the message back. - //So there is no to.obp.api.1.caseclass..ObpApiLoopback at all. Just use `apiLoopbackTopic` in the response topic. - val allTopicsApiListening: List[String] = allTopicsOverAdapter :+ apiLoopbackTopic - consumer.subscribe(allTopicsApiListening) - - @volatile var completed = false - @volatile var started = false - - def complete(): Unit = { - completed = true - } - - override def run(): Unit = { - while (!completed) { - val records = consumer.poll(100) - for (record <- records) { - processor.processMessage(record) - } - } - consumer.close() - logger.info("Consumer closed") - } - - def start(): Unit = { - if(!started) { - logger.info("Consumer started") - val t = new Thread(this) - t.start() - started = true - } - } - -} diff --git a/obp-api/src/main/scala/code/kafka/OBPKafkaConsumer.scala b/obp-api/src/main/scala/code/kafka/OBPKafkaConsumer.scala deleted file mode 100644 index 6fe37bb88..000000000 --- a/obp-api/src/main/scala/code/kafka/OBPKafkaConsumer.scala +++ /dev/null @@ -1,5 +0,0 @@ -package code.kafka - -object OBPKafkaConsumer extends KafkaConfig { - lazy val primaryConsumer = NorthSideConsumer(bootstrapServers, "", groupId + "-north.side.consumer", new NorthSideConsumerMessageProcessor()) -} diff --git a/obp-api/src/main/scala/code/kafka/actor/RequestResponseActor.scala b/obp-api/src/main/scala/code/kafka/actor/RequestResponseActor.scala deleted file mode 100644 index 937fea8a0..000000000 --- a/obp-api/src/main/scala/code/kafka/actor/RequestResponseActor.scala +++ /dev/null @@ -1,53 +0,0 @@ -package code.kafka.actor - -import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, PoisonPill} -import code.util.Helper.MdcLoggable -import shapeless.ops.zipper.Down - -import scala.concurrent.duration.DurationInt - - -object RequestResponseActor { - case class Request(backendRequestId: String, payload: String) - case class Response(backendRequestId: String, payload: String) -} - -/** - * This Actor acts in next way: - * 1. Someone sends a message to it, i.e. "thisActor ? Request(backendRequestId, requestMessage)" - * 2. The actor log the request - * 3. The actor immediately start to listen to a Response(backendRequestId, responseMessage) - * without returning answer to "thisActor ? Request(backendRequestId, requestMessage)" - * 4. The actor receives the Response(backendRequestId, responseMessage - * 5. The actor sends answer to "thisActor ? Request(backendRequestId, requestMessage)" - * 6. The actor destroy itself - * - * Please note that this type of Actor during its life cycle: - * - leaves up to 60 seconds - * - serves only one Kafka message - */ -class RequestResponseActor extends Actor with ActorLogging with MdcLoggable { - import RequestResponseActor._ - - def receive = waitingForRequest - - private def waitingForRequest: Receive = { - case Request(backendRequestId, payload) => - implicit val ec = context.dispatcher - val timeout = context.system.scheduler.scheduleOnce(60.second, self, Down) - context become waitingForResponse(sender, timeout) - logger.info(s"Request (backendRequestId, payload) = ($backendRequestId, $payload) was sent.") - } - - private def waitingForResponse(origin: ActorRef, timeout: Cancellable): Receive = { - case Response(backendRequestId, payload) => - timeout.cancel() - origin ! payload - self ! PoisonPill - logger.info(s"Response (backendRequestId, payload) = ($backendRequestId, $payload) was processed.") - case Down => - self ! PoisonPill - logger.info(s"Actor $self was destroyed by the scheduler.") - } - -} \ No newline at end of file diff --git a/obp-api/src/main/scala/code/kafka/kafkaStreamsHelper.scala b/obp-api/src/main/scala/code/kafka/kafkaStreamsHelper.scala deleted file mode 100644 index ffda837f5..000000000 --- a/obp-api/src/main/scala/code/kafka/kafkaStreamsHelper.scala +++ /dev/null @@ -1,262 +0,0 @@ -package code.kafka - -import java.util.concurrent.{Future => JFuture} - -import akka.actor.{Actor, PoisonPill, Props} -import akka.kafka.ProducerSettings -import akka.pattern.pipe -import akka.stream.ActorMaterializer -import code.actorsystem.{ObpActorHelper, ObpActorInit} -import code.api.util.{APIUtil, CustomJsonFormats} -import code.bankconnectors.AvroSerializer -import code.kafka.actor.RequestResponseActor -import code.kafka.actor.RequestResponseActor.Request -import code.util.Helper.MdcLoggable -import com.openbankproject.commons.model.TopicTrait -import net.liftweb.json -import net.liftweb.json.JsonParser.ParseException -import net.liftweb.json.{Extraction, JsonAST} -import org.apache.kafka.clients.producer.{Callback, ProducerRecord, RecordMetadata} -import org.apache.kafka.common.serialization.StringSerializer - -import scala.concurrent.{ExecutionException, Future} -import scala.util.Try - -/** - * Actor for accessing kafka from North side. - */ -class KafkaStreamsHelperActor extends Actor with ObpActorInit with ObpActorHelper with MdcLoggable with KafkaConfig with AvroSerializer { - - implicit val formats = CustomJsonFormats.formats - - implicit val materializer = ActorMaterializer() - - import materializer._ - /** - *Random select the partitions number from 0 to kafka.partitions value - *The specified partition number will be inside the Key. - */ - private def keyAndPartition = scala.util.Random.nextInt(partitions) + "_" + APIUtil.generateUUID() - - private val producerSettings = if (APIUtil.getPropsValue("kafka.use.ssl").getOrElse("false") == "true") { - ProducerSettings(system, new StringSerializer, new StringSerializer) - .withBootstrapServers(bootstrapServers) - .withProperty("batch.size", "0") - .withParallelism(3) - .withProperty("security.protocol","SSL") - .withProperty("ssl.truststore.location", APIUtil.getPropsValue("truststore.path").getOrElse("")) - .withProperty("ssl.truststore.password", APIUtil.getPropsValue("keystore.password").getOrElse(APIUtil.initPasswd)) - .withProperty("ssl.keystore.location",APIUtil.getPropsValue("keystore.path").getOrElse("")) - .withProperty("ssl.keystore.password", APIUtil.getPropsValue("keystore.password").getOrElse(APIUtil.initPasswd)) - } else { - ProducerSettings(system, new StringSerializer, new StringSerializer) - .withBootstrapServers(bootstrapServers) - .withProperty("batch.size", "0") - .withParallelism(3) - } - - private val producer = producerSettings.createKafkaProducer() - - /** - * communication with Kafka, send and receive message. - * This method will send message to Kafka, using the specified key and partition for each topic - * And get the message from the specified partition and filter by key - */ - private val sendRequestAndGetResponseFromKafka: ((TopicPair, String, String) => Future[String]) = { (topic, key, value) => - //When we send RequestTopic message, contain the partition in it, and when we get the ResponseTopic according to the partition. - val requestTopic = topic.request - val responseTopic = topic.response - if (NorthSideConsumer.listOfTopics.exists(_ == responseTopic)) { - logger.error(s"North Kafka Consumer is not subscribed to a topic: $responseTopic") - } - // This actor is used to listen to a message which will be sent by NorthSideConsumer - val actorListener = context.actorOf(Props[RequestResponseActor], key) - - /** - * This function is used o send Kafka message in Async way to a Kafka broker - * In case the the broker cannot accept the message an error is logged - * @param requestTopic A topic used to send Kafka message to Adapter side - * @param key Kafka Message key - * @param value Kafka Message value - */ - def sendAsync(requestTopic: String, key: String, value: String): JFuture[RecordMetadata] = { - val message = new ProducerRecord[String, String](requestTopic, key, value) - logger.debug(s" kafka producer : $message") - producer.send(message, (_: RecordMetadata, e: Exception) => { - if (e != null) { - e.printStackTrace() - logger.error(s"unknown error happened in kafka producer,the following message to do producer properly: $message") - actorListener ! PoisonPill - } - }) - } - - def listenResponse: Future[String] = { - import akka.pattern.ask - // Listen to a message which will be sent by NorthSideConsumer - (actorListener ? Request(key, value)).mapTo[String] // this future will be fail future with AskTimeoutException - } - - //producer publishes the message to a broker - try { - import scala.util.{Failure => JFailure, Success => JSuccess} - - val jFuture = sendAsync(requestTopic, key, value) - if(jFuture.isDone) Try(jFuture.get()) match { - case JSuccess(_) => listenResponse - // reference KafkaProducer#send method source code, it may return KafkaProducer#FutureFailure, this case return fail future of ApiException - case JFailure(e: ExecutionException) => Future.failed(e.getCause) - case JFailure(e) => Future.failed(e) // impossible case, just add this case as insurance - } else { - listenResponse// here will not block, so don't worry sync thread - } - } catch { - case e:Throwable => Future.failed(e) - } - } - - private val stringToJValueF: (String => Future[JsonAST.JValue]) = { r => - logger.debug("kafka-consumer-stringToJValueF:" + r) - Future(json.parse(r)).recover { - case e: ParseException => throw new ParseException(s"parse json fail, the wrong json String is: $r", e) - } - } - - val extractJValueToAnyF: (JsonAST.JValue => Future[Any]) = { r => - logger.debug("kafka-consumer-extractJValueToAnyF:" + r) - Future(extractResult(r)) - } - - val anyToJValueF: (Any => Future[json.JValue]) = { m => - logger.debug("kafka-produce-anyToJValueF:" + m) - Future(Extraction.decompose(m)) - } - - val serializeF: (json.JValue => Future[String]) = { m => - logger.debug("kafka-produce-serializeF:" + m) - Future(json.compactRender(m)) - } - - //private val RESP: String = "{\"count\": \"\", \"data\": [], \"state\": \"\", \"pager\": \"\", \"target\": \"banks\"}" - - override def preStart(): Unit = { - super.preStart() - val conn = { - - val c = APIUtil.getPropsValue("connector").openOr("June2017") - if (c.contains("_")) c.split("_")(1) else c - } - //configuration optimization is postponed - //self ? conn - } - - def receive = { - case value: String => - logger.debug("kafka_request[value]: " + value) - for { - t <- Future(Topics.topicPairHardCode) // Just have two Topics: obp.request.version and obp.response.version - r <- sendRequestAndGetResponseFromKafka(t, keyAndPartition, value) - jv <- stringToJValueF(r) - } yield { - logger.debug("South Side recognises version info") - jv - } - - // This is for KafkaMappedConnector_vJune2017, the request is TopicTrait - /** - * the follow matched case, if pipTo sender, then all exception will in Future, exception means: - * > net.liftweb.json.JsonParser.ParseException is response parse JValue fail - * > AskTimeoutException timeout but have no response return - * > (AuthenticationException| AuthorizationException| IllegalStateException| InterruptException| SerializationException| TimeoutException| KafkaException| ApiException) send message to kafka server fail - */ - case request: TopicTrait => - logger.debug("kafka_request[TopicCaseClass]: " + request) - val f = for { - t <- Future(Topics.createTopicByClassName(request.getClass.getSimpleName)) - d <- anyToJValueF(request) - s <- serializeF(d) - r <- sendRequestAndGetResponseFromKafka(t,keyAndPartition, s) //send s to kafka server,and get message, may case fail Futures: - jv <- stringToJValueF(r)// String to JValue, may return fail Future of net.liftweb.json.JsonParser.ParseException - } yield { - jv - } - f pipeTo sender - - // This is for KafkaMappedConnector_JVMcompatible, KafkaMappedConnector_vMar2017 and KafkaMappedConnector, the request is Map[String, String] - case request: Map[_, _] => - logger.debug("kafka_request[Map[String, String]]: " + request) - val orgSender = sender - val f = for { - t <- Future(Topics.topicPairFromProps) // Just have two Topics: Request and Response - d <- anyToJValueF(request) - v <- serializeF(d) - r <- sendRequestAndGetResponseFromKafka(t, keyAndPartition, v) - jv <- stringToJValueF(r) - } yield { - jv - } - f pipeTo orgSender - - // This is used to send Outbound Adapter Error to Kafka topic responsable for it - case request: OutboundAdapterError => - val key = APIUtil.generateUUID() - val value = request.error - val topic = s"from.obp.api.${apiInstanceId}.to.adapter.mf.caseclass.OutboundAdapterError" - val message = new ProducerRecord[String, String](topic, key, value) - logger.debug(s" kafka producer's OutboundAdapterError : $message") - producer.send(message, new Callback { - override def onCompletion(metadata: RecordMetadata, e: Exception): Unit = { - if (e != null) { - val msg = e.printStackTrace() - logger.error(s"unknown error happened in kafka producer's OutboundAdapterError, the following message to do producer properly: $message") - } - } - }) - } -} - -/** - * This case class design an error send to Kafka topic "from.obp.api.${apiInstanceId}.to.adapter.mf.caseclass.OutboundAdapterError - * @param error the error message sent to Kafka - */ -case class OutboundAdapterError(error: String) - -/** - * This case class design a pair of Topic, for both North and South side. - * They are a pair - * @param request eg: obp.June2017.N.GetBanks - * @param response eg: obp.June2017.S.GetBanks - */ -case class TopicPair(request: String, response: String) - -object Topics extends KafkaConfig { - - /** - * Two topics: - * Request : North is producer, South is the consumer. North --> South - * Response: South is producer, North is the consumer. South --> North - */ - private val requestTopic = APIUtil.getPropsValue("kafka.request_topic").openOr("Request") - private val responseTopic = APIUtil.getPropsValue("kafka.response_topic").openOr("Response") - - /** - * set in props, we have two topics: Request and Response - */ - val topicPairFromProps = TopicPair(requestTopic, responseTopic) - - def topicPairHardCode = TopicPair("obp.Request.version", "obp.Response.version") - - def createTopicByClassName(className: String): TopicPair = { - - /** - * eg: - * from.obp.api.1.to.adapter.mf.caseclass.GetBank - * to.obp.api.1.caseclass.GetBank - */ - TopicPair( - s"from.obp.api.${apiInstanceId}.to.adapter.mf.caseclass.${className.replace("$", "")}", - s"to.obp.api.${apiInstanceId}.caseclass.${className.replace("$", "")}" - ) - } - -} diff --git a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala index fbef73572..4594c764a 100644 --- a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala +++ b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala @@ -1122,7 +1122,7 @@ def restoreSomeSessions(): Unit = { S.error(S.?(ErrorMessages.UsernameHasBeenLocked)) loginRedirect(ObpS.param("Referer").or(S.param("Referer"))) - // Check if user came from kafka/obpjvm/stored_procedure and + // Check if user came from CBS and // if User is NOT locked. Then check username and password // from connector in case they changed on the south-side case Full(user) if externalUserIsValidatedAndNotLocked(usernameFromGui, user) && testExternalPassword(usernameFromGui, passwordFromGui) => @@ -1131,7 +1131,7 @@ def restoreSomeSessions(): Unit = { val preLoginState = capturePreLoginState() logger.info("login redirect: " + loginRedirect.get) val redirect = redirectUri(user.user.foreign) - //This method is used for connector = kafka* || obpjvm* + //This method is used for connector = cbs* || obpjvm* //It will update the views and createAccountHolder .... registeredUserHelper(user.getProvider(),user.username.get) // User init actions @@ -1150,8 +1150,7 @@ def restoreSomeSessions(): Unit = { // If user cannot be found locally, try to authenticate user via connector - case Empty if (APIUtil.getPropsAsBoolValue("connector.user.authentication", false) || - APIUtil.getPropsAsBoolValue("kafka.user.authentication", false) ) => + case Empty if (APIUtil.getPropsAsBoolValue("connector.user.authentication", false)) => val preLoginState = capturePreLoginState() logger.info("login redirect: " + loginRedirect.get) @@ -1235,7 +1234,7 @@ def restoreSomeSessions(): Unit = { * This method will update the views and createAccountHolder .... */ def registeredUserHelper(provider: String, username: String) = { - if (connector.startsWith("kafka")) { + if (connector.startsWith("rest_vMar2019")) { for { u <- Users.users.vend.getUserByProviderAndUsername(provider, username) } yield { diff --git a/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala b/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala index 1ead4906a..53af3e711 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala @@ -30,7 +30,7 @@ trait ChallengeProvider { def getChallengesByBasketId(basketId: String): Box[List[ChallengeTrait]] /** - * There is another method: Connector.validateChallengeAnswer, it validate the challenge over Kafka. + * There is another method: Connector.validateChallengeAnswer, it validates the challenge over CBS. * This method, will validate the answer in OBP side. */ def validateChallenge(challengeId: String, challengeAnswer: String, userId: Option[String]) : Box[ChallengeTrait] diff --git a/obp-api/src/main/scala/code/util/Helper.scala b/obp-api/src/main/scala/code/util/Helper.scala index a76291004..2d8bde111 100644 --- a/obp-api/src/main/scala/code/util/Helper.scala +++ b/obp-api/src/main/scala/code/util/Helper.scala @@ -235,7 +235,6 @@ object Helper extends Loggable { /** * Used for version extraction from props string */ - val matchAnyKafka = "kafka.*|star".r val matchAnyStoredProcedure = "stored_procedure.*|star".r /** diff --git a/obp-api/src/main/scala/code/views/Views.scala b/obp-api/src/main/scala/code/views/Views.scala index 720a24ea3..f2dc93ec4 100644 --- a/obp-api/src/main/scala/code/views/Views.scala +++ b/obp-api/src/main/scala/code/views/Views.scala @@ -93,12 +93,12 @@ trait Views { final def getPrivateBankAccountsFuture(user : User, bankId : BankId) : Future[List[BankIdAccountId]] = Future {getPrivateBankAccounts(user, bankId)} /** - * @param bankIdAccountId the IncomingAccount from Kafka + * @param bankIdAccountId the IncomingAccount from CBS * @param viewId This field should be selected one from Owner/Public/Accountant/Auditor, only support * these four values. * @return This will insert a View (e.g. the owner view) for an Account (BankAccount), and return the view * Note: - * updateUserAccountViews would call createAccountView once per View specified in the IncomingAccount from Kafka. + * updateUserAccountViews would call createAccountView once per View specified in the IncomingAccount from CBS. * We should cache this function because the available views on an account will change rarely. * */ diff --git a/obp-api/src/test/scala/code/api/v2_2_0/API2_2_0Test.scala b/obp-api/src/test/scala/code/api/v2_2_0/API2_2_0Test.scala index 25a7fe76c..34e50d2b3 100644 --- a/obp-api/src/test/scala/code/api/v2_2_0/API2_2_0Test.scala +++ b/obp-api/src/test/scala/code/api/v2_2_0/API2_2_0Test.scala @@ -423,25 +423,7 @@ class API2_2_0Test extends V220ServerSetup with DefaultUsers { val response: APIResponse = makeGetRequest(request) response.code should be (200) - } - scenario("Get Message Docs - kafka_vSept2018") { - val request = (v2_2Request / "message-docs" / "kafka_vSept2018" ) - val response: APIResponse = makeGetRequest(request) - - response.code should be (200) - } - scenario("Get Message Docs - kafka_vMay2019") { - val request = (v2_2Request / "message-docs" / "kafka_vMay2019" ) - val response: APIResponse = makeGetRequest(request) - - response.code should be (200) - } - scenario("Get Message Docs - rest_vMar2019") { - val request = (v2_2Request / "message-docs" / "rest_vMar2019" ) - val response: APIResponse = makeGetRequest(request) - - response.code should be (200) - } + } scenario("Get Message Docs - stored_procedure_vDec2019") { val request = (v2_2Request / "message-docs" / "stored_procedure_vDec2019" ) val response: APIResponse = makeGetRequest(request) diff --git a/obp-api/src/test/scala/code/api/v3_1_0/ObpApiLoopbackTest.scala b/obp-api/src/test/scala/code/api/v3_1_0/ObpApiLoopbackTest.scala index bec51ab36..e448e5a1a 100644 --- a/obp-api/src/test/scala/code/api/v3_1_0/ObpApiLoopbackTest.scala +++ b/obp-api/src/test/scala/code/api/v3_1_0/ObpApiLoopbackTest.scala @@ -53,7 +53,7 @@ class ObpApiLoopbackTest extends V310ServerSetup { Then("We should get a 400") response310.code should equal(400) val connectorVersion = APIUtil.getPropsValue("connector").openOrThrowException("connector props filed `connector` not set") - val errorMessage = s"${NotImplemented}for connector ${connectorVersion}" + val errorMessage = s"${NotImplemented}" And("error should be " + errorMessage) response310.body.extract[ErrorMessage].message should equal (errorMessage) } diff --git a/obp-api/src/test/scala/code/container/EmbeddedKafka.scala b/obp-api/src/test/scala/code/container/EmbeddedKafka.scala deleted file mode 100644 index ae0e4cd81..000000000 --- a/obp-api/src/test/scala/code/container/EmbeddedKafka.scala +++ /dev/null @@ -1,79 +0,0 @@ -package code.container - -import code.api.v5_0_0.V500ServerSetup -import code.setup.DefaultUsers -import org.apache.kafka.clients.consumer.{ConsumerConfig, KafkaConsumer} -import org.apache.kafka.clients.producer.{KafkaProducer, ProducerConfig, ProducerRecord} -import org.apache.kafka.common.serialization.{StringDeserializer, StringSerializer} -import org.scalatest.Ignore -import org.testcontainers.kafka.KafkaContainer - -import java.util.{Collections, Properties} -import scala.jdk.CollectionConverters._ - - -@Ignore -class EmbeddedKafka extends V500ServerSetup with DefaultUsers { - - val kafkaContainer: KafkaContainer = new KafkaContainer("apache/kafka-native:3.8.0") - // It registers a shutdown hook, which is a block of code (or function) that runs when the application terminates, - // - either normally(e.g., when the main method completes) - // - or due to an external signal(e.g., Ctrl + C or termination by the operating system). - sys.addShutdownHook { - kafkaContainer.stop() - } - override def beforeAll(): Unit = { - super.beforeAll() - // Start RabbitMQ container - kafkaContainer.start() - } - - override def afterAll(): Unit = { - super.afterAll() - kafkaContainer.stop() - } - - feature(s"test EmbeddedKafka") { - scenario("Publish and Consume Message") { - - val bootstrapServers: String = kafkaContainer.getBootstrapServers - - // Kafka producer properties - val producerProps = new Properties() - producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers) - producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, classOf[StringSerializer].getName) - producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, classOf[StringSerializer].getName) - - // Kafka consumer properties - val consumerProps = new Properties() - consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers) - consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, "test-group") - consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, classOf[StringDeserializer].getName) - consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, classOf[StringDeserializer].getName) - consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") - - // Create a producer - val producer = new KafkaProducer[String, String](producerProps) - val topic = "test-topic" - val key = "test-key" - val value = "Hello, Kafka!" - - // Produce a message - producer.send(new ProducerRecord[String, String](topic, key, value)) - producer.close() - - // Create a consumer - val consumer = new KafkaConsumer[String, String](consumerProps) - consumer.subscribe(Collections.singletonList(topic)) - - // Consume the message - val records = consumer.poll(5000L) - consumer.close() - - val messages = records.asScala.map(record => record.value()) - messages should contain(value) - - } - } - -} \ No newline at end of file diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/BankingModel.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/BankingModel.scala index 05b4ae2ad..356c035ab 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/BankingModel.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/BankingModel.scala @@ -101,7 +101,6 @@ case class TransactionRequestStatusValue(value : String) { override def toString = value } -//Note: change case class -> trait, for kafka extends it trait TransactionRequestStatus{ def transactionRequestId : String def bulkTransactionsStatus: List[TransactionStatus] diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala index 195a8c7ab..4e0af1910 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala @@ -44,7 +44,7 @@ trait JsonFieldReName /** * -* This is the base class for all kafka outbound case class +* This is the base class for all CBS outbound case class * action and messageFormat are mandatory * The optionalFields can be any other new fields . */ @@ -251,7 +251,7 @@ trait CustomerAddress { def insertDate: Date } -// This is the common InboundAccount from all Kafka/remote, not finished yet. +// This is the common InboundAccount from all CBS/remote, not finished yet. trait InboundAccount{ def bankId: String def branchId: String @@ -392,8 +392,6 @@ trait RoutingT { def address: String } -// @see 'case request: TopicTrait' in code/bankconnectors/kafkaStreamsHelper.scala -// This is for Kafka topics for both North and South sides. // In OBP-API, these topics will be created automatically. trait TopicTrait { diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/ViewModel.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/ViewModel.scala index a4b0fcf9f..e94185f05 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/ViewModel.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/ViewModel.scala @@ -234,7 +234,6 @@ trait View { * 2rd: the view can grant the access to any other (not owner) users. eg: Simon's accountant view can grant access to Carola, then Carola can see Simon's accountant data * also look into some createView methods in code, you can understand more: * create1: code.bankconnectors.Connector.createViews - * need also look into here KafkaMappedConnector_vMar2017.updateUserAccountViewsOld * after createViews method, always need call addPermission(v.uid, user). This will create this field * Create2: code.model.dataAccess.BankAccountCreation.createOwnerView * after create view, always need call `addPermission(ownerViewUID, user)`, this will create this field diff --git a/pom.xml b/pom.xml index 270f475b7..b1ab5ea61 100644 --- a/pom.xml +++ b/pom.xml @@ -13,8 +13,6 @@ 2.12 2.12.12 2.5.32 - 2.0.5 - 1.1.0 1.8.2 3.5.0 9.4.50.v20221201 diff --git a/release_notes.md b/release_notes.md index c43d5d104..d5dbc5dff 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,6 +3,8 @@ ### Most recent changes at top of file ``` Date Commit Action +17/03/2025 166e4f2a Removed Kafka commits: 166e4f2a,7f24802e,6f0a3b53,f22763c3, + 76fd73f7,7d1db2c2,dde267b1,7f259e49,00885604,a2847ce2,89ee59ac 17/02/2025 5877d2f2 Bootstrap Super User Added props super_admin_username=TomWilliams Added props super_admin_inital_password=681aeeb9f681aeeb9f681aeeb9 diff --git a/roadmap.md b/roadmap.md index 84dd97783..4b7e6fdae 100644 --- a/roadmap.md +++ b/roadmap.md @@ -36,7 +36,6 @@ See [completed_developments.md](completed_developments.md) * Clarify Account Customer Owners. * Auto feed of Firehose Accounts/Transactions/Customers into Elastic Search -* Kafka Stream API for Accounts/Transactions/Customers ### SDK Documentation Upgrade