From 56630c513fd0300cbecb65c3d56306c9e4e0a3de Mon Sep 17 00:00:00 2001 From: hongwei Date: Fri, 6 Feb 2026 09:50:08 +0100 Subject: [PATCH] refactor/(StoredProcedureConnector): Add external user and FX rate operations - Add checkExternalUserCredentials method with message documentation for validating external user credentials - Add checkExternalUserExists method with message documentation for checking external user existence - Add getCurrentFxRate method with message documentation for retrieving current foreign exchange rates - Include comprehensive example outbound and inbound messages for all new operations - Add adapter implementation documentation for Core adapter support - Enable external user authentication and FX rate lookup capabilities in stored procedure connector --- .../StoredProcedureConnector_vDec2019.scala | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) 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 d3a89839a6..7531169217 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 @@ -883,7 +883,81 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_bank_accounts_for_user", req, callContext) response.map(convertToTuple[List[InboundAccountCommons]](callContext)) } + + + messageDocs += checkExternalUserCredentialsDoc + def checkExternalUserCredentialsDoc = MessageDoc( + process = "obp.checkExternalUserCredentials", + messageFormat = messageFormat, + description = "Check External User Credentials", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundCheckExternalUserCredentials(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + username=usernameExample.value, + password=passwordExample.value) + ), + exampleInboundMessage = ( + InBoundCheckExternalUserCredentials(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data= InboundExternalUser(aud=audExample.value, + exp=expExample.value, + iat=iatExample.value, + iss=issExample.value, + sub=subExample.value, + azp=Some("string"), + email=Some(emailExample.value), + emailVerified=Some(emailVerifiedExample.value), + name=Some(userNameExample.value), + userAuthContext=Some(List( BasicUserAuthContext(key=keyExample.value, + value=valueExample.value))))) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def checkExternalUserCredentials(username: String, password: String, callContext: Option[CallContext]): Box[InboundExternalUser] = { + import com.openbankproject.commons.dto.{InBoundCheckExternalUserCredentials => InBound, OutBoundCheckExternalUserCredentials => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, username, password) + val response: Future[Box[InBound]] = sendRequest[InBound]("obp_check_external_user_credentials", req, callContext) + response.map(convertToTuple[InboundExternalUser](callContext)) + } + messageDocs += checkExternalUserExistsDoc + def checkExternalUserExistsDoc = MessageDoc( + process = "obp.checkExternalUserExists", + messageFormat = messageFormat, + description = "Check External User Exists", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundCheckExternalUserExists(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, + username=usernameExample.value) + ), + exampleInboundMessage = ( + InBoundCheckExternalUserExists(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, + status=MessageDocsSwaggerDefinitions.inboundStatus, + data= InboundExternalUser(aud=audExample.value, + exp=expExample.value, + iat=iatExample.value, + iss=issExample.value, + sub=subExample.value, + azp=Some("string"), + email=Some(emailExample.value), + emailVerified=Some(emailVerifiedExample.value), + name=Some(userNameExample.value), + userAuthContext=Some(List( BasicUserAuthContext(key=keyExample.value, + value=valueExample.value))))) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def checkExternalUserExists(username: String, callContext: Option[CallContext]): Box[InboundExternalUser] = { + import com.openbankproject.commons.dto.{InBoundCheckExternalUserExists => InBound, OutBoundCheckExternalUserExists => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, username) + val response: Future[Box[InBound]] = sendRequest[InBound]("obp_check_external_user_exists", req, callContext) + response.map(convertToTuple[InboundExternalUser](callContext)) + } + messageDocs += getBankAccountByIbanDoc def getBankAccountByIbanDoc = MessageDoc( process = "obp.getBankAccountByIban", @@ -3725,6 +3799,37 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable { response.map(convertToTuple[List[AtmTCommons]](callContext)) } + messageDocs += getCurrentFxRateDoc + def getCurrentFxRateDoc = MessageDoc( + process = "obp.getCurrentFxRate", + messageFormat = messageFormat, + description = "Get Current Fx Rate", + outboundTopic = None, + inboundTopic = None, + exampleOutboundMessage = ( + OutBoundGetCurrentFxRate(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext,bankId=BankId(bankIdExample.value), + fromCurrencyCode=fromCurrencyCodeExample.value, + toCurrencyCode=toCurrencyCodeExample.value) + ), + exampleInboundMessage = ( + InBoundGetCurrentFxRate(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,status=MessageDocsSwaggerDefinitions.inboundStatus, + data= FXRateCommons(bankId=BankId(bankIdExample.value), + fromCurrencyCode=fromCurrencyCodeExample.value, + toCurrencyCode=toCurrencyCodeExample.value, + conversionValue=conversionValueExample.value.toDouble, + inverseConversionValue=inverseConversionValueExample.value.toDouble, + effectiveDate=toDate(effectiveDateExample))) + ), + adapterImplementation = Some(AdapterImplementation("- Core", 1)) + ) + + override def getCurrentFxRate(bankId: BankId, fromCurrencyCode: String, toCurrencyCode: String, callContext: Option[CallContext]): Box[FXRate] = { + import com.openbankproject.commons.dto.{InBoundGetCurrentFxRate => InBound, OutBoundGetCurrentFxRate => OutBound} + val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull,bankId, fromCurrencyCode, toCurrencyCode) + val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_current_fx_rate", req, callContext) + response.map(convertToTuple[FXRateCommons](callContext)) + } + messageDocs += createTransactionAfterChallengev300Doc def createTransactionAfterChallengev300Doc = MessageDoc( process = "obp.createTransactionAfterChallengev300",