From 57c1e74f62541ccd63bbe9555d11ba0a656390d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 23 Jul 2024 13:15:53 +0200 Subject: [PATCH 1/9] refactor/Remove duplicated code --- .../code/api/v5_1_0/RegulatedEntityTest.scala | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala b/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala index 5d7696209c..e48e3254ff 100644 --- a/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala +++ b/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala @@ -23,9 +23,8 @@ class RegulatedEntityTest extends V510ServerSetup { object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString) object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.createRegulatedEntity)) object ApiEndpoint2 extends Tag(nameOf(Implementations5_1_0.getRegulatedEntityById)) - object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.getRegulatedEntityById)) - object ApiEndpoint4 extends Tag(nameOf(Implementations5_1_0.deleteRegulatedEntity)) - + object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.deleteRegulatedEntity)) + feature(s"test $ApiEndpoint1 version $VersionOfApi - Unauthorized access") { scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") @@ -36,7 +35,7 @@ class RegulatedEntityTest extends V510ServerSetup { response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn) } } - + feature(s"test $ApiEndpoint1 version $VersionOfApi - Authorized access") { scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") @@ -47,7 +46,7 @@ class RegulatedEntityTest extends V510ServerSetup { response510.body.extract[ErrorMessage].message should be (UserHasMissingRoles + CanCreateRegulatedEntity) } } - + feature(s"test $ApiEndpoint1 version $VersionOfApi - Authorized access") { scenario("We will call the endpoint with user credentials and a proper entitlement", ApiEndpoint1, VersionOfApi) { Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateRegulatedEntity.toString) @@ -61,7 +60,7 @@ class RegulatedEntityTest extends V510ServerSetup { } // ApiEndpoint4 - deleteRegulatedEntity - feature(s"test $ApiEndpoint4 version $VersionOfApi - Unauthorized access") { + feature(s"test $ApiEndpoint3 version $VersionOfApi - Unauthorized access") { scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") val request510 = (v5_1_0_Request / "regulated-entities" / "some id").DELETE @@ -71,7 +70,7 @@ class RegulatedEntityTest extends V510ServerSetup { response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn) } } - feature(s"test $ApiEndpoint4 version $VersionOfApi - Authorized access") { + feature(s"test $ApiEndpoint3 version $VersionOfApi - Authorized access") { scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") val request510 = (v5_1_0_Request / "regulated-entities" / "some id").DELETE <@ (user1) @@ -83,7 +82,7 @@ class RegulatedEntityTest extends V510ServerSetup { } - feature(s"test $ApiEndpoint1, $ApiEndpoint2, $ApiEndpoint3, $ApiEndpoint4 version $VersionOfApi - CRUD") { + feature(s"test $ApiEndpoint1, $ApiEndpoint2, $ApiEndpoint3 version $VersionOfApi - CRUD") { scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) { // Create a row Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateRegulatedEntity.toString) From e5793c2e53df15f82432d5b7f1afaa43e8404200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 21 Aug 2024 15:13:03 +0200 Subject: [PATCH 2/9] refactor/Remove unused code at Berlin Group --- .../v1_3/JSONFactory_BERLIN_GROUP_1_3.scala | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala index 096de0a477..c26cbe6291 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala @@ -442,22 +442,6 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats { ) } - private def extractAccountData(scheme: String, address: String): (String, String, String, String, String) = { - val (iban: String, bban: String, pan: String, maskedPan: String, currency: String) = Connector.connector.vend.getBankAccountByRoutingLegacy( - None, - scheme, - address, - None - ) match { - case Full((account, _)) => - val (iban: String, bban: String) = getIbanAndBban(account) - val (pan, maskedPan) = (account.number, getMaskedPrimaryAccountNumber(accountNumber = account.number)) - (iban, bban, pan, maskedPan, account.currency) - case _ => ("", "", "", "", "") - } - (iban, bban, pan, maskedPan, currency) - } - def createTransactionsJson(bankAccount: BankAccount, transactions: List[ModeratedTransaction], transactionRequests: List[TransactionRequest]) : TransactionsJsonV13 = { val accountId = bankAccount.accountId.value val (iban: String, bban: String) = getIbanAndBban(bankAccount) From 7543c93fb25e3fad9b37e23e396fdfe041c1537d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 22 Aug 2024 10:57:25 +0200 Subject: [PATCH 3/9] feature/Fail in case of account routing ambiguity --- .../scala/code/api/v5_0_0/APIMethods500.scala | 2 +- .../bankconnectors/LocalMappedConnector.scala | 22 ++++++++++++++----- .../code/api/v5_0_0/ConsentRequestTest.scala | 2 ++ .../scala/code/api/v5_1_0/ConsentsTest.scala | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala index 022cfc9100..9138526c99 100644 --- a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala +++ b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala @@ -1113,7 +1113,7 @@ trait APIMethods500 { Future.sequence( consentRequestJson.account_access.map( access => - NewStyle.function.getBankAccountByRouting(None,access.account_routing.scheme, access.account_routing.address, cc.callContext) + NewStyle.function.getBankAccountByRouting(consentRequestJson.bank_id.map(BankId(_)),access.account_routing.scheme, access.account_routing.address, cc.callContext) .map(result =>PostConsentViewJsonV310( result._1.bankId.value, result._1.accountId.value, diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index b6ea170f10..a639c6e2e6 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -846,15 +846,25 @@ object LocalMappedConnector extends Connector with MdcLoggable { } override def getBankAccountByRoutingLegacy(bankId: Option[BankId], scheme: String, address: String, callContext: Option[CallContext]): Box[(BankAccount, Option[CallContext])] = { + def handleRouting(routing: List[BankAccountRouting]): Box[(MappedBankAccount, Option[CallContext])] = { + if (routing.size > 1) { // Handle more than 1 occurrence + // Routing MUST be unique + val errorMessage = s"Routing ($scheme, $address) is not unique at this instance" + Failure(errorMessage) + } else { // Handle 0 and 1 occurrence + Box(routing.headOption).flatMap(accountRouting => getBankAccountCommon(accountRouting.bankId, accountRouting.accountId, callContext)) + } + } + bankId match { case Some(bankId) => - BankAccountRouting - .find(By(BankAccountRouting.BankId, bankId.value), By(BankAccountRouting.AccountRoutingScheme, scheme), By(BankAccountRouting.AccountRoutingAddress, address)) - .flatMap(accountRouting => getBankAccountCommon(accountRouting.bankId, accountRouting.accountId, callContext)) + val routing = BankAccountRouting + .findAll(By(BankAccountRouting.BankId, bankId.value), By(BankAccountRouting.AccountRoutingScheme, scheme), By(BankAccountRouting.AccountRoutingAddress, address)) + handleRouting(routing) case None => - BankAccountRouting - .find(By(BankAccountRouting.AccountRoutingScheme, scheme), By(BankAccountRouting.AccountRoutingAddress, address)) - .flatMap(accountRouting => getBankAccountCommon(accountRouting.bankId, accountRouting.accountId, callContext)) + val routing = BankAccountRouting + .findAll(By(BankAccountRouting.AccountRoutingScheme, scheme), By(BankAccountRouting.AccountRoutingAddress, address)) + handleRouting(routing) } } diff --git a/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala b/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala index af98a24033..1d2a18b6ca 100644 --- a/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala +++ b/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala @@ -64,6 +64,7 @@ class ConsentRequestTest extends V500ServerSetupAsync with PropsReset{ object ApiEndpoint6 extends Tag(nameOf(Implementations5_0_0.getConsentRequest)) lazy val entitlements = List(PostConsentEntitlementJsonV310("", CanGetAnyUser.toString())) + lazy val bankId = testBankId1.value lazy val forbiddenEntitlementOneBank = List(PostConsentEntitlementJsonV310(testBankId1.value, CanCreateEntitlementAtOneBank.toString())) lazy val forbiddenEntitlementAnyBank = List(PostConsentEntitlementJsonV310("", CanCreateEntitlementAtAnyBank.toString())) lazy val accountAccess = List(AccountAccessV500( @@ -73,6 +74,7 @@ class ConsentRequestTest extends V500ServerSetupAsync with PropsReset{ lazy val postConsentRequestJson = SwaggerDefinitionsJSON.postConsentRequestJsonV500 .copy(entitlements=Some(entitlements)) .copy(consumer_id=None) + .copy(bank_id=Some(bankId)) .copy(account_access=accountAccess) val createConsentRequestWithoutLoginUrl = (v5_0_0_Request / "consumer" / "consent-requests") diff --git a/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala b/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala index e6b3aeaa05..b1955d6ddb 100644 --- a/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala +++ b/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala @@ -75,8 +75,9 @@ class ConsentsTest extends V510ServerSetup with PropsReset{ lazy val postConsentRequestJsonV310 = SwaggerDefinitionsJSON.postConsentRequestJsonV500 .copy(entitlements=Some(entitlements)) .copy(consumer_id=None) + .copy(bank_id=Some(bankId)) .copy(account_access=accountAccess) - + val createConsentRequestWithoutLoginUrl = (v5_1_0_Request / "consumer" / "consent-requests") val createConsentRequestUrl = (v5_1_0_Request / "consumer"/ "consent-requests").POST<@(user1) def getConsentRequestUrl(requestId:String) = (v5_1_0_Request / "consumer"/ "consent-requests"/requestId).GET<@(user1) From 4f42182a034151d37ff33e894793c206e30e29e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 23 Aug 2024 15:24:40 +0200 Subject: [PATCH 4/9] docfix/Fail in case of account routing ambiguity --- .../main/scala/code/bankconnectors/LocalMappedConnector.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index a639c6e2e6..930a1ef1d5 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -857,11 +857,11 @@ object LocalMappedConnector extends Connector with MdcLoggable { } bankId match { - case Some(bankId) => + case Some(bankId) => // Bank specific routing val routing = BankAccountRouting .findAll(By(BankAccountRouting.BankId, bankId.value), By(BankAccountRouting.AccountRoutingScheme, scheme), By(BankAccountRouting.AccountRoutingAddress, address)) handleRouting(routing) - case None => + case None => // World wide specific routing (IBAN etc.) val routing = BankAccountRouting .findAll(By(BankAccountRouting.AccountRoutingScheme, scheme), By(BankAccountRouting.AccountRoutingAddress, address)) handleRouting(routing) From 6220afd7d39e2e6978ce06ec9ccbdc29dc192203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Mon, 2 Sep 2024 14:47:14 +0200 Subject: [PATCH 5/9] feature/Tweak endpoint createConsentByConsentRequestId v5.0.0 --- .../src/main/scala/code/api/v5_0_0/APIMethods500.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala index 9138526c99..47d072da19 100644 --- a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala +++ b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala @@ -990,13 +990,13 @@ trait APIMethods500 { description = postConsentRequestJsonV510.to_account.counterparty_name, currency = postConsentRequestJsonV510.to_account.limit.currency, other_account_routing_scheme = postConsentRequestJsonV510.to_account.account_routing.scheme, - other_account_routing_address = postConsentRequestJsonV510.to_account.account_routing.scheme, + other_account_routing_address = postConsentRequestJsonV510.to_account.account_routing.address, other_account_secondary_routing_scheme = "", other_account_secondary_routing_address = "", - other_bank_routing_scheme = postConsentRequestJsonV510.to_account.account_routing.scheme, - other_bank_routing_address = postConsentRequestJsonV510.to_account.account_routing.scheme, - other_branch_routing_scheme = postConsentRequestJsonV510.to_account.account_routing.scheme, - other_branch_routing_address = postConsentRequestJsonV510.to_account.account_routing.scheme, + other_bank_routing_scheme = postConsentRequestJsonV510.to_account.bank_routing.scheme, + other_bank_routing_address = postConsentRequestJsonV510.to_account.bank_routing.address, + other_branch_routing_scheme = postConsentRequestJsonV510.to_account.branch_routing.scheme, + other_branch_routing_address = postConsentRequestJsonV510.to_account.branch_routing.address, is_beneficiary = true, bespoke = Nil ) From 029f10f0f164bf4e074c136a840b4da20ea45347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Wed, 4 Sep 2024 15:28:14 +0200 Subject: [PATCH 6/9] feature/Allow can_get_counterparty in case of VRP consent request --- obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala index 47d072da19..8d973c2d8b 100644 --- a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala +++ b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala @@ -951,7 +951,8 @@ trait APIMethods500 { val vrpViewId = s"_VRP-${UUID.randomUUID.toString}".dropRight(5)// to make sure the length of the viewId is 36. val targetPermissions = List(//may need getTransactionRequest .. so far only this payments. - "can_add_transaction_request_to_beneficiary" + "can_add_transaction_request_to_beneficiary", + "can_get_counterparty" ) val targetCreateCustomViewJson = CreateCustomViewJson( From a6728bfaec0dd3dc71274b790996fc5a4bb240f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 5 Sep 2024 11:37:21 +0200 Subject: [PATCH 7/9] feature/new props for user invitation base URL --- obp-api/src/main/resources/props/sample.props.template | 5 +++++ obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/obp-api/src/main/resources/props/sample.props.template b/obp-api/src/main/resources/props/sample.props.template index a9a3fd1cdd..5b1810460d 100644 --- a/obp-api/src/main/resources/props/sample.props.template +++ b/obp-api/src/main/resources/props/sample.props.template @@ -1180,6 +1180,11 @@ personal_data_collection_consent_country_waiver_list = Austria, Belgium, Bulgari # local_identity_provider=strongly recommended to use top level domain name so that all nodes in the cluster share same provider name +# User Invitation Link Base URL +# it defaults to the "portal_hostname" as a 1st choise and to the "hostname" props value as a 2nd choise +# user_invitation_link_base_URL=strongly recommended to use top level domain name so that all nodes in the cluster share same URL + + # enable dynamic code sandbox, default is false, this will make sandbox works for code running in Future, will make performance lower than disable dynamic_code_sandbox_enable=false # Here is the default permissions if you set the dynamic_code_sandbox_enable = true. If you need more permission need to add it manually here. diff --git a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala index 56f25e11a9..fcf804f28d 100644 --- a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala +++ b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala @@ -3822,7 +3822,7 @@ trait APIMethods400 extends MdcLoggable { postedData.purpose, cc.callContext) } yield { - val link = s"${APIUtil.getPropsValue("portal_hostname", Constant.HostName)}/user-invitation?id=${invitation.secretKey}" + val link = s"${APIUtil.getPropsValue("user_invitation_link_base_URL", APIUtil.getPropsValue("portal_hostname", Constant.HostName))}/user-invitation?id=${invitation.secretKey}" if (postedData.purpose == UserInvitationPurpose.DEVELOPER.toString){ val subject = getWebUiPropsValue("webui_developer_user_invitation_email_subject", "Welcome to the API Playground") val from = getWebUiPropsValue("webui_developer_user_invitation_email_from", "do-not-reply@openbankproject.com") From ad1b102b60b64df62eba0306c60d170258272bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 6 Sep 2024 12:15:05 +0200 Subject: [PATCH 8/9] Revert "refactor/Remove duplicated code" This reverts commit 57c1e74f --- .../code/api/v5_1_0/RegulatedEntityTest.scala | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala b/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala index e48e3254ff..5d7696209c 100644 --- a/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala +++ b/obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala @@ -23,8 +23,9 @@ class RegulatedEntityTest extends V510ServerSetup { object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString) object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.createRegulatedEntity)) object ApiEndpoint2 extends Tag(nameOf(Implementations5_1_0.getRegulatedEntityById)) - object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.deleteRegulatedEntity)) - + object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.getRegulatedEntityById)) + object ApiEndpoint4 extends Tag(nameOf(Implementations5_1_0.deleteRegulatedEntity)) + feature(s"test $ApiEndpoint1 version $VersionOfApi - Unauthorized access") { scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") @@ -35,7 +36,7 @@ class RegulatedEntityTest extends V510ServerSetup { response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn) } } - + feature(s"test $ApiEndpoint1 version $VersionOfApi - Authorized access") { scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") @@ -46,7 +47,7 @@ class RegulatedEntityTest extends V510ServerSetup { response510.body.extract[ErrorMessage].message should be (UserHasMissingRoles + CanCreateRegulatedEntity) } } - + feature(s"test $ApiEndpoint1 version $VersionOfApi - Authorized access") { scenario("We will call the endpoint with user credentials and a proper entitlement", ApiEndpoint1, VersionOfApi) { Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateRegulatedEntity.toString) @@ -60,7 +61,7 @@ class RegulatedEntityTest extends V510ServerSetup { } // ApiEndpoint4 - deleteRegulatedEntity - feature(s"test $ApiEndpoint3 version $VersionOfApi - Unauthorized access") { + feature(s"test $ApiEndpoint4 version $VersionOfApi - Unauthorized access") { scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") val request510 = (v5_1_0_Request / "regulated-entities" / "some id").DELETE @@ -70,7 +71,7 @@ class RegulatedEntityTest extends V510ServerSetup { response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn) } } - feature(s"test $ApiEndpoint3 version $VersionOfApi - Authorized access") { + feature(s"test $ApiEndpoint4 version $VersionOfApi - Authorized access") { scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) { When("We make a request v5.1.0") val request510 = (v5_1_0_Request / "regulated-entities" / "some id").DELETE <@ (user1) @@ -82,7 +83,7 @@ class RegulatedEntityTest extends V510ServerSetup { } - feature(s"test $ApiEndpoint1, $ApiEndpoint2, $ApiEndpoint3 version $VersionOfApi - CRUD") { + feature(s"test $ApiEndpoint1, $ApiEndpoint2, $ApiEndpoint3, $ApiEndpoint4 version $VersionOfApi - CRUD") { scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) { // Create a row Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateRegulatedEntity.toString) From 57ebe05c93449c8a90881e76bd6336e0551b8101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 6 Sep 2024 15:16:13 +0200 Subject: [PATCH 9/9] docfix/Add error message AccountRoutingNotUnique --- obp-api/src/main/scala/code/api/util/ErrorMessages.scala | 1 + .../main/scala/code/bankconnectors/LocalMappedConnector.scala | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/obp-api/src/main/scala/code/api/util/ErrorMessages.scala b/obp-api/src/main/scala/code/api/util/ErrorMessages.scala index d69d4907b8..322302c948 100644 --- a/obp-api/src/main/scala/code/api/util/ErrorMessages.scala +++ b/obp-api/src/main/scala/code/api/util/ErrorMessages.scala @@ -385,6 +385,7 @@ object ErrorMessages { val BankAccountNotFoundByAccountRouting = "OBP-30073: Bank Account not found. Please specify valid values for account routing scheme and address." val BankAccountNotFoundByIban = "OBP-30074: Bank Account not found. Please specify a valid value for iban." val AccountRoutingNotFound = "OBP-30075: Account routing not found, Please specify valid values for account routing scheme and address" + val AccountRoutingNotUnique = "OBP-31075: Routing is not unique at this instance" val BankAccountNotFoundByAccountId = "OBP-30076: Bank Account not found. Please specify a valid value for ACCOUNT_ID." val TransactionRequestAttributeNotFound = "OBP-30078: Transaction Request Attribute not found. Please specify a valid value for TRANSACTION_REQUEST_ATTRIBUTE_ID." diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index 930a1ef1d5..b35a61f648 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -849,7 +849,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { def handleRouting(routing: List[BankAccountRouting]): Box[(MappedBankAccount, Option[CallContext])] = { if (routing.size > 1) { // Handle more than 1 occurrence // Routing MUST be unique - val errorMessage = s"Routing ($scheme, $address) is not unique at this instance" + val errorMessage = s"$AccountRoutingNotUnique (scheme: $scheme, address: $address)" Failure(errorMessage) } else { // Handle 0 and 1 occurrence Box(routing.headOption).flatMap(accountRouting => getBankAccountCommon(accountRouting.bankId, accountRouting.accountId, callContext))