From 43bb59e9927b4949b65c506b623c5b8e41677d5d Mon Sep 17 00:00:00 2001 From: hongwei Date: Wed, 7 Aug 2024 13:17:18 +0200 Subject: [PATCH] feature/added new method getChallengesByBasketId to StoredProcedureConnector_vDec2019 --- .../bankconnectors/ConnectorBuilderUtil.scala | 1 + .../StoredProcedureConnector_vDec2019.scala | 46 +++++++++++++++++-- .../commons/dto/JsonsTransfer.scala | 3 ++ 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala index 4bf6e97bd..937fa0e9c 100644 --- a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala +++ b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala @@ -359,6 +359,7 @@ object ConnectorBuilderUtil { "createDirectDebit", "deleteCustomerAttribute", "getPhysicalCardsForUser", + "getChallengesByBasketId", // The follow methods's parameter or return type are special "getCurrentFxRate", 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 b9d7ba4f4..e0954ea6e 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-07-30T13:47:52Z +// ---------- created on 2024-08-07T12:43:02Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -706,6 +706,44 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[List[ChallengeCommons]](callContext)) } + messageDocs += getChallengesByBasketIdDoc + def getChallengesByBasketIdDoc = MessageDoc( + process = "obp.getChallengesByBasketId", + messageFormat = messageFormat, + description = "Get Challenges By Basket Id", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundGetChallengesByBasketId(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + basketId=basketIdExample.value) + ), + exampleInboundMessage = ( + InBoundGetChallengesByBasketId(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(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 getChallengesByBasketId(basketId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[ChallengeTrait]]] = { + import com.openbankproject.commons.dto.{InBoundGetChallengesByBasketId => InBound, OutBoundGetChallengesByBasketId => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, basketId) + val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_challenges_by_basket_id", req, callContext) + response.map(convertToTuple[List[ChallengeCommons]](callContext)) + } + messageDocs += getChallengeDoc def getChallengeDoc = MessageDoc( process = "obp.getChallenge", @@ -1304,9 +1342,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { override def checkBankAccountExists(bankId: BankId, accountId: AccountId, callContext: Option[CallContext]): OBPReturnType[Box[BankAccount]] = { import com.openbankproject.commons.dto.{InBoundCheckBankAccountExists => InBound, OutBoundCheckBankAccountExists => OutBound} - logger.debug(s"StoredProcedureConnector_vDec2019.checkBankAccountExists.callContext : $callContext") val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankId, accountId) - logger.debug(s"StoredProcedureConnector_vDec2019.checkBankAccountExists.req : $req") val response: Future[Box[InBound]] = sendRequest[InBound]("obp_check_bank_account_exists", req, callContext) response.map(convertToTuple[BankAccountCommons](callContext)) } @@ -6739,8 +6775,8 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-07-30T13:47:52Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-08-07T12:43:02Z +//---------------- dynamic end ---------------------please don't modify this line private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") 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 d80578a5d..916be6c83 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 @@ -1431,6 +1431,9 @@ case class InBoundGetChallengesByTransactionRequestId(inboundAdapterCallContext: case class OutBoundGetChallengesByConsentId(outboundAdapterCallContext: OutboundAdapterCallContext, consentId: String) extends TopicTrait case class InBoundGetChallengesByConsentId(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[ChallengeCommons]) extends InBoundTrait[List[ChallengeCommons]] +case class OutBoundGetChallengesByBasketId(outboundAdapterCallContext: OutboundAdapterCallContext, basketId: String) extends TopicTrait +case class InBoundGetChallengesByBasketId(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[ChallengeCommons]) extends InBoundTrait[List[ChallengeCommons]] + case class OutBoundGetCounterpartyByIbanAndBankAccountId(outboundAdapterCallContext: OutboundAdapterCallContext, iban: String, bankId: BankId, accountId: AccountId) extends TopicTrait case class InBoundGetCounterpartyByIbanAndBankAccountId(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: CounterpartyTraitCommons) extends InBoundTrait[CounterpartyTraitCommons]