mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:56:46 +00:00
feature/added consent_request_id only for V500
This commit is contained in:
parent
78323f4fcb
commit
e74d5c71c4
@ -3701,8 +3701,7 @@ object SwaggerDefinitionsJSON {
|
||||
val consentJsonV310 = ConsentJsonV310(
|
||||
consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
|
||||
jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4",
|
||||
status = ConsentStatus.INITIATED.toString,
|
||||
consent_request_id = Some(consentRequestIdExample.value)
|
||||
status = ConsentStatus.INITIATED.toString
|
||||
)
|
||||
val consentJsonV400 = ConsentJsonV400(
|
||||
consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
|
||||
@ -3724,8 +3723,7 @@ object SwaggerDefinitionsJSON {
|
||||
val revokedConsentJsonV310 = ConsentJsonV310(
|
||||
consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
|
||||
jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4",
|
||||
status = ConsentStatus.REJECTED.toString,
|
||||
consent_request_id = Some(consentRequestIdExample.value)
|
||||
status = ConsentStatus.REJECTED.toString
|
||||
)
|
||||
|
||||
val postConsentEmailJsonV310 = PostConsentEmailJsonV310(
|
||||
@ -4667,6 +4665,13 @@ object SwaggerDefinitionsJSON {
|
||||
consumer_id = consumerIdExample.value
|
||||
)
|
||||
|
||||
val consentJsonV500 = ConsentJsonV500(
|
||||
consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945",
|
||||
jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4",
|
||||
status = ConsentStatus.INITIATED.toString,
|
||||
consent_request_id = Some(consentRequestIdExample.value)
|
||||
)
|
||||
|
||||
//The common error or success format.
|
||||
//Just some helper format to use in Json
|
||||
case class NotSupportedYet()
|
||||
|
||||
@ -3564,7 +3564,7 @@ trait APIMethods310 {
|
||||
case _ =>Future{"Success"}
|
||||
}
|
||||
} yield {
|
||||
(ConsentJsonV310(createdConsent.consentId, consentJWT, createdConsent.status, Some(createdConsent.consentRequestId)), HttpCode.`201`(callContext))
|
||||
(ConsentJsonV310(createdConsent.consentId, consentJWT, createdConsent.status), HttpCode.`201`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3618,7 +3618,7 @@ trait APIMethods310 {
|
||||
i => connectorEmptyResponse(i, callContext)
|
||||
}
|
||||
} yield {
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status, Some(consent.consentRequestId)), HttpCode.`201`(callContext))
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status), HttpCode.`201`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3697,7 +3697,7 @@ trait APIMethods310 {
|
||||
i => connectorEmptyResponse(i, callContext)
|
||||
}
|
||||
} yield {
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status, Some(consent.consentRequestId)), HttpCode.`200`(callContext))
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -554,7 +554,7 @@ case class PostConsentPhoneJsonV310(
|
||||
time_to_live: Option[Long]
|
||||
) extends PostConsentCommonBody
|
||||
|
||||
case class ConsentJsonV310(consent_id: String, jwt: String, status: String, consent_request_id: Option[String])
|
||||
case class ConsentJsonV310(consent_id: String, jwt: String, status: String)
|
||||
case class ConsentsJsonV310(consents: List[ConsentJsonV310])
|
||||
|
||||
case class PostConsentChallengeJsonV310(answer: String)
|
||||
@ -1284,7 +1284,7 @@ object JSONFactory310{
|
||||
}
|
||||
|
||||
def createConsentsJsonV310(consents: List[MappedConsent]): ConsentsJsonV310= {
|
||||
ConsentsJsonV310(consents.map(c => ConsentJsonV310(c.consentId, c.jsonWebToken, c.status, Some(c.consentRequestId))))
|
||||
ConsentsJsonV310(consents.map(c => ConsentJsonV310(c.consentId, c.jsonWebToken, c.status)))
|
||||
}
|
||||
|
||||
def getOAuth2ServerJwksUrisJson(): OAuth2ServerJwksUrisJson = {
|
||||
|
||||
@ -8378,7 +8378,7 @@ trait APIMethods400 {
|
||||
i => connectorEmptyResponse(i, callContext)
|
||||
}
|
||||
} yield {
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status, Some(consent.consentRequestId)), HttpCode.`200`(callContext))
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8437,7 +8437,7 @@ trait APIMethods400 {
|
||||
} map ((_, HttpCode.`200`(callContext)))
|
||||
}
|
||||
} yield {
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status, Some(consent.consentRequestId)), code)
|
||||
(ConsentJsonV310(consent.consentId, consent.jsonWebToken, consent.status), code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.{APIUtil, ApiRole, Consent, NewStyle}
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.v3_1_0.{ConsentJsonV310, PostConsentBodyCommonJson, PostConsentEmailJsonV310, PostConsentPhoneJsonV310, PostUserAuthContextJson, PostUserAuthContextUpdateJsonV310}
|
||||
import code.api.v3_1_0.{PostConsentBodyCommonJson, PostConsentEmailJsonV310, PostConsentPhoneJsonV310, PostUserAuthContextJson, PostUserAuthContextUpdateJsonV310}
|
||||
import code.bankconnectors.Connector
|
||||
import code.consent.{ConsentRequests, Consents}
|
||||
import code.entitlement.Entitlement
|
||||
@ -344,7 +344,7 @@ trait APIMethods500 {
|
||||
|
|
||||
""".stripMargin,
|
||||
EmptyBody,
|
||||
consentJsonV310,
|
||||
consentJsonV500,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
@ -361,7 +361,7 @@ trait APIMethods500 {
|
||||
}
|
||||
} yield {
|
||||
(
|
||||
ConsentJsonV310(
|
||||
ConsentJsonV500(
|
||||
consent.consentId,
|
||||
consent.jsonWebToken,
|
||||
consent.status,
|
||||
@ -386,7 +386,7 @@ trait APIMethods500 {
|
||||
|
|
||||
|""",
|
||||
EmptyBody,
|
||||
consentJsonV310,
|
||||
consentJsonV500,
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
BankNotFound,
|
||||
@ -413,7 +413,7 @@ trait APIMethods500 {
|
||||
|
|
||||
|""",
|
||||
EmptyBody,
|
||||
consentJsonV310,
|
||||
consentJsonV500,
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
@ -553,7 +553,7 @@ trait APIMethods500 {
|
||||
case _ =>Future{"Success"}
|
||||
}
|
||||
} yield {
|
||||
(ConsentJsonV310(createdConsent.consentId, consentJWT, createdConsent.status, Some(createdConsent.consentRequestId)), HttpCode.`201`(callContext))
|
||||
(ConsentJsonV500(createdConsent.consentId, consentJWT, createdConsent.status, Some(createdConsent.consentRequestId)), HttpCode.`201`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ case class ConsentRequestResponseJson(
|
||||
payload : JValue,
|
||||
consumer_id : String
|
||||
)
|
||||
|
||||
case class ConsentJsonV500(consent_id: String, jwt: String, status: String, consent_request_id: Option[String])
|
||||
object JSONFactory500 {
|
||||
|
||||
def createUserAuthContextJson(userAuthContext: UserAuthContext): UserAuthContextJsonV500 = {
|
||||
|
||||
@ -26,18 +26,16 @@ TESOBE (http://www.tesobe.com/)
|
||||
package code.api.v5_0_0
|
||||
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.{postUserAuthContextJson, postUserAuthContextUpdateJsonV310}
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import code.api.util.ApiRole._
|
||||
import code.api.util.Consent
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.v3_1_0.{ConsentJsonV310, CustomerJsonV310, PostConsentChallengeJsonV310, PostConsentEntitlementJsonV310, PostConsentViewJsonV310}
|
||||
import code.api.v3_1_0.{PostConsentChallengeJsonV310, PostConsentEntitlementJsonV310, PostConsentViewJsonV310}
|
||||
import code.api.v5_0_0.OBPAPI5_0_0.Implementations5_0_0
|
||||
import code.consent.ConsentStatus
|
||||
import code.entitlement.Entitlement
|
||||
import code.transactionRequestAttribute.TransactionRequestAttribute.BankId
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.model.{AccountId, ErrorMessage}
|
||||
import com.openbankproject.commons.model.{ErrorMessage}
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
import net.liftweb.json.Serialization.write
|
||||
import org.scalatest.Tag
|
||||
@ -102,7 +100,7 @@ class ConsentRequestTest extends V500ServerSetupAsync {
|
||||
val createConsentByRequestResponse = makePostRequest(createConsentByRequestIdUrl(consentRequestId), write(""))
|
||||
Then("We should get a 200")
|
||||
createConsentByRequestResponse.code should equal(201)
|
||||
val consentId = createConsentByRequestResponse.body.extract[ConsentJsonV310].consent_id
|
||||
val consentId = createConsentByRequestResponse.body.extract[ConsentJsonV500].consent_id
|
||||
|
||||
val answerConsentChallengeRequest = (v5_0_0_Request / "banks" / testBankId1.value / "consents" / consentId / "challenge").POST <@ (user1)
|
||||
val challenge = Consent.challengeAnswerAtTestEnvironment
|
||||
@ -115,7 +113,7 @@ class ConsentRequestTest extends V500ServerSetupAsync {
|
||||
val getConsentByRequestResponse = makeGetRequest(getConsentByRequestIdUrl(consentRequestId))
|
||||
Then("We should get a 200")
|
||||
getConsentByRequestResponse.code should equal(200)
|
||||
val getConsentByRequestResponseJson = getConsentByRequestResponse.body.extract[ConsentJsonV310]
|
||||
val getConsentByRequestResponseJson = getConsentByRequestResponse.body.extract[ConsentJsonV500]
|
||||
getConsentByRequestResponseJson.consent_request_id.head should be(consentRequestId)
|
||||
getConsentByRequestResponseJson.status should be(ConsentStatus.ACCEPTED.toString)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user