feature/added new connector method getBankAccountBalances to StoredProcedureConnector_vDec2019

This commit is contained in:
hongwei 2024-06-12 14:39:34 +02:00
parent 53d4302032
commit f7595a98cf
6 changed files with 51 additions and 8 deletions

View File

@ -148,7 +148,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
val DateWithMonthFormat = new SimpleDateFormat(DateWithMonth)
val DateWithDayFormat = new SimpleDateFormat(DateWithDay)
val DateWithSecondsFormat = new SimpleDateFormat(DateWithSeconds)
lazy val DateWithMsFormat = new SimpleDateFormat(DateWithMs)
val DateWithMsFormat = new SimpleDateFormat(DateWithMs)
val DateWithMsRollbackFormat = new SimpleDateFormat(DateWithMsRollback)
val DateWithYearExampleString: String = "1100"

View File

@ -336,8 +336,7 @@ object ErrorMessages {
val CreateCardError = "OBP-30032: Could not insert the Card"
val UpdateCardError = "OBP-30033: Could not update the Card"
val ViewIdNotSupported = s"OBP-30034: This ViewId is not supported. Only the following can be used: " +
code.api.Constant.ALL_SYSTEM_VIEWS_CREATED_FROM_CBS.mkString(", ")
val ViewIdNotSupported = s"OBP-30034: This ViewId is not supported. Only the following can be used: "
val UserCustomerLinkNotFound = "OBP-30035: User Customer Link not found"

View File

@ -234,6 +234,7 @@ object ConnectorBuilderUtil {
"getBankAccountsForUser",
"getUser",
"getBankAccountsBalances",
"getBankAccountBalances",
"getCoreBankAccounts",
"getBankAccountsHeld",
"getCounterpartyTrait",

View File

@ -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-29T13:58:37Z
// ---------- created on 2024-06-12T14:42:25Z
messageDocs += getAdapterInfoDoc
def getAdapterInfoDoc = MessageDoc(
@ -1051,6 +1051,43 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
response.map(convertToTuple[AccountsBalances](callContext))
}
messageDocs += getBankAccountBalancesDoc
def getBankAccountBalancesDoc = MessageDoc(
process = "obp.getBankAccountBalances",
messageFormat = messageFormat,
description = "Get Bank Account Balances",
outboundTopic = None,
inboundTopic = None,
exampleOutboundMessage = (
OutBoundGetBankAccountBalances(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext,
bankIdAccountId= BankIdAccountId(bankId=BankId(bankIdExample.value),
accountId=AccountId(accountIdExample.value)))
),
exampleInboundMessage = (
InBoundGetBankAccountBalances(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
status=MessageDocsSwaggerDefinitions.inboundStatus,
data= AccountBalances(id=idExample.value,
label=labelExample.value,
bankId=bankIdExample.value,
accountRoutings=List( AccountRouting(scheme=accountRoutingSchemeExample.value,
address=accountRoutingAddressExample.value)),
balances=List( BankAccountBalance(balance= AmountOfMoney(currency=balanceCurrencyExample.value,
amount=balanceAmountExample.value),
balanceType="string")),
overallBalance= AmountOfMoney(currency=currencyExample.value,
amount=amountExample.value),
overallBalanceDate=toDate(overallBalanceDateExample)))
),
adapterImplementation = Some(AdapterImplementation("- Core", 1))
)
override def getBankAccountBalances(bankIdAccountId: BankIdAccountId, callContext: Option[CallContext]): OBPReturnType[Box[AccountBalances]] = {
import com.openbankproject.commons.dto.{InBoundGetBankAccountBalances => InBound, OutBoundGetBankAccountBalances => OutBound}
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankIdAccountId)
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_get_bank_account_balances", req, callContext)
response.map(convertToTuple[AccountBalances](callContext))
}
messageDocs += getCoreBankAccountsDoc
def getCoreBankAccountsDoc = MessageDoc(
process = "obp.getCoreBankAccounts",
@ -6587,8 +6624,8 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
response.map(convertToTuple[Boolean](callContext))
}
// ---------- created on 2024-01-29T13:58:37Z
//---------------- dynamic end ---------------------please don't modify this line
// ---------- created on 2024-06-12T14:42:25Z
//---------------- dynamic end ---------------------please don't modify this line
private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]")

View File

@ -611,8 +611,9 @@ object MapperViews extends Views with MdcLoggable {
val theView = if (ALL_SYSTEM_VIEWS_CREATED_FROM_CBS.contains(viewId)) {
getOrCreateSystemView(viewId)
} else {
logger.error(ViewIdNotSupported + s"Your input viewId is :$viewId")
Failure(ViewIdNotSupported + s"Your input viewId is :$viewId")
val errorMessage = ViewIdNotSupported + code.api.Constant.ALL_SYSTEM_VIEWS_CREATED_FROM_CBS.mkString(", ") + s"Your input viewId is :$viewId"
logger.error(errorMessage)
Failure(errorMessage)
}
logger.debug(s"-->getOrCreateSystemViewFromCbs --- finish.${viewId } : ${theView} ")
theView

View File

@ -112,6 +112,11 @@ case class OutBoundGetBankAccountsBalances(outboundAdapterCallContext: OutboundA
case class InBoundGetBankAccountsBalances(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: AccountsBalances) extends InBoundTrait[AccountsBalances]
case class OutBoundGetBankAccountBalances(outboundAdapterCallContext: OutboundAdapterCallContext,
bankIdAccountId: BankIdAccountId) extends TopicTrait
case class InBoundGetBankAccountBalances(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: AccountBalances) extends InBoundTrait[AccountBalances]
case class OutBoundGetCoreBankAccountsHeld(outboundAdapterCallContext: OutboundAdapterCallContext,
bankIdAccountIds: List[BankIdAccountId]) extends TopicTrait
case class InBoundGetCoreBankAccountsHeld(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[AccountHeld]) extends InBoundTrait[List[AccountHeld]]