From 1c740b5b8d678cd998265bfc8f406765ca6416cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 6 Dec 2024 17:13:51 +0100 Subject: [PATCH] feature/Tweak BG Create Consent Response 2 --- .../v1_3/JSONFactory_BERLIN_GROUP_1_3.scala | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala index 4439b781a..b1c2ea329 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala @@ -517,6 +517,16 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { } def createPostConsentResponseJson(consent: ConsentTrait) : PostConsentResponseJson = { + def redirectionWithDedicatedStartOfAuthorization = { + PostConsentResponseJson( + consentId = consent.consentId, + consentStatus = consent.status.toLowerCase(), + _links = ConsentLinksV13( + startAuthorisation = Some(Href(s"/v1.3/consents/${consent.consentId}/authorisations")) + ) + ) + } + getPropsValue("psu_authentication_method") match { case Full("redirection") => val scaRedirectUrl = getPropsValue("psu_authentication_method_sca_redirect_url") @@ -531,13 +541,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { ) ) case Full("redirection_with_dedicated_start_of_authorization") => - PostConsentResponseJson( - consentId = consent.consentId, - consentStatus = consent.status.toLowerCase(), - _links = ConsentLinksV13( - startAuthorisation = Some(Href(s"/v1.3/consents/${consent.consentId}/authorisations")) - ) - ) + redirectionWithDedicatedStartOfAuthorization case Full("embedded") => PostConsentResponseJson( consentId = consent.consentId, @@ -555,13 +559,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { ) ) case _ => - PostConsentResponseJson( - consentId = consent.consentId, - consentStatus = consent.status.toLowerCase(), - _links = ConsentLinksV13( - startAuthorisation = Some(Href(s"/v1.3/consents/${consent.consentId}/authorisations")) - ) - ) + redirectionWithDedicatedStartOfAuthorization } }