From 5422c1cc6807f53167adc825e8590d5ae480b6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 20 Dec 2023 10:21:21 +0100 Subject: [PATCH 01/21] docfix/Tweak post json at endpoint createConsumer --- obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala index 06677998b7..34f5dcb1e8 100644 --- a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala +++ b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala @@ -1801,7 +1801,7 @@ trait APIMethods510 { | Please note that JWT must be signed with the counterpart private kew of the public key used to establish mTLS | |""", - ConsumerJwtPostJsonV510("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXNjcmlwdGlvbiI6IkRlc2NyaXB0aW9uIn0.qDnzk1dGK8akdLFRl8fmJV_SeoDjRTDG_eMogCIzZ7M"), + ConsumerJwtPostJsonV510("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXNjcmlwdGlvbiI6IlRQUCBkZXNjcmlwdGlvbiJ9.c5gPPsyUmnVW774y7h2xyLXg0wdtu25nbU2AvOmyzcWa7JTdCKuuy3CblxueGwqYkQDDQIya1Qny4blyAvh_a1Q28LgzEKBcH7Em9FZXerhkvR9v4FWbCC5AgNLdQ7sR8-rUQdShmJcGDKdVmsZjuO4XhY2Zx0nFnkcvYfsU9bccoAvkKpVJATXzwBqdoEOuFlplnbxsMH1wWbAd3hbcPPWTdvO43xavNZTB5ybgrXVDEYjw8D-98_ZkqxS0vfvhJ4cGefHViaFzp6zXm7msdBpcE__O9rFbdl9Gvup_bsMbrHJioIrmc2d15Yc-tTNTF9J4qjD_lNxMRlx5o2TZEw"), consumerJsonV510, List( InvalidJsonFormat, From e14946b85accf50637a77b707521928a2f7d9227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 16 Jan 2024 12:05:58 +0100 Subject: [PATCH 02/21] feature/Add Berlin Group Signing Basket; DB model --- .../main/scala/bootstrap/liftweb/Boot.scala | 4 + .../scala/code/api/constant/constant.scala | 2 +- .../main/scala/code/api/util/NewStyle.scala | 45 ++++ .../scala/code/bankconnectors/Connector.scala | 14 +- .../bankconnectors/ConnectorBuilderUtil.scala | 1 + .../bankconnectors/LocalMappedConnector.scala | 47 +++- .../akka/AkkaConnector_vDec2018.scala | 227 ++++++++++++++---- .../rest/RestConnector_vMar2019.scala | 56 ++++- .../StoredProcedureConnector_vDec2019.scala | 56 ++++- .../remotedata/RemotedataChallenges.scala | 8 +- .../RemotedataChallengesActor.scala | 5 +- .../MappedSigningBasketProvider.scala | 105 ++++++++ .../code/signingbaskets/SigningBasket.scala | 27 +++ .../ChallengeProvider.scala | 11 +- .../MappedChallengeProvider.scala | 40 +-- .../MappedExpectedChallengeAnswer.scala | 59 ++--- .../RestConnector_vMar2019_frozen_meta_data | Bin 113208 -> 114141 bytes .../scala/code/util/MappedClassNameTest.scala | 3 + .../commons/dto/JsonsTransfer.scala | 11 + .../commons/model/CommonModel.scala | 1 + .../commons/model/CommonModelTrait.scala | 14 ++ release_notes.md | 1 + 22 files changed, 618 insertions(+), 119 deletions(-) create mode 100644 obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala create mode 100644 obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala diff --git a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala index b4d0725bec..c370280e6c 100644 --- a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala @@ -110,6 +110,7 @@ import code.regulatedentities.MappedRegulatedEntity import code.remotedata.RemotedataActors import code.scheduler.{DataBaseCleanerScheduler, DatabaseDriverScheduler, JobScheduler, MetricsArchiveScheduler} import code.scope.{MappedScope, MappedUserScope} +import code.signingbaskets.{MappedSigningBasket, MappedSigningBasketConsent, MappedSigningBasketPayment} import code.snippet.{OAuthAuthorisation, OAuthWorkedThanks} import code.socialmedia.MappedSocialMedia import code.standingorders.StandingOrder @@ -1040,6 +1041,9 @@ object ToSchemify { AuthUser, JobScheduler, MappedETag, + MappedSigningBasket, + MappedSigningBasketPayment, + MappedSigningBasketConsent, MappedRegulatedEntity, AtmAttribute, Admin, diff --git a/obp-api/src/main/scala/code/api/constant/constant.scala b/obp-api/src/main/scala/code/api/constant/constant.scala index bc0163d0a1..86a601cfe8 100644 --- a/obp-api/src/main/scala/code/api/constant/constant.scala +++ b/obp-api/src/main/scala/code/api/constant/constant.scala @@ -22,7 +22,7 @@ object Constant extends MdcLoggable { final val h2DatabaseDefaultUrlValue = "jdbc:h2:mem:OBPTest_H2_v2.1.214;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=10" - final val HostName = APIUtil.getPropsValue("hostname").openOrThrowException(ErrorMessages.HostnameNotSpecified) + def HostName = APIUtil.getPropsValue("hostname").openOrThrowException(ErrorMessages.HostnameNotSpecified) final val ApiInstanceId = { val apiInstanceIdFromProps = APIUtil.getPropsValue("api_instance_id") 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 5042e44026..5b0338bc33 100644 --- a/obp-api/src/main/scala/code/api/util/NewStyle.scala +++ b/obp-api/src/main/scala/code/api/util/NewStyle.scala @@ -1402,6 +1402,51 @@ object NewStyle extends MdcLoggable{ } } } + + /** + * + * @param userIds OBP support multiple challenges, we can ask different users to answer different challenges + * @param challengeType OBP support different challenge types, @see the Enum ChallengeType + * @param scaMethod @see the Enum StrongCustomerAuthentication + * @param scaStatus @see the Enum StrongCustomerAuthenticationStatus + * @param transactionRequestId it is also the BelinGroup PaymentId + * @param consentId + * @param basketId + * @param authenticationMethodId this is used for BelinGroup Consent + * @param callContext + * @return + */ + def createChallengesC3( + userIds: List[String], + challengeType: ChallengeType.Value, + transactionRequestId: Option[String], + scaMethod: Option[SCA], + scaStatus: Option[SCAStatus],//Only use for BerlinGroup Now + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + authenticationMethodId: Option[String], + callContext: Option[CallContext] + ) : OBPReturnType[List[ChallengeTrait]] = { + if(challengeType == ChallengeType.BERLINGROUP_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)){ + 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.createChallengesC3( + userIds: List[String], + challengeType: ChallengeType.Value, + transactionRequestId: Option[String], + scaMethod: Option[SCA], + scaStatus: Option[SCAStatus],//Only use for BerlinGroup Now + consentId: Option[String], // Note: consentId and transactionRequestId and consentId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and consentId are exclusive here. + authenticationMethodId: Option[String], + callContext: Option[CallContext] + ) map { i => + (unboxFullOrFail(i._1, callContext, s"$InvalidConnectorResponseForCreateChallenge ", 400), i._2) + } + } + } def getChallengesByTransactionRequestId( transactionRequestId: String, diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index 08278efb5d..0d4e8217bb 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -421,7 +421,19 @@ trait Connector extends MdcLoggable { consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. authenticationMethodId: Option[String], callContext: Option[CallContext]) : OBPReturnType[Box[List[ChallengeTrait]]]= Future{(Failure(setUnimplementedError), callContext)} - + + // now, we try to share the same challenges for obp payments, berlin group payments, berlin group consents and signing baskets + def createChallengesC3( + userIds: List[String], + challengeType: ChallengeType.Value, + transactionRequestId: Option[String], + scaMethod: Option[SCA], + scaStatus: Option[SCAStatus],//Only use for BerlinGroup Now + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + authenticationMethodId: Option[String], + callContext: Option[CallContext]) : OBPReturnType[Box[List[ChallengeTrait]]]= Future{(Failure(setUnimplementedError), callContext)} + // Validates an answer for a challenge and returns if the answer is correct or not def validateChallengeAnswer(challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = Future{(Full(true), callContext)} diff --git a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala index bdce90a3fb..5418bac7c6 100644 --- a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala +++ b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala @@ -365,6 +365,7 @@ object ConnectorBuilderUtil { "checkExternalUserCredentials", "checkExternalUserExists", "createChallengesC2", + "createChallengesC3", "getChallenge", "getChallengesByTransactionRequestId", "getChallengesByConsentId", diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index a963fe9859..fe23129b54 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -266,6 +266,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { None, //there are only for new version, set the empty here. None,//there are only for new version, set the empty here. None,//there are only for new version, set the empty here. + None,//there are only for new version, set the empty here. challengeType = OBP_TRANSACTION_REQUEST_CHALLENGE.toString, callContext: Option[CallContext]) (challenge._1.map(_.challengeId),challenge._2) @@ -296,6 +297,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { None, //there are only for new version, set the empty here. None,//there are only for new version, set the empty here. None,//there are only for new version, set the empty here. + None,//there are only for new version, set the empty here. challengeType = OBP_TRANSACTION_REQUEST_CHALLENGE.toString, callContext ) @@ -323,24 +325,43 @@ object LocalMappedConnector extends Connector with MdcLoggable { scaMethod, scaStatus, consentId, + None, // Signing Baskets are introduced in case of version createChallengesC3 authenticationMethodId, challengeType = OBP_TRANSACTION_REQUEST_CHALLENGE.toString, callContext ) challengeId.toList } + (Full(challenges.flatten), callContext) + } - //We use obp MappedExpectedChallengeAnswer instead of Authorisations now. - // please also check Challenges.ChallengeProvider.vend.saveChallenge -// Authorisations.authorisationProvider.vend.createAuthorization( -// transactionRequestId.getOrElse(""), -// consentId.getOrElse(""), -// AuthenticationType.SMS_OTP.toString, -// "", -// ScaStatus.received.toString, -// "12345" // TODO Implement SMS sending -// ) - + override def createChallengesC3( + userIds: List[String], + challengeType: ChallengeType.Value, + transactionRequestId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + scaMethod: Option[SCA], + scaStatus: Option[SCAStatus],//Only use for BerlinGroup Now + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + authenticationMethodId: Option[String], + callContext: Option[CallContext] + ): OBPReturnType[Box[List[ChallengeTrait]]] = Future { + val challenges = for { + userId <- userIds + } yield { + val (challengeId, _) = createChallengeInternal( + userId, + transactionRequestId.getOrElse(""), + scaMethod, + scaStatus, + consentId, + basketId, + authenticationMethodId, + challengeType = OBP_TRANSACTION_REQUEST_CHALLENGE.toString, + callContext + ) + challengeId.toList + } (Full(challenges.flatten), callContext) } @@ -349,7 +370,8 @@ object LocalMappedConnector extends Connector with MdcLoggable { transactionRequestId: String, scaMethod: Option[SCA], scaStatus: Option[SCAStatus], //Only use for BerlinGroup Now - consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. + consentId: Option[String], // Note: consentId and transactionRequestId and BasketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and BasketId are exclusive here. authenticationMethodId: Option[String], challengeType: String, callContext: Option[CallContext] @@ -367,6 +389,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { scaMethod, scaStatus, consentId, + basketId, authenticationMethodId, challengeType), callContext) } diff --git a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala index 9e6ca7c2c2..54ab9297df 100644 --- a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala +++ b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala @@ -308,7 +308,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2022-03-11T18:42:02Z +// ---------- created on 2024-01-15T10:29:27Z messageDocs += validateAndCheckIbanNumberDoc def validateAndCheckIbanNumberDoc = MessageDoc( @@ -332,7 +332,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { city=cityExample.value, zip="string", phone=phoneExample.value, - country="string", + country=countryExample.value, countryIso="string", sepaCreditTransfer=sepaCreditTransferExample.value, sepaDirectDebit=sepaDirectDebitExample.value, @@ -545,9 +545,11 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string")))) + authenticationMethodId=Some("string"), + attemptCounter=123))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -559,6 +561,51 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { response.map(convertToTuple[List[ChallengeCommons]](callContext)) } + messageDocs += createChallengesC3Doc + def createChallengesC3Doc = MessageDoc( + process = "obp.createChallengesC3", + messageFormat = messageFormat, + description = "Create Challenges C3", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundCreateChallengesC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + userIds=listExample.value.split("[,;]").toList, + challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, + transactionRequestId=Some(transactionRequestIdExample.value), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + consentId=Some(consentIdExample.value), + basketId=Some("string"), + authenticationMethodId=Some("string")) + ), + exampleInboundMessage = ( + InBoundCreateChallengesC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data=List( ChallengeCommons(challengeId=challengeIdExample.value, + transactionRequestId=transactionRequestIdExample.value, + expectedAnswer="string", + expectedUserId="string", + salt="string", + successful=true, + challengeType=challengeTypeExample.value, + consentId=Some(consentIdExample.value), + basketId=Some("string"), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + authenticationMethodId=Some("string"), + attemptCounter=123))) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def createChallengesC3(userIds: List[String], challengeType: ChallengeType.Value, transactionRequestId: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], scaStatus: Option[SCAStatus], consentId: Option[String], basketId: Option[String], authenticationMethodId: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { + import com.openbankproject.commons.dto.{InBoundCreateChallengesC3 => InBound, OutBoundCreateChallengesC3 => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userIds, challengeType, transactionRequestId, scaMethod, scaStatus, consentId, basketId, authenticationMethodId) + val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) + response.map(convertToTuple[List[ChallengeCommons]](callContext)) + } + messageDocs += validateChallengeAnswerDoc def validateChallengeAnswerDoc = MessageDoc( process = "obp.validateChallengeAnswer", @@ -611,9 +658,11 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"))) + authenticationMethodId=Some("string"), + attemptCounter=123)) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -647,9 +696,11 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string")))) + authenticationMethodId=Some("string"), + attemptCounter=123))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -683,9 +734,11 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string")))) + authenticationMethodId=Some("string"), + attemptCounter=123))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -719,9 +772,11 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), - authenticationMethodId=Some("string"))) + authenticationMethodId=Some("string"), + attemptCounter=123)) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -958,7 +1013,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def getBankAccountByRoutingLegacy(bankId: Option[BankId], scheme: String, address: String, callContext: Option[CallContext]): Box[(BankAccount, Option[CallContext])] = { + override def getBankAccountByRouting(bankId: Option[BankId], scheme: String, address: String, callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { import com.openbankproject.commons.dto.{InBoundGetBankAccountByRouting => InBound, OutBoundGetBankAccountByRouting => OutBound} val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, scheme, address) val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) @@ -1431,8 +1486,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), collected=Some(CardCollectionInfo(toDate(collectedExample))), posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value - ))) + customerId=customerIdExample.value, + cvv=Some(cvvExample.value), + brand=Some(brandExample.value)))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -1498,8 +1554,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), collected=Some(CardCollectionInfo(toDate(collectedExample))), posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value - )) + customerId=customerIdExample.value, + cvv=Some(cvvExample.value), + brand=Some(brandExample.value))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -1613,7 +1670,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), collected=Some(CardCollectionInfo(toDate(collectedExample))), posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value))) + customerId=customerIdExample.value, + cvv=Some(cvvExample.value), + brand=Some(brandExample.value)))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -1656,8 +1715,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { collected=Some(CardCollectionInfo(toDate(collectedExample))), posted=Some(CardPostedInfo(toDate(postedExample))), customerId=customerIdExample.value, - cvv = cvvExample.value, - brand = brandExample.value) + cvv=cvvExample.value, + brand=brandExample.value) ), exampleInboundMessage = ( InBoundCreatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, @@ -1701,17 +1760,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), collected=Some(CardCollectionInfo(toDate(collectedExample))), posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value)) + customerId=customerIdExample.value, + cvv=Some(cvvExample.value), + brand=Some(brandExample.value))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, - serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, - technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, - replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], - posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String, - callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = { + override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = { import com.openbankproject.commons.dto.{InBoundCreatePhysicalCard => InBound, OutBoundCreatePhysicalCard => OutBound} val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand) val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) @@ -1793,7 +1849,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)), collected=Some(CardCollectionInfo(toDate(collectedExample))), posted=Some(CardPostedInfo(toDate(postedExample))), - customerId=customerIdExample.value)) + customerId=customerIdExample.value, + cvv=Some(cvvExample.value), + brand=Some(brandExample.value))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -1950,6 +2008,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -2127,6 +2193,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -2245,6 +2319,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -2336,6 +2418,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -2440,6 +2530,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -2510,6 +2608,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -3016,7 +3122,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { siteName=Some("string"), cashWithdrawalNationalFee=Some(cashWithdrawalNationalFeeExample.value), cashWithdrawalInternationalFee=Some(cashWithdrawalInternationalFeeExample.value), - balanceInquiryFee=Some(balanceInquiryFeeExample.value))) + balanceInquiryFee=Some(balanceInquiryFeeExample.value), + atmType=Some(atmTypeExample.value), + phone=Some(phoneExample.value))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -3095,7 +3203,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { siteName=Some("string"), cashWithdrawalNationalFee=Some(cashWithdrawalNationalFeeExample.value), cashWithdrawalInternationalFee=Some(cashWithdrawalInternationalFeeExample.value), - balanceInquiryFee=Some(balanceInquiryFeeExample.value)))) + balanceInquiryFee=Some(balanceInquiryFeeExample.value), + atmType=Some(atmTypeExample.value), + phone=Some(phoneExample.value)))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -3190,6 +3300,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -3447,6 +3565,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -3533,6 +3659,14 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { account_id=account_idExample.value)), to_sepa=Some(TransactionRequestIban(transactionRequestIban.value)), to_counterparty=Some(TransactionRequestCounterpartyId(transactionRequestCounterpartyIdExample.value)), + to_simple=Some( TransactionRequestSimple(otherBankRoutingScheme=otherBankRoutingSchemeExample.value, + otherBankRoutingAddress=otherBankRoutingAddressExample.value, + otherBranchRoutingScheme=otherBranchRoutingSchemeExample.value, + otherBranchRoutingAddress=otherBranchRoutingAddressExample.value, + otherAccountRoutingScheme=otherAccountRoutingSchemeExample.value, + otherAccountRoutingAddress=otherAccountRoutingAddressExample.value, + otherAccountSecondaryRoutingScheme=otherAccountSecondaryRoutingSchemeExample.value, + otherAccountSecondaryRoutingAddress=otherAccountSecondaryRoutingAddressExample.value)), to_transfer_to_phone=Some( TransactionRequestTransferToPhone(value= AmountOfMoneyJsonV121(currency=currencyExample.value, amount=amountExample.value), description=descriptionExample.value, @@ -4491,8 +4625,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { key=keyExample.value, value=valueExample.value, timeStamp=toDate(timeStampExample), - consumerId=consumerIdExample.value - )) + consumerId=consumerIdExample.value)) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -4526,8 +4659,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { value=valueExample.value, challenge=challengeExample.value, status=statusExample.value, - consumerId=consumerIdExample.value - )) + consumerId=consumerIdExample.value)) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -4609,7 +4741,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { userId=userIdExample.value, key=keyExample.value, value=valueExample.value, - timeStamp=toDate(timeStampExample), + timeStamp=toDate(timeStampExample), consumerId=consumerIdExample.value))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) @@ -4771,7 +4903,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { accountAttributeId=accountAttributeIdExample.value, name=nameExample.value, attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value)) + value=valueExample.value, + productInstanceCode=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -4829,7 +4962,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { productAttributeId=Some(productAttributeIdExample.value), name=nameExample.value, accountAttributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value) + value=valueExample.value, + productInstanceCode=Some("string")) ), exampleInboundMessage = ( InBoundCreateOrUpdateAccountAttribute(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, @@ -4840,15 +4974,15 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { accountAttributeId=accountAttributeIdExample.value, name=nameExample.value, attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value)) + value=valueExample.value, + productInstanceCode=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def createOrUpdateAccountAttribute(bankId: BankId, accountId: AccountId, productCode: ProductCode, productAttributeId: Option[String], name: String, accountAttributeType: AccountAttributeType.Value, value: String, - productInstanceCode: Option[String],callContext: Option[CallContext]): OBPReturnType[Box[AccountAttribute]] = { + override def createOrUpdateAccountAttribute(bankId: BankId, accountId: AccountId, productCode: ProductCode, productAttributeId: Option[String], name: String, accountAttributeType: AccountAttributeType.Value, value: String, productInstanceCode: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[AccountAttribute]] = { import com.openbankproject.commons.dto.{InBoundCreateOrUpdateAccountAttribute => InBound, OutBoundCreateOrUpdateAccountAttribute => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, productCode, productAttributeId, name, accountAttributeType, value) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, productCode, productAttributeId, name, accountAttributeType, value, productInstanceCode) val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) response.map(convertToTuple[AccountAttributeCommons](callContext)) } @@ -4943,7 +5077,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { name=nameExample.value, attributeType=com.openbankproject.commons.model.enums.ProductAttributeType.example, value=valueExample.value, - isActive=Some(isActiveExample.value.toBoolean)))) + isActive=Some(isActiveExample.value.toBoolean))), + productInstanceCode=Some("string")) ), exampleInboundMessage = ( InBoundCreateAccountAttributes(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, @@ -4954,15 +5089,15 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { accountAttributeId=accountAttributeIdExample.value, name=nameExample.value, attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value))) + value=valueExample.value, + productInstanceCode=Some("string")))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) - override def createAccountAttributes(bankId: BankId, accountId: AccountId, productCode: ProductCode, accountAttributes: List[ProductAttribute], - productInstanceCode: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[AccountAttribute]]] = { + override def createAccountAttributes(bankId: BankId, accountId: AccountId, productCode: ProductCode, accountAttributes: List[ProductAttribute], productInstanceCode: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[AccountAttribute]]] = { import com.openbankproject.commons.dto.{InBoundCreateAccountAttributes => InBound, OutBoundCreateAccountAttributes => OutBound} - val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, productCode, accountAttributes) + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId, productCode, accountAttributes, productInstanceCode) val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) response.map(convertToTuple[List[AccountAttributeCommons]](callContext)) } @@ -4988,7 +5123,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { accountAttributeId=accountAttributeIdExample.value, name=nameExample.value, attributeType=com.openbankproject.commons.model.enums.AccountAttributeType.example, - value=valueExample.value))) + value=valueExample.value, + productInstanceCode=Some("string")))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -6091,7 +6227,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { date=toDate(dateExample), message=messageExample.value, fromDepartment=fromDepartmentExample.value, - fromPerson=fromPersonExample.value)) + fromPerson=fromPersonExample.value, + transport=Some(transportExample.value))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -6240,6 +6377,6 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2022-03-11T18:42:02Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-15T10:29:27Z +//---------------- dynamic end ---------------------please don't modify this line } diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index cc8f4c8f98..070c7de2da 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -96,7 +96,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2023-06-01T16:45:32Z +// ---------- created on 2024-01-15T10:31:47Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -367,6 +367,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -382,6 +383,51 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable response.map(convertToTuple[List[ChallengeCommons]](callContext)) } + messageDocs += createChallengesC3Doc + def createChallengesC3Doc = MessageDoc( + process = "obp.createChallengesC3", + messageFormat = messageFormat, + description = "Create Challenges C3", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundCreateChallengesC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + userIds=listExample.value.split("[,;]").toList, + challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, + transactionRequestId=Some(transactionRequestIdExample.value), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + consentId=Some(consentIdExample.value), + basketId=Some("string"), + authenticationMethodId=Some("string")) + ), + exampleInboundMessage = ( + InBoundCreateChallengesC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data=List( ChallengeCommons(challengeId=challengeIdExample.value, + transactionRequestId=transactionRequestIdExample.value, + expectedAnswer="string", + expectedUserId="string", + salt="string", + successful=true, + challengeType=challengeTypeExample.value, + consentId=Some(consentIdExample.value), + basketId=Some("string"), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + authenticationMethodId=Some("string"), + attemptCounter=123))) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def createChallengesC3(userIds: List[String], challengeType: ChallengeType.Value, transactionRequestId: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], scaStatus: Option[SCAStatus], consentId: Option[String], basketId: Option[String], authenticationMethodId: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { + import com.openbankproject.commons.dto.{InBoundCreateChallengesC3 => InBound, OutBoundCreateChallengesC3 => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userIds, challengeType, transactionRequestId, scaMethod, scaStatus, consentId, basketId, authenticationMethodId) + val response: Future[Box[InBound]] = sendRequest[InBound](getUrl(callContext, "createChallengesC3"), HttpMethods.POST, req, callContext) + response.map(convertToTuple[List[ChallengeCommons]](callContext)) + } + messageDocs += validateChallengeAnswerDoc def validateChallengeAnswerDoc = MessageDoc( process = "obp.validateChallengeAnswer", @@ -434,6 +480,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -471,6 +518,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -508,6 +556,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -545,6 +594,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -6516,8 +6566,8 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2023-06-01T16:45:32Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-15T10:31:47Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") diff --git a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala index 304c4d0e27..49338a7d3e 100644 --- a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala @@ -75,7 +75,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { val connectorName = "stored_procedure_vDec2019" //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2023-06-01T16:47:09Z +// ---------- created on 2024-01-15T10:32:00Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -346,6 +346,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -361,6 +362,51 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[List[ChallengeCommons]](callContext)) } + messageDocs += createChallengesC3Doc + def createChallengesC3Doc = MessageDoc( + process = "obp.createChallengesC3", + messageFormat = messageFormat, + description = "Create Challenges C3", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundCreateChallengesC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + userIds=listExample.value.split("[,;]").toList, + challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, + transactionRequestId=Some(transactionRequestIdExample.value), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + consentId=Some(consentIdExample.value), + basketId=Some("string"), + authenticationMethodId=Some("string")) + ), + exampleInboundMessage = ( + InBoundCreateChallengesC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data=List( ChallengeCommons(challengeId=challengeIdExample.value, + transactionRequestId=transactionRequestIdExample.value, + expectedAnswer="string", + expectedUserId="string", + salt="string", + successful=true, + challengeType=challengeTypeExample.value, + consentId=Some(consentIdExample.value), + basketId=Some("string"), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + authenticationMethodId=Some("string"), + attemptCounter=123))) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def createChallengesC3(userIds: List[String], challengeType: ChallengeType.Value, transactionRequestId: Option[String], scaMethod: Option[StrongCustomerAuthentication.SCA], scaStatus: Option[SCAStatus], consentId: Option[String], basketId: Option[String], authenticationMethodId: Option[String], callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { + import com.openbankproject.commons.dto.{InBoundCreateChallengesC3 => InBound, OutBoundCreateChallengesC3 => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, userIds, challengeType, transactionRequestId, scaMethod, scaStatus, consentId, basketId, authenticationMethodId) + val response: Future[Box[InBound]] = sendRequest[InBound]("obp_create_challenges_c3", req, callContext) + response.map(convertToTuple[List[ChallengeCommons]](callContext)) + } + messageDocs += validateChallengeAnswerDoc def validateChallengeAnswerDoc = MessageDoc( process = "obp.validateChallengeAnswer", @@ -413,6 +459,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -450,6 +497,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -487,6 +535,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -524,6 +573,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), + basketId=Some("string"), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -6495,8 +6545,8 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2023-06-01T16:47:09Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-15T10:32:00Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") diff --git a/obp-api/src/main/scala/code/remotedata/RemotedataChallenges.scala b/obp-api/src/main/scala/code/remotedata/RemotedataChallenges.scala index 868f4f1117..cf0b86ea45 100644 --- a/obp-api/src/main/scala/code/remotedata/RemotedataChallenges.scala +++ b/obp-api/src/main/scala/code/remotedata/RemotedataChallenges.scala @@ -20,12 +20,13 @@ object RemotedataChallenges extends ObpActorInit with ChallengeProvider { expectedUserId: String, scaMethod: Option[SCA], scaStatus: Option[SCAStatus], - consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. authenticationMethodId: Option[String], challengeType: String, ): Box[ChallengeTrait] = getValueFromFuture( - (actor ? cc.saveChallenge(challengeId, transactionRequestId, salt, expectedAnswer, expectedUserId, scaMethod, scaStatus, consentId, authenticationMethodId, challengeType)) + (actor ? cc.saveChallenge(challengeId, transactionRequestId, salt, expectedAnswer, expectedUserId, scaMethod, scaStatus, consentId, basketId, authenticationMethodId, challengeType)) .mapTo[Box[ChallengeTrait]] ) @@ -44,5 +45,8 @@ object RemotedataChallenges extends ObpActorInit with ChallengeProvider { override def getChallengesByConsentId(consentId: String): Box[List[ChallengeTrait]] = getValueFromFuture( (actor ? cc.getChallengesByConsentId(consentId)).mapTo[Box[List[ChallengeTrait]]] ) + override def getChallengesByBasketId(basketId: String): Box[List[ChallengeTrait]] = getValueFromFuture( + (actor ? cc.getChallengesByConsentId(basketId )).mapTo[Box[List[ChallengeTrait]]] + ) } diff --git a/obp-api/src/main/scala/code/remotedata/RemotedataChallengesActor.scala b/obp-api/src/main/scala/code/remotedata/RemotedataChallengesActor.scala index f26c530c74..1d5f141da2 100644 --- a/obp-api/src/main/scala/code/remotedata/RemotedataChallengesActor.scala +++ b/obp-api/src/main/scala/code/remotedata/RemotedataChallengesActor.scala @@ -17,12 +17,13 @@ class RemotedataChallengesActor extends Actor with ObpActorHelper with MdcLoggab case cc.saveChallenge(challengeId: String, transactionRequestId: String, salt: String, expectedAnswer: String, expectedUserId: String, scaMethod: Option[SCA], scaStatus: Option[SCAStatus], - consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. authenticationMethodId: Option[String], challengeType: String, ) => logger.debug(s"saveChallenge($challengeId, $transactionRequestId, $salt, $expectedAnswer, $expectedUserId)") - sender ! (mapper.saveChallenge(challengeId, transactionRequestId, salt, expectedAnswer, expectedUserId, scaMethod, scaStatus, consentId, authenticationMethodId, challengeType: String)) + sender ! (mapper.saveChallenge(challengeId, transactionRequestId, salt, expectedAnswer, expectedUserId, scaMethod, scaStatus, consentId, basketId, authenticationMethodId, challengeType: String)) case cc.getChallenge(challengeId: String) => logger.debug(s"getChallenge($challengeId)") diff --git a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala new file mode 100644 index 0000000000..ee90168572 --- /dev/null +++ b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala @@ -0,0 +1,105 @@ +package code.signingbaskets + +import code.util.MappedUUID +import com.openbankproject.commons.model.{RegulatedEntityTrait, SigningBasketConsentTrait, SigningBasketPaymentTrait, SigningBasketTrait} +import net.liftweb.common.Box +import net.liftweb.common.Box.tryo +import net.liftweb.mapper._ + +import scala.concurrent.Future + +object MappedSigningBasketProvider extends SigningBasketProvider { + def getSigningBaskets(): List[SigningBasketTrait] = { + MappedSigningBasket.findAll() + } + + override def getSigningBasketByBasketId(entityId: String): Box[SigningBasketTrait] = { + MappedSigningBasket.find(By(MappedSigningBasket.BasketId, entityId)) + } + + override def createSigningBasket(basketId: Option[String], + status: Option[String], + description: Option[String], + ): Box[SigningBasketTrait] = { + tryo { + val entity = MappedSigningBasket.create + basketId match { + case Some(v) => entity.BasketId(v) + case None => + } + status match { + case Some(v) => entity.Status(v) + case None => + } + description match { + case Some(v) => entity.Description(v) + case None => + } + + if (entity.validate.isEmpty) { + entity.saveMe() + } else { + throw new Error(entity.validate.map(_.msg.toString()).mkString(";")) + } + } + } + + override def deleteSigningBasket(id: String): Box[Boolean] = { + tryo( + MappedSigningBasket.bulkDelete_!!(By(MappedSigningBasket.BasketId, id)) + ) + } + +} + +class MappedSigningBasket extends SigningBasketTrait with LongKeyedMapper[MappedSigningBasket] with IdPK { + override def getSingleton = MappedSigningBasket + object BasketId extends MappedUUID(this) + object Status extends MappedString(this, 50) + object Description extends MappedText(this) + + + + override def basketId: String = BasketId.get + override def status: String = Status.get + override def description: String = Description.get + + +} + +object MappedSigningBasket extends MappedSigningBasket with LongKeyedMetaMapper[MappedSigningBasket] { + override def dbTableName = "SigningBasket" // define the DB table name + override def dbIndexes = Index(BasketId) :: super.dbIndexes +} + + +class MappedSigningBasketPayment extends SigningBasketPaymentTrait with LongKeyedMapper[MappedSigningBasketPayment] with IdPK { + override def getSingleton = MappedSigningBasketPayment + object BasketId extends MappedUUID(this) + object PaymentId extends MappedUUID(this) + + + override def basketId: String = BasketId.get + override def paymentId: String = PaymentId.get + +} +object MappedSigningBasketPayment extends MappedSigningBasketPayment with LongKeyedMetaMapper[MappedSigningBasketPayment] { + override def dbTableName = "SigningBasketPayment" // define the DB table name + override def dbIndexes = Index(BasketId, PaymentId) :: super.dbIndexes +} + +class MappedSigningBasketConsent extends SigningBasketConsentTrait with LongKeyedMapper[MappedSigningBasketConsent] with IdPK { + override def getSingleton = MappedSigningBasketConsent + object BasketId extends MappedUUID(this) + object ConsentId extends MappedUUID(this) + + + override def basketId: String = BasketId.get + override def consentId: String = ConsentId.get + +} +object MappedSigningBasketConsent extends MappedSigningBasketConsent with LongKeyedMetaMapper[MappedSigningBasketConsent] { + override def dbTableName = "SigningBasketConsent" // define the DB table name + override def dbIndexes = Index(BasketId, ConsentId) :: super.dbIndexes +} + diff --git a/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala b/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala new file mode 100644 index 0000000000..6e2f041815 --- /dev/null +++ b/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala @@ -0,0 +1,27 @@ +package code.signingbaskets + +import com.openbankproject.commons.model.SigningBasketTrait +import net.liftweb.common.{Box, Logger} +import net.liftweb.util.SimpleInjector + +object SigningBasketX extends SimpleInjector { + val signingBasketProvider: SigningBasketX.Inject[SigningBasketProvider] = new Inject(buildOne _) {} + private def buildOne: SigningBasketProvider = MappedSigningBasketProvider +} + +trait SigningBasketProvider { + + private val logger = Logger(classOf[SigningBasketProvider]) + + def getSigningBaskets(): List[SigningBasketTrait] + + def getSigningBasketByBasketId(entityId: String): Box[SigningBasketTrait] + + def createSigningBasket(basketId: Option[String], + status: Option[String], + description: Option[String], + ): Box[SigningBasketTrait] + + def deleteSigningBasket(id: String): Box[Boolean] + +} \ No newline at end of file diff --git a/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala b/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala index 84437e5e5d..5c8ea19d8b 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/ChallengeProvider.scala @@ -10,13 +10,14 @@ import net.liftweb.common.Box trait ChallengeProvider { def saveChallenge( challengeId: String, - transactionRequestId: String, + transactionRequestId: String, // Note: basketId, consentId and transactionRequestId are exclusive here. salt: String, expectedAnswer: String, expectedUserId: String, scaMethod: Option[SCA], scaStatus: Option[SCAStatus], - consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. + consentId: Option[String], // Note: basketId, consentId and transactionRequestId are exclusive here. + basketId: Option[String], // Note: basketId, consentId and transactionRequestId are exclusive here. authenticationMethodId: Option[String], challengeType: String, ): Box[ChallengeTrait] @@ -26,7 +27,8 @@ trait ChallengeProvider { def getChallengesByTransactionRequestId(transactionRequestId: String): Box[List[ChallengeTrait]] def getChallengesByConsentId(consentId: String): Box[List[ChallengeTrait]] - + def getChallengesByBasketId(basketId: String): Box[List[ChallengeTrait]] + /** * There is another method: Connector.validateChallengeAnswer, it validate the challenge over Kafka. * This method, will validate the answer in OBP side. @@ -45,7 +47,8 @@ class RemotedataChallengeProviderCaseClasses { expectedUserId: String, scaMethod: Option[SCA], scaStatus: Option[SCAStatus], - consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. authenticationMethodId: Option[String], challengeType: String, ) diff --git a/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala b/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala index 0006d6f5e7..3961c3cf3c 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala @@ -19,40 +19,44 @@ object MappedChallengeProvider extends ChallengeProvider { override def saveChallenge( challengeId: String, - transactionRequestId: String, + transactionRequestId: String, // Note: consentId and transactionRequestId and basketId are exclusive here. salt: String, expectedAnswer: String, expectedUserId: String, scaMethod: Option[SCA], scaStatus: Option[SCAStatus], - consentId: Option[String], // Note: consentId and transactionRequestId are exclusive here. + consentId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. + basketId: Option[String], // Note: consentId and transactionRequestId and basketId are exclusive here. authenticationMethodId: Option[String], challengeType: String, ): Box[ChallengeTrait] = tryo ( MappedExpectedChallengeAnswer .create - .mChallengeId(challengeId) - .mChallengeType(challengeType) - .mTransactionRequestId(transactionRequestId) - .mSalt(salt) - .mExpectedAnswer(expectedAnswer) - .mExpectedUserId(expectedUserId) - .mScaMethod(scaMethod.map(_.toString).getOrElse("")) - .mScaStatus(scaStatus.map(_.toString).getOrElse("")) - .mConsentId(consentId.getOrElse("")) - .mAuthenticationMethodId(expectedUserId) + .ChallengeId(challengeId) + .ChallengeType(challengeType) + .TransactionRequestId(transactionRequestId) + .Salt(salt) + .ExpectedAnswer(expectedAnswer) + .ExpectedUserId(expectedUserId) + .ScaMethod(scaMethod.map(_.toString).getOrElse("")) + .ScaStatus(scaStatus.map(_.toString).getOrElse("")) + .ConsentId(consentId.getOrElse("")) + .BasketId(basketId.getOrElse("")) + .AuthenticationMethodId(expectedUserId) .saveMe() ) override def getChallenge(challengeId: String): Box[MappedExpectedChallengeAnswer] = - MappedExpectedChallengeAnswer.find(By(MappedExpectedChallengeAnswer.mChallengeId,challengeId)) + MappedExpectedChallengeAnswer.find(By(MappedExpectedChallengeAnswer.ChallengeId,challengeId)) override def getChallengesByTransactionRequestId(transactionRequestId: String): Box[List[ChallengeTrait]] = - Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.mTransactionRequestId,transactionRequestId))) + Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.TransactionRequestId,transactionRequestId))) override def getChallengesByConsentId(consentId: String): Box[List[ChallengeTrait]] = - Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.mConsentId,consentId))) + Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.ConsentId,consentId))) + override def getChallengesByBasketId(id: String): Box[List[ChallengeTrait]] = + Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.BasketId,id))) override def validateChallenge( challengeId: String, @@ -63,7 +67,7 @@ object MappedChallengeProvider extends ChallengeProvider { challenge <- getChallenge(challengeId) ?~! s"${ErrorMessages.InvalidTransactionRequestChallengeId}" currentAttemptCounterValue = challenge.attemptCounter //We update the counter anyway. - _ = challenge.mAttemptCounter(currentAttemptCounterValue+1).saveMe() + _ = challenge.AttemptCounter(currentAttemptCounterValue+1).saveMe() createDateTime = challenge.createdAt.get challengeTTL : Long = Helpers.seconds(APIUtil.transactionRequestChallengeTtl) @@ -76,7 +80,7 @@ object MappedChallengeProvider extends ChallengeProvider { userId match { case None => if(currentHashedAnswer==expectedHashedAnswer) { - tryo{challenge.mSuccessful(true).mScaStatus(StrongCustomerAuthenticationStatus.finalised.toString).saveMe()} + tryo{challenge.Successful(true).ScaStatus(StrongCustomerAuthenticationStatus.finalised.toString).saveMe()} } else { Failure(s"${ s"${ @@ -87,7 +91,7 @@ object MappedChallengeProvider extends ChallengeProvider { } case Some(id) => if(currentHashedAnswer==expectedHashedAnswer && id==challenge.expectedUserId) { - tryo{challenge.mSuccessful(true).mScaStatus(StrongCustomerAuthenticationStatus.finalised.toString).saveMe()} + tryo{challenge.Successful(true).ScaStatus(StrongCustomerAuthenticationStatus.finalised.toString).saveMe()} } else { Failure(s"${ s"${ diff --git a/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala b/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala index 3fd5683431..38bbf97dbe 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala @@ -2,9 +2,9 @@ package code.transactionChallenge import code.util.MappedUUID import com.openbankproject.commons.model.ChallengeTrait -import com.openbankproject.commons.model.enums.{StrongCustomerAuthentication, StrongCustomerAuthenticationStatus} import com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SCA import com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.SCAStatus +import com.openbankproject.commons.model.enums.{StrongCustomerAuthentication, StrongCustomerAuthenticationStatus} import net.liftweb.mapper._ class MappedExpectedChallengeAnswer extends ChallengeTrait with LongKeyedMapper[MappedExpectedChallengeAnswer] with IdPK with CreatedUpdated { @@ -12,36 +12,39 @@ class MappedExpectedChallengeAnswer extends ChallengeTrait with LongKeyedMapper[ def getSingleton = MappedExpectedChallengeAnswer // Unique - object mChallengeId extends MappedUUID(this) - object mChallengeType extends MappedString(this, 100) - object mTransactionRequestId extends MappedUUID(this) - object mExpectedAnswer extends MappedString(this,50) - object mExpectedUserId extends MappedUUID(this) - object mSalt extends MappedString(this, 50) - object mSuccessful extends MappedBoolean(this) - - object mScaMethod extends MappedString(this,100) - object mScaStatus extends MappedString(this,100) - object mConsentId extends MappedString(this,100) - object mAuthenticationMethodId extends MappedString(this,100) - object mAttemptCounter extends MappedInt(this){ + object ChallengeId extends MappedUUID(this) + object ChallengeType extends MappedString(this, 100) + object TransactionRequestId extends MappedUUID(this) + object ExpectedAnswer extends MappedString(this,50) + object ExpectedUserId extends MappedUUID(this) + object Salt extends MappedString(this, 50) + object Successful extends MappedBoolean(this) + + object ScaMethod extends MappedString(this,100) + object ScaStatus extends MappedString(this,100) + object ConsentId extends MappedString(this,100) + object BasketId extends MappedString(this,100) + object AuthenticationMethodId extends MappedString(this,100) + object AttemptCounter extends MappedInt(this){ override def defaultValue = 0 } - - override def challengeId: String = mChallengeId.get - override def challengeType: String = mChallengeType.get - override def transactionRequestId: String = mTransactionRequestId.get - override def expectedAnswer: String = mExpectedAnswer.get - override def expectedUserId: String = mExpectedUserId.get - override def salt: String = mSalt.get - override def successful: Boolean = mSuccessful.get - override def consentId: Option[String] = Option(mConsentId.get) - override def scaMethod: Option[SCA] = Option(StrongCustomerAuthentication.withName(mScaMethod.get)) - override def scaStatus: Option[SCAStatus] = Option(StrongCustomerAuthenticationStatus.withName(mScaStatus.get)) - override def authenticationMethodId: Option[String] = Option(mAuthenticationMethodId.get) - override def attemptCounter: Int = mAttemptCounter.get + + override def challengeId: String = ChallengeId.get + override def challengeType: String = ChallengeType.get + override def transactionRequestId: String = TransactionRequestId.get + override def expectedAnswer: String = ExpectedAnswer.get + override def expectedUserId: String = ExpectedUserId.get + override def salt: String = Salt.get + override def successful: Boolean = Successful.get + override def consentId: Option[String] = Option(ConsentId.get) + override def basketId: Option[String] = Option(BasketId.get) + override def scaMethod: Option[SCA] = Option(StrongCustomerAuthentication.withName(ScaMethod.get)) + override def scaStatus: Option[SCAStatus] = Option(StrongCustomerAuthenticationStatus.withName(ScaStatus.get)) + override def authenticationMethodId: Option[String] = Option(AuthenticationMethodId.get) + override def attemptCounter: Int = AttemptCounter.get } object MappedExpectedChallengeAnswer extends MappedExpectedChallengeAnswer with LongKeyedMetaMapper[MappedExpectedChallengeAnswer] { - override def dbIndexes = UniqueIndex(mChallengeId):: super.dbIndexes + override def dbTableName = "ExpectedChallengeAnswer" // define the DB table name + override def dbIndexes = UniqueIndex(ChallengeId):: super.dbIndexes } \ No newline at end of file diff --git a/obp-api/src/test/scala/code/connector/RestConnector_vMar2019_frozen_meta_data b/obp-api/src/test/scala/code/connector/RestConnector_vMar2019_frozen_meta_data index 5a1f839fd6b5a443eee23752d2b4ab336d09de37..eff03ed3a829ad14ab2c5cc2ef3f1275f049ca18 100644 GIT binary patch delta 6134 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 delta 6244 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 Ks&#x_8TM~pJBxV$ diff --git a/obp-api/src/test/scala/code/util/MappedClassNameTest.scala b/obp-api/src/test/scala/code/util/MappedClassNameTest.scala index 06dc3040fa..347bc6ec08 100644 --- a/obp-api/src/test/scala/code/util/MappedClassNameTest.scala +++ b/obp-api/src/test/scala/code/util/MappedClassNameTest.scala @@ -116,6 +116,9 @@ class MappedClassNameTest extends FeatureSpec { "code.UserRefreshes.MappedUserRefreshes", "code.DynamicEndpoint.DynamicEndpoint", "code.regulatedentities.MappedRegulatedEntity", + "code.signingbaskets.MappedSigningBasketConsent", + "code.signingbaskets.MappedSigningBasket", + "code.signingbaskets.MappedSigningBasketPayment", "code.CustomerDependants.MappedCustomerDependant") val newMappedTypes = ClassScanUtils.findTypes{ info => diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala b/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala index deaf224f02..b17aae8557 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala @@ -1334,8 +1334,19 @@ case class OutBoundCreateChallengesC2( scaStatus: Option[SCAStatus], consentId: Option[String], authenticationMethodId: Option[String]) extends TopicTrait +case class OutBoundCreateChallengesC3( + outboundAdapterCallContext: OutboundAdapterCallContext, + userIds: List[String], + challengeType: ChallengeType.Value, + transactionRequestId: Option[String], + scaMethod: Option[SCA], + scaStatus: Option[SCAStatus], + consentId: Option[String], + basketId: Option[String], + authenticationMethodId: Option[String]) extends TopicTrait case class InBoundCreateChallengesC2(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[ChallengeCommons]) extends InBoundTrait[List[ChallengeCommons]] +case class InBoundCreateChallengesC3(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[ChallengeCommons]) extends InBoundTrait[List[ChallengeCommons]] case class OutBoundValidateChallengeAnswerC2( outboundAdapterCallContext: OutboundAdapterCallContext, diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala index 31844b7af1..3b869c13b9 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala @@ -532,6 +532,7 @@ case class ChallengeCommons( override val challengeType: String, override val consentId: Option[String], + override val basketId: Option[String] = None, override val scaMethod: Option[SCA], override val scaStatus: Option[SCAStatus], override val authenticationMethodId: Option[String] , diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala index 7707a607b9..e59b311a88 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala @@ -96,6 +96,19 @@ trait AccountApplication { def status: String } +trait SigningBasketTrait { + def basketId: String + def status: String + def description: String +} +trait SigningBasketPaymentTrait { + def basketId: String + def paymentId: String +} +trait SigningBasketConsentTrait { + def basketId: String + def consentId: String +} trait RegulatedEntityTrait { def entityId: String @@ -590,6 +603,7 @@ trait ChallengeTrait { //NOTE: following are from BerlinGroup, we try to share the same challenges for different standard. //for OBP standard, all the following can be Optional: def consentId: Option[String] // Note: consentId and transactionRequestId are exclusive here. + def basketId: Option[String] // Note: consentId and transactionRequestId are exclusive here. def scaMethod: Option[SCA] def scaStatus: Option[SCAStatus] def authenticationMethodId: Option[String] diff --git a/release_notes.md b/release_notes.md index 489530bf20..7114e7b7f8 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,6 +3,7 @@ ### Most recent changes at top of file ``` Date Commit Action +12/01/2024 Renamed table MappedExpectedChallengeAnswer => ExpectedChallengeAnswer and removed prefix 'm' from fields. 16/11/2023 2b8811dc Added show_used_connector_methods, default is false. 30/10/2023 4e82c66c Added createLocalisedResourceDocJson.cache.ttl.seconds, default is 3600 13/10/2023 d87c99d8 Added props hikari.connectionTimeout, default is from hikari. From 23b0328994c23fbd95f708623ccffc2f992da89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 16 Jan 2024 12:08:32 +0100 Subject: [PATCH 03/21] docfix/Tweak renamed table MappedExpectedChallengeAnswer release note --- release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_notes.md b/release_notes.md index 7114e7b7f8..76a124111a 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,7 +3,7 @@ ### Most recent changes at top of file ``` Date Commit Action -12/01/2024 Renamed table MappedExpectedChallengeAnswer => ExpectedChallengeAnswer and removed prefix 'm' from fields. +12/01/2024 e14946b8 Renamed table MappedExpectedChallengeAnswer => ExpectedChallengeAnswer and removed prefix 'm' from fields. 16/11/2023 2b8811dc Added show_used_connector_methods, default is false. 30/10/2023 4e82c66c Added createLocalisedResourceDocJson.cache.ttl.seconds, default is 3600 13/10/2023 d87c99d8 Added props hikari.connectionTimeout, default is from hikari. From 81d0791b8e0db1104aab968ce9cbde2b88eae1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 17 Jan 2024 09:46:20 +0100 Subject: [PATCH 04/21] docfix/Tweak akka, rest and stored procedure connector --- .../scala/code/api/util/ExampleValue.scala | 5 ++++- .../akka/AkkaConnector_vDec2018.scala | 20 +++++++++---------- .../rest/RestConnector_vMar2019.scala | 20 +++++++++---------- .../StoredProcedureConnector_vDec2019.scala | 20 +++++++++---------- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/obp-api/src/main/scala/code/api/util/ExampleValue.scala b/obp-api/src/main/scala/code/api/util/ExampleValue.scala index 8777fcab92..2ce0791848 100644 --- a/obp-api/src/main/scala/code/api/util/ExampleValue.scala +++ b/obp-api/src/main/scala/code/api/util/ExampleValue.scala @@ -1491,7 +1491,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("direct_debit_id", directDebitIdExample) lazy val consentIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("consent_id", consentIdExample) + glossaryItems += makeGlossaryItem("consent_id", consentIdExample) + + lazy val basketIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) + glossaryItems += makeGlossaryItem("basket_id", basketIdExample) lazy val consentRequestPayloadExample = ConnectorField( """{ diff --git a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala index 54ab9297df..e531aa1e4a 100644 --- a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala +++ b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala @@ -308,7 +308,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-15T10:29:27Z +// ---------- created on 2024-01-17T09:43:18Z messageDocs += validateAndCheckIbanNumberDoc def validateAndCheckIbanNumberDoc = MessageDoc( @@ -545,7 +545,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -576,7 +576,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), authenticationMethodId=Some("string")) ), exampleInboundMessage = ( @@ -590,7 +590,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -658,7 +658,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -696,7 +696,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -734,7 +734,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -772,7 +772,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -6377,6 +6377,6 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-15T10:29:27Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-17T09:43:18Z +//---------------- dynamic end ---------------------please don't modify this line } diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index 070c7de2da..ed41b2f41d 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -96,7 +96,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-15T10:31:47Z +// ---------- created on 2024-01-17T09:40:00Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -367,7 +367,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -398,7 +398,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), authenticationMethodId=Some("string")) ), exampleInboundMessage = ( @@ -412,7 +412,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -480,7 +480,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -518,7 +518,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -556,7 +556,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -594,7 +594,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -6566,8 +6566,8 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-15T10:31:47Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-17T09:40:00Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") diff --git a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala index 49338a7d3e..3486e6cbc7 100644 --- a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala @@ -75,7 +75,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { val connectorName = "stored_procedure_vDec2019" //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-15T10:32:00Z +// ---------- created on 2024-01-17T09:44:33Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -346,7 +346,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -377,7 +377,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), authenticationMethodId=Some("string")) ), exampleInboundMessage = ( @@ -391,7 +391,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -459,7 +459,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -497,7 +497,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -535,7 +535,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -573,7 +573,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { successful=true, challengeType=challengeTypeExample.value, consentId=Some(consentIdExample.value), - basketId=Some("string"), + basketId=Some(basketIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), authenticationMethodId=Some("string"), @@ -6545,8 +6545,8 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-15T10:32:00Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-17T09:44:33Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") From 3fa139f7a8dd7f421f8e54440b35b00214dfe400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 23 Jan 2024 16:03:49 +0100 Subject: [PATCH 05/21] refactor/Make Berlin Group PIS API's paths more restrictive --- .../group/v1_3/PaymentInitiationServicePISApi.scala | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 777a0ee68e..c0629694aa 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 @@ -22,6 +22,7 @@ import com.openbankproject.commons.model.enums.ChallengeType.BERLINGROUP_PAYMENT import com.openbankproject.commons.model.enums.TransactionRequestStatus._ import com.openbankproject.commons.model.enums.{ChallengeType, StrongCustomerAuthenticationStatus, TransactionRequestStatus} import com.openbankproject.commons.util.ApiVersion +import net.liftweb.common.Box.tryo import net.liftweb.common.Full import net.liftweb.http.js.JE.JsRaw import net.liftweb.http.rest.RestHelper @@ -39,9 +40,15 @@ object APIMethods_PaymentInitiationServicePISApi extends RestHelper { val apiRelations = ArrayBuffer[ApiRelation]() protected implicit def JvalueToSuper(what: JValue): JvalueCaseClass = JvalueCaseClass(what) - def checkPaymentServerError(paymentService: String) = s"${InvalidTransactionRequestType.replaceAll("TRANSACTION_REQUEST_TYPE", "PAYMENT_SERVICE in the URL.")}: '${paymentService}'.It should be `payments` for now, will support (bulk-payments, periodic-payments) soon" + def checkPaymentServerError(paymentService: String) = { + val ccc = "" + s"${InvalidTransactionRequestType.replaceAll("TRANSACTION_REQUEST_TYPE", "PAYMENT_SERVICE in the URL.")}: '${paymentService}'.It should be `payments` for now, will support (bulk-payments, periodic-payments) soon" + } def checkPaymentProductError(paymentProduct: String) = s"${InvalidTransactionRequestType.replaceAll("TRANSACTION_REQUEST_TYPE", "PAYMENT_PRODUCT in the URL.")}: '${paymentProduct}'.It should be `sepa-credit-transfers`for now, will support (instant-sepa-credit-transfers, target-2-payments, cross-border-credit-transfers) soon." + def checkPaymentServiceType(paymentService: String) = tryo { + PaymentServiceTypes.withName(paymentService.replaceAll("-","_")) + }.isDefined val endpoints = cancelPayment :: @@ -213,7 +220,7 @@ Returns the content of a payment object""", ) lazy val getPaymentInformation : OBPEndpoint = { - case paymentService :: paymentProduct :: paymentId :: Nil JsonGet _ => { + case paymentService :: paymentProduct :: paymentId :: Nil JsonGet _ if checkPaymentServiceType(paymentService) => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) @@ -669,7 +676,7 @@ This applies in the following scenarios: ) lazy val startPaymentAuthorisation : OBPEndpoint = { - case paymentService :: paymentProduct :: paymentId :: "authorisations" :: Nil JsonPost json -> _ => { + case paymentService :: paymentProduct :: paymentId :: "authorisations" :: Nil JsonPost json -> _ if checkPaymentServiceType(paymentService) => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) From 34e9421e464a762722fc9daa1617176f86c658ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Mon, 29 Jan 2024 14:00:13 +0100 Subject: [PATCH 06/21] feature/Add Berlin Group Signing Basket; API Endpoints --- .../code/api/berlin/group/ConstantsBG.scala | 14 + .../v1_3/JSONFactory_BERLIN_GROUP_1_3.scala | 58 +++- .../v1_3/PaymentInitiationServicePISApi.scala | 2 +- .../berlin/group/v1_3/SigningBasketsApi.scala | 250 ++++++++++-------- .../src/main/scala/code/api/util/ApiTag.scala | 1 + .../main/scala/code/api/util/NewStyle.scala | 43 ++- .../scala/code/bankconnectors/Connector.scala | 13 +- .../bankconnectors/ConnectorBuilderUtil.scala | 1 + .../bankconnectors/LocalMappedConnector.scala | 17 +- .../akka/AkkaConnector_vDec2018.scala | 48 +++- .../rest/RestConnector_vMar2019.scala | 48 +++- .../StoredProcedureConnector_vDec2019.scala | 48 +++- .../MappedSigningBasketProvider.scala | 54 ++-- .../code/signingbaskets/SigningBasket.scala | 9 +- .../MappedChallengeProvider.scala | 4 +- .../commons/dto/JsonsTransfer.scala | 10 + .../commons/model/CommonModelTrait.scala | 6 +- .../commons/model/enums/Enumerations.scala | 1 + 18 files changed, 466 insertions(+), 161 deletions(-) create mode 100644 obp-api/src/main/scala/code/api/berlin/group/ConstantsBG.scala diff --git a/obp-api/src/main/scala/code/api/berlin/group/ConstantsBG.scala b/obp-api/src/main/scala/code/api/berlin/group/ConstantsBG.scala new file mode 100644 index 0000000000..0058a6fe1c --- /dev/null +++ b/obp-api/src/main/scala/code/api/berlin/group/ConstantsBG.scala @@ -0,0 +1,14 @@ +package code.api.berlin.group + +object ConstantsBG { + object SigningBasketsStatus extends Enumeration { + type SigningBasketsStatus = Value + // Only the codes + // 1) RCVD (Received), + // 2) PATC (PartiallyAcceptedTechnical Correct) The payment initiation needs multiple authentications, where some but not yet all have been performed. Syntactical and semantical validations are successful., + // 3) ACTC (AcceptedTechnicalValidation) , + // 4) CANC (Cancelled) and + // 5) RJCT (Rejected) are supported for signing baskets. + val RCVD, PATC, ACTC, CANC, RJCT = Value + } +} 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 c71f08da15..f613f7497c 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 @@ -20,7 +20,25 @@ case class JvalueCaseClass(jvalueToCaseclass: JValue) object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { - + case class PostSigningBasketJsonV13( + paymentIds: Option[List[String]], + consentIds: Option[List[String]] + ) + + case class SigningBasketLinksV13( + self: LinkHrefJson, + status: LinkHrefJson, + startAuthorisation: LinkHrefJson + ) + case class SigningBasketResponseJson( + transactionStatus: String, + basketId: String, + _links: SigningBasketLinksV13) + case class SigningBasketGetResponseJson( + transactionStatus: String, + payments: Option[List[String]], + consents: Option[List[String]] + ) case class LinkHrefJson( href: String ) @@ -621,4 +639,42 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { _links = ScaStatusJsonV13(s"/v1.3/${paymentService}/${paymentProduct}/${paymentId}/cancellation-authorisations/${challenge.challengeId}") ) } + + + def createStartSigningBasketAuthorisationJson(basketId: String, challenge: ChallengeTrait): StartPaymentAuthorisationJson = { + StartPaymentAuthorisationJson( + scaStatus = challenge.scaStatus.map(_.toString).getOrElse(""), + authorisationId = challenge.challengeId, + psuMessage = "Please check your SMS at a mobile device.", + _links = ScaStatusJsonV13(s"/v1.3/signing-baskets/${basketId}/authorisations/${challenge.challengeId}") + ) + } + + def createSigningBasketResponseJson(basket: SigningBasketTrait): SigningBasketResponseJson = { + SigningBasketResponseJson( + basketId = basket.basketId, + transactionStatus = basket.status.toLowerCase(), + _links = SigningBasketLinksV13( + self = LinkHrefJson(s"/v1.3/signing-baskets/${basket.basketId}"), + status = LinkHrefJson(s"/v1.3/signing-baskets/${basket.basketId}/status"), + startAuthorisation = LinkHrefJson(s"/v1.3/signing-baskets/${basket.basketId}/authorisations") + ) + ) + } + def getSigningBasketResponseJson(basket: SigningBasketContent): SigningBasketGetResponseJson = { + SigningBasketGetResponseJson( + transactionStatus = basket.basket.status.toLowerCase(), + payments = basket.payments, + consents = basket.consents, + ) + } + def getSigningBasketStatusResponseJson(basket: SigningBasketContent): SigningBasketGetResponseJson = { + SigningBasketGetResponseJson( + transactionStatus = basket.basket.status.toLowerCase(), + payments = None, + consents = None, + ) + } + + } 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 c0629694aa..44925870b9 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 @@ -990,7 +990,7 @@ There are the following request types on this access path: ) lazy val updatePaymentPsuData : OBPEndpoint = { - case paymentService :: paymentProduct :: paymentId:: "authorisations" :: authorisationid :: Nil JsonPut json -> _ => { + case paymentService :: paymentProduct :: paymentId:: "authorisations" :: authorisationid :: Nil JsonPut json -> _ if checkPaymentServiceType(paymentService) => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) 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 d8afdbd3f0..498d1e6668 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 @@ -1,6 +1,7 @@ package code.api.builder.SigningBasketsApi import code.api.APIFailureNewStyle +import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{PostSigningBasketJsonV13, UpdatePaymentPsuDataJson, createSigningBasketResponseJson, createStartSigningBasketAuthorisationJson, getSigningBasketResponseJson, getSigningBasketStatusResponseJson} import code.api.berlin.group.v1_3.{JSONFactory_BERLIN_GROUP_1_3, JvalueCaseClass, OBP_BERLIN_GROUP_1_3} import net.liftweb.json import net.liftweb.json._ @@ -11,16 +12,21 @@ import code.api.util.ApiTag._ import code.api.util.NewStyle.HttpCode import code.bankconnectors.Connector import code.model._ +import code.signingbaskets.SigningBasketX import code.util.Helper import code.views.Views -import net.liftweb.common.Full +import net.liftweb.common.{Box, Full} import net.liftweb.http.rest.RestHelper import com.github.dwickern.macros.NameOf.nameOf import scala.collection.immutable.Nil import scala.collection.mutable.ArrayBuffer import com.openbankproject.commons.ExecutionContext.Implicits.global +import com.openbankproject.commons.model.{ChallengeTrait, SigningBasketTrait, TransactionRequestId} +import com.openbankproject.commons.model.enums.TransactionRequestStatus.{COMPLETED, REJECTED} +import com.openbankproject.commons.model.enums.{ChallengeType, StrongCustomerAuthenticationStatus} import com.openbankproject.commons.util.ApiVersion +import net.liftweb.http.js.JE.JsRaw import scala.concurrent.Future @@ -53,10 +59,7 @@ object APIMethods_SigningBasketsApi extends RestHelper { Create a signing basket resource for authorising several transactions with one SCA method. The resource identifications of these transactions are contained in the payload of this access method """, - json.parse("""{ - "consentIds" : "", - "paymentIds" : "" -}"""), + PostSigningBasketJsonV13(paymentIds = Some(List("123qwert456789", "12345qwert7899")), None), json.parse("""{ "basketId" : "1234-basket-567", "challengeData" : { @@ -97,54 +100,29 @@ The resource identifications of these transactions are contained in the payload "psuMessage" : { } }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val createSigningBasket : OBPEndpoint = { - case "signing-baskets" :: Nil JsonPost _ => { + case "signing-baskets" :: Nil JsonPost jsonPost -> _ => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "basketId" : "1234-basket-567", - "challengeData" : { - "otpMaxLength" : 0, - "additionalInformation" : "additionalInformation", - "image" : "image", - "imageLink" : "http://example.com/aeiou", - "otpFormat" : "characters", - "data" : "data" - }, - "scaMethods" : "", - "tppMessages" : [ { - "path" : "path", - "code" : { }, - "text" : { }, - "category" : { } - }, { - "path" : "path", - "code" : { }, - "text" : { }, - "category" : { } - } ], - "_links" : { - "scaStatus" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithEncryptedPsuAuthentication" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "scaRedirect" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithAuthenticationMethodSelection" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithPsuAuthentication" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "scaOAuth" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "self" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithPsuIdentification" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisation" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithTransactionAuthorisation" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "status" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983" - }, - "chosenScaMethod" : "", - "transactionStatus" : "ACCP", - "psuMessage" : { } -}"""), callContext) + _ <- passesPsd2Pisp(callContext) + failMsg = s"$InvalidJsonFormat The Json body should be the $PostSigningBasketJsonV13 " + postJson <- NewStyle.function.tryons(failMsg, 400, callContext) { + jsonPost.extract[PostSigningBasketJsonV13] + } + signingBasket <- Future { + SigningBasketX.signingBasketProvider.vend.createSigningBasket( + postJson.paymentIds, + postJson.consentIds, + ) + } map { + i => connectorEmptyResponse(i, callContext) + } + } yield { + (createSigningBasketResponseJson(signingBasket), HttpCode.`201`(callContext)) } } } @@ -166,7 +144,7 @@ Nevertheless, single transactions might be cancelled on an individual basis on t emptyObjectJson, emptyObjectJson, List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val deleteSigningBasket : OBPEndpoint = { @@ -174,8 +152,14 @@ Nevertheless, single transactions might be cancelled on an individual basis on t cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (NotImplemented, callContext) + _ <- passesPsd2Pisp(callContext) + _ <- Future { + SigningBasketX.signingBasketProvider.vend.deleteSigningBasket(basketid) + } map { + i => connectorEmptyResponse(i, callContext) + } + } yield { + (JsRaw(""), HttpCode.`204`(callContext)) } } } @@ -196,7 +180,7 @@ Returns the content of an signing basket object.""", "consents" : "" }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val getSigningBasket : OBPEndpoint = { @@ -204,12 +188,14 @@ Returns the content of an signing basket object.""", cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "transactionStatus" : "ACCP", - "payments" : "", - "consents" : "" -}"""), callContext) + _ <- passesPsd2Pisp(callContext) + basket <- Future { + SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketid) + } map { + i => connectorEmptyResponse(i, callContext) + } + } yield { + (getSigningBasketResponseJson(basket), HttpCode.`200`(callContext)) } } } @@ -231,7 +217,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- "authorisationIds" : "" }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val getSigningBasketAuthorisation : OBPEndpoint = { @@ -239,10 +225,10 @@ This function returns an array of hyperlinks to all generated authorisation sub- cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "authorisationIds" : "" -}"""), callContext) + _ <- passesPsd2Pisp(callContext) + (challenges, callContext) <- NewStyle.function.getChallengesByBasketId(basketid, callContext) + } yield { + (JSONFactory_BERLIN_GROUP_1_3.AuthorisationJsonV13(challenges.map(_.challengeId)), HttpCode.`200`(callContext)) } } } @@ -262,21 +248,26 @@ This method returns the SCA status of a signing basket's authorisation sub-resou "scaStatus" : "psuAuthenticated" }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val getSigningBasketScaStatus : OBPEndpoint = { - case "signing-baskets" :: basketid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { + case "signing-baskets" :: basketId:: "authorisations" :: authorisationId :: Nil JsonGet _ => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "scaStatus" : "psuAuthenticated" -}"""), callContext) + _ <- passesPsd2Pisp(callContext) + _ <- Future(SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketId)) map { + unboxFullOrFail(_, callContext, s"$ConsentNotFound ($basketId)") + } + (challenges, callContext) <- NewStyle.function.getChallengesByBasketId(basketId, callContext) + } yield { + val challengeStatus = challenges.filter(_.challengeId == authorisationId) + .flatMap(_.scaStatus).headOption.map(_.toString).getOrElse("None") + (JSONFactory_BERLIN_GROUP_1_3.ScaStatusJsonV13(challengeStatus), HttpCode.`200`(callContext)) } } - } + } resourceDocs += ResourceDoc( getSigningBasketStatus, @@ -293,20 +284,23 @@ Returns the status of a signing basket object. "transactionStatus" : "RCVD" }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val getSigningBasketStatus : OBPEndpoint = { - case "signing-baskets" :: basketid:: "status" :: Nil JsonGet _ => { + case "signing-baskets" :: basketid:: "status" :: Nil JsonGet _ => cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "transactionStatus" : "RCVD" -}"""), callContext) + _ <- passesPsd2Pisp(callContext) + basket <- Future { + SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketid) + } map { + i => connectorEmptyResponse(i, callContext) + } + } yield { + (getSigningBasketStatusResponseJson(basket), HttpCode.`200`(callContext)) } - } } resourceDocs += ResourceDoc( @@ -376,39 +370,32 @@ This applies in the following scenarios: "psuMessage" : { } }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val startSigningBasketAuthorisation : OBPEndpoint = { - case "signing-baskets" :: basketid:: "authorisations" :: Nil JsonPost _ => { + case "signing-baskets" :: basketId :: "authorisations" :: Nil JsonPost _ => { cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse("""{ - "challengeData" : { - "otpMaxLength" : 0, - "additionalInformation" : "additionalInformation", - "image" : "image", - "imageLink" : "http://example.com/aeiou", - "otpFormat" : "characters", - "data" : "data" - }, - "scaMethods" : "", - "scaStatus" : "psuAuthenticated", - "_links" : { - "scaStatus" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithEncryptedPsuAuthentication" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "scaRedirect" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "selectAuthenticationMethod" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "startAuthorisationWithPsuAuthentication" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "authoriseTransaction" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "scaOAuth" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983", - "updatePsuIdentification" : "/v1.3/payments/sepa-credit-transfers/1234-wertiq-983" - }, - "chosenScaMethod" : "", - "psuMessage" : { } -}"""), callContext) + _ <- passesPsd2Pisp(callContext) + (challenges, callContext) <- NewStyle.function.createChallengesC3( + List(u.userId), + ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE, + None, + getSuggestedDefaultScaMethod(), + Some(StrongCustomerAuthenticationStatus.received), + None, + Some(basketId), + None, + callContext + ) + //NOTE: in OBP it support multiple challenges, but in Berlin Group it has only one challenge. The following guard is to make sure it return the 1st challenge properly. + challenge <- NewStyle.function.tryons(InvalidConnectorResponseForCreateChallenge, 400, callContext) { + challenges.head + } + } yield { + (createStartSigningBasketAuthorisationJson(basketId, challenge), HttpCode.`201`(callContext)) } } } @@ -462,21 +449,64 @@ There are the following request types on this access path: therefore many optional elements are not present. Maybe in a later version the access path will change. """, - emptyObjectJson, - json.parse(""""""""), + json.parse("""{"scaAuthenticationData":"123"}"""), + json.parse("""{ + "scaStatus":"finalised", + "authorisationId":"4f4a8b7f-9968-4183-92ab-ca512b396bfc", + "psuMessage":"Please check your SMS at a mobile device.", + "_links":{ + "scaStatus":"/v1.3/payments/sepa-credit-transfers/PAYMENT_ID/4f4a8b7f-9968-4183-92ab-ca512b396bfc" + } + }"""), List(UserNotLoggedIn, UnknownError), - ApiTag("Signing Baskets") :: apiTagMockedData :: Nil + apiTagSigningBaskets :: Nil ) lazy val updateSigningBasketPsuData : OBPEndpoint = { - case "signing-baskets" :: basketid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { + case "signing-baskets" :: basketId:: "authorisations" :: authorisationId :: Nil JsonPut json -> _ => cc => for { (Full(u), callContext) <- authenticatedAccess(cc) - } yield { - (json.parse(""""""""), callContext) + _ <- passesPsd2Pisp(callContext) + failMsg = s"$InvalidJsonFormat The Json body should be the $UpdatePaymentPsuDataJson " + updateBasketPsuDataJson <- NewStyle.function.tryons(failMsg, 400, callContext) { + json.extract[UpdatePaymentPsuDataJson] + } + _ <- Future(org.scalameta.logger.elem(updateBasketPsuDataJson)) + // Validate a challenge answer and get an error if any + (boxedChallenge: Box[ChallengeTrait], callContext) <- NewStyle.function.validateChallengeAnswerC3( + ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE, + None, + None, + Some(basketId), + authorisationId, + updateBasketPsuDataJson.scaAuthenticationData, + callContext + ) + // Get the challenge after validation + (challenge: ChallengeTrait, callContext) <- NewStyle.function.getChallenge(authorisationId, callContext) + _ <- challenge.scaStatus.toString match { + case status if status == StrongCustomerAuthenticationStatus.finalised.toString => // finalised + // TODO Implement successful case + Future(unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse() ")) + case status if status == StrongCustomerAuthenticationStatus.failed.toString => // failed + Future { + // Reject all related transaction requests + val basket = SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketId) + basket.map { i => + i.payments.map(_.map { i => + Connector.connector.vend.saveTransactionRequestStatusImpl(TransactionRequestId(i), REJECTED.toString) + }) + } + // Fail in case of an error message + unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ") + } + case _ => // Fail in case of an error message + Future(unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ") ) + } + } yield { + (JSONFactory_BERLIN_GROUP_1_3.createStartPaymentAuthorisationJson(challenge), callContext) } - } } } diff --git a/obp-api/src/main/scala/code/api/util/ApiTag.scala b/obp-api/src/main/scala/code/api/util/ApiTag.scala index 59fc4b65c1..998109a2ed 100644 --- a/obp-api/src/main/scala/code/api/util/ApiTag.scala +++ b/obp-api/src/main/scala/code/api/util/ApiTag.scala @@ -61,6 +61,7 @@ object ApiTag { val apiTagMetric = ResourceDocTag("Metric") val apiTagDocumentation = ResourceDocTag("Documentation") val apiTagBerlinGroup = ResourceDocTag("Berlin-Group") + val apiTagSigningBaskets = ResourceDocTag("Signing Baskets") val apiTagUKOpenBanking = ResourceDocTag("UKOpenBanking") val apiTagMXOpenFinance = ResourceDocTag("MXOpenFinance") val apiTagApiBuilder = ResourceDocTag("API-Builder") 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 5b0338bc33..6f742c8de0 100644 --- a/obp-api/src/main/scala/code/api/util/NewStyle.scala +++ b/obp-api/src/main/scala/code/api/util/NewStyle.scala @@ -1360,6 +1360,32 @@ object NewStyle extends MdcLoggable{ } } } + def validateChallengeAnswerC3( + challengeType: ChallengeType.Value, + transactionRequestId: Option[String], + consentId: Option[String], + basketId: Option[String], + challengeId: String, + hashOfSuppliedAnswer: String, + callContext: Option[CallContext] + ): OBPReturnType[Box[ChallengeTrait]] = { + if(challengeType == ChallengeType.BERLINGROUP_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 ){ + 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 ){ + 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( + transactionRequestId: Option[String], + consentId: Option[String], + basketId: Option[String], + challengeId: String, + hashOfSuppliedAnswer: String, + callContext: Option[CallContext] + ) + } + } /** * @@ -1429,9 +1455,11 @@ object NewStyle extends MdcLoggable{ ) : OBPReturnType[List[ChallengeTrait]] = { if(challengeType == ChallengeType.BERLINGROUP_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.BERLINGROUP_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{ + } else if(challengeType == ChallengeType.BERLINGROUP_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( userIds: List[String], challengeType: ChallengeType.Value, @@ -1470,6 +1498,17 @@ object NewStyle extends MdcLoggable{ (unboxFullOrFail(i._1, callContext, s"$InvalidChallengeTransactionRequestId Current transactionRequestId($consentId) ", 400), i._2) } } + def getChallengesByBasketId( + basketId: String, + callContext: Option[CallContext] + ): OBPReturnType[List[ChallengeTrait]] = { + Connector.connector.vend.getChallengesByBasketId( + basketId: String, + callContext: Option[CallContext] + ) map { i => + (unboxFullOrFail(i._1, callContext, s"$InvalidChallengeTransactionRequestId Current basketId($basketId) ", 400), i._2) + } + } def getChallenge( challengeId: String, diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index 0d4e8217bb..077c481c68 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -451,11 +451,20 @@ trait Connector extends MdcLoggable { hashOfSuppliedAnswer: String, callContext: Option[CallContext] ): OBPReturnType[Box[ChallengeTrait]] = Future{(Failure(setUnimplementedError), callContext)} + def validateChallengeAnswerC3( + transactionRequestId: Option[String], + consentId: Option[String], + basketId: Option[String], + challengeId: String, + hashOfSuppliedAnswer: String, + callContext: Option[CallContext] + ): OBPReturnType[Box[ChallengeTrait]] = Future{(Failure(setUnimplementedError), callContext)} def getChallengesByTransactionRequestId(transactionRequestId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = Future{(Failure(setUnimplementedError), callContext)} def getChallengesByConsentId(consentId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = Future{(Failure(setUnimplementedError), callContext)} - + def getChallengesByBasketId(basketId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = Future{(Failure(setUnimplementedError), callContext)} + def getChallenge(challengeId: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = Future{(Failure(setUnimplementedError), callContext)} //gets a particular bank handled by this connector @@ -1440,7 +1449,7 @@ trait Connector extends MdcLoggable { didSaveTransId <- Future{saveTransactionRequestTransaction(transactionRequestId, transactionId).openOrThrowException(attemptedToOpenAnEmptyBox)} didSaveStatus <- Future{saveTransactionRequestStatusImpl(transactionRequestId, TransactionRequestStatus.COMPLETED.toString).openOrThrowException(attemptedToOpenAnEmptyBox)} //After `makePaymentv200` and update data for request, we get the new requqest from database again. - (transactionRequest, callContext) <- NewStyle.function.getTransactionRequestImpl(transactionRequestId, callContext) + (transactionRequest: TransactionRequest, callContext) <- NewStyle.function.getTransactionRequestImpl(transactionRequestId, callContext) } yield { (Full(transactionRequest), callContext) diff --git a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala index 5418bac7c6..70610ebaec 100644 --- a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala +++ b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala @@ -371,6 +371,7 @@ object ConnectorBuilderUtil { "getChallengesByConsentId", "validateAndCheckIbanNumber", "validateChallengeAnswerC2", + "validateChallengeAnswerC3", "getCounterpartyByIbanAndBankAccountId", ).distinct diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index fe23129b54..70d8be3460 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -357,7 +357,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { consentId, basketId, authenticationMethodId, - challengeType = OBP_TRANSACTION_REQUEST_CHALLENGE.toString, + challengeType = challengeType.toString, callContext ) challengeId.toList @@ -459,12 +459,27 @@ object LocalMappedConnector extends Connector with MdcLoggable { (Challenges.ChallengeProvider.vend.validateChallenge(challengeId, hashOfSuppliedAnswer, userId), callContext) } } + override def validateChallengeAnswerC3( + transactionRequestId: Option[String], + consentId: Option[String], + basketId: Option[String], + challengeId: String, + hashOfSuppliedAnswer: String, + callContext: Option[CallContext] + ) = Future { + Future { + val userId = callContext.map(_.user.map(_.userId).openOrThrowException(s"$UserNotLoggedIn Can not find the userId here.")) + (Challenges.ChallengeProvider.vend.validateChallenge(challengeId, hashOfSuppliedAnswer, userId), callContext) + } + } override def getChallengesByTransactionRequestId(transactionRequestId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = Future {(Challenges.ChallengeProvider.vend.getChallengesByTransactionRequestId(transactionRequestId), callContext)} override def getChallengesByConsentId(consentId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = Future {(Challenges.ChallengeProvider.vend.getChallengesByConsentId(consentId), callContext)} + override def getChallengesByBasketId(basketId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = + Future {(Challenges.ChallengeProvider.vend.getChallengesByBasketId(basketId), callContext)} override def getChallenge(challengeId: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = diff --git a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala index e531aa1e4a..c9712ced55 100644 --- a/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala +++ b/obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnector_vDec2018.scala @@ -308,7 +308,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-17T09:43:18Z +// ---------- created on 2024-01-29T13:57:05Z messageDocs += validateAndCheckIbanNumberDoc def validateAndCheckIbanNumberDoc = MessageDoc( @@ -674,6 +674,48 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { response.map(convertToTuple[ChallengeCommons](callContext)) } + messageDocs += validateChallengeAnswerC3Doc + def validateChallengeAnswerC3Doc = MessageDoc( + process = "obp.validateChallengeAnswerC3", + messageFormat = messageFormat, + description = "Validate Challenge Answer C3", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundValidateChallengeAnswerC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + transactionRequestId=Some(transactionRequestIdExample.value), + consentId=Some(consentIdExample.value), + basketId=Some(basketIdExample.value), + challengeId=challengeIdExample.value, + hashOfSuppliedAnswer=hashOfSuppliedAnswerExample.value) + ), + exampleInboundMessage = ( + InBoundValidateChallengeAnswerC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data= ChallengeCommons(challengeId=challengeIdExample.value, + transactionRequestId=transactionRequestIdExample.value, + expectedAnswer="string", + expectedUserId="string", + salt="string", + successful=true, + challengeType=challengeTypeExample.value, + consentId=Some(consentIdExample.value), + basketId=Some(basketIdExample.value), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + authenticationMethodId=Some("string"), + attemptCounter=123)) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def validateChallengeAnswerC3(transactionRequestId: Option[String], consentId: Option[String], basketId: Option[String], challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { + import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC3 => InBound, OutBoundValidateChallengeAnswerC3 => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, basketId, challengeId, hashOfSuppliedAnswer) + val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _) + response.map(convertToTuple[ChallengeCommons](callContext)) + } + messageDocs += getChallengesByTransactionRequestIdDoc def getChallengesByTransactionRequestIdDoc = MessageDoc( process = "obp.getChallengesByTransactionRequestId", @@ -6377,6 +6419,6 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-17T09:43:18Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-29T13:57:05Z +//---------------- dynamic end ---------------------please don't modify this line } diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index ed41b2f41d..137023df80 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -96,7 +96,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-17T09:40:00Z +// ---------- created on 2024-01-29T13:59:34Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -496,6 +496,48 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable response.map(convertToTuple[ChallengeCommons](callContext)) } + messageDocs += validateChallengeAnswerC3Doc + def validateChallengeAnswerC3Doc = MessageDoc( + process = "obp.validateChallengeAnswerC3", + messageFormat = messageFormat, + description = "Validate Challenge Answer C3", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundValidateChallengeAnswerC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + transactionRequestId=Some(transactionRequestIdExample.value), + consentId=Some(consentIdExample.value), + basketId=Some(basketIdExample.value), + challengeId=challengeIdExample.value, + hashOfSuppliedAnswer=hashOfSuppliedAnswerExample.value) + ), + exampleInboundMessage = ( + InBoundValidateChallengeAnswerC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data= ChallengeCommons(challengeId=challengeIdExample.value, + transactionRequestId=transactionRequestIdExample.value, + expectedAnswer="string", + expectedUserId="string", + salt="string", + successful=true, + challengeType=challengeTypeExample.value, + consentId=Some(consentIdExample.value), + basketId=Some(basketIdExample.value), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + authenticationMethodId=Some("string"), + attemptCounter=123)) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def validateChallengeAnswerC3(transactionRequestId: Option[String], consentId: Option[String], basketId: Option[String], challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { + import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC3 => InBound, OutBoundValidateChallengeAnswerC3 => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, basketId, challengeId, hashOfSuppliedAnswer) + val response: Future[Box[InBound]] = sendRequest[InBound](getUrl(callContext, "validateChallengeAnswerC3"), HttpMethods.POST, req, callContext) + response.map(convertToTuple[ChallengeCommons](callContext)) + } + messageDocs += getChallengesByTransactionRequestIdDoc def getChallengesByTransactionRequestIdDoc = MessageDoc( process = "obp.getChallengesByTransactionRequestId", @@ -6566,8 +6608,8 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-17T09:40:00Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-29T13:59:34Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") diff --git a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala index 3486e6cbc7..9ab651e8e6 100644 --- a/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/storedprocedure/StoredProcedureConnector_vDec2019.scala @@ -75,7 +75,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { val connectorName = "stored_procedure_vDec2019" //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-17T09:44:33Z +// ---------- created on 2024-01-29T13:58:37Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -475,6 +475,48 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[ChallengeCommons](callContext)) } + messageDocs += validateChallengeAnswerC3Doc + def validateChallengeAnswerC3Doc = MessageDoc( + process = "obp.validateChallengeAnswerC3", + messageFormat = messageFormat, + description = "Validate Challenge Answer C3", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundValidateChallengeAnswerC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + transactionRequestId=Some(transactionRequestIdExample.value), + consentId=Some(consentIdExample.value), + basketId=Some(basketIdExample.value), + challengeId=challengeIdExample.value, + hashOfSuppliedAnswer=hashOfSuppliedAnswerExample.value) + ), + exampleInboundMessage = ( + InBoundValidateChallengeAnswerC3(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data= ChallengeCommons(challengeId=challengeIdExample.value, + transactionRequestId=transactionRequestIdExample.value, + expectedAnswer="string", + expectedUserId="string", + salt="string", + successful=true, + challengeType=challengeTypeExample.value, + consentId=Some(consentIdExample.value), + basketId=Some(basketIdExample.value), + scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), + scaStatus=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.example), + authenticationMethodId=Some("string"), + attemptCounter=123)) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def validateChallengeAnswerC3(transactionRequestId: Option[String], consentId: Option[String], basketId: Option[String], challengeId: String, hashOfSuppliedAnswer: String, callContext: Option[CallContext]): OBPReturnType[Box[ChallengeTrait]] = { + import com.openbankproject.commons.dto.{InBoundValidateChallengeAnswerC3 => InBound, OutBoundValidateChallengeAnswerC3 => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, transactionRequestId, consentId, basketId, challengeId, hashOfSuppliedAnswer) + val response: Future[Box[InBound]] = sendRequest[InBound]("obp_validate_challenge_answer_c3", req, callContext) + response.map(convertToTuple[ChallengeCommons](callContext)) + } + messageDocs += getChallengesByTransactionRequestIdDoc def getChallengesByTransactionRequestIdDoc = MessageDoc( process = "obp.getChallengesByTransactionRequestId", @@ -6545,8 +6587,8 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-17T09:44:33Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-01-29T13:58:37Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") diff --git a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala index ee90168572..8c7afa2d8f 100644 --- a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala +++ b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala @@ -1,53 +1,56 @@ package code.signingbaskets +import code.api.berlin.group.ConstantsBG import code.util.MappedUUID -import com.openbankproject.commons.model.{RegulatedEntityTrait, SigningBasketConsentTrait, SigningBasketPaymentTrait, SigningBasketTrait} +import com.openbankproject.commons.model.{SigningBasketConsentTrait, SigningBasketContent, SigningBasketPaymentTrait, SigningBasketTrait} import net.liftweb.common.Box import net.liftweb.common.Box.tryo import net.liftweb.mapper._ -import scala.concurrent.Future - object MappedSigningBasketProvider extends SigningBasketProvider { def getSigningBaskets(): List[SigningBasketTrait] = { MappedSigningBasket.findAll() } - override def getSigningBasketByBasketId(entityId: String): Box[SigningBasketTrait] = { - MappedSigningBasket.find(By(MappedSigningBasket.BasketId, entityId)) + override def getSigningBasketByBasketId(entityId: String): Box[SigningBasketContent] = { + val basket: Box[MappedSigningBasket] = MappedSigningBasket.find(By(MappedSigningBasket.BasketId, entityId)) + val payments = MappedSigningBasketPayment.findAll(By(MappedSigningBasketPayment.BasketId, entityId)).map(_.basketId) match { + case Nil => None + case head :: tail => Some(head :: tail) + } + val consents = MappedSigningBasketConsent.findAll(By(MappedSigningBasketConsent.BasketId, entityId)).map(_.basketId) match { + case Nil => None + case head :: tail => Some(head :: tail) + } + basket.map( i => SigningBasketContent(basket = i, payments = payments, consents = consents)) } - override def createSigningBasket(basketId: Option[String], - status: Option[String], - description: Option[String], - ): Box[SigningBasketTrait] = { + override def createSigningBasket(paymentIds: Option[List[String]], + consentIds: Option[List[String]] + ): Box[SigningBasketTrait] = { tryo { val entity = MappedSigningBasket.create - basketId match { - case Some(v) => entity.BasketId(v) - case None => - } - status match { - case Some(v) => entity.Status(v) - case None => - } - description match { - case Some(v) => entity.Description(v) - case None => - } + entity.Status(ConstantsBG.SigningBasketsStatus.RCVD.toString) if (entity.validate.isEmpty) { entity.saveMe() } else { throw new Error(entity.validate.map(_.msg.toString()).mkString(";")) } + paymentIds.getOrElse(Nil).map { paymentId => + MappedSigningBasketPayment.create.BasketId(entity.basketId).PaymentId(paymentId)saveMe() + } + consentIds.getOrElse(Nil).map { consentId => + MappedSigningBasketConsent.create.BasketId(entity.basketId).ConsentId(consentId).saveMe() + } + entity } } override def deleteSigningBasket(id: String): Box[Boolean] = { - tryo( - MappedSigningBasket.bulkDelete_!!(By(MappedSigningBasket.BasketId, id)) - ) + MappedSigningBasket.find(By(MappedSigningBasket.BasketId, id)) map { + _.Status(ConstantsBG.SigningBasketsStatus.CANC.toString).save + } } } @@ -56,14 +59,11 @@ class MappedSigningBasket extends SigningBasketTrait with LongKeyedMapper[Mapped override def getSingleton = MappedSigningBasket object BasketId extends MappedUUID(this) object Status extends MappedString(this, 50) - object Description extends MappedText(this) override def basketId: String = BasketId.get override def status: String = Status.get - override def description: String = Description.get - } diff --git a/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala b/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala index 6e2f041815..61f2b455a1 100644 --- a/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala +++ b/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala @@ -1,6 +1,6 @@ package code.signingbaskets -import com.openbankproject.commons.model.SigningBasketTrait +import com.openbankproject.commons.model.{SigningBasketContent, SigningBasketTrait} import net.liftweb.common.{Box, Logger} import net.liftweb.util.SimpleInjector @@ -15,11 +15,10 @@ trait SigningBasketProvider { def getSigningBaskets(): List[SigningBasketTrait] - def getSigningBasketByBasketId(entityId: String): Box[SigningBasketTrait] + def getSigningBasketByBasketId(entityId: String): Box[SigningBasketContent] - def createSigningBasket(basketId: Option[String], - status: Option[String], - description: Option[String], + def createSigningBasket(paymentIds: Option[List[String]], + consentIds: Option[List[String]], ): Box[SigningBasketTrait] def deleteSigningBasket(id: String): Box[Boolean] diff --git a/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala b/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala index 3961c3cf3c..654af20e9f 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/MappedChallengeProvider.scala @@ -55,8 +55,8 @@ object MappedChallengeProvider extends ChallengeProvider { override def getChallengesByConsentId(consentId: String): Box[List[ChallengeTrait]] = Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.ConsentId,consentId))) - override def getChallengesByBasketId(id: String): Box[List[ChallengeTrait]] = - Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.BasketId,id))) + override def getChallengesByBasketId(basketId: String): Box[List[ChallengeTrait]] = + Full(MappedExpectedChallengeAnswer.findAll(By(MappedExpectedChallengeAnswer.BasketId,basketId))) override def validateChallenge( challengeId: String, diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala b/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala index b17aae8557..16e932fc73 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala @@ -1356,7 +1356,17 @@ case class OutBoundValidateChallengeAnswerC2( hashOfSuppliedAnswer: String ) extends TopicTrait +case class OutBoundValidateChallengeAnswerC3( + outboundAdapterCallContext: OutboundAdapterCallContext, + transactionRequestId: Option[String], + consentId: Option[String], + basketId: Option[String], + challengeId: String, + hashOfSuppliedAnswer: String +) extends TopicTrait + case class InBoundValidateChallengeAnswerC2(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: ChallengeCommons) extends InBoundTrait[ChallengeCommons] +case class InBoundValidateChallengeAnswerC3(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: ChallengeCommons) extends InBoundTrait[ChallengeCommons] case class OutBoundValidateAndCheckIbanNumber( outboundAdapterCallContext: OutboundAdapterCallContext, diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala index e59b311a88..06161ca899 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModelTrait.scala @@ -99,8 +99,12 @@ trait AccountApplication { trait SigningBasketTrait { def basketId: String def status: String - def description: String } +case class SigningBasketContent( + basket: SigningBasketTrait, + payments: Option[List[String]], + consents: Option[List[String]] + ) trait SigningBasketPaymentTrait { def basketId: String def paymentId: String 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 8623e99a02..c75e485e42 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 @@ -127,6 +127,7 @@ object ChallengeType extends OBPEnumeration[ChallengeType] { 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 } sealed trait PemCertificateRole extends EnumValue From ddc253b12b2c9e6a2cd02231dcd4f43a0ebb8f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Mon, 29 Jan 2024 14:27:25 +0100 Subject: [PATCH 07/21] refactor/Rename tables to lower case due to case-insensitive databases --- .../main/scala/code/context/MappedConsentAuthContext.scala | 2 +- obp-api/src/main/scala/code/etag/MappedETag.scala | 2 +- obp-api/src/main/scala/code/metrics/MappedMetrics.scala | 2 +- .../regulatedentities/MappedRegulatedEntitiyProvider.scala | 2 +- .../code/signingbaskets/MappedSigningBasketProvider.scala | 6 +++--- .../MappedExpectedChallengeAnswer.scala | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala b/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala index 8f57fb243e..c4128f4e97 100644 --- a/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala +++ b/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala @@ -21,6 +21,6 @@ class MappedConsentAuthContext extends ConsentAuthContext with LongKeyedMapper[M } object MappedConsentAuthContext extends MappedConsentAuthContext with LongKeyedMetaMapper[MappedConsentAuthContext] { - override def dbTableName = "ConsentAuthContext" // define a custom DB table name + override def dbTableName = "consentauthcontext" // define a custom DB table name override def dbIndexes = UniqueIndex(ConsentId, Key, createdAt) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/etag/MappedETag.scala b/obp-api/src/main/scala/code/etag/MappedETag.scala index 9f3d8d4f26..20e9500e71 100644 --- a/obp-api/src/main/scala/code/etag/MappedETag.scala +++ b/obp-api/src/main/scala/code/etag/MappedETag.scala @@ -16,7 +16,7 @@ class MappedETag extends MappedCacheTrait with LongKeyedMapper[MappedETag] with } object MappedETag extends MappedETag with LongKeyedMetaMapper[MappedETag] { - override def dbTableName = "ETag" // define the DB table name + override def dbTableName = "etag" // define the DB table name override def dbIndexes: List[BaseIndex[MappedETag]] = UniqueIndex(ETagResource) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/metrics/MappedMetrics.scala b/obp-api/src/main/scala/code/metrics/MappedMetrics.scala index 9f04090dbf..e7e0c54248 100644 --- a/obp-api/src/main/scala/code/metrics/MappedMetrics.scala +++ b/obp-api/src/main/scala/code/metrics/MappedMetrics.scala @@ -577,7 +577,7 @@ object MappedMetric extends MappedMetric with LongKeyedMetaMapper[MappedMetric] // - at an existing sandbox the table "MappedMetric" still exists with rows until this change is deployed at it // and new rows are stored in the table "Metric" // - at a fresh sandbox there is no the table "MappedMetric", only "Metric" is present - override def dbTableName = "Metric" // define the DB table name + override def dbTableName = "metric" // define the DB table name override def dbIndexes = Index(date) :: Index(consumerId) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala b/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala index e84a6d0421..ba1f587596 100644 --- a/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala +++ b/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala @@ -125,7 +125,7 @@ class MappedRegulatedEntity extends RegulatedEntityTrait with LongKeyedMapper[Ma } object MappedRegulatedEntity extends MappedRegulatedEntity with LongKeyedMetaMapper[MappedRegulatedEntity] { - override def dbTableName = "RegulatedEntity" // define the DB table name + override def dbTableName = "regulatedentity" // define the DB table name override def dbIndexes = Index(CertificateAuthorityCaOwnerId) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala index 8c7afa2d8f..d66b299509 100644 --- a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala +++ b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala @@ -68,7 +68,7 @@ class MappedSigningBasket extends SigningBasketTrait with LongKeyedMapper[Mapped } object MappedSigningBasket extends MappedSigningBasket with LongKeyedMetaMapper[MappedSigningBasket] { - override def dbTableName = "SigningBasket" // define the DB table name + override def dbTableName = "signingbasket" // define the DB table name override def dbIndexes = Index(BasketId) :: super.dbIndexes } @@ -84,7 +84,7 @@ class MappedSigningBasketPayment extends SigningBasketPaymentTrait with LongKeye } object MappedSigningBasketPayment extends MappedSigningBasketPayment with LongKeyedMetaMapper[MappedSigningBasketPayment] { - override def dbTableName = "SigningBasketPayment" // define the DB table name + override def dbTableName = "signingbasketpayment" // define the DB table name override def dbIndexes = Index(BasketId, PaymentId) :: super.dbIndexes } @@ -99,7 +99,7 @@ class MappedSigningBasketConsent extends SigningBasketConsentTrait with LongKeye } object MappedSigningBasketConsent extends MappedSigningBasketConsent with LongKeyedMetaMapper[MappedSigningBasketConsent] { - override def dbTableName = "SigningBasketConsent" // define the DB table name + override def dbTableName = "signingbasketconsent" // define the DB table name override def dbIndexes = Index(BasketId, ConsentId) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala b/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala index 38bbf97dbe..08ce31b6ba 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala @@ -45,6 +45,6 @@ class MappedExpectedChallengeAnswer extends ChallengeTrait with LongKeyedMapper[ } object MappedExpectedChallengeAnswer extends MappedExpectedChallengeAnswer with LongKeyedMetaMapper[MappedExpectedChallengeAnswer] { - override def dbTableName = "ExpectedChallengeAnswer" // define the DB table name + override def dbTableName = "expectedchallengeanswer" // define the DB table name override def dbIndexes = UniqueIndex(ChallengeId):: super.dbIndexes } \ No newline at end of file From 5d8d77d121c25aadc613149575551b8becfcf0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Mon, 29 Jan 2024 15:10:22 +0100 Subject: [PATCH 08/21] test/Tweak rest connector frozen test --- .../RestConnector_vMar2019_frozen_meta_data | Bin 114141 -> 114769 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/obp-api/src/test/scala/code/connector/RestConnector_vMar2019_frozen_meta_data b/obp-api/src/test/scala/code/connector/RestConnector_vMar2019_frozen_meta_data index eff03ed3a829ad14ab2c5cc2ef3f1275f049ca18..58c888c9b584b7451f36312615a919e17f9a5c38 100644 GIT binary patch delta 6439 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 NqN=G|@HuGkzX5q^VUGX+ delta 6143 zcmZ`-d0ds{wq_yj4Q$wZqZpG2NFs1vg5(SS?@O>oO|wH-}Js~eAZge`&}#3-u{QC zfxv8r!49w&@1FC*<`)fUr%w&5oMvT{ol!h8*Q&&d?=?l~iwZMBdOVHj@g%P_*Xs2E z6$o31t`vhW#y>XTGGmtE-(+B$u?))1OPwNmK@HYBC-Ot5^LcB#ngXldk}mXG=#R!` z13FIVi!QEFfr>>vwf-lImM_JG_xs`&*CK1HPOQ^=q1T#Oc!77}vXmg4eG zUknb?;{72p$^YhO_biC}&>m6$PyVaf>X|!vpSdzHNaW|_P!H&!yCcDW%dkQ@U+5UL zM)=0@Iuc}-ygY$tO-4Mk)(*phP0A`mNS?6zV%T8(GS7#C2f{OUSsD5HY!+M;yUlhZ z-ccZcDR=$xzMm0ShRy^XH9El%{4>-8D#*tlnke`U=!17g#V`V{k}HlKZAbPE;7e7m zV2hoB8f*%4kaeZ8@__KwoPqlAa{xMQd^ZU1G-&C259kAOl5a%R@T&Z=w}k2J#MR|G zTo$=kF}q`HI<{@pq1U*+${WX^acCPIE)>K>*NaPAbgH<-n?B?VmAnB_*jnt1rdTcJ zjDK0#mKHMuD$ETr!&Dzr=lfF7Joe{N}sOVq*$)Wp5Ok9B%~ zTpM=|$}x8OLnx>IRp5&8Gmb+CwiHgqr1-bHvxjPnzC5{p==OxbL zI6SyI2=6BvSy^Xd5^w^Nk}im^17;mpw&c86#__%O1HU-d3g-)U!BP% z>ST)-UUnDTMBHvfBxC9;VeHC-9B9J$L@mDb>MY**;NEvwIeVN~*O;~xqmrZerAYYB zWP`{_+SfyH#-|$mCdF0Noo0_)QzvvindH49ykaAH#Dfdgrmy5!cxSoMz6#LeEw5}m zG$)#EZk?0R11Y+B&np$A=}}@nSoT9IrRIPqwwv@gEyGDs_%XZ=nz@k~)Jm|n42*7HmA?EtUPpp;grrb@+U0RF*i}Hem5V?e+l@B=_ ztHb%R%F~8|a<<~~4uK3ee6DbZgpSSpF1N@Xtj!fgF;Z)4URJKD5gnle8&8B{V5E~n z?DDMq0;wM5D03mKXQ?4SHKB1uqFkf6c12tF1c$yB&r3x1_rBK3KD-+V;pWd*xd}uG zygHPA(-olgv0*s7?0Ln|Rj2&vZyPvoxvM8~NPyIWmKL_FFSzB?Y(J3tp92P5aKJritA4zMyA-h< zTT7KYkzUX3pgAbMLbuK??qLuMbv5==5MF&B^6t6Q z;aPNC(nljk9Xo#8VrKtovkUuq^rITJ484X86_LZ1ca6CFxIv^x?@uLTIV6`|AR4`! zwkbGyDt3#Xj#?5xYm`NIb1We|3U7aCz@|(`dCWKH+&M@j352FwxW_;DdKI+hY8u?#g}vZHM#Gta#e_$4bn+alr*tyA@Ux&7@x% z;6*%pv4NN6UP@<_%8~o+^M{IPr`ynW>_{G#~k9Tn2cWpYoSx*~9;y$q0=7dam-` zbhDW6M4!5KbHB*Ux?9-{u=ZPQzIoj@3wl8^w%$IZXzNi`nAI|w{SX~PB9-gz#3({j z?n-spE%B2WpLWcc{Hba)XmH#As6(oDcL?TuKapc~?E41R6>@I{w)`+c9WTv~G#K@x z6T9NGYmj|hMnSrSks2)du|QtqB~3l=pNvdPLVmJiujMXmoT0~ppN$F->?P8PwLfo` zbe!SE5AOLqg^6jAhdJ~YjT-y8zg|Te6cVi z9rOS8jXuO#W|l$+d%+rBJlqBnc@rJThrdv&26#3K!g_^Dv@k*Tc_|KA=uc_=pf{!2 zf{Sb`ib@I#_M|jB@a+o9w~u|O-VTnk;1qi}V8g;hccL){_<--7+<1x@jleTfR$_J% zwn!DXu@Aha+^UBuy3rTL@=~KSY*r;*cZPS^EQ!C!r>=Xa9qIdiET(YDTUD`s=c&hImWl@baFXKj#0}X;O0UD{6I8SafUS>5%X*d82P-%d368} zrTx>9!H^3T?=dbwY5g=ffUT1-O?3g#!IC7@EDD6t^3bEsKwx%hF%5;k3nbInAU0R( zAjh#i(uTGV2cC77w&B2)D4nL*PDdIT0xD54g!qf0NIOOVQ*?=&8bSi7Y9vfm&EQkr zRDn|VQcR1_loKcgje=ON$JKt~lbqri=I9UldJ=9R5(41;eKp?uPy)G-jl2x1mW zO=I9kVK5{2n4AC$C*WC8CCnASQowFYK3l;9hh@?fI3P8y+m=xjFby&}>{ZjajAb{8=bA6>xZjtmr;BotfXDCF@vX=q zpOP9m4V}&fIORs9WmN+A3N_b9a(Ma$8#H3HQAHv+u;}VUXizhnmjs_G!Q??howK+N z$_jXrl}HMDl9M&`M;~xj@@dy2pON_8V@Evek!+d$3WzCf;ixhMBr7fbl7VMWxy365 zGDT+>rzUY+{dJQk#((QdmFb{Wt&ZHuR-Y|3IOOHbE1X*(vmW{Q74)hvlXyFvK0!-y zb6~m(CtPvOfVF^r|~&wypD=;`8S4~7iL+?nSsLcA&(XD7;;jef};H6 zPuNgtVHZ-wWT3Jlc{1f>b2=+|qLgXC5raOl6%>FaGeH!GnhALc{5BhdzS#+U4zqoT*kF$$xmC9;Z%#ib_A+1_h_$&>^ev8R2F7<1AiPgQ!f79zw>{!c_x*Fj2mb0^`+ z6NQKjy=yA?DofO z(5JrQx0?e!M0kc(*=^?iqe%_F1C%qK}BPl2eJQOWGSS-CjqRm@~pjZ?& zH&%(@ke=%-V-1p9j?iN3#!GMk{-GN1FpPN-s+{J#l>G!hcqm759w1Kgr><&K4 z+(DWitrDBvN3q9%Pwke=kTFnCBl%WIV&vPlwk`!>FnjY}C) Date: Thu, 1 Feb 2024 16:54:57 +0100 Subject: [PATCH 09/21] feature/Implement BG endpoint updateSigningBasketPsuData - WIP --- .../berlin/group/v1_3/SigningBasketsApi.scala | 58 +++++++++++-------- .../MappedSigningBasketProvider.scala | 12 ++++ .../code/signingbaskets/SigningBasket.scala | 1 + 3 files changed, 48 insertions(+), 23 deletions(-) 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 498d1e6668..bdb13a2c1b 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 @@ -1,33 +1,28 @@ package code.api.builder.SigningBasketsApi -import code.api.APIFailureNewStyle +import code.api.berlin.group.ConstantsBG import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{PostSigningBasketJsonV13, UpdatePaymentPsuDataJson, createSigningBasketResponseJson, createStartSigningBasketAuthorisationJson, getSigningBasketResponseJson, getSigningBasketStatusResponseJson} -import code.api.berlin.group.v1_3.{JSONFactory_BERLIN_GROUP_1_3, JvalueCaseClass, OBP_BERLIN_GROUP_1_3} -import net.liftweb.json -import net.liftweb.json._ -import code.api.util.APIUtil.{defaultBankId, _} -import code.api.util.{ApiTag, NewStyle} -import code.api.util.ErrorMessages._ +import code.api.berlin.group.v1_3.{JSONFactory_BERLIN_GROUP_1_3, JvalueCaseClass} +import code.api.util.APIUtil._ import code.api.util.ApiTag._ +import code.api.util.ErrorMessages._ +import code.api.util.NewStyle import code.api.util.NewStyle.HttpCode import code.bankconnectors.Connector -import code.model._ import code.signingbaskets.SigningBasketX -import code.util.Helper -import code.views.Views -import net.liftweb.common.{Box, Full} -import net.liftweb.http.rest.RestHelper import com.github.dwickern.macros.NameOf.nameOf - -import scala.collection.immutable.Nil -import scala.collection.mutable.ArrayBuffer import com.openbankproject.commons.ExecutionContext.Implicits.global -import com.openbankproject.commons.model.{ChallengeTrait, SigningBasketTrait, TransactionRequestId} import com.openbankproject.commons.model.enums.TransactionRequestStatus.{COMPLETED, REJECTED} import com.openbankproject.commons.model.enums.{ChallengeType, StrongCustomerAuthenticationStatus} +import com.openbankproject.commons.model.{ChallengeTrait, TransactionRequestId} import com.openbankproject.commons.util.ApiVersion +import net.liftweb.common.{Box, Empty, Full} import net.liftweb.http.js.JE.JsRaw +import net.liftweb.http.rest.RestHelper +import net.liftweb.json +import net.liftweb.json._ +import scala.collection.mutable.ArrayBuffer import scala.concurrent.Future object APIMethods_SigningBasketsApi extends RestHelper { @@ -472,7 +467,6 @@ There are the following request types on this access path: updateBasketPsuDataJson <- NewStyle.function.tryons(failMsg, 400, callContext) { json.extract[UpdatePaymentPsuDataJson] } - _ <- Future(org.scalameta.logger.elem(updateBasketPsuDataJson)) // Validate a challenge answer and get an error if any (boxedChallenge: Box[ChallengeTrait], callContext) <- NewStyle.function.validateChallengeAnswerC3( ChallengeType.BERLINGROUP_SIGNING_BASKETS_CHALLENGE, @@ -485,11 +479,29 @@ There are the following request types on this access path: ) // Get the challenge after validation (challenge: ChallengeTrait, callContext) <- NewStyle.function.getChallenge(authorisationId, callContext) - _ <- challenge.scaStatus.toString match { - case status if status == StrongCustomerAuthenticationStatus.finalised.toString => // finalised - // TODO Implement successful case - Future(unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse() ")) - case status if status == StrongCustomerAuthenticationStatus.failed.toString => // failed + _ <- challenge.scaStatus match { + case Some(status) if status.toString == StrongCustomerAuthenticationStatus.finalised.toString => // finalised + Future { + val basket = SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketId) + val existAll: Box[Boolean] = + basket.flatMap(_.payments.map(_.forall(i => Connector.connector.vend.getTransactionRequestImpl(TransactionRequestId(i), callContext).isDefined))) + if (existAll.getOrElse(false)) { + basket.map { i => + i.payments.map(_.map { i => + Connector.connector.vend.saveTransactionRequestStatusImpl(TransactionRequestId(i), COMPLETED.toString) + Connector.connector.vend.getTransactionRequestImpl(TransactionRequestId(i), callContext) map { t => + Connector.connector.vend.makePaymentV400(t._1, None, callContext) + } + }) + } + SigningBasketX.signingBasketProvider.vend.saveSigningBasketStatus(basketId, ConstantsBG.SigningBasketsStatus.ACTC.toString) + unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ") + } else { // Fail due to unexisting payment + val paymentIds = basket.flatMap(_.payments).getOrElse(Nil).mkString(",") + unboxFullOrFail(Empty, callContext, s"$InvalidConnectorResponse Some of paymentIds [${paymentIds}] are invalid") + } + } + case Some(status) if status.toString == StrongCustomerAuthenticationStatus.failed.toString => // failed Future { // Reject all related transaction requests val basket = SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketId) @@ -502,7 +514,7 @@ There are the following request types on this access path: unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ") } case _ => // Fail in case of an error message - Future(unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ") ) + Future(unboxFullOrFail(Empty, callContext, s"$InvalidConnectorResponse ")) } } yield { (JSONFactory_BERLIN_GROUP_1_3.createStartPaymentAuthorisationJson(challenge), callContext) diff --git a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala index d66b299509..c019517c6d 100644 --- a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala +++ b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala @@ -24,6 +24,18 @@ object MappedSigningBasketProvider extends SigningBasketProvider { } basket.map( i => SigningBasketContent(basket = i, payments = payments, consents = consents)) } + override def saveSigningBasketStatus(entityId: String, status: String): Box[SigningBasketContent] = { + val basket: Box[MappedSigningBasket] = MappedSigningBasket.find(By(MappedSigningBasket.BasketId, entityId)).map(_.Status(status).saveMe) + val payments = MappedSigningBasketPayment.findAll(By(MappedSigningBasketPayment.BasketId, entityId)).map(_.basketId) match { + case Nil => None + case head :: tail => Some(head :: tail) + } + val consents = MappedSigningBasketConsent.findAll(By(MappedSigningBasketConsent.BasketId, entityId)).map(_.basketId) match { + case Nil => None + case head :: tail => Some(head :: tail) + } + basket.map( i => SigningBasketContent(basket = i, payments = payments, consents = consents)) + } override def createSigningBasket(paymentIds: Option[List[String]], consentIds: Option[List[String]] diff --git a/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala b/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala index 61f2b455a1..b5bb12b208 100644 --- a/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala +++ b/obp-api/src/main/scala/code/signingbaskets/SigningBasket.scala @@ -16,6 +16,7 @@ trait SigningBasketProvider { def getSigningBaskets(): List[SigningBasketTrait] def getSigningBasketByBasketId(entityId: String): Box[SigningBasketContent] + def saveSigningBasketStatus(entityId: String, status: String): Box[SigningBasketContent] def createSigningBasket(paymentIds: Option[List[String]], consentIds: Option[List[String]], From b273812932d7a3275572367e2f6e6df33d0135e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 2 Feb 2024 17:27:23 +0100 Subject: [PATCH 10/21] feature/Tweak Berlin Group Error Message Signature --- .../v1_3/JSONFactory_BERLIN_GROUP_1_3.scala | 3 +++ .../src/main/scala/code/api/util/APIUtil.scala | 16 +++++++++++++--- .../AccountInformationServiceAISApiTest.scala | 14 +++++++------- .../ConfirmationOfFundsServicePIISApiTest.scala | 7 +++---- .../PaymentInitiationServicePISApiTest.scala | 14 +++++++------- 5 files changed, 33 insertions(+), 21 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 f613f7497c..f5127063b3 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 @@ -20,6 +20,9 @@ case class JvalueCaseClass(jvalueToCaseclass: JValue) object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { + case class ErrorMessageBG(category: String, code: Int, path: String, text: String) + case class ErrorMessagesBG(tppMessages: List[ErrorMessageBG]) + case class PostSigningBasketJsonV13( paymentIds: Option[List[String]], consentIds: Option[List[String]] diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala index 16105575fa..bb7070f21f 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -28,13 +28,13 @@ TESOBE (http://www.tesobe.com/) package code.api.util import bootstrap.liftweb.CustomDBVendor + import java.io.InputStream import java.net.URLDecoder import java.nio.charset.Charset import java.text.{ParsePosition, SimpleDateFormat} import java.util.concurrent.ConcurrentHashMap import java.util.{Calendar, Date, TimeZone, UUID} - import code.UserRefreshes.UserRefreshes import code.accountholders.AccountHolders import code.api.Constant._ @@ -57,6 +57,7 @@ import code.api.v2_0_0.CreateEntitlementJSON import code.api.dynamic.endpoint.helper.DynamicEndpointHelper import code.api.dynamic.entity.OBPAPIDynamicEntity import code.api._ +import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{ErrorMessageBG, ErrorMessagesBG} import code.api.dynamic.entity.helper.DynamicEntityHelper import code.api.v5_0_0.OBPAPI5_0_0 import code.api.v5_1_0.OBPAPI5_1_0 @@ -114,9 +115,9 @@ import javassist.{ClassPool, LoaderClassPath} import javassist.expr.{ExprEditor, MethodCall} import org.apache.commons.io.IOUtils import org.apache.commons.lang3.StringUtils + import java.security.AccessControlException import java.util.regex.Pattern - import code.api.util.FutureUtil.{EndpointContext, EndpointTimeout} import code.api.v2_1_0.OBPAPI2_1_0.Implementations2_1_0 import code.api.v2_2_0.OBPAPI2_2_0.Implementations2_2_0 @@ -728,7 +729,16 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ case _ => (httpCode, getHeaders() ::: headers.list) } - val errorMessageAst: json.JValue = Extraction.decompose(ErrorMessage(message = message, code = code)) + def composeErrorMessage() = { + val path = callContextLight.map(_.url).getOrElse("") + if (path.contains("berlin-group")) { + val errorMessagesBG = ErrorMessagesBG(tppMessages = List(ErrorMessageBG(category = "ERROR", code = code, path = callContextLight.map(_.url).getOrElse(""), text = message))) + Extraction.decompose(errorMessagesBG) + } else { + Extraction.decompose(ErrorMessage(message = message, code = code)) + } + } + val errorMessageAst: json.JValue = composeErrorMessage() val httpBody = JsonAST.compactRender(errorMessageAst) val jwsHeaders: CustomResponseHeaders = getSignRequestHeadersError(callContextLight, httpBody) JsonResponse(errorMessageAst, responseHeaders ::: jwsHeaders.list, Nil, code) diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApiTest.scala index 5ccb9afeba..de84f378c7 100644 --- a/obp-api/src/test/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApiTest.scala +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApiTest.scala @@ -54,7 +54,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit Then("We should get a 401 ") response.code should equal(401) - response.body.extract[ErrorMessage].message should startWith(UserNotLoggedIn) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(UserNotLoggedIn) } scenario("Authentication User, test failed", BerlinGroupV1_3, getAccountList) { @@ -63,7 +63,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit Then("We should get a 403 ") response.code should equal(403) - response.body.extract[ErrorMessage].message should startWith(NoViewReadAccountsBerlinGroup) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(NoViewReadAccountsBerlinGroup) } } @@ -74,7 +74,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit Then("We should get a 401 ") response.code should equal(401) - response.body.extract[ErrorMessage].message should startWith(UserNotLoggedIn) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(UserNotLoggedIn) } scenario("Authentication User, test succeed", BerlinGroupV1_3, readAccountDetails) { @@ -104,7 +104,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit val requestGetFailed = (V1_3_BG / "accounts" / testAccountId1.value / "balances").GET <@ (user1) val responseGetFailed: APIResponse = makeGetRequest(requestGetFailed) responseGetFailed.code should equal(403) - responseGetFailed.body.extract[ErrorMessage].message should startWith(NoViewReadAccountsBerlinGroup) + responseGetFailed.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(NoViewReadAccountsBerlinGroup) grantUserAccessToViewViaEndpoint( bankId, @@ -132,7 +132,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit val responseGetFailed: APIResponse = makeGetRequest(requestGetFailed) Then("We should get a 403 ") responseGetFailed.code should equal(403) - responseGetFailed.body.extract[ErrorMessage].message should startWith(UserNoPermissionAccessView) + responseGetFailed.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(UserNoPermissionAccessView) val bankId = MappedBankAccount.find(By(MappedBankAccount.theAccountId, testAccountId.value)).map(_.bankId.value).getOrElse("") grantUserAccessToViewViaEndpoint( @@ -161,7 +161,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit val responseGetFailed: APIResponse = makeGetRequest(requestGetFailed) Then("We should get a 403 ") responseGetFailed.code should equal(403) - responseGetFailed.body.extract[ErrorMessage].message should startWith(UserNoPermissionAccessView) + responseGetFailed.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(UserNoPermissionAccessView) val bankId = MappedBankAccount.find(By(MappedBankAccount.theAccountId, testAccountId.value)).map(_.bankId.value).getOrElse("") grantUserAccessToViewViaEndpoint( @@ -195,7 +195,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit val responseGetFailed: APIResponse = makeGetRequest(requestGetFailed) Then("We should get a 403 ") responseGetFailed.code should equal(403) - responseGetFailed.body.extract[ErrorMessage].message should startWith(UserNoPermissionAccessView) + responseGetFailed.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(UserNoPermissionAccessView) val bankId = MappedBankAccount.find(By(MappedBankAccount.theAccountId, testAccountId.value)).map(_.bankId.value).getOrElse("") grantUserAccessToViewViaEndpoint( diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApiTest.scala index 57885795c9..08e0c6f58c 100644 --- a/obp-api/src/test/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApiTest.scala +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApiTest.scala @@ -1,5 +1,6 @@ package code.api.berlin.group.v1_3 +import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.ErrorMessagesBG import com.openbankproject.commons.model.ErrorMessage import code.api.builder.ConfirmationOfFundsServicePIISApi.APIMethods_ConfirmationOfFundsServicePIISApi import code.api.util.APIUtil.OAuth._ @@ -33,8 +34,7 @@ class ConfirmationOfFundsServicePIISApiTest extends BerlinGroupServerSetupV1_3 w Then("We should get a 404 ") response.code should equal(404) - response.body.extract[ErrorMessage] - .message should startWith(BankAccountNotFoundByIban) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(BankAccountNotFoundByIban) } scenario("Failed Case, invalid post json", BerlinGroupV1_3, PIIS, checkAvailabilityOfFunds) { @@ -43,8 +43,7 @@ class ConfirmationOfFundsServicePIISApiTest extends BerlinGroupServerSetupV1_3 w Then("We should get a 400 ") response.code should equal(400) - response.body.extract[ErrorMessage] - .message should startWith(InvalidJsonFormat) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(InvalidJsonFormat) } scenario("Success case - Enough Funds", BerlinGroupV1_3, PIIS, checkAvailabilityOfFunds) { diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApiTest.scala index 280f2ddc5b..c63d573783 100644 --- a/obp-api/src/test/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApiTest.scala +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApiTest.scala @@ -3,7 +3,7 @@ package code.api.berlin.group.v1_3 import code.api.BerlinGroup.ScaStatus import code.api.Constant import code.api.Constant.SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID -import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{CancellationJsonV13, InitiatePaymentResponseJson, StartPaymentAuthorisationJson} +import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{CancellationJsonV13, ErrorMessagesBG, InitiatePaymentResponseJson, StartPaymentAuthorisationJson} import code.api.builder.PaymentInitiationServicePISApi.APIMethods_PaymentInitiationServicePISApi import code.api.util.APIUtil.OAuth._ import code.api.util.APIUtil.extractErrorMessageCode @@ -60,7 +60,7 @@ class PaymentInitiationServicePISApiTest extends BerlinGroupServerSetupV1_3 with response.code should equal(400) val error = s"$InvalidJsonFormat The Json body should be the $SepaCreditTransfersBerlinGroupV13 " And("error should be " + error) - response.body.extract[ErrorMessage].message should startWith (error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith (error) } scenario("Failed Case - wrong amount", BerlinGroupV1_3, PIS, initiatePayment) { val wrongAmountInitiatePaymentJson = @@ -84,7 +84,7 @@ class PaymentInitiationServicePISApiTest extends BerlinGroupServerSetupV1_3 with response.code should equal(400) val error = s"${NotPositiveAmount} Current input is: '-1234'" And("error should be " + error) - response.body.extract[ErrorMessage].message contains extractErrorMessageCode(NotPositiveAmount) should be (true) + response.body.extract[ErrorMessagesBG].tppMessages.head.text contains extractErrorMessageCode(NotPositiveAmount) should be (true) } scenario("Successful case - small amount -- change the balance", BerlinGroupV1_3, PIS, initiatePayment) { val accountsRoutingIban = BankAccountRouting.findAll(By(BankAccountRouting.AccountRoutingScheme, AccountRoutingScheme.IBAN.toString)) @@ -296,7 +296,7 @@ class PaymentInitiationServicePISApiTest extends BerlinGroupServerSetupV1_3 with val response: APIResponse = makePostRequest(requestPost, """""") Then("We should get a 400 ") response.code should equal(400) - response.body.extract[ErrorMessage].message should startWith (InvalidTransactionRequestId) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith (InvalidTransactionRequestId) } scenario(s"Successful Case ", BerlinGroupV1_3, PIS, startPaymentAuthorisation) { val accountsRoutingIban = BankAccountRouting.findAll(By(BankAccountRouting.AccountRoutingScheme, AccountRoutingScheme.IBAN.toString)).filterNot(_.bankId.value == "DEFAULT_BANK_ID_NOT_SET") @@ -407,7 +407,7 @@ class PaymentInitiationServicePISApiTest extends BerlinGroupServerSetupV1_3 with val response: APIResponse = makePostRequest(requestPost, """""") Then("We should get a 400 ") response.code should equal(400) - response.body.extract[ErrorMessage].message should startWith (InvalidTransactionRequestId) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith (InvalidTransactionRequestId) } scenario(s"Successful Case ", BerlinGroupV1_3, PIS) { @@ -504,7 +504,7 @@ class PaymentInitiationServicePISApiTest extends BerlinGroupServerSetupV1_3 with response.code should equal(400) val error = s"$InvalidTransactionRequestId Current TransactionRequestId(PAYMENT_ID) " And("error should be " + error) - response.body.extract[ErrorMessage].message should equal (error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should equal (error) } } feature("test the BG v1.3 getPaymentInitiationAuthorisation") { @@ -520,7 +520,7 @@ class PaymentInitiationServicePISApiTest extends BerlinGroupServerSetupV1_3 with response.code should equal(400) val error = s"$InvalidTransactionRequestId Current TransactionRequestId(NON_EXISTING_PAYMENT_ID) " And("error should be " + error) - response.body.extract[ErrorMessage].message should equal (error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should equal (error) } } feature("test the BG v1.3 getPaymentInitiationCancellationAuthorisationInformation") { From eafb7bd05109435a911bfb95a767f52b7c520172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 28 Feb 2024 11:35:48 +0100 Subject: [PATCH 11/21] feature/Ensure that the WHERE clause is not missing in UPDATE query. --- .../main/scripts/migrate/migrate_00000011.sql | 7 ++++++- .../main/scripts/migrate/migrate_00000013.sql | 20 +++++++++++++------ .../main/scripts/migrate/migrate_00000014.sql | 7 ++++++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/obp-api/src/main/scripts/migrate/migrate_00000011.sql b/obp-api/src/main/scripts/migrate/migrate_00000011.sql index 15336ccf81..acb2bfcbc3 100644 --- a/obp-api/src/main/scripts/migrate/migrate_00000011.sql +++ b/obp-api/src/main/scripts/migrate/migrate_00000011.sql @@ -1 +1,6 @@ -update viewimpl set isFirehose_=TRUE; \ No newline at end of file +update + viewimpl +set + isFirehose_ = TRUE +where + isFirehose_ <> TRUE; diff --git a/obp-api/src/main/scripts/migrate/migrate_00000013.sql b/obp-api/src/main/scripts/migrate/migrate_00000013.sql index 1c822f6d9c..969920f80f 100644 --- a/obp-api/src/main/scripts/migrate/migrate_00000013.sql +++ b/obp-api/src/main/scripts/migrate/migrate_00000013.sql @@ -1,6 +1,14 @@ -UPDATE consumer SET - perhourcalllimit = -1 , - perdaycalllimit = -1 , - perweekcalllimit = -1 , - permonthcalllimit = -1 , - perminutecalllimit = -1; \ No newline at end of file +UPDATE + consumer +SET + perhourcalllimit = -1, + perdaycalllimit = -1, + perweekcalllimit = -1, + permonthcalllimit = -1, + perminutecalllimit = -1 +WHERE + perhourcalllimit <> -1 + OR perdaycalllimit <> -1 + OR perweekcalllimit <> -1 + OR permonthcalllimit <> -1 + OR perminutecalllimit <> -1; diff --git a/obp-api/src/main/scripts/migrate/migrate_00000014.sql b/obp-api/src/main/scripts/migrate/migrate_00000014.sql index bbf1a8a543..ac8ad2734e 100644 --- a/obp-api/src/main/scripts/migrate/migrate_00000014.sql +++ b/obp-api/src/main/scripts/migrate/migrate_00000014.sql @@ -1 +1,6 @@ -UPDATE consumer SET persecondcalllimit = -1; \ No newline at end of file +UPDATE + consumer +SET + persecondcalllimit = -1 +where + persecondcalllimit <> -1; From 37951e878d359c419b31843686bff6132681dbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 29 Feb 2024 08:55:27 +0100 Subject: [PATCH 12/21] docfix/Improve a feedback regarding the error messages OBP-20047 --- .../main/scala/code/api/v4_0_0/APIMethods400.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala index 855044d64e..04e503d180 100644 --- a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala +++ b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala @@ -4399,7 +4399,8 @@ trait APIMethods400 extends MdcLoggable { postJson <- NewStyle.function.tryons(failMsg, 400, cc.callContext) { json.extract[PostAccountAccessJsonV400] } - _ <- Helper.booleanToFuture(UserLacksPermissionCanGrantAccessToViewForTargetAccount, cc = cc.callContext) { + msg = UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewId(${postJson.view.view_id}) and current UserId(${u.userId})" + _ <- Helper.booleanToFuture(msg, cc = cc.callContext) { APIUtil.canGrantAccessToView(bankId, accountId, ViewId(postJson.view.view_id), u, callContext) } (user, callContext) <- NewStyle.function.findByUserId(postJson.user_id, callContext) @@ -4461,7 +4462,8 @@ trait APIMethods400 extends MdcLoggable { postJson.provider.startsWith("dauth.") } viewIdList = postJson.views.map(view =>ViewId(view.view_id)) - _ <- Helper.booleanToFuture(s"$UserLacksPermissionCanGrantAccessToViewForTargetAccount ", 403, cc = Some(cc)) { + msg = UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewIds(${viewIdList.mkString}) and current UserId(${u.userId})" + _ <- Helper.booleanToFuture(msg, 403, cc = Some(cc)) { APIUtil.canGrantAccessToMultipleViews(bankId, accountId, viewIdList, u, callContext) } (targetUser, callContext) <- NewStyle.function.getOrCreateResourceUser(postJson.provider, postJson.username, cc.callContext) @@ -4512,7 +4514,8 @@ trait APIMethods400 extends MdcLoggable { json.extract[PostAccountAccessJsonV400] } viewId = ViewId(postJson.view.view_id) - _ <- Helper.booleanToFuture(UserLacksPermissionCanGrantAccessToViewForTargetAccount, cc = cc.callContext) { + msg = UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewId(${viewId}) and current UserId(${u.userId})" + _ <- Helper.booleanToFuture(msg, cc = cc.callContext) { APIUtil.canRevokeAccessToView(bankId, accountId, viewId, u, callContext) } (user, callContext) <- NewStyle.function.findByUserId(postJson.user_id, cc.callContext) @@ -4566,7 +4569,8 @@ trait APIMethods400 extends MdcLoggable { postJson <- NewStyle.function.tryons(failMsg, 400, cc.callContext) { json.extract[PostRevokeGrantAccountAccessJsonV400] } - _ <- Helper.booleanToFuture(UserLacksPermissionCanGrantAccessToViewForTargetAccount, cc = cc.callContext) { + msg = UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewIds(${postJson.views.mkString}) and current UserId(${u.userId})" + _ <- Helper.booleanToFuture(msg, cc = cc.callContext) { APIUtil.canRevokeAccessToAllViews(bankId, accountId, u, callContext) } _ <- Future(Views.views.vend.revokeAccountAccessByUser(bankId, accountId, u, callContext)) map { From 169c12964ba6b8d8a8930b83bca594c06bf9822f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 1 Mar 2024 21:25:43 +0100 Subject: [PATCH 13/21] feature/Tweak signing basket endpoints --- .../berlin/group/v1_3/SigningBasketsApi.scala | 2 + .../util/newstyle/SigningBasketNewStyle.scala | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 obp-api/src/main/scala/code/api/util/newstyle/SigningBasketNewStyle.scala 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 bdb13a2c1b..b33dcd9a6e 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 @@ -8,6 +8,7 @@ import code.api.util.ApiTag._ import code.api.util.ErrorMessages._ import code.api.util.NewStyle import code.api.util.NewStyle.HttpCode +import code.api.util.newstyle.SigningBasketNewStyle import code.bankconnectors.Connector import code.signingbaskets.SigningBasketX import com.github.dwickern.macros.NameOf.nameOf @@ -467,6 +468,7 @@ There are the following request types on this access path: updateBasketPsuDataJson <- NewStyle.function.tryons(failMsg, 400, callContext) { json.extract[UpdatePaymentPsuDataJson] } + _ <- 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, diff --git a/obp-api/src/main/scala/code/api/util/newstyle/SigningBasketNewStyle.scala b/obp-api/src/main/scala/code/api/util/newstyle/SigningBasketNewStyle.scala new file mode 100644 index 0000000000..d0ce26305e --- /dev/null +++ b/obp-api/src/main/scala/code/api/util/newstyle/SigningBasketNewStyle.scala @@ -0,0 +1,38 @@ +package code.api.util.newstyle + +import code.api.util.APIUtil.{OBPReturnType, unboxFullOrFail} +import code.api.util.CallContext +import code.api.util.ErrorMessages.{InvalidConnectorResponse, RegulatedEntityNotDeleted} +import code.bankconnectors.Connector +import code.signingbaskets.SigningBasketX +import com.openbankproject.commons.model.TransactionRequestId +import net.liftweb.common.{Box, Empty} + +import scala.concurrent.Future + +object SigningBasketNewStyle { + + import com.openbankproject.commons.ExecutionContext.Implicits.global + + def checkSigningBasketPayments(basketId: String, + callContext: Option[CallContext] + ): OBPReturnType[Boolean] = { + Future { + val basket = SigningBasketX.signingBasketProvider.vend.getSigningBasketByBasketId(basketId) + val existAll: Box[Boolean] = + basket.flatMap(_.payments.map(_.forall(i => Connector.connector.vend.getTransactionRequestImpl(TransactionRequestId(i), callContext).isDefined))) + if (existAll.getOrElse(false)) { + Some(true) + } else { // Fail due to unexisting payment + val paymentIds = basket.flatMap(_.payments).getOrElse(Nil).mkString(",") + unboxFullOrFail(Empty, callContext, s"$InvalidConnectorResponse Some of paymentIds [${paymentIds}] are invalid") + } + } map { + (_, callContext) + } map { + x => (unboxFullOrFail(x._1, callContext, RegulatedEntityNotDeleted, 400), x._2) + } + } + + +} From ad73656cc41a1d718356bc71d6d6d78301f7475d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 8 Mar 2024 12:14:00 +0100 Subject: [PATCH 14/21] feature/Tweak signing basket endpoint createSigningBasket v3.1.12 --- .../code/api/berlin/group/v1_3/SigningBasketsApi.scala | 6 ++++++ 1 file changed, 6 insertions(+) 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 b33dcd9a6e..67e5c49bb3 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 @@ -11,6 +11,7 @@ import code.api.util.NewStyle.HttpCode import code.api.util.newstyle.SigningBasketNewStyle import code.bankconnectors.Connector import code.signingbaskets.SigningBasketX +import code.util.Helper.booleanToFuture import com.github.dwickern.macros.NameOf.nameOf import com.openbankproject.commons.ExecutionContext.Implicits.global import com.openbankproject.commons.model.enums.TransactionRequestStatus.{COMPLETED, REJECTED} @@ -109,6 +110,11 @@ The resource identifications of these transactions are contained in the payload postJson <- NewStyle.function.tryons(failMsg, 400, callContext) { jsonPost.extract[PostSigningBasketJsonV13] } + _ <- booleanToFuture(failMsg, cc = callContext) { + // One of them MUST be defined. Otherwise post json is treated as empty one. + !(jsonPost.extract[PostSigningBasketJsonV13].paymentIds.isEmpty && + jsonPost.extract[PostSigningBasketJsonV13].consentIds.isEmpty) + } signingBasket <- Future { SigningBasketX.signingBasketProvider.vend.createSigningBasket( postJson.paymentIds, From 6db0db481fc628cfade0a29589b3293dfe2ffbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 8 Mar 2024 13:39:14 +0100 Subject: [PATCH 15/21] test/Add signing basket tests WIP --- .../v1_3/SigningBasketServiceSBSApiTest.scala | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala new file mode 100644 index 0000000000..a61fbddb69 --- /dev/null +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala @@ -0,0 +1,134 @@ +package code.api.berlin.group.v1_3 + +import code.api.berlin.group.ConstantsBG +import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{ErrorMessagesBG, PostSigningBasketJsonV13, SigningBasketGetResponseJson, SigningBasketResponseJson} +import code.api.builder.SigningBasketsApi.APIMethods_SigningBasketsApi +import code.api.util.APIUtil.OAuth._ +import code.api.util.ErrorMessages._ +import code.setup.{APIResponse, DefaultUsers} +import com.github.dwickern.macros.NameOf.nameOf +import org.scalatest.Tag + +class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with DefaultUsers { + object SBS extends Tag("Signing Baskets Service (SBS)") + object createSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.createSigningBasket)) + object getSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasket)) + object getSigningBasketStatus extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketStatus)) + + feature(s"test the BG v1.3 - ${createSigningBasket.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, createSigningBasket) { + val postJson = + s"""{ + | "consentIds": [ + | "123qwert456789", + | "12345qwert7899" + | ] + |}""".stripMargin + + val requestPost = (V1_3_BG / "signing-baskets").POST + val response: APIResponse = makePostRequest(requestPost, postJson) + Then("We should get a 401 ") + response.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + + feature(s"test the BG v1.3 -${createSigningBasket.name}") { + scenario("Failed Case - Wrong Json format Body", BerlinGroupV1_3, SBS, createSigningBasket) { + val wrongFieldNameJson = + s"""{ + | "wrongFieldName": [ + | "123qwert456789", + | "12345qwert7899" + | ] + |}""".stripMargin + + val requestPost = (V1_3_BG / "signing-baskets").POST <@ (user1) + val response: APIResponse = makePostRequest(requestPost, wrongFieldNameJson) + Then("We should get a 400 ") + response.code should equal(400) + val error = s"$InvalidJsonFormat The Json body should be the $PostSigningBasketJsonV13 " + And("error should be " + error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith (error) + } + } + + // TODO Add check that paymentId is an existing transaction request + feature(s"test the BG v1.3 -${createSigningBasket.name}") { + scenario("Failed Case - Successful", BerlinGroupV1_3, SBS, createSigningBasket) { + val postJson = + s"""{ + | "paymentIds": [ + | "123qwert456789", + | "12345qwert7899" + | ] + |}""".stripMargin + + val requestPost = (V1_3_BG / "signing-baskets").POST <@ (user1) + val response: APIResponse = makePostRequest(requestPost, postJson) + Then("We should get a 201 ") + response.code should equal(201) + } + } + + + feature(s"test the BG v1.3 - ${getSigningBasket.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, getSigningBasket) { + val requestGet = (V1_3_BG / "signing-baskets" / "basketId").GET + val responseGet = makeGetRequest(requestGet) + Then("We should get a 401 ") + responseGet.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + responseGet.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + + feature(s"test the BG v1.3 - ${getSigningBasketStatus.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, getSigningBasketStatus) { + val requestGet = (V1_3_BG / "signing-baskets" / "basketId" / "status").GET + val responseGet = makeGetRequest(requestGet) + Then("We should get a 401 ") + responseGet.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + responseGet.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + + + feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket and $getSigningBasketStatus") { + scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus) { + val postJson = + s"""{ + | "paymentIds": [ + | "123qwert456789", + | "12345qwert7899" + | ] + |}""".stripMargin + + val requestPost = (V1_3_BG / "signing-baskets").POST <@ (user1) + val response: APIResponse = makePostRequest(requestPost, postJson) + Then("We should get a 201 ") + response.code should equal(201) + + val basketId = response.body.extract[SigningBasketResponseJson].basketId + + Then(s"We test the $getSigningBasket") + val requestGet = (V1_3_BG / "signing-baskets" / basketId).GET <@ (user1) + val responseGet = makeGetRequest(requestGet) + responseGet.code should be(200) + responseGet.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + + Then(s"We test the $getSigningBasketStatus") + val requestGetStatus = (V1_3_BG / "signing-baskets" / basketId / "status").GET <@ (user1) + val responseGetStatus = makeGetRequest(requestGetStatus) + responseGetStatus.code should be(200) + responseGetStatus.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + } + } + + +} \ No newline at end of file From 43d740a9ebe23ed125afdef0f08dbb800aab7e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 8 Mar 2024 15:06:25 +0100 Subject: [PATCH 16/21] test/Add signing basket tests WIP 2 --- .../v1_3/SigningBasketServiceSBSApiTest.scala | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala index a61fbddb69..b6ba197b57 100644 --- a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala @@ -14,6 +14,7 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def object createSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.createSigningBasket)) object getSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasket)) object getSigningBasketStatus extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketStatus)) + object deleteSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.deleteSigningBasket)) feature(s"test the BG v1.3 - ${createSigningBasket.name}") { scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, createSigningBasket) { @@ -98,9 +99,21 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def } } + feature(s"test the BG v1.3 - ${deleteSigningBasket.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, deleteSigningBasket) { + val request = (V1_3_BG / "signing-baskets" / "basketId").DELETE + val response = makeDeleteRequest(request) + Then("We should get a 401 ") + response.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + - feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket and $getSigningBasketStatus") { - scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus) { + feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket, $getSigningBasketStatus, $deleteSigningBasket") { + scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus, deleteSigningBasket) { val postJson = s"""{ | "paymentIds": [ @@ -120,13 +133,24 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def val requestGet = (V1_3_BG / "signing-baskets" / basketId).GET <@ (user1) val responseGet = makeGetRequest(requestGet) responseGet.code should be(200) - responseGet.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + responseGet.body.extract[SigningBasketGetResponseJson].transactionStatus should + be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) Then(s"We test the $getSigningBasketStatus") val requestGetStatus = (V1_3_BG / "signing-baskets" / basketId / "status").GET <@ (user1) - val responseGetStatus = makeGetRequest(requestGetStatus) + var responseGetStatus = makeGetRequest(requestGetStatus) + responseGetStatus.code should be(200) + responseGetStatus.body.extract[SigningBasketGetResponseJson].transactionStatus should + be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + + val requestDelete = (V1_3_BG / "signing-baskets" / basketId).DELETE <@ (user1) + val responseDelete = makeDeleteRequest(requestDelete) + responseDelete.code should be(204) + + responseGetStatus = makeGetRequest(requestGetStatus) responseGetStatus.code should be(200) - responseGetStatus.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + responseGetStatus.body.extract[SigningBasketGetResponseJson].transactionStatus should + be(ConstantsBG.SigningBasketsStatus.CANC.toString.toLowerCase()) } } From 45e968fbbf088f73733610af1485b3a4d9869426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Mon, 11 Mar 2024 14:31:14 +0100 Subject: [PATCH 17/21] test/Add signing basket tests WIP 3 --- .../v1_3/SigningBasketServiceSBSApiTest.scala | 76 ++++++++++++++++++- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala index b6ba197b57..71908d8f45 100644 --- a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala @@ -1,12 +1,13 @@ package code.api.berlin.group.v1_3 import code.api.berlin.group.ConstantsBG -import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{ErrorMessagesBG, PostSigningBasketJsonV13, SigningBasketGetResponseJson, SigningBasketResponseJson} +import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{AuthorisationJsonV13, ErrorMessagesBG, PostSigningBasketJsonV13, ScaStatusJsonV13, SigningBasketGetResponseJson, SigningBasketResponseJson, StartPaymentAuthorisationJson} import code.api.builder.SigningBasketsApi.APIMethods_SigningBasketsApi import code.api.util.APIUtil.OAuth._ import code.api.util.ErrorMessages._ import code.setup.{APIResponse, DefaultUsers} import com.github.dwickern.macros.NameOf.nameOf +import com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus import org.scalatest.Tag class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with DefaultUsers { @@ -15,6 +16,9 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def object getSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasket)) object getSigningBasketStatus extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketStatus)) object deleteSigningBasket extends Tag(nameOf(APIMethods_SigningBasketsApi.deleteSigningBasket)) + object startSigningBasketAuthorisation extends Tag(nameOf(APIMethods_SigningBasketsApi.startSigningBasketAuthorisation)) + object getSigningBasketScaStatus extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketScaStatus)) + object getSigningBasketAuthorisation extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketAuthorisation)) feature(s"test the BG v1.3 - ${createSigningBasket.name}") { scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, createSigningBasket) { @@ -111,9 +115,47 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def } } + feature(s"test the BG v1.3 - ${startSigningBasketAuthorisation.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, startSigningBasketAuthorisation) { + val postJson = s"""{}""".stripMargin + val request = (V1_3_BG / "signing-baskets" / "basketId" / "authorisations").POST + val response = makePostRequest(request, postJson) + Then("We should get a 401 ") + response.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + + feature(s"test the BG v1.3 - ${getSigningBasketScaStatus.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, getSigningBasketScaStatus) { + val requestGet = (V1_3_BG / "signing-baskets" / "basketId" / "authorisations" / "authorisationId").GET + val responseGet = makeGetRequest(requestGet) + Then("We should get a 401 ") + responseGet.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + responseGet.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + + feature(s"test the BG v1.3 - ${getSigningBasketAuthorisation.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, getSigningBasketAuthorisation) { + val requestGet = (V1_3_BG / "signing-baskets" / "basketId" / "authorisations").GET + val responseGet = makeGetRequest(requestGet) + Then("We should get a 401 ") + responseGet.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + responseGet.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } - feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket, $getSigningBasketStatus, $deleteSigningBasket") { - scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus, deleteSigningBasket) { + + feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket, $getSigningBasketStatus, $deleteSigningBasket, $startSigningBasketAuthorisation, $getSigningBasketAuthorisation") { + scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus, deleteSigningBasket, startSigningBasketAuthorisation, getSigningBasketAuthorisation) { + // Create Signing Basket val postJson = s"""{ | "paymentIds": [ @@ -129,6 +171,7 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def val basketId = response.body.extract[SigningBasketResponseJson].basketId + // Get Signing Basket Then(s"We test the $getSigningBasket") val requestGet = (V1_3_BG / "signing-baskets" / basketId).GET <@ (user1) val responseGet = makeGetRequest(requestGet) @@ -136,6 +179,7 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def responseGet.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + // Get Signing Basket Status Then(s"We test the $getSigningBasketStatus") val requestGetStatus = (V1_3_BG / "signing-baskets" / basketId / "status").GET <@ (user1) var responseGetStatus = makeGetRequest(requestGetStatus) @@ -143,6 +187,7 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def responseGetStatus.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.RCVD.toString.toLowerCase()) + // Delete Signing Basket val requestDelete = (V1_3_BG / "signing-baskets" / basketId).DELETE <@ (user1) val responseDelete = makeDeleteRequest(requestDelete) responseDelete.code should be(204) @@ -151,6 +196,31 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def responseGetStatus.code should be(200) responseGetStatus.body.extract[SigningBasketGetResponseJson].transactionStatus should be(ConstantsBG.SigningBasketsStatus.CANC.toString.toLowerCase()) + + // Start Signing Basket Auth Flow + val postJsonAuth = s"""{}""".stripMargin + val requestAuth = (V1_3_BG / "signing-baskets" / basketId / "authorisations").POST <@ (user1) + val responseAuth = makePostRequest(requestAuth, postJsonAuth) + Then("We should get a 201 ") + responseAuth.code should equal(201) + responseAuth.body.extract[StartPaymentAuthorisationJson].scaStatus should + be(StrongCustomerAuthenticationStatus.received.toString) + val authorisationId = responseAuth.body.extract[StartPaymentAuthorisationJson].authorisationId + + // Get Signing Basket Auth Flow Status + val requestAuthStatus = (V1_3_BG / "signing-baskets" / basketId / "authorisations" / authorisationId).GET <@ (user1) + val responseAuthStatus = makeGetRequest(requestAuthStatus) + Then("We should get a 200 ") + responseAuthStatus.code should equal(200) + responseAuthStatus.body.extract[ScaStatusJsonV13].scaStatus should + be(responseAuth.body.extract[StartPaymentAuthorisationJson].scaStatus) + + // Get Signing Basket Authorisations + val requestGetAuths = (V1_3_BG / "signing-baskets" / "basketId" / "authorisations").GET <@ (user1) + val responseGetAuths = makeGetRequest(requestGetAuths) + Then("We should get a 200 ") + responseGetAuths.code should equal(200) + responseGetAuths.body.extract[AuthorisationJsonV13] } } From 2048f72aa2918c19ae51f34d0bee6e60e2812e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 12 Mar 2024 16:19:39 +0100 Subject: [PATCH 18/21] test/Add signing basket tests WIP 4 --- .../v1_3/SigningBasketServiceSBSApiTest.scala | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala index 71908d8f45..490e886ffe 100644 --- a/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala +++ b/obp-api/src/test/scala/code/api/berlin/group/v1_3/SigningBasketServiceSBSApiTest.scala @@ -19,6 +19,7 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def object startSigningBasketAuthorisation extends Tag(nameOf(APIMethods_SigningBasketsApi.startSigningBasketAuthorisation)) object getSigningBasketScaStatus extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketScaStatus)) object getSigningBasketAuthorisation extends Tag(nameOf(APIMethods_SigningBasketsApi.getSigningBasketAuthorisation)) + object updateSigningBasketPsuData extends Tag(nameOf(APIMethods_SigningBasketsApi.updateSigningBasketPsuData)) feature(s"test the BG v1.3 - ${createSigningBasket.name}") { scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, createSigningBasket) { @@ -152,9 +153,22 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def } } + feature(s"test the BG v1.3 - ${updateSigningBasketPsuData.name}") { + scenario("Failed Case - Unauthenticated Access", BerlinGroupV1_3, SBS, updateSigningBasketPsuData) { + val putJson = s"""{"scaAuthenticationData":"123"}""".stripMargin + val request = (V1_3_BG / "signing-baskets" / "basketId" / "authorisations" / "authorisationId").PUT + val response = makePutRequest(request, putJson) + Then("We should get a 401 ") + response.code should equal(401) + val error = s"$UserNotLoggedIn" + And("error should be " + error) + response.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) + } + } + - feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket, $getSigningBasketStatus, $deleteSigningBasket, $startSigningBasketAuthorisation, $getSigningBasketAuthorisation") { - scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus, deleteSigningBasket, startSigningBasketAuthorisation, getSigningBasketAuthorisation) { + feature(s"BG v1.3 - $createSigningBasket, $getSigningBasket, $getSigningBasketStatus, $deleteSigningBasket, $startSigningBasketAuthorisation, $getSigningBasketAuthorisation, $updateSigningBasketPsuData") { + scenario("Authentication User, test succeed", BerlinGroupV1_3, SBS, createSigningBasket, getSigningBasket, getSigningBasketStatus, deleteSigningBasket, startSigningBasketAuthorisation, getSigningBasketAuthorisation, updateSigningBasketPsuData) { // Create Signing Basket val postJson = s"""{ @@ -221,6 +235,14 @@ class SigningBasketServiceSBSApiTest extends BerlinGroupServerSetupV1_3 with Def Then("We should get a 200 ") responseGetAuths.code should equal(200) responseGetAuths.body.extract[AuthorisationJsonV13] + + // Failed due to unexisting paymentIds + val putJson = s"""{"scaAuthenticationData":"123"}""".stripMargin + val requestPut = (V1_3_BG / "signing-baskets" / basketId / "authorisations" / authorisationId).PUT <@ (user1) + val responsePut = makePutRequest(requestPut, putJson) + val error = s"$InvalidConnectorResponse" + And("error should be " + error) + responsePut.body.extract[ErrorMessagesBG].tppMessages.head.text should startWith(error) } } 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 19/21] 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 8004e8193d..0c7d68ea60 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 6db402846f..d2d26ad118 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 67e5c49bb3..312fc7de8b 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 6f742c8de0..af2a498072 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 c75e485e42..35bd148f68 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 From 9e6b2403a9b45b7be54947fa1e5e3b5fa83fe24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 14 Mar 2024 08:38:52 +0100 Subject: [PATCH 20/21] Revert "refactor/Rename tables to lower case due to case-insensitive databases" This reverts commit ddc253b12b2c9e6a2cd02231dcd4f43a0ebb8f9b. --- .../main/scala/code/context/MappedConsentAuthContext.scala | 2 +- obp-api/src/main/scala/code/etag/MappedETag.scala | 2 +- obp-api/src/main/scala/code/metrics/MappedMetrics.scala | 2 +- .../regulatedentities/MappedRegulatedEntitiyProvider.scala | 2 +- .../code/signingbaskets/MappedSigningBasketProvider.scala | 6 +++--- .../MappedExpectedChallengeAnswer.scala | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala b/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala index c4128f4e97..8f57fb243e 100644 --- a/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala +++ b/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala @@ -21,6 +21,6 @@ class MappedConsentAuthContext extends ConsentAuthContext with LongKeyedMapper[M } object MappedConsentAuthContext extends MappedConsentAuthContext with LongKeyedMetaMapper[MappedConsentAuthContext] { - override def dbTableName = "consentauthcontext" // define a custom DB table name + override def dbTableName = "ConsentAuthContext" // define a custom DB table name override def dbIndexes = UniqueIndex(ConsentId, Key, createdAt) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/etag/MappedETag.scala b/obp-api/src/main/scala/code/etag/MappedETag.scala index 20e9500e71..9f3d8d4f26 100644 --- a/obp-api/src/main/scala/code/etag/MappedETag.scala +++ b/obp-api/src/main/scala/code/etag/MappedETag.scala @@ -16,7 +16,7 @@ class MappedETag extends MappedCacheTrait with LongKeyedMapper[MappedETag] with } object MappedETag extends MappedETag with LongKeyedMetaMapper[MappedETag] { - override def dbTableName = "etag" // define the DB table name + override def dbTableName = "ETag" // define the DB table name override def dbIndexes: List[BaseIndex[MappedETag]] = UniqueIndex(ETagResource) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/metrics/MappedMetrics.scala b/obp-api/src/main/scala/code/metrics/MappedMetrics.scala index e7e0c54248..9f04090dbf 100644 --- a/obp-api/src/main/scala/code/metrics/MappedMetrics.scala +++ b/obp-api/src/main/scala/code/metrics/MappedMetrics.scala @@ -577,7 +577,7 @@ object MappedMetric extends MappedMetric with LongKeyedMetaMapper[MappedMetric] // - at an existing sandbox the table "MappedMetric" still exists with rows until this change is deployed at it // and new rows are stored in the table "Metric" // - at a fresh sandbox there is no the table "MappedMetric", only "Metric" is present - override def dbTableName = "metric" // define the DB table name + override def dbTableName = "Metric" // define the DB table name override def dbIndexes = Index(date) :: Index(consumerId) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala b/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala index ba1f587596..e84a6d0421 100644 --- a/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala +++ b/obp-api/src/main/scala/code/regulatedentities/MappedRegulatedEntitiyProvider.scala @@ -125,7 +125,7 @@ class MappedRegulatedEntity extends RegulatedEntityTrait with LongKeyedMapper[Ma } object MappedRegulatedEntity extends MappedRegulatedEntity with LongKeyedMetaMapper[MappedRegulatedEntity] { - override def dbTableName = "regulatedentity" // define the DB table name + override def dbTableName = "RegulatedEntity" // define the DB table name override def dbIndexes = Index(CertificateAuthorityCaOwnerId) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala index c019517c6d..9cea72f1d7 100644 --- a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala +++ b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala @@ -80,7 +80,7 @@ class MappedSigningBasket extends SigningBasketTrait with LongKeyedMapper[Mapped } object MappedSigningBasket extends MappedSigningBasket with LongKeyedMetaMapper[MappedSigningBasket] { - override def dbTableName = "signingbasket" // define the DB table name + override def dbTableName = "SigningBasket" // define the DB table name override def dbIndexes = Index(BasketId) :: super.dbIndexes } @@ -96,7 +96,7 @@ class MappedSigningBasketPayment extends SigningBasketPaymentTrait with LongKeye } object MappedSigningBasketPayment extends MappedSigningBasketPayment with LongKeyedMetaMapper[MappedSigningBasketPayment] { - override def dbTableName = "signingbasketpayment" // define the DB table name + override def dbTableName = "SigningBasketPayment" // define the DB table name override def dbIndexes = Index(BasketId, PaymentId) :: super.dbIndexes } @@ -111,7 +111,7 @@ class MappedSigningBasketConsent extends SigningBasketConsentTrait with LongKeye } object MappedSigningBasketConsent extends MappedSigningBasketConsent with LongKeyedMetaMapper[MappedSigningBasketConsent] { - override def dbTableName = "signingbasketconsent" // define the DB table name + override def dbTableName = "SigningBasketConsent" // define the DB table name override def dbIndexes = Index(BasketId, ConsentId) :: super.dbIndexes } diff --git a/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala b/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala index 08ce31b6ba..38bbf97dbe 100644 --- a/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala +++ b/obp-api/src/main/scala/code/transactionChallenge/MappedExpectedChallengeAnswer.scala @@ -45,6 +45,6 @@ class MappedExpectedChallengeAnswer extends ChallengeTrait with LongKeyedMapper[ } object MappedExpectedChallengeAnswer extends MappedExpectedChallengeAnswer with LongKeyedMetaMapper[MappedExpectedChallengeAnswer] { - override def dbTableName = "expectedchallengeanswer" // define the DB table name + override def dbTableName = "ExpectedChallengeAnswer" // define the DB table name override def dbIndexes = UniqueIndex(ChallengeId):: super.dbIndexes } \ No newline at end of file From 87911298949882b35b62b7a9cd259c48cfc7ed87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 14 Mar 2024 08:41:16 +0100 Subject: [PATCH 21/21] refactor/Rename table SigningBasket to signingbasket --- .../scala/code/signingbaskets/MappedSigningBasketProvider.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala index 9cea72f1d7..eb2ab958c5 100644 --- a/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala +++ b/obp-api/src/main/scala/code/signingbaskets/MappedSigningBasketProvider.scala @@ -80,7 +80,7 @@ class MappedSigningBasket extends SigningBasketTrait with LongKeyedMapper[Mapped } object MappedSigningBasket extends MappedSigningBasket with LongKeyedMetaMapper[MappedSigningBasket] { - override def dbTableName = "SigningBasket" // define the DB table name + override def dbTableName = "signingbasket" // define the DB table name override def dbIndexes = Index(BasketId) :: super.dbIndexes }