Skip to content

Commit

Permalink
Merge pull request #2245 from constantine2nd/develop
Browse files Browse the repository at this point in the history
Tweak BG endpoint Payment initiation request
  • Loading branch information
simonredfern authored Jul 19, 2023
2 parents 131be16 + 4f00165 commit 5fe4faf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import code.api.util.NewStyle.HttpCode
import code.api.util.{ApiRole, ApiTag, NewStyle}
import code.bankconnectors.Connector
import code.fx.fx
import code.model._
import code.api.Constant._
import code.transactionrequests.TransactionRequests.TransactionRequestTypes.SEPA_CREDIT_TRANSFERS
import code.transactionrequests.TransactionRequests.{PaymentServiceTypes, TransactionRequestTypes}
import code.util.Helper
Expand Down Expand Up @@ -566,11 +566,11 @@ $additionalInstructions
_ <- Helper.booleanToFuture(invalidIban, cc=callContext) { ibanChecker.isValid == true }
(toAccount, callContext) <- NewStyle.function.getToBankAccountByIban(toAccountIban, callContext)

//no accountAccess and no canAddTransactionRequestToOwnAccount ==> this will not throw exception,only return false!
anyViewContainsCanAddTransactionRequestToAnyAccountPermission = Views.views.vend.permission(BankIdAccountId(fromAccount.bankId, fromAccount.accountId), u)
.map(_.views.map(_.canAddTransactionRequestToAnyAccount).find(_.==(true)).getOrElse(false)).getOrElse(false)
viewId = ViewId(SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID)
bankIdAccountId = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(u), callContext)

_ <- if (anyViewContainsCanAddTransactionRequestToAnyAccountPermission)
_ <- if (view.canAddTransactionRequestToAnyAccount)
Future.successful(Full(Unit))
else
NewStyle.function.hasEntitlement(fromAccount.bankId.value, u.userId, ApiRole.canCreateAnyTransactionRequest, callContext, InsufficientAuthorisationToCreateTransactionRequest)
Expand Down
Binary file modified obp-api/src/test/resources/frozen_type_meta_data
Binary file not shown.

0 comments on commit 5fe4faf

Please sign in to comment.