mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:37:00 +00:00
Tweaked endpoint getCustomersForCurrentUserAtBank v3.1.0, added role canUpdateAccountAttribute
This commit is contained in:
parent
772403c51a
commit
5f32a1fb99
@ -92,6 +92,9 @@ object ApiRole {
|
||||
case class CanUpdateAccount(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canUpdateAccount = CanUpdateAccount()
|
||||
|
||||
case class CanUpdateAccountAttribute(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canUpdateAccountAttribute = CanUpdateAccountAttribute()
|
||||
|
||||
case class CanGetAnyUser (requiresBankId: Boolean = false) extends ApiRole
|
||||
lazy val canGetAnyUser = CanGetAnyUser()
|
||||
|
||||
@ -407,6 +410,7 @@ object ApiRole {
|
||||
canDeleteCustomerAddress ::
|
||||
canCreateAccount ::
|
||||
canUpdateAccount ::
|
||||
canUpdateAccountAttribute ::
|
||||
canGetAnyUser ::
|
||||
canCreateAnyTransactionRequest ::
|
||||
canAddSocialMediaHandle ::
|
||||
|
||||
@ -2839,14 +2839,16 @@ trait APIMethods310 {
|
||||
UnknownError
|
||||
),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagNewStyle))
|
||||
List(apiTagAccount, apiTagNewStyle),
|
||||
Some(List(canUpdateAccountAttribute))
|
||||
)
|
||||
|
||||
lazy val updateAccountAttribute : OBPEndpoint = {
|
||||
case "banks" :: bankId :: "accounts" :: accountId :: "products" :: productCode :: "attributes" :: accountAtrributeId :: Nil JsonPut json -> _=> {
|
||||
case "banks" :: bankId :: "accounts" :: accountId :: "products" :: productCode :: "attributes" :: accountAttributeId :: Nil JsonPut json -> _=> {
|
||||
cc =>
|
||||
for {
|
||||
(_, callContext) <- authorizedAccess(cc)
|
||||
|
||||
(Full(u), callContext) <- authorizedAccess(cc)
|
||||
_ <- NewStyle.function.hasEntitlement(bankId, u.userId, canUpdateAccountAttribute, callContext)
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $AccountAttributeJson "
|
||||
postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
json.extract[AccountAttributeJson]
|
||||
@ -2861,14 +2863,14 @@ trait APIMethods310 {
|
||||
(_, callContext) <- NewStyle.function.getBank(BankId(bankId), callContext)
|
||||
(_, callContext) <- NewStyle.function.getBankAccount(BankId(bankId), AccountId(accountId), callContext)
|
||||
(_, callContext) <- NewStyle.function.getProduct(BankId(bankId), ProductCode(productCode), callContext)
|
||||
(_, callContext) <- NewStyle.function.getAccountAttributeById(accountAtrributeId, callContext)
|
||||
(_, callContext) <- NewStyle.function.getAccountAttributeById(accountAttributeId, callContext)
|
||||
|
||||
|
||||
(accountAttribute, callContext) <- NewStyle.function.createOrUpdateAccountAttribute(
|
||||
BankId(bankId),
|
||||
AccountId(accountId),
|
||||
ProductCode(productCode),
|
||||
Some(accountAtrributeId),
|
||||
Some(accountAttributeId),
|
||||
postedData.name,
|
||||
accountAttributeType,
|
||||
postedData.value,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user