mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:16:53 +00:00
Tweaking the getMessageDocs
This commit is contained in:
parent
118bad372f
commit
8cd3a01e57
@ -260,7 +260,7 @@ val dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd")
|
||||
val InsufficientAuthorisationToCreateBranch = "OBP-30209: Insufficient authorisation to Create Branch. You do not have the role CanCreateBranch." // was OBP-20019
|
||||
val InsufficientAuthorisationToCreateBank = "OBP-30210: Insufficient authorisation to Create Bank. You do not have the role CanCreateBank." // was OBP-20020
|
||||
|
||||
val InvalidConnectorVersion = "OBP-30211: Invalid Connector Version. Please specify a valid value for CONNECTOR_VERSION."
|
||||
val InvalidConnector = "OBP-30211: Invalid Connector Version. Please specify a valid value for CONNECTOR."
|
||||
|
||||
// General Resource related messages above here
|
||||
|
||||
|
||||
@ -354,12 +354,12 @@ trait APIMethods220 {
|
||||
implementedInApiVersion,
|
||||
"getMessageDocs",
|
||||
"GET",
|
||||
"/message-docs/CONNECTOR_VERSION",
|
||||
"/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.
|
||||
| Integrators can use these messages to build Adapters that provide core banking services to OBP.
|
||||
|
|
||||
| `CONNECTOR_VERSION`: vMar2017 or vJune2017 or ...
|
||||
| `CONNECTOR`: kafka_vJuneYellow2017, kafka_vJune2017 , kafka_vMar2017 or ...
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
messageDocsJson,
|
||||
@ -369,11 +369,13 @@ trait APIMethods220 {
|
||||
)
|
||||
|
||||
lazy val getMessageDocs: PartialFunction[Req, Box[User] => Box[JsonResponse]] = {
|
||||
case "message-docs" :: connectorVersion :: Nil JsonGet _ => {
|
||||
case "message-docs" :: connector :: Nil JsonGet _ => {
|
||||
user => {
|
||||
for {
|
||||
connector <- tryo{Connector.getObjectInstance(s"code.bankconnectors.$connectorVersion.KafkaMappedConnector_$connectorVersion")} ?~! s"$InvalidConnectorVersion Current CONNECTOR_VERSION is $connectorVersion. "
|
||||
messageDocs <- Full{connector.messageDocs.toList}
|
||||
//afka_vJune2017 --> vJune2017 : get the valid version for search the connector object.
|
||||
connectorVersion<- tryo(connector.split("_")(1))?~! s"$InvalidConnector Current CONNECTOR is $connector. It should be eg: kafka_vJune2017"
|
||||
connectorObject <- tryo{Connector.getObjectInstance(s"code.bankconnectors.$connectorVersion.KafkaMappedConnector_$connectorVersion")} ?~! s"$InvalidConnector Current CONNECTOR is $connector.It should be eg: kafka_vJune2017"
|
||||
messageDocs <- Full{connectorObject.messageDocs.toList}
|
||||
} yield {
|
||||
val json = JsonFactory_vMar2017.createMessageDocsJson(messageDocs)
|
||||
successJsonResponse(Extraction.decompose(json))
|
||||
|
||||
@ -421,8 +421,8 @@ class API2_2_0Test extends User1AllPrivileges with V220ServerSetup with DefaultU
|
||||
}
|
||||
|
||||
feature("Get Message Docs - v2.2.0"){
|
||||
scenario("Get Message Docs - vJune2017") {
|
||||
val request = (v2_2Request / "message-docs" / "vJune2017" )
|
||||
scenario("Get Message Docs - kafka_vJune2017") {
|
||||
val request = (v2_2Request / "message-docs" / "kafka_vJune2017" )
|
||||
val response: APIResponse = makeGetRequest(request)
|
||||
|
||||
response.code should be (200)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user