mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:56:46 +00:00
refactor the view methods -- step7 remove the firehose methods in MappedView. Only support the explict endpoints for firehose
This commit is contained in:
parent
1f0a06cad7
commit
e2f56c019e
@ -208,8 +208,6 @@ trait APIMethods121 {
|
||||
s"""Returns the list of accounts at that the user has access to at all banks.
|
||||
|For each account the API returns the account ID and the available views.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
@ -244,8 +242,6 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is required.
|
||||
|
|
||||
|This endpoint works with firehose
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
@ -278,7 +274,6 @@ trait APIMethods121 {
|
||||
|For each account the API returns the ID and the available views.
|
||||
|Authentication via OAuth is required.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
@ -305,8 +300,6 @@ trait APIMethods121 {
|
||||
s"""Returns the list of accounts at BANK_ID that the user has access to.
|
||||
|For each account the API returns the account ID and the available views.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
""",
|
||||
@ -343,8 +336,6 @@ trait APIMethods121 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
@ -377,8 +368,6 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is not required.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
@ -421,8 +410,6 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
|
||||
|
|
||||
|This endpoint works with firehose
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
moderatedAccountJSON,
|
||||
|
||||
@ -424,8 +424,6 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
| This approach aims to provide only one endpoint for initiating transactions, and one that handles challenges, whilst still allowing flexibility with the payload and internal logic.
|
||||
|
|
||||
| This endpoint works with firehose
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
transactionRequestTypesJsonV140,
|
||||
@ -473,7 +471,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
"GET",
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-requests",
|
||||
"Get all Transaction Requests.",
|
||||
"This endpoint works with firehose. ",
|
||||
"",
|
||||
emptyObjectJson,
|
||||
transactionRequest,
|
||||
List(
|
||||
@ -597,7 +595,6 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
"""
|
||||
|In Sandbox mode, any string that can be converted to a possitive integer will be accepted as an answer.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
""".stripMargin,
|
||||
challengeAnswerJSON,
|
||||
transactionRequest,
|
||||
|
||||
@ -140,8 +140,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
basicAccountsJSON,
|
||||
@ -176,8 +174,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
coreAccountsJSON,
|
||||
@ -221,8 +217,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
basicAccountsJSON,
|
||||
@ -261,8 +255,6 @@ trait APIMethods200 {
|
||||
|Returns the list of accounts at BANK_ID that the user has access to.
|
||||
|For each account the API returns the account ID and the available views.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
@ -316,8 +308,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
coreAccountsJSON,
|
||||
@ -384,8 +374,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
basicAccountsJSON,
|
||||
@ -424,8 +412,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|Authentication via OAuth is not required.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
basicAccountsJSON,
|
||||
@ -860,8 +846,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|OAuth authentication is required
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
moderatedCoreAccountJSON,
|
||||
@ -965,8 +949,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|OAuth authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
moderatedAccountJSON,
|
||||
@ -1252,8 +1234,6 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
transactionRequestBodyJsonV200,
|
||||
emptyObjectJson,
|
||||
@ -1329,8 +1309,6 @@ trait APIMethods200 {
|
||||
"""
|
||||
|In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
""".stripMargin,
|
||||
ChallengeAnswerJSON("89123812", "123345"),
|
||||
transactionRequestWithChargeJson,
|
||||
@ -1432,8 +1410,6 @@ trait APIMethods200 {
|
||||
|This endpoint provides the charge that would be applied if the Transaction Request proceeds - and a record of that charge there after.
|
||||
|The customer can proceed with the Transaction by answering the security challenge.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
transactionRequestWithChargesJson,
|
||||
|
||||
@ -534,8 +534,6 @@ trait APIMethods210 {
|
||||
|
|
||||
|4) `answer` : is `challenge.answer` can be any Interge in sandbox mode.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
""".stripMargin,
|
||||
challengeAnswerJSON,
|
||||
transactionRequestWithChargeJson,
|
||||
@ -656,8 +654,6 @@ trait APIMethods210 {
|
||||
|This endpoint provides the charge that would be applied if the Transaction Request proceeds - and a record of that charge there after.
|
||||
|The customer can proceed with the Transaction by answering the security challenge.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
transactionRequestWithChargeJSONs210,
|
||||
|
||||
@ -277,9 +277,6 @@ trait APIMethods220 {
|
||||
s"""Get the counterparties for the account / view.
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
counterpartiesJsonV220,
|
||||
@ -326,9 +323,6 @@ trait APIMethods220 {
|
||||
s"""Information returned about the Counterparty specified by COUNTERPARTY_ID:
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
counterpartyWithMetadataJson,
|
||||
@ -1040,8 +1034,6 @@ trait APIMethods220 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
postCounterpartyJSON,
|
||||
counterpartyWithMetadataJson,
|
||||
|
||||
@ -263,9 +263,6 @@ trait APIMethods300 {
|
||||
|This call provides balance and other account information via delegated authenticaiton using OAuth.
|
||||
|
|
||||
|Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
moderatedCoreAccountJsonV300,
|
||||
@ -322,8 +319,6 @@ trait APIMethods300 {
|
||||
|
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
moderatedCoreAccountJsonV300,
|
||||
@ -376,8 +371,6 @@ trait APIMethods300 {
|
||||
|
|
||||
|OAuth authentication is required
|
||||
|
|
||||
|This endpoint works with firehose.
|
||||
|
|
||||
|""".stripMargin,
|
||||
emptyObjectJson,
|
||||
moderatedCoreAccountJsonV300,
|
||||
@ -482,7 +475,7 @@ trait APIMethods300 {
|
||||
}
|
||||
bankBox <- Future { Bank(bankId) } map {x => fullBoxOrException(x ?~! BankNotFound)}
|
||||
bank<- unboxFullAndWrapIntoFuture(bankBox)
|
||||
availableBankIdAccountIdList <- Future { MapperViews.getAllFirehoseAccounts(bank, u) }
|
||||
availableBankIdAccountIdList <- Future {Views.views.vend.getAllFirehoseAccounts(bank, u) }
|
||||
moderatedAccounts = for {
|
||||
//Here is a new for-loop to get the moderated accouts for the firehose user, according to the viewId.
|
||||
//1 each accountId-> find a proper bankAccount object.
|
||||
|
||||
@ -310,51 +310,6 @@ object MapperViews extends Views with MdcLoggable {
|
||||
Nil
|
||||
}
|
||||
|
||||
/**
|
||||
* An account is considered firehose if it contains a firehose view
|
||||
* @return the list of all bankAccountUUIDs which contains a firehose view
|
||||
*/
|
||||
def getAllFirehoseAccounts(user : User) : List[BankIdAccountId] = {
|
||||
if (canUseFirehose(user)) {
|
||||
ViewImpl.findAll(
|
||||
By(ViewImpl.isFirehose_, true)
|
||||
).map(v => {BankIdAccountId(v.bankId, v.accountId)})
|
||||
} else {
|
||||
Nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An account is considered firehose if it contains a firehose view
|
||||
* @return the list of all bankAccountUUIDs which contains a firehose view
|
||||
*/
|
||||
def getAllFirehoseViews(bankAccountId: BankIdAccountId, user : User): List[ViewImpl] = {
|
||||
if (canUseFirehose(user)) {
|
||||
ViewImpl.findAll(
|
||||
By(ViewImpl.isFirehose_, true),
|
||||
By(ViewImpl.bankPermalink, bankAccountId.bankId.value),
|
||||
By(ViewImpl.accountPermalink, bankAccountId.accountId.value)
|
||||
)
|
||||
} else {
|
||||
Nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An account is considered firehose if it contains a firehose view
|
||||
* @return the list of all bankAccountUUIDs which contains a firehose view
|
||||
*/
|
||||
def getAllFirehoseAccounts(bank: Bank, user : User) : List[BankIdAccountId] = {
|
||||
if (canUseFirehose(user)) {
|
||||
ViewImpl.findAll(
|
||||
By(ViewImpl.isFirehose_, true),
|
||||
By(ViewImpl.bankPermalink, bank.bankId.value)
|
||||
).map(v => {BankIdAccountId(v.bankId, v.accountId)})
|
||||
} else {
|
||||
Nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bank accounts where the user has at least access to a Private view (is_public==false)
|
||||
*/
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package code.views
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.canUseFirehose
|
||||
import code.model.dataAccess.{ViewImpl, ViewPrivileges}
|
||||
import code.model.{CreateViewJson, Permission, _}
|
||||
import code.remotedata.RemotedataViews
|
||||
@ -74,6 +75,17 @@ trait Views {
|
||||
def getPrivateBankAccountsFuture(user : User, bankId : BankId) : Future[List[BankIdAccountId]]
|
||||
def getPrivateBankAccounts(user : User, bankId : BankId) : List[BankIdAccountId]
|
||||
|
||||
final def getAllFirehoseAccounts(bank: Bank, user : User) : List[BankIdAccountId] = {
|
||||
if (canUseFirehose(user)) {
|
||||
ViewImpl.findAll(
|
||||
By(ViewImpl.isFirehose_, true),
|
||||
By(ViewImpl.bankPermalink, bank.bankId.value)
|
||||
).map(v => {BankIdAccountId(v.bankId, v.accountId)})
|
||||
} else {
|
||||
Nil
|
||||
}
|
||||
}
|
||||
|
||||
def getOrCreateAccountView(bankAccountUID: BankIdAccountId, viewId: String): Box[View]
|
||||
def getOrCreateFirehoseView(bankId: BankId, accountId: AccountId, description: String) : Box[View]
|
||||
def getOrCreateOwnerView(bankId: BankId, accountId: AccountId, description: String) : Box[View]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user