feature/added getAccountsHeldByUser to rabbitMqConnector

This commit is contained in:
hongwei 2025-01-14 19:55:22 +08:00
parent 011cb997e5
commit be8ec767e5
3 changed files with 64 additions and 6 deletions

View File

@ -432,6 +432,7 @@ object ConnectorBuilderUtil {
"saveTransactionRequestStatusImpl",
"getTransactionRequestTypeCharges",
"getAccountsHeld",
"getAccountsHeldByUser",
).distinct
/**

View File

@ -77,7 +77,7 @@ class ServerCallback(val ch: Channel) extends DeliverCallback with MdcLoggable{
))
}
//---------------- dynamic start -------------------please don't modify this line
// ---------- created on 2025-01-14T11:14:03Z
// ---------- created on 2025-01-14T11:53:01Z
} else if (obpMessageId.contains("get_adapter_info")) {
val outBound = json.parse(message).extract[OutBoundGetAdapterInfo]
@ -708,6 +708,27 @@ class ServerCallback(val ch: Channel) extends DeliverCallback with MdcLoggable{
)).recoverWith {
case e: Exception => Future(InBoundGetAccountsHeld(
inboundAdapterCallContext = InboundAdapterCallContext(
correlationId = outBound.outboundAdapterCallContext.correlationId
),
status = Status(e.getMessage, Nil),
data = null
))
}
} else if (obpMessageId.contains("get_accounts_held_by_user")) {
val outBound = json.parse(message).extract[OutBoundGetAccountsHeldByUser]
val obpMappedResponse = code.bankconnectors.LocalMappedConnector.getAccountsHeldByUser(outBound.user,None).map(_._1.head)
obpMappedResponse.map(response => InBoundGetAccountsHeldByUser(
inboundAdapterCallContext = InboundAdapterCallContext(
correlationId = outBound.outboundAdapterCallContext.correlationId
),
status = Status("", Nil),
data = response
)).recoverWith {
case e: Exception => Future(InBoundGetAccountsHeldByUser(
inboundAdapterCallContext = InboundAdapterCallContext(
correlationId = outBound.outboundAdapterCallContext.correlationId
),
@ -3109,8 +3130,8 @@ class ServerCallback(val ch: Channel) extends DeliverCallback with MdcLoggable{
data = null
))
}
// ---------- created on 2025-01-14T11:14:03Z
//---------------- dynamic end ---------------------please don't modify this line
// ---------- created on 2025-01-14T11:53:01Z
//---------------- dynamic end ---------------------please don't modify this line
} else {
Future {
1

View File

@ -70,7 +70,7 @@ trait RabbitMQConnector_vOct2024 extends Connector with MdcLoggable {
val connectorName = "rabbitmq_vOct2024"
//---------------- dynamic start -------------------please don't modify this line
// ---------- created on 2025-01-14T19:12:57Z
// ---------- created on 2025-01-14T19:52:36Z
messageDocs += getAdapterInfoDoc
def getAdapterInfoDoc = MessageDoc(
@ -1191,6 +1191,42 @@ trait RabbitMQConnector_vOct2024 extends Connector with MdcLoggable {
response.map(convertToTuple[List[BankIdAccountId]](callContext))
}
messageDocs += getAccountsHeldByUserDoc
def getAccountsHeldByUserDoc = MessageDoc(
process = "obp.getAccountsHeldByUser",
messageFormat = messageFormat,
description = "Get Accounts Held By User",
outboundTopic = None,
inboundTopic = None,
exampleOutboundMessage = (
OutBoundGetAccountsHeldByUser(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext,
user= UserCommons(userPrimaryKey=UserPrimaryKey(123),
userId=userIdExample.value,
idGivenByProvider="string",
provider=providerExample.value,
emailAddress=emailAddressExample.value,
name=userNameExample.value,
createdByConsentId=Some("string"),
createdByUserInvitationId=Some("string"),
isDeleted=Some(true),
lastMarketingAgreementSignedDate=Some(toDate(dateExample))))
),
exampleInboundMessage = (
InBoundGetAccountsHeldByUser(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
status=MessageDocsSwaggerDefinitions.inboundStatus,
data=List( BankIdAccountId(bankId=BankId(bankIdExample.value),
accountId=AccountId(accountIdExample.value))))
),
adapterImplementation = Some(AdapterImplementation("- Core", 1))
)
override def getAccountsHeldByUser(user: User, callContext: Option[CallContext]): OBPReturnType[Box[List[BankIdAccountId]]] = {
import com.openbankproject.commons.dto.{InBoundGetAccountsHeldByUser => InBound, OutBoundGetAccountsHeldByUser => OutBound}
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, user)
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_accounts_held_by_user", req, callContext)
response.map(convertToTuple[List[BankIdAccountId]](callContext))
}
messageDocs += checkBankAccountExistsDoc
def checkBankAccountExistsDoc = MessageDoc(
process = "obp.checkBankAccountExists",
@ -7034,8 +7070,8 @@ trait RabbitMQConnector_vOct2024 extends Connector with MdcLoggable {
response.map(convertToTuple[Boolean](callContext))
}
// ---------- created on 2025-01-14T19:12:57Z
//---------------- dynamic end ---------------------please don't modify this line
// ---------- created on 2025-01-14T19:52:36Z
//---------------- dynamic end ---------------------please don't modify this line
private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]")