mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:07:02 +00:00
feature/added getRegulatedEntities and getRegulatedEntityByEntityId to RabbitMQConnector_vOct2024
This commit is contained in:
parent
299e70c2f0
commit
d52a24bf6a
@ -8,6 +8,10 @@ import code.model.{AppType, Consumer}
|
||||
import code.regulatedentities.MappedRegulatedEntityProvider
|
||||
import com.openbankproject.commons.model.RegulatedEntityTrait
|
||||
import net.liftweb.common.Box
|
||||
import code.bankconnectors.Connector
|
||||
import code.api.util.ErrorMessages.{InvalidConnectorResponse}
|
||||
import code.api.util.{APIUtil, CallContext}
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
|
||||
import scala.concurrent.Future
|
||||
|
||||
@ -48,22 +52,19 @@ object RegulatedEntityNewStyle {
|
||||
}
|
||||
}
|
||||
|
||||
def getRegulatedEntitiesNewStyle(callContext: Option[CallContext]): OBPReturnType[List[RegulatedEntityTrait]] = {
|
||||
Future {
|
||||
MappedRegulatedEntityProvider.getRegulatedEntities()
|
||||
} map {
|
||||
(_, callContext)
|
||||
def getRegulatedEntitiesNewStyle(
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[List[RegulatedEntityTrait]] = {
|
||||
Connector.connector.vend.getRegulatedEntities(callContext: Option[CallContext]) map { i =>
|
||||
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponse ${nameOf(Connector.connector.vend.getRegulatedEntities _)} ", 400 ), i._2)
|
||||
}
|
||||
}
|
||||
def getRegulatedEntityByEntityIdNewStyle(id: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[RegulatedEntityTrait] = {
|
||||
Future {
|
||||
MappedRegulatedEntityProvider.getRegulatedEntityByEntityId(id)
|
||||
} map {
|
||||
(_, callContext)
|
||||
} map {
|
||||
x => (unboxFullOrFail(x._1, callContext, RegulatedEntityNotFound, 404), x._2)
|
||||
def getRegulatedEntityByEntityIdNewStyle(
|
||||
id: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[RegulatedEntityTrait] = {
|
||||
Connector.connector.vend.getRegulatedEntityByEntityId(id, callContext: Option[CallContext]) map { i =>
|
||||
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponse ${nameOf(Connector.connector.vend.getRegulatedEntityByEntityId _)} ", 400 ), i._2)
|
||||
}
|
||||
}
|
||||
def deleteRegulatedEntityNewStyle(id: String,
|
||||
|
||||
@ -174,7 +174,7 @@ trait APIMethods510 {
|
||||
"""Get Regulated Entity By REGULATED_ENTITY_ID
|
||||
""",
|
||||
EmptyBody,
|
||||
regulatedEntitiesJsonV510,
|
||||
regulatedEntityJsonV510,
|
||||
List(UnknownError),
|
||||
apiTagDirectory :: apiTagApi :: Nil)
|
||||
|
||||
|
||||
@ -1885,5 +1885,12 @@ trait Connector extends MdcLoggable {
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[Boolean]] = Future{(Failure(setUnimplementedError(nameOf(deleteCounterpartyLimit _))), callContext)}
|
||||
|
||||
|
||||
def getRegulatedEntities(
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[List[RegulatedEntityTrait]]] = Future{(Failure(setUnimplementedError(nameOf(getRegulatedEntities _))), callContext)}
|
||||
|
||||
def getRegulatedEntityByEntityId(
|
||||
regulatedEntityId: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[RegulatedEntityTrait]] = Future{(Failure(setUnimplementedError(nameOf(getRegulatedEntityByEntityId _))), callContext)}
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ import code.productcollection.ProductCollectionX
|
||||
import code.productcollectionitem.ProductCollectionItems
|
||||
import code.productfee.ProductFeeX
|
||||
import code.products.MappedProduct
|
||||
import code.regulatedentities.MappedRegulatedEntityProvider
|
||||
import code.standingorders.StandingOrders
|
||||
import com.openbankproject.commons.model.StandingOrderTrait
|
||||
import code.taxresidence.TaxResidenceX
|
||||
@ -5345,5 +5346,22 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
counterpartyId: String) map {
|
||||
(_, callContext)
|
||||
}
|
||||
|
||||
override def getRegulatedEntities(
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[List[RegulatedEntityTrait]]] = Future {
|
||||
tryo {MappedRegulatedEntityProvider.getRegulatedEntities()}
|
||||
} map {
|
||||
(_, callContext)
|
||||
}
|
||||
|
||||
override def getRegulatedEntityByEntityId(
|
||||
regulatedEntityId: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[RegulatedEntityTrait]] = Future {
|
||||
MappedRegulatedEntityProvider.getRegulatedEntityByEntityId(regulatedEntityId)
|
||||
} map {
|
||||
(_, callContext)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -435,6 +435,8 @@ object ConnectorBuilderUtil {
|
||||
"getTransactionRequestTypeCharges",
|
||||
"getAccountsHeld",
|
||||
"getAccountsHeldByUser",
|
||||
"getRegulatedEntities",
|
||||
"getRegulatedEntityByEntityId",
|
||||
).distinct
|
||||
|
||||
/**
|
||||
|
||||
@ -60,17 +60,15 @@ trait RabbitMQConnector_vOct2024 extends Connector with MdcLoggable {
|
||||
// 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 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"
|
||||
val messageFormat: String = "rabbitmq_vOct2024"
|
||||
|
||||
override val messageDocs = ArrayBuffer[MessageDoc]()
|
||||
|
||||
val authInfoExample = AuthInfo(userId = "userId", username = "username", cbsToken = "cbsToken")
|
||||
val errorCodeExample = "INTERNAL-OBP-ADAPTER-6001: ..."
|
||||
|
||||
val connectorName = "rabbitmq_vOct2024"
|
||||
|
||||
//---------------- dynamic start -------------------please don't modify this line
|
||||
// ---------- created on 2025-01-14T19:52:36Z
|
||||
// ---------- created on 2025-04-04T14:01:22Z
|
||||
|
||||
messageDocs += getAdapterInfoDoc
|
||||
def getAdapterInfoDoc = MessageDoc(
|
||||
@ -7070,8 +7068,99 @@ trait RabbitMQConnector_vOct2024 extends Connector with MdcLoggable {
|
||||
response.map(convertToTuple[Boolean](callContext))
|
||||
}
|
||||
|
||||
// ---------- created on 2025-01-14T19:52:36Z
|
||||
//---------------- dynamic end ---------------------please don't modify this line
|
||||
messageDocs += getRegulatedEntitiesDoc
|
||||
def getRegulatedEntitiesDoc = MessageDoc(
|
||||
process = "obp.getRegulatedEntities",
|
||||
messageFormat = messageFormat,
|
||||
description = "Get Regulated Entities",
|
||||
outboundTopic = None,
|
||||
inboundTopic = None,
|
||||
exampleOutboundMessage = (
|
||||
OutBoundGetRegulatedEntities(MessageDocsSwaggerDefinitions.outboundAdapterCallContext)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundGetRegulatedEntities(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
status=MessageDocsSwaggerDefinitions.inboundStatus,
|
||||
data = List(RegulatedEntityTraitCommons(entityId = "0af807d7-3c39-43ef-9712-82bcfde1b9ca",
|
||||
certificateAuthorityCaOwnerId = "CY_CBC",
|
||||
entityName = "EXAMPLE COMPANY LTD",
|
||||
entityCode = "PSD_PICY_CBC!12345",
|
||||
entityCertificatePublicKey =
|
||||
"""-----BEGIN CERTIFICATE-----MIICsjCCAZqgAwIBAgIGAYwQ62R0MA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNVBAMMD2
|
||||
|FwcC5leGFtcGxlLmNvbTAeFw0yMzExMjcxMzE1MTFaFw0yNTExMjYxMzE1MTFaMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTCCASIwDQ
|
||||
|YJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK9WIodZHWzKyCcf9YfWEhPURbfO6zKuMqzHN27GdqHsVVEGxP4F/J4mso+0ENcRr6ur4u81iRE
|
||||
|aVdCc40rHDHVJNEtniD8Icbz7tcsqAewIVhc/q6WXGqImJpCq7hA0m247dDsaZT0lb/MVBiMoJxDEmAE/GYYnWTEn84R35WhJsMvuQ7QmLvNg6
|
||||
|RkChY6POCT/YKe9NKwa1NqI1U+oA5RFzAaFtytvZCE3jtp+aR0brL7qaGfgxm6B7dEpGyhg0NcVCV7xMQNq2JxZTVdAr6lcsRGaAFulakmW3aN
|
||||
|nmK+L35Wu8uW+OxNxwUuC6f3b4FVBa276FMuUTRfu7gc+k6kCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAAU5CjEyAoyTn7PgFpQD48ZNPuUsEQ
|
||||
|19gzYgJvHMzFIoZ7jKBodjO5mCzWBcR7A4mpeAsdyiNBl2sTiZscSnNqxk61jVzP5Ba1D7XtOjjr7+3iqowrThj6BY40QqhYh/6BSY9fDzVZQi
|
||||
|Hnvlo6ZUM5kUK6OavZOovKlp5DIl5sGqoP0qAJnpQ4nhB2WVVsKfPlOXc+2KSsbJ23g9l8zaTMr+X0umlvfEKqyEl1Fa2L1dO0y/KFQ+ILmxcZ
|
||||
|LpRdq1hRAjd0quq9qGC8ucXhRWDgM4hslVpau0da68g0aItWNez3mc5lB82b3dcZpFMzO41bgw7gvw10AvvTfQDqEYIuQ==-----END CERTIFICATE----- """.stripMargin,
|
||||
entityType = "PSD_PI",
|
||||
entityAddress = "EXAMPLE COMPANY LTD, 5 SOME STREET",
|
||||
entityTownCity = "SOME CITY",
|
||||
entityPostCode = "1060",
|
||||
entityCountry = "CY",
|
||||
entityWebSite = "www.example.com",
|
||||
services = "PISP,AISP")))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def getRegulatedEntities(callContext: Option[CallContext]): OBPReturnType[Box[List[RegulatedEntityTrait]]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundGetRegulatedEntities => InBound, OutBoundGetRegulatedEntities => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull)
|
||||
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_regulated_entities", req, callContext)
|
||||
response.map(convertToTuple[List[RegulatedEntityTraitCommons]](callContext))
|
||||
}
|
||||
|
||||
messageDocs += getRegulatedEntityByEntityIdDoc
|
||||
def getRegulatedEntityByEntityIdDoc = MessageDoc(
|
||||
process = "obp.getRegulatedEntityByEntityId",
|
||||
messageFormat = messageFormat,
|
||||
description = "Get Regulated Entity By Entity Id",
|
||||
outboundTopic = None,
|
||||
inboundTopic = None,
|
||||
exampleOutboundMessage = (
|
||||
OutBoundGetRegulatedEntityByEntityId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext,
|
||||
regulatedEntityId="string")
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundGetRegulatedEntityByEntityId(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
status = MessageDocsSwaggerDefinitions.inboundStatus,
|
||||
data = RegulatedEntityTraitCommons(entityId = "0af807d7-3c39-43ef-9712-82bcfde1b9ca",
|
||||
certificateAuthorityCaOwnerId = "CY_CBC",
|
||||
entityName = "EXAMPLE COMPANY LTD",
|
||||
entityCode = "PSD_PICY_CBC!12345",
|
||||
entityCertificatePublicKey =
|
||||
"""-----BEGIN CERTIFICATE-----MIICsjCCAZqgAwIBAgIGAYwQ62R0MA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNVBAMMD2
|
||||
|FwcC5leGFtcGxlLmNvbTAeFw0yMzExMjcxMzE1MTFaFw0yNTExMjYxMzE1MTFaMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTCCASIwDQ
|
||||
|YJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK9WIodZHWzKyCcf9YfWEhPURbfO6zKuMqzHN27GdqHsVVEGxP4F/J4mso+0ENcRr6ur4u81iRE
|
||||
|aVdCc40rHDHVJNEtniD8Icbz7tcsqAewIVhc/q6WXGqImJpCq7hA0m247dDsaZT0lb/MVBiMoJxDEmAE/GYYnWTEn84R35WhJsMvuQ7QmLvNg6
|
||||
|RkChY6POCT/YKe9NKwa1NqI1U+oA5RFzAaFtytvZCE3jtp+aR0brL7qaGfgxm6B7dEpGyhg0NcVCV7xMQNq2JxZTVdAr6lcsRGaAFulakmW3aN
|
||||
|nmK+L35Wu8uW+OxNxwUuC6f3b4FVBa276FMuUTRfu7gc+k6kCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAAU5CjEyAoyTn7PgFpQD48ZNPuUsEQ
|
||||
|19gzYgJvHMzFIoZ7jKBodjO5mCzWBcR7A4mpeAsdyiNBl2sTiZscSnNqxk61jVzP5Ba1D7XtOjjr7+3iqowrThj6BY40QqhYh/6BSY9fDzVZQi
|
||||
|Hnvlo6ZUM5kUK6OavZOovKlp5DIl5sGqoP0qAJnpQ4nhB2WVVsKfPlOXc+2KSsbJ23g9l8zaTMr+X0umlvfEKqyEl1Fa2L1dO0y/KFQ+ILmxcZ
|
||||
|LpRdq1hRAjd0quq9qGC8ucXhRWDgM4hslVpau0da68g0aItWNez3mc5lB82b3dcZpFMzO41bgw7gvw10AvvTfQDqEYIuQ==-----END CERTIFICATE----- """.stripMargin,
|
||||
entityType = "PSD_PI",
|
||||
entityAddress = "EXAMPLE COMPANY LTD, 5 SOME STREET",
|
||||
entityTownCity = "SOME CITY",
|
||||
entityPostCode = "1060",
|
||||
entityCountry = "CY",
|
||||
entityWebSite = "www.example.com",
|
||||
services = "PISP,AISP"))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def getRegulatedEntityByEntityId(regulatedEntityId: String, callContext: Option[CallContext]): OBPReturnType[Box[RegulatedEntityTrait]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundGetRegulatedEntityByEntityId => InBound, OutBoundGetRegulatedEntityByEntityId => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, regulatedEntityId)
|
||||
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_regulated_entity_by_entity_id", req, callContext)
|
||||
response.map(convertToTuple[RegulatedEntityTraitCommons](callContext))
|
||||
}
|
||||
|
||||
// ---------- created on 2025-04-04T14:01:22Z
|
||||
//---------------- dynamic end ---------------------please don't modify this line
|
||||
|
||||
private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]")
|
||||
|
||||
|
||||
@ -43,6 +43,14 @@ trait InBoundTrait[T] {
|
||||
|
||||
//--------generated
|
||||
|
||||
case class OutBoundGetRegulatedEntities (outboundAdapterCallContext: OutboundAdapterCallContext) extends TopicTrait
|
||||
case class InBoundGetRegulatedEntities (inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[RegulatedEntityTraitCommons]) extends InBoundTrait[List[RegulatedEntityTraitCommons]]
|
||||
|
||||
|
||||
case class OutBoundGetRegulatedEntityByEntityId (outboundAdapterCallContext: OutboundAdapterCallContext,
|
||||
regulatedEntityId: String) extends TopicTrait
|
||||
case class InBoundGetRegulatedEntityByEntityId (inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: RegulatedEntityTraitCommons) extends InBoundTrait[RegulatedEntityTraitCommons]
|
||||
|
||||
case class OutBoundGetObpConnectorLoopback(outboundAdapterCallContext: OutboundAdapterCallContext) extends TopicTrait
|
||||
|
||||
case class InBoundGetObpConnectorLoopback(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: ObpApiLoopback) extends InBoundTrait[ObpApiLoopback]
|
||||
|
||||
@ -890,6 +890,21 @@ case class TransactionRequestTransferToAtm(
|
||||
to: ToAccountTransferToAtm
|
||||
) extends TransactionRequestCommonBodyJSON
|
||||
|
||||
case class RegulatedEntityTraitCommons(
|
||||
entityId :String,
|
||||
certificateAuthorityCaOwnerId :String,
|
||||
entityName :String,
|
||||
entityCode :String,
|
||||
entityCertificatePublicKey :String,
|
||||
entityType :String,
|
||||
entityAddress :String,
|
||||
entityTownCity :String,
|
||||
entityPostCode :String,
|
||||
entityCountry :String,
|
||||
entityWebSite :String,
|
||||
services :String) extends RegulatedEntityTrait
|
||||
object RegulatedEntityTraitCommons extends Converter[RegulatedEntityTrait, RegulatedEntityTraitCommons]
|
||||
|
||||
//For COUNTERPARTY, it needs the counterparty_id to find the toCounterparty--> toBankAccount
|
||||
case class TransactionRequestCounterpartyId (counterparty_id : String)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user