mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 18:46:46 +00:00
Merge pull request #919 from hongwei1/develop
#724 added getFirehoseTransactions
This commit is contained in:
commit
cd694b3416
@ -445,6 +445,56 @@ trait APIMethods300 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
getFirehoseTransactionsForBankAccount,
|
||||
implementedInApiVersion,
|
||||
"getFirehoseTransactionsForBankAccount",
|
||||
"GET",
|
||||
"/banks/BANK_ID/firehose/accounts/ACCOUNT_ID/views/VIEW_ID/transactions",
|
||||
"Get Firehose Transactions for Account (Firehose)",
|
||||
s"""
|
||||
|Get firehose transactions for Account.
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
transactionsJsonV300,
|
||||
List(UserNotLoggedIn, FirehoseViewsNotAllowedOnThisInstance, UserHasMissingRoles, UnknownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagAccount, apiTagFirehoseData))
|
||||
|
||||
lazy val getFirehoseTransactionsForBankAccount : OBPEndpoint = {
|
||||
//get private accounts for all banks
|
||||
case "banks" :: BankId(bankId):: "firehose" :: "accounts" :: AccountId(accountId) :: "views" :: ViewId(viewId) :: "transactions" :: Nil JsonGet json => {
|
||||
cc =>
|
||||
val res =
|
||||
for {
|
||||
(user, callContext) <- extractCallContext(UserNotLoggedIn, cc)
|
||||
u <- unboxFullAndWrapIntoFuture{ user }
|
||||
_ <- Helper.booleanToFuture(failMsg = FirehoseViewsNotAllowedOnThisInstance +" or " + UserHasMissingRoles + CanUseFirehoseAtAnyBank ) {
|
||||
MapperViews.canUseFirehose(u)
|
||||
}
|
||||
bankAccount <- Future { BankAccount(bankId, accountId, callContext) } map {
|
||||
x => fullBoxOrException(x ?~! BankAccountNotFound)
|
||||
} map { unboxFull(_) }
|
||||
view <- Views.views.vend.viewFuture(viewId, BankIdAccountId(bankAccount.bankId, bankAccount.accountId)) map {
|
||||
x => fullBoxOrException(x ?~! ViewNotFound)
|
||||
} map { unboxFull(_) }
|
||||
} yield {
|
||||
for {
|
||||
//Note: error handling and messages for getTransactionParams are in the sub method
|
||||
params <- getTransactionParams(json)
|
||||
transactions <- bankAccount.getModeratedTransactions(user, view, params: _*)(callContext)
|
||||
} yield {
|
||||
(createTransactionsJson(transactions), callContext)
|
||||
}
|
||||
}
|
||||
res map { fullBoxOrException(_) } map { unboxFull(_) }
|
||||
}
|
||||
}
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
getCoreTransactionsForBankAccount,
|
||||
implementedInApiVersion,
|
||||
|
||||
@ -264,6 +264,7 @@ object OBPAPI3_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
|
||||
Implementations3_0_0.getEntitlementRequestsForCurrentUser ::
|
||||
Implementations3_0_0.getFirehoseAccountsAtOneBank ::
|
||||
Implementations3_0_0.getEntitlementsForCurrentUser ::
|
||||
Implementations3_0_0.getFirehoseTransactionsForBankAccount ::
|
||||
Nil
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user