tweaking the error message for missing defaultBankId in props

This commit is contained in:
hongwei1 2018-07-12 09:15:48 +02:00
parent 636d9f3e0a
commit 97a357cc1d
5 changed files with 8 additions and 6 deletions

View File

@ -30,7 +30,7 @@ Date Commit Action
02/05/2017 3084827 added 1 new caching props to sample.props.template connector.cache.ttl.seconds.APIMethods121.getTransactions. If it's omitted default value is 0 i.e. no caching. This cacahe is from API level.
10/05/2017 7f95a5c added allow_public_views=false, we will not create the public views and will not access them (if public views are exsiting)when it is false.
17/07/2017 1530231 added account_id.length=64, this will set all relevant accountid length to 64, when create new sandbox.
17/02/2016 e3bead1 Added Props defaultBank.bank_id. Default Bank. Incase the server wants to support a default bank so developers don't have to specify BANK_ID
```

View File

@ -93,7 +93,7 @@ trait APIMethods_UKOpenBanking_200 {
(user, callContext) <- extractCallContext(UserNotLoggedIn, cc)
u <- unboxFullAndWrapIntoFuture{ user }
bankAccount <- Future { BankAccount(BankId(defaultBankId), accountId, callContext) } map {
x => fullBoxOrException(x ~> APIFailureNewStyle(BankAccountNotFound, 400, Some(cc.toLight)))
x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, Some(cc.toLight)))
} map { unboxFull(_) }
view <- Views.views.vend.viewFuture(ViewId("owner"), BankIdAccountId(bankAccount.bankId, bankAccount.accountId)) map {
x => fullBoxOrException(x ~> APIFailureNewStyle(ViewNotFound, 400, Some(cc.toLight)))
@ -187,7 +187,7 @@ trait APIMethods_UKOpenBanking_200 {
u <- unboxFullAndWrapIntoFuture{ user }
account <- Future { BankAccount(BankId(defaultBankId), accountId, callContext) } map {
x => fullBoxOrException(x ~> APIFailureNewStyle(BankAccountNotFound, 400, Some(cc.toLight)))
x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, Some(cc.toLight)))
} map { unboxFull(_) }
view <- Views.views.vend.viewFuture(ViewId("owner"), BankIdAccountId(account.bankId, account.accountId)) map {

View File

@ -98,7 +98,7 @@ trait APIMethods_BERLIN_GROUP_1 {
u <- unboxFullAndWrapIntoFuture{ user }
account <- Future { BankAccount(BankId(defaultBankId), accountId, callContext) } map {
x => fullBoxOrException(x ~> APIFailureNewStyle(BankAccountNotFound, 400, Some(cc.toLight)))
x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, Some(cc.toLight)))
} map { unboxFull(_) }
view <- Views.views.vend.viewFuture(ViewId("owner"), BankIdAccountId(account.bankId, account.accountId)) map {
@ -148,7 +148,7 @@ trait APIMethods_BERLIN_GROUP_1 {
(user, callContext) <- extractCallContext(UserNotLoggedIn, cc)
u <- unboxFullAndWrapIntoFuture{ user }
bankAccount <- Future { BankAccount(BankId(defaultBankId), accountId, callContext) } map {
x => fullBoxOrException(x ~> APIFailureNewStyle(BankAccountNotFound, 400, Some(cc.toLight)))
x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, Some(cc.toLight)))
} map { unboxFull(_) }
view <- Views.views.vend.viewFuture(ViewId("owner"), BankIdAccountId(bankAccount.bankId, bankAccount.accountId)) map {
x => fullBoxOrException(x ~> APIFailureNewStyle(ViewNotFound, 400, Some(cc.toLight)))

View File

@ -189,6 +189,8 @@ object ErrorMessages {
val GetTopApisError = "OBP-30042: Could not get the top apis from database. "
val GetMetricsTopConsumersError = "OBP-30042: Could not get the top consumers from database. "
val GetAggregateMetricsError = "OBP-30043: Could not get the aggregate metrics from database. "
val DefaultBankIdNotSet = "OBP-30044: Default BankId is not set on this instance. Please set defaultBank.bank_id in props files. "
// Meetings

View File

@ -348,7 +348,7 @@ trait APIMethods200 {
cc =>
for {
u <- cc.user ?~! ErrorMessages.UserNotLoggedIn
bank <- Bank(BankId(defaultBankId))
bank <- Bank(BankId(defaultBankId)) ?~! ErrorMessages.DefaultBankIdNotSet
} yield {
val privateViewsUserCanAccessAtOneBank = Views.views.vend.privateViewsUserCanAccess(u).filter(_.bankId == bankId)
val privateAaccountsForOneBank = bank.privateAccounts(privateViewsUserCanAccessAtOneBank)