From bbb41e45ecc997f4db82b1999cc8534f1ddbf3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 13 Mar 2024 13:54:13 +0100 Subject: [PATCH] refactor/Tweak Berlin Group constants --- .../AccountInformationServiceAISApi.scala | 4 ++-- .../v1_3/PaymentInitiationServicePISApi.scala | 12 +++++------ .../berlin/group/v1_3/SigningBasketsApi.scala | 4 ++-- .../main/scala/code/api/util/NewStyle.scala | 20 +++++++++---------- .../commons/model/enums/Enumerations.scala | 6 +++--- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala index 8004e8193..0c7d68ea6 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala @@ -1090,7 +1090,7 @@ using the extended forms as indicated above. } (challenges, callContext) <- NewStyle.function.createChallengesC2( List(u.userId), - ChallengeType.BERLINGROUP_CONSENT_CHALLENGE, + ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE, None, getSuggestedDefaultScaMethod(), Some(StrongCustomerAuthenticationStatus.received), @@ -1260,7 +1260,7 @@ Maybe in a later version the access path will change. challenges.filter(_.challengeId == authorisationId).size == 1 } (challenge, callContext) <- NewStyle.function.validateChallengeAnswerC2( - ChallengeType.BERLINGROUP_CONSENT_CHALLENGE, + ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE, None, Some(consentId), challenges.filter(_.challengeId == authorisationId).head.challengeId, diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala index 6db402846..d2d26ad11 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala @@ -21,7 +21,7 @@ import code.views.Views import com.github.dwickern.macros.NameOf.nameOf import com.openbankproject.commons.ExecutionContext.Implicits.global import com.openbankproject.commons.model._ -import com.openbankproject.commons.model.enums.ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE +import com.openbankproject.commons.model.enums.ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE import com.openbankproject.commons.model.enums.TransactionRequestStatus._ import com.openbankproject.commons.model.enums.{ChallengeType, StrongCustomerAuthenticationStatus, TransactionRequestStatus} import com.openbankproject.commons.util.ApiVersion @@ -600,7 +600,7 @@ Check the transaction status of a payment initiation.""", ), transDetailsSerialized, "", - Some(BERLINGROUP_PAYMENT_CHALLENGE), + Some(BERLIN_GROUP_PAYMENT_CHALLENGE), None, None, Some(transDetailsJson), @@ -926,7 +926,7 @@ This applies in the following scenarios: (challenges, callContext) <- NewStyle.function.createChallengesC2( List(u.userId), - ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE, + ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE, Some(paymentId), getScaMethodAtInstance(SEPA_CREDIT_TRANSFERS.toString).toOption, Some(StrongCustomerAuthenticationStatus.received), @@ -1021,7 +1021,7 @@ This applies in the following scenarios: } (challenges, callContext) <- NewStyle.function.createChallengesC2( List(u.userId), - ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE, + ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE, Some(paymentId), getScaMethodAtInstance(SEPA_CREDIT_TRANSFERS.toString).toOption, Some(StrongCustomerAuthenticationStatus.received), @@ -1227,7 +1227,7 @@ There are the following request types on this access path: } (_, callContext) <- NewStyle.function.getTransactionRequestImpl(TransactionRequestId(paymentId), callContext) (challenge, callContext) <- NewStyle.function.validateChallengeAnswerC2( - ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE, + ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE, Some(paymentId), None, authorisationId, @@ -1470,7 +1470,7 @@ There are the following request types on this access path: existingTransactionRequest.status == TransactionRequestStatus.INITIATED.toString } (challenge, callContext) <- NewStyle.function.validateChallengeAnswerC2( - ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE, + ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE, Some(paymentId), None, authorisationid, diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala index 67e5c49bb..312fc7de8 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala @@ -383,7 +383,7 @@ This applies in the following scenarios: _ <- passesPsd2Pisp(callContext) (challenges, callContext) <- NewStyle.function.createChallengesC3( List(u.userId), - ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE, + ChallengeType.BERLIN_GROUP_SIGNING_BASKETS_CHALLENGE, None, getSuggestedDefaultScaMethod(), Some(StrongCustomerAuthenticationStatus.received), @@ -477,7 +477,7 @@ There are the following request types on this access path: _ <- SigningBasketNewStyle.checkSigningBasketPayments(basketId, callContext) // Validate a challenge answer and get an error if any (boxedChallenge: Box[ChallengeTrait], callContext) <- NewStyle.function.validateChallengeAnswerC3( - ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE, + ChallengeType.BERLIN_GROUP_SIGNING_BASKETS_CHALLENGE, None, None, Some(basketId), diff --git a/obp-api/src/main/scala/code/api/util/NewStyle.scala b/obp-api/src/main/scala/code/api/util/NewStyle.scala index 6f742c8de..af2a49807 100644 --- a/obp-api/src/main/scala/code/api/util/NewStyle.scala +++ b/obp-api/src/main/scala/code/api/util/NewStyle.scala @@ -1340,9 +1340,9 @@ object NewStyle extends MdcLoggable{ hashOfSuppliedAnswer: String, callContext: Option[CallContext] ): OBPReturnType[ChallengeTrait] = { - if(challengeType == ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE && transactionRequestId.isEmpty ){ + if(challengeType == ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE && transactionRequestId.isEmpty ){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_PAYMENT_CHALLENGE challengeType: paymentId($transactionRequestId) ")} - }else if(challengeType == ChallengeType.BERLINGROUP_CONSENT_CHALLENGE && consentId.isEmpty ){ + }else if(challengeType == ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE && consentId.isEmpty ){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_CONSENT_CHALLENGE challengeType: consentId($consentId) ")} }else{ Connector.connector.vend.validateChallengeAnswerC2( @@ -1369,11 +1369,11 @@ object NewStyle extends MdcLoggable{ hashOfSuppliedAnswer: String, callContext: Option[CallContext] ): OBPReturnType[Box[ChallengeTrait]] = { - if(challengeType == ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE && transactionRequestId.isEmpty ){ + if(challengeType == ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE && transactionRequestId.isEmpty ){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_PAYMENT_CHALLENGE challengeType: paymentId($transactionRequestId) ")} - } else if(challengeType == ChallengeType.BERLINGROUP_CONSENT_CHALLENGE && consentId.isEmpty ){ + } else if(challengeType == ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE && consentId.isEmpty ){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_CONSENT_CHALLENGE challengeType: consentId($consentId) ")} - } else if(challengeType == ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE && basketId.isEmpty ){ + } else if(challengeType == ChallengeType.BERLIN_GROUP_SIGNING_BASKETS_CHALLENGE && basketId.isEmpty ){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_CONSENT_CHALLENGE challengeType: basketId($basketId) ")} } else { Connector.connector.vend.validateChallengeAnswerC3( @@ -1409,9 +1409,9 @@ object NewStyle extends MdcLoggable{ authenticationMethodId: Option[String], callContext: Option[CallContext] ) : OBPReturnType[List[ChallengeTrait]] = { - if(challengeType == ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE && (transactionRequestId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ + if(challengeType == ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE && (transactionRequestId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_PAYMENT challengeType: paymentId($transactionRequestId), scaStatus($scaStatus), scaMethod($scaMethod) ")} - }else if(challengeType == ChallengeType.BERLINGROUP_CONSENT_CHALLENGE && (consentId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ + }else if(challengeType == ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE && (consentId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_CONSENT challengeType: consentId($consentId), scaStatus($scaStatus), scaMethod($scaMethod) ")} }else{ Connector.connector.vend.createChallengesC2( @@ -1453,11 +1453,11 @@ object NewStyle extends MdcLoggable{ authenticationMethodId: Option[String], callContext: Option[CallContext] ) : OBPReturnType[List[ChallengeTrait]] = { - if(challengeType == ChallengeType.BERLINGROUP_PAYMENT_CHALLENGE && (transactionRequestId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ + if(challengeType == ChallengeType.BERLIN_GROUP_PAYMENT_CHALLENGE && (transactionRequestId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_PAYMENT challengeType: paymentId($transactionRequestId), scaStatus($scaStatus), scaMethod($scaMethod) ")} - } else if(challengeType == ChallengeType.BERLINGROUP_CONSENT_CHALLENGE && (consentId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ + } else if(challengeType == ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE && (consentId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_CONSENT challengeType: consentId($consentId), scaStatus($scaStatus), scaMethod($scaMethod) ")} - } else if(challengeType == ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE && (basketId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ + } else if(challengeType == ChallengeType.BERLIN_GROUP_SIGNING_BASKETS_CHALLENGE && (basketId.isEmpty || scaStatus.isEmpty || scaMethod.isEmpty)){ Future{ throw new Exception(s"$UnknownError The following parameters can not be empty for BERLINGROUP_CONSENT challengeType: basketId($basketId), scaStatus($scaStatus), scaMethod($scaMethod) ")} } else { Connector.connector.vend.createChallengesC3( diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/enums/Enumerations.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/enums/Enumerations.scala index c75e485e4..35bd148f6 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/enums/Enumerations.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/enums/Enumerations.scala @@ -125,9 +125,9 @@ sealed trait ChallengeType extends EnumValue object ChallengeType extends OBPEnumeration[ChallengeType] { object OBP_TRANSACTION_REQUEST_CHALLENGE extends Value object OBP_CONSENT_CHALLENGE extends Value - object BERLINGROUP_PAYMENT_CHALLENGE extends Value - object BERLINGROUP_CONSENT_CHALLENGE extends Value - object BERLINGROUP_SIGNING_BASKETS_CHALLENGE extends Value + object BERLIN_GROUP_PAYMENT_CHALLENGE extends Value + object BERLIN_GROUP_CONSENT_CHALLENGE extends Value + object BERLIN_GROUP_SIGNING_BASKETS_CHALLENGE extends Value } sealed trait PemCertificateRole extends EnumValue