-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2434 from constantine2nd/develop
OIDC; Get My Consents
- Loading branch information
Showing
5 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ package code.api.v5_1_0 | |
|
||
import code.api.Constant | ||
import code.api.util.{APIUtil, ConsentJWT, CustomJsonFormats, JwtUtil, Role} | ||
import code.api.util.APIUtil.{gitCommit, stringOrNull} | ||
import code.api.util.APIUtil.{DateWithDay, DateWithSeconds, gitCommit, stringOrNull} | ||
import code.api.v1_2_1.BankRoutingJsonV121 | ||
import code.api.v1_4_0.JSONFactory1_4_0.{LocationJsonV140, MetaJsonV140, transformToLocationFromV140, transformToMetaFromV140} | ||
import code.api.v2_1_0.ResourceUserJSON | ||
|
@@ -52,6 +52,7 @@ import net.liftweb.common.{Box, Full} | |
import net.liftweb.json | ||
import net.liftweb.json.{JString, JValue, parse, parseOpt} | ||
|
||
import java.text.SimpleDateFormat | ||
import scala.collection.immutable.List | ||
import scala.util.Try | ||
|
||
|
@@ -122,6 +123,21 @@ case class ConsentJsonV510(consent_id: String, | |
consent_request_id: Option[String], | ||
scopes: Option[List[Role]]) | ||
|
||
|
||
case class ConsentInfoJsonV510(consent_id: String, | ||
consumer_id: String, | ||
created_by_user_id: String, | ||
status: String, | ||
last_action_date: String, | ||
last_usage_date: String, | ||
jwt: String, | ||
jwt_payload: Box[ConsentJWT], | ||
api_standard: String, | ||
api_version: String, | ||
) | ||
case class ConsentsInfoJsonV510(consents: List[ConsentInfoJsonV510]) | ||
|
||
|
||
case class CurrencyJsonV510(alphanumeric_code: String) | ||
case class CurrenciesJsonV510(currencies: List[CurrencyJsonV510]) | ||
|
||
|
@@ -676,6 +692,26 @@ object JSONFactory510 extends CustomJsonFormats { | |
) | ||
} | ||
|
||
def createConsentsInfoJsonV510(consents: List[MappedConsent]): ConsentsInfoJsonV510 = { | ||
ConsentsInfoJsonV510( | ||
consents.map { c => | ||
val jwtPayload: Box[ConsentJWT] = JwtUtil.getSignedPayloadAsJson(c.jsonWebToken).map(parse(_).extract[ConsentJWT]) | ||
ConsentInfoJsonV510( | ||
consent_id = c.consentId, | ||
consumer_id = c.consumerId, | ||
created_by_user_id = c.userId, | ||
status = c.status, | ||
last_action_date = if (c.lastActionDate != null) new SimpleDateFormat(DateWithDay).format(c.lastActionDate) else null, | ||
last_usage_date = if (c.usesSoFarTodayCounterUpdatedAt != null) new SimpleDateFormat(DateWithSeconds).format(c.usesSoFarTodayCounterUpdatedAt) else null, | ||
jwt = c.jsonWebToken, | ||
jwt_payload = jwtPayload, | ||
api_standard = c.apiStandard, | ||
api_version = c.apiVersion | ||
) | ||
} | ||
) | ||
} | ||
|
||
def getApiInfoJSON(apiVersion : ApiVersion, apiVersionStatus: String) = { | ||
val organisation = APIUtil.getPropsValue("hosted_by.organisation", "TESOBE") | ||
val email = APIUtil.getPropsValue("hosted_by.email", "[email protected]") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters