mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:17:09 +00:00
Send branch to createOrUpdateBranch and update example for Resource Doc / Swagger
This commit is contained in:
parent
ff04b1a368
commit
e14ba467d8
@ -929,8 +929,8 @@ object SwaggerDefinitionsJSON {
|
||||
address = address,
|
||||
location = location,
|
||||
meta = meta,
|
||||
lobbyString = null,
|
||||
driveUpString = null,
|
||||
lobbyString = None,
|
||||
driveUpString = None,
|
||||
lobby = Full(lobby),
|
||||
driveUp = Full(driveUp),
|
||||
branchRouting = branchRouting,
|
||||
|
||||
@ -422,7 +422,10 @@ object SwaggerJSONFactory {
|
||||
// name -> Tesobe, --> "name" : {"type":"string"}
|
||||
// bank -> Bank(gh.29.uk), --> "bank": {"$ref":"#/definitions/Bank"}
|
||||
// banks -> List(Bank(gh.29.uk) --> "banks": {"type": "array", "items":{"$ref": "#/definitions/Bank"}}
|
||||
val properties = for ((key, value) <- mapOfFields) yield {
|
||||
val properties = for {
|
||||
(key, value) <- mapOfFields
|
||||
_ = print("\n val properties for comprehension: " + key + " is " + value)
|
||||
} yield {
|
||||
value match {
|
||||
case i: Boolean => "\"" + key + """": {"type":"boolean", "example":"""" +i+"\"}"
|
||||
case Some(i: Boolean) => "\"" + key + """": {"type":"boolean", "example":"""" +i+"\"}"
|
||||
|
||||
@ -719,11 +719,13 @@ trait APIMethods300 {
|
||||
||
|
||||
hasEntitlement("", u.userId, CanCreateBranchAtAnyBank)
|
||||
, createBranchEntitlementsRequiredText)
|
||||
branchJsonV300 <- tryo {json.extract[Branch]} ?~! ErrorMessages.InvalidJsonFormat
|
||||
success <- Connector.connector.vend.createOrUpdateBranch(branchJsonV300)
|
||||
branchJsonV300 <- tryo {json.extract[BranchJsonV300]} ?~! ErrorMessages.InvalidJsonFormat
|
||||
branch <- transformToBranchFromV300(branchJsonV300)
|
||||
success <- Connector.connector.vend.createOrUpdateBranch(branch)
|
||||
} yield {
|
||||
val json = branchJsonV300 // JSONFactory300.createBranchJson(success)
|
||||
createdJsonResponse(Extraction.decompose(json))
|
||||
// TODO remove the shortcut i.e. we should do the conversion back from branch to json rather than just echo the input
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -678,8 +678,7 @@ object JSONFactory300{
|
||||
|
||||
|
||||
// This goes FROM JSON TO internal representation of a Branch
|
||||
// This can be overloaded, and each function can accept a different input type
|
||||
def transformToBranch(branchJsonV300: BranchJsonV300): Box[Branch] = {
|
||||
def transformToBranchFromV300(branchJsonV300: BranchJsonV300): Box[Branch] = {
|
||||
|
||||
|
||||
val address : Address = transformToAddressFromV300(branchJsonV300.address) // Note the address in V220 is V140
|
||||
|
||||
Loading…
Reference in New Issue
Block a user