diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7287b0bf5..529152087 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,7 +57,7 @@ When naming variables use strict camel case e.g. use myUrl not myURL. This is so cc => { for { // Extract the user from the headers and get an updated callContext - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) // Now here is the business logic. // Get The customers related to a user. Process the resonse which might be an Exception (customers,callContext) <- Connector.connector.vend.getCustomersByUserIdFuture(u.userId, callContext) map { @@ -79,7 +79,7 @@ When naming variables use strict camel case e.g. use myUrl not myURL. This is so cc => for { // 1. makes sure the user which attempts to use the endpoint is authorized - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) // 2. makes sure the user which attempts to use the endpoint is allowed to consume it _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = createProductEntitlementsRequiredText)(bankId.value, u.userId, createProductEntitlements) // 3. checks the endpoint constraints @@ -90,11 +90,11 @@ When naming variables use strict camel case e.g. use myUrl not myURL. This is so Please note that that checks at an endpoint should be applied only in case an user is authorized and has privilege to consume the endpoint. Otherwise we can reveal sensitive data to the user. For instace if we reorder the checks in next way: ```scala // 1. makes sure the user which attempts to use the endpoint is authorized - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) // 3. checks the endpoint constraints (_, callContext) <- NewStyle.function.getBank(bankId, callContext) failMsg = s"$InvalidJsonFormat The Json body should be the $PostPutProductJsonV310 " - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) // 2. makes sure the user which attempts to use the endpoint is allowed to consume it _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = createProductEntitlementsRequiredText)(bankId.value, u.userId, createProductEntitlements) ``` diff --git a/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala b/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala index 13e1569f6..1ca431b6c 100644 --- a/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala +++ b/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala @@ -65,7 +65,7 @@ Removes consent""", case "accounts":: "v2_1_1.1":: "deleteConsent" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -123,7 +123,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getAccount" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -207,7 +207,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getAccounts" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -270,7 +270,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getHolds" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -364,7 +364,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getTransactionDetail" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "baseInfo" : "", @@ -453,7 +453,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getTransactionsCancelled" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -502,7 +502,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getTransactionsDone" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -551,7 +551,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getTransactionsPending" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -600,7 +600,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getTransactionsRejected" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -649,7 +649,7 @@ User identification based on access token""", case "accounts":: "v2_1_1.1":: "getTransactionsScheduled" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { diff --git a/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala b/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala index c310bf902..7d3760177 100644 --- a/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala +++ b/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala @@ -943,7 +943,7 @@ Requests OAuth2 authorization code""", case "auth":: "v2_1_1.1":: "authorize" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "responseHeader" : { @@ -1861,7 +1861,7 @@ Requests OAuth2 authorization code based One-time authorization code issued by E case "auth":: "v2_1_1.1":: "authorizeExt" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -2838,7 +2838,7 @@ Requests OAuth2 access token value""", case "auth":: "v2_1_1.1":: "token" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "access_token" : "access_token", diff --git a/src/main/scala/code/api/Polish/v2_1_1_1/CAFApi.scala b/src/main/scala/code/api/Polish/v2_1_1_1/CAFApi.scala index 4d5d0afec..98a7cd277 100644 --- a/src/main/scala/code/api/Polish/v2_1_1_1/CAFApi.scala +++ b/src/main/scala/code/api/Polish/v2_1_1_1/CAFApi.scala @@ -72,7 +72,7 @@ Confirming the availability on the payers account of the amount necessary to exe case "confirmation":: "v2_1_1.1":: "getConfirmationOfFunds" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "fundsAvailable" : true, diff --git a/src/main/scala/code/api/Polish/v2_1_1_1/PISApi.scala b/src/main/scala/code/api/Polish/v2_1_1_1/PISApi.scala index 97c57adbd..9be6abb13 100644 --- a/src/main/scala/code/api/Polish/v2_1_1_1/PISApi.scala +++ b/src/main/scala/code/api/Polish/v2_1_1_1/PISApi.scala @@ -269,7 +269,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "bundle" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "payments" : [ { @@ -331,7 +331,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "cancelPayments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "payments" : [ { @@ -385,7 +385,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "cancelRecurringPayment" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "tppRecurringPaymentId" : "tppRecurringPaymentId", @@ -449,7 +449,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "domestic" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "generalStatus" : { }, @@ -513,7 +513,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "EEA" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "generalStatus" : { }, @@ -577,7 +577,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "getBundle" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "tppBundleId" : "tppBundleId", @@ -663,7 +663,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "getMultiplePayments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "payments" : [ { @@ -713,7 +713,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "getPayment" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -754,7 +754,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "getRecurringPayment" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "tppRecurringPaymentId" : "tppRecurringPaymentId", @@ -827,7 +827,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "nonEEA" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "generalStatus" : { }, @@ -974,7 +974,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "recurring" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "recurrence" : { @@ -1052,7 +1052,7 @@ object APIMethods_PISApi extends RestHelper { case "payments":: "v2_1_1.1":: "tax" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "generalStatus" : { }, diff --git a/src/main/scala/code/api/STET/v1_4/AISPApi.scala b/src/main/scala/code/api/STET/v1_4/AISPApi.scala index 669a106c7..74f5f8d69 100644 --- a/src/main/scala/code/api/STET/v1_4/AISPApi.scala +++ b/src/main/scala/code/api/STET/v1_4/AISPApi.scala @@ -109,7 +109,7 @@ The ASPSP answers by providing a list of balances on this account. case "accounts" :: accountresourceid:: "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) { defaultBankId != "DEFAULT_BANK_ID_NOT_SET" } (_, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext) (bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(BankId(defaultBankId), AccountId(accountresourceid), callContext) @@ -200,7 +200,7 @@ The TPP sends a request to the ASPSP for retrieving the list of the PSU payment case "accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} @@ -293,7 +293,7 @@ The AISP requests the ASPSP on one of the PSU's accounts. It may specify some se case "accounts" :: accountresourceid:: "transactions" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} @@ -370,7 +370,7 @@ The PSU specifies to the AISP which of his/her accounts will be accessible and w case "consents" :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -413,7 +413,7 @@ The AISP asks for the identity of the PSU. The ASPSP answers with the identity, case "end-user-identity" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -456,7 +456,7 @@ The AISP asks for the trusted beneficiaries list. The ASPSP answers with a list case "trusted-beneficiaries" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } diff --git a/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala b/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala index 67e77d733..ed1fbdc84 100644 --- a/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala +++ b/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala @@ -78,7 +78,7 @@ The CBPII requests the ASPSP for a payment coverage check against either a bank case "funds-confirmations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } diff --git a/src/main/scala/code/api/STET/v1_4/PISPApi.scala b/src/main/scala/code/api/STET/v1_4/PISPApi.scala index 6cbea4456..8843bac80 100644 --- a/src/main/scala/code/api/STET/v1_4/PISPApi.scala +++ b/src/main/scala/code/api/STET/v1_4/PISPApi.scala @@ -82,7 +82,7 @@ In REDIRECT and DECOUPLED approach, this confirmation is not a prerequisite to t case "payment-requests" :: paymentrequestresourceid:: "confirmation" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -233,7 +233,7 @@ Since the modification request needs a PSU authentication before committing, the case "payment-requests" :: paymentrequestresourceid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "appliedAuthenticationApproach" : { @@ -299,7 +299,7 @@ The status information must be available during at least 30 calendar days after case "payment-requests" :: paymentrequestresourceid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -542,7 +542,7 @@ When the chosen authentication approach within the ASPSP answers is set to "EMBE case "payment-requests" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } diff --git a/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala b/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala index 3f1c8fd2e..0008bf1a5 100644 --- a/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala +++ b/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala @@ -54,7 +54,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ case "accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(ErrorMessages.UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) availablePrivateAccounts <- Views.views.vend.getPrivateBankAccountsFuture(u) accounts <- {Connector.connector.vend.getBankAccountsFuture(availablePrivateAccounts, callContext)} } yield { @@ -87,7 +87,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ case "accounts" :: AccountId(accountId) :: "transactions" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bankAccount, callContext) <- Future { BankAccount(BankId(defaultBankId), accountId, callContext) } map { x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, callContext.map(_.toLight))) } map { unboxFull(_) } @@ -139,7 +139,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ case "accounts" :: AccountId(accountId) :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(ErrorMessages.UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) availablePrivateAccounts <- Views.views.vend.getPrivateBankAccountsFuture(u) map { _.filter(_.accountId.value == accountId.value) } @@ -176,7 +176,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ case "accounts" :: AccountId(accountId) :: "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- Future { BankAccount(BankId(defaultBankId), accountId, callContext) } map { x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, callContext.map(_.toLight))) @@ -224,7 +224,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ case "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) availablePrivateAccounts <- Views.views.vend.getPrivateBankAccountsFuture(u) diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala index e3bd8dc3e..e49694c07 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala @@ -80,7 +80,7 @@ object APIMethods_AccountAccessApi extends RestHelper { case "account-access-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -130,7 +130,7 @@ object APIMethods_AccountAccessApi extends RestHelper { case "account-access-consents" :: consentid :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -180,7 +180,7 @@ object APIMethods_AccountAccessApi extends RestHelper { case "account-access-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala index a5cb4cb44..3998abf73 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala @@ -115,7 +115,7 @@ object APIMethods_AccountsApi extends RestHelper { case "accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -260,7 +260,7 @@ object APIMethods_AccountsApi extends RestHelper { case "accounts" :: accountid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala index 650c463ab..485fd3014 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala @@ -119,7 +119,7 @@ object APIMethods_BalancesApi extends RestHelper { case "accounts" :: accountid:: "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -272,7 +272,7 @@ object APIMethods_BalancesApi extends RestHelper { case "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala index 10f65d537..3fe64a177 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala @@ -125,7 +125,7 @@ object APIMethods_BeneficiariesApi extends RestHelper { case "accounts" :: accountid:: "beneficiaries" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -290,7 +290,7 @@ object APIMethods_BeneficiariesApi extends RestHelper { case "beneficiaries" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala index 9765d8f04..2124cd9ea 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala @@ -93,7 +93,7 @@ object APIMethods_DirectDebitsApi extends RestHelper { case "accounts" :: accountid:: "direct-debits" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -194,7 +194,7 @@ object APIMethods_DirectDebitsApi extends RestHelper { case "direct-debits" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala index b1260847c..0481862f8 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala @@ -150,7 +150,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { case "domestic-payment-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -348,7 +348,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { case "domestic-payments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -546,7 +546,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { case "domestic-payment-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -683,7 +683,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { case "domestic-payment-consents" :: consentid:: "funds-confirmation" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -809,7 +809,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { case "domestic-payments" :: domesticpaymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala index fbfb4ce40..44c56f991 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala @@ -151,7 +151,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { case "domestic-scheduled-payment-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -352,7 +352,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { case "domestic-scheduled-payments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -553,7 +553,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { case "domestic-scheduled-payment-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -754,7 +754,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { case "domestic-scheduled-payments" :: domesticscheduledpaymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala index 87c17da87..f90b67e66 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala @@ -142,7 +142,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { case "domestic-standing-order-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -325,7 +325,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { case "domestic-standing-orders" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -508,7 +508,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { case "domestic-standing-order-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -691,7 +691,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { case "domestic-standing-orders" :: domesticstandingorderid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala index efc21c213..cfea1f5d0 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala @@ -119,7 +119,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payment-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -204,7 +204,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payment-consents" :: consentid:: "file" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -292,7 +292,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -438,7 +438,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payment-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -523,7 +523,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payment-consents" :: consentid:: "file" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -611,7 +611,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payments" :: filepaymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -699,7 +699,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { case "file-payments" :: filepaymentid:: "report-file" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala index abaf3aa86..0abcd4b88 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala @@ -83,7 +83,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { case "funds-confirmation-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -158,7 +158,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { case "funds-confirmations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -208,7 +208,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { case "funds-confirmation-consents" :: consentid :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -260,7 +260,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { case "funds-confirmation-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala index c8b1b2a05..f2140bf88 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala @@ -186,7 +186,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { case "international-payment-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -456,7 +456,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { case "international-payments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -726,7 +726,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { case "international-payment-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -899,7 +899,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { case "international-payment-consents" :: consentid:: "funds-confirmation" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -1061,7 +1061,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { case "international-payments" :: internationalpaymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala index ba91dd700..03677965f 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala @@ -188,7 +188,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { case "international-scheduled-payment-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -461,7 +461,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { case "international-scheduled-payments" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -734,7 +734,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { case "international-scheduled-payment-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -909,7 +909,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { case "international-scheduled-payment-consents" :: consentid:: "funds-confirmation" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -1072,7 +1072,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { case "international-scheduled-payments" :: internationalscheduledpaymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala index 08029df37..f2e73ee7f 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala @@ -169,7 +169,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { case "international-standing-order-consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -406,7 +406,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { case "international-standing-orders" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -643,7 +643,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { case "international-standing-order-consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -880,7 +880,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { case "international-standing-orders" :: internationalstandingorderpaymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala index c1e34da62..196b3f41e 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala @@ -109,7 +109,7 @@ object APIMethods_OffersApi extends RestHelper { case "accounts" :: accountid:: "offers" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -242,7 +242,7 @@ object APIMethods_OffersApi extends RestHelper { case "offers" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala index a631e5b91..88f94a900 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala @@ -98,7 +98,7 @@ object APIMethods_PartysApi extends RestHelper { case "accounts" :: accountid:: "party" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -209,7 +209,7 @@ object APIMethods_PartysApi extends RestHelper { case "party" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala index 457addfe4..cd9390d9c 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala @@ -55,7 +55,7 @@ object APIMethods_ProductsApi extends RestHelper { case "accounts" :: accountid:: "product" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -82,7 +82,7 @@ object APIMethods_ProductsApi extends RestHelper { case "products" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala index a7d30199a..e85e56d0d 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala @@ -111,7 +111,7 @@ object APIMethods_ScheduledPaymentsApi extends RestHelper { case "accounts" :: accountid:: "scheduled-payments" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -248,7 +248,7 @@ object APIMethods_ScheduledPaymentsApi extends RestHelper { case "scheduled-payments" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala index bcc79cb2f..404ba6381 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala @@ -135,7 +135,7 @@ object APIMethods_StandingOrdersApi extends RestHelper { case "accounts" :: accountid:: "standing-orders" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -320,7 +320,7 @@ object APIMethods_StandingOrdersApi extends RestHelper { case "standing-orders" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala index d3023fb7a..7d4f8b409 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala @@ -250,7 +250,7 @@ object APIMethods_StatementsApi extends RestHelper { case "accounts" :: accountid:: "statements" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -659,7 +659,7 @@ object APIMethods_StatementsApi extends RestHelper { case "accounts" :: accountid:: "statements" :: statementid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -877,7 +877,7 @@ object APIMethods_StatementsApi extends RestHelper { case "accounts" :: accountid:: "statements" :: statementid:: "file" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -1127,7 +1127,7 @@ object APIMethods_StatementsApi extends RestHelper { case "accounts" :: accountid:: "statements" :: statementid:: "transactions" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -1568,7 +1568,7 @@ object APIMethods_StatementsApi extends RestHelper { case "statements" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala b/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala index 0f0b138e9..149b2500d 100644 --- a/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala +++ b/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala @@ -280,7 +280,7 @@ object APIMethods_TransactionsApi extends RestHelper { case "accounts" :: accountid:: "statements" :: statementid:: "transactions" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -753,7 +753,7 @@ object APIMethods_TransactionsApi extends RestHelper { case "accounts" :: accountid:: "transactions" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { @@ -1226,7 +1226,7 @@ object APIMethods_TransactionsApi extends RestHelper { case "transactions" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "Meta" : { diff --git a/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala b/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala index 993e3bd26..e705adea7 100644 --- a/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala +++ b/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala @@ -58,7 +58,7 @@ object APIMethods_BERLIN_GROUP_1 extends RestHelper{ case "accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} @@ -101,7 +101,7 @@ object APIMethods_BERLIN_GROUP_1 extends RestHelper{ case "accounts" :: AccountId(accountId) :: "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) { defaultBankId != "DEFAULT_BANK_ID_NOT_SET" } (_, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext) (bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(BankId(defaultBankId), accountId, callContext) @@ -144,7 +144,7 @@ object APIMethods_BERLIN_GROUP_1 extends RestHelper{ cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} diff --git a/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala b/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala index 05a2ad3c1..466a8c94b 100644 --- a/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala +++ b/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala @@ -169,7 +169,7 @@ As a last option, an ASPSP might in addition accept a command with access rights case "consents" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -223,7 +223,7 @@ As a last option, an ASPSP might in addition accept a command with access rights case "consents" :: consentid :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -306,7 +306,7 @@ of the PSU at this ASPSP. case "accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} @@ -361,7 +361,7 @@ The account-id is constant at least throughout the lifecycle of a given consent. case "accounts" :: AccountId(accountId):: "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) { defaultBankId != "DEFAULT_BANK_ID_NOT_SET" } (_, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext) (bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(BankId(defaultBankId), accountId, callContext) @@ -438,7 +438,7 @@ respectively the OAuth2 access token. case "card-accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "cardAccounts" : [ { @@ -521,7 +521,7 @@ This account-id then can be retrieved by the case "card-accounts" :: account_id:: "balances" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "balances" : "", @@ -584,7 +584,7 @@ Reads account data from a given card account addressed by "account-id". cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} @@ -639,7 +639,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- case "consents" :: consentid:: "authorisations" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "authorisationIds" : "" @@ -726,7 +726,7 @@ where the consent was directly managed between ASPSP and PSU e.g. in a re-direct case "consents" :: consentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "access" : { @@ -811,7 +811,7 @@ This method returns the SCA status of a consent initiation's authorisation sub-r case "consents" :: consentid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -842,7 +842,7 @@ This method returns the SCA status of a consent initiation's authorisation sub-r case "consents" :: consentid:: "status" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "consentStatus" : { } @@ -918,7 +918,7 @@ This call is only available on transactions as reported in a JSON format. case "accounts" :: account_id:: "transactions" :: resourceid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "debtorAccount" : { @@ -1016,7 +1016,7 @@ The ASPSP might add balance information, if transaction lists without balances a cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet ) {defaultBankId != "DEFAULT_BANK_ID_NOT_SET"} @@ -1097,7 +1097,7 @@ Give detailed information about the addressed account together with balance info case "accounts" :: account_id :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "cashAccountType" : { }, @@ -1166,7 +1166,7 @@ access token. case "card-accounts" :: account_id :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "balances" : "", @@ -1265,7 +1265,7 @@ This applies in the following scenarios: case "consents" :: consentid:: "authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -1355,7 +1355,7 @@ There are the following request types on this access path: case "consents" :: consentid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } diff --git a/src/main/scala/code/api/berlin/group/v1_3/CommonServicesApi.scala b/src/main/scala/code/api/berlin/group/v1_3/CommonServicesApi.scala index d69e973ca..1830f288f 100644 --- a/src/main/scala/code/api/berlin/group/v1_3/CommonServicesApi.scala +++ b/src/main/scala/code/api/berlin/group/v1_3/CommonServicesApi.scala @@ -74,7 +74,7 @@ Nevertheless, single transactions might be cancelled on an individual basis on t case "signing-baskets" :: basketid :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -104,7 +104,7 @@ This method returns the SCA status of a consent initiation's authorisation sub-r case "consents" :: consentid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -136,7 +136,7 @@ This method returns the SCA status of a payment initiation's authorisation sub-r case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: cancellationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -170,7 +170,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- case payment_service :: payment_product :: paymentid:: "authorisations" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "authorisationIds" : "" @@ -202,7 +202,7 @@ This method returns the SCA status of a payment initiation's authorisation sub-r case payment_service :: payment_product :: paymentid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -236,7 +236,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- case "signing-baskets" :: basketid:: "authorisations" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "authorisationIds" : "" @@ -268,7 +268,7 @@ This method returns the SCA status of a signing basket's authorisation sub-resou case "signing-baskets" :: basketid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -300,7 +300,7 @@ Returns the status of a signing basket object. case "signing-baskets" :: basketid:: "status" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "transactionStatus" : "RCVD" @@ -383,7 +383,7 @@ This applies in the following scenarios: case "consents" :: consentid:: "authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -488,7 +488,7 @@ This applies in the following scenarios: case payment_service :: payment_product :: paymentid:: "authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -593,7 +593,7 @@ This applies in the following scenarios: case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -698,7 +698,7 @@ This applies in the following scenarios: case "signing-baskets" :: basketid:: "authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -788,7 +788,7 @@ There are the following request types on this access path: case "consents" :: consentid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -855,7 +855,7 @@ There are the following request types on this access path: case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: cancellationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -920,7 +920,7 @@ There are the following request types on this access path: case payment_service :: payment_product :: paymentid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -987,7 +987,7 @@ There are the following request types on this access path: case "signing-baskets" :: basketid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } diff --git a/src/main/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApi.scala b/src/main/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApi.scala index a4626bf32..74670587a 100644 --- a/src/main/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApi.scala +++ b/src/main/scala/code/api/berlin/group/v1_3/ConfirmationOfFundsServicePIISApi.scala @@ -70,7 +70,7 @@ Creates a confirmation of funds request at the ASPSP. Checks whether a specific case "funds-confirmations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "fundsAvailable" : true diff --git a/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala b/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala index 75721f843..499f13897 100644 --- a/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala +++ b/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala @@ -95,7 +95,7 @@ The response to this DELETE command will tell the TPP whether the case payment_service :: payment_product :: paymentid :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -144,7 +144,7 @@ This method returns the SCA status of a payment initiation's authorisation sub-r case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: cancellationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -173,7 +173,7 @@ Returns the content of a payment object""", case payment_service :: payment_product :: paymentid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -205,7 +205,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- case payment_service :: payment_product :: paymentid:: "authorisations" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "authorisationIds" : "" @@ -235,7 +235,7 @@ Retrieve a list of all created cancellation authorisation sub-resources. case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -265,7 +265,7 @@ This method returns the SCA status of a payment initiation's authorisation sub-r case payment_service :: payment_product :: paymentid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -296,7 +296,7 @@ Check the transaction status of a payment initiation.""", case payment_service :: payment_product :: paymentid:: "status" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "transactionStatus" : "ACCP" @@ -370,7 +370,7 @@ In these cases, first an authorisation sub-resource has to be generated followin case payment_service :: payment_product :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -452,7 +452,7 @@ This applies in the following scenarios: case payment_service :: payment_product :: paymentid:: "authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -557,7 +557,7 @@ This applies in the following scenarios: case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -647,7 +647,7 @@ There are the following request types on this access path: case payment_service :: payment_product :: paymentid:: "cancellation-authorisations" :: cancellationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } @@ -712,7 +712,7 @@ There are the following request types on this access path: case payment_service :: payment_product :: paymentid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } diff --git a/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala b/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala index 25c982718..a14836d6b 100644 --- a/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala +++ b/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala @@ -103,7 +103,7 @@ The resource identifications of these transactions are contained in the payload case "signing-baskets" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "basketId" : "1234-basket-567", @@ -173,7 +173,7 @@ Nevertheless, single transactions might be cancelled on an individual basis on t case "signing-baskets" :: basketid :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (NotImplemented, callContext) } @@ -204,7 +204,7 @@ Returns the content of an signing basket object.""", case "signing-baskets" :: basketid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "transactionStatus" : "ACCP", @@ -240,7 +240,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- case "signing-baskets" :: basketid:: "authorisations" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "authorisationIds" : "" @@ -272,7 +272,7 @@ This method returns the SCA status of a signing basket's authorisation sub-resou case "signing-baskets" :: basketid:: "authorisations" :: authorisationid :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "scaStatus" : "psuAuthenticated" @@ -304,7 +304,7 @@ Returns the status of a signing basket object. case "signing-baskets" :: basketid:: "status" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "transactionStatus" : "RCVD" @@ -388,7 +388,7 @@ This applies in the following scenarios: case "signing-baskets" :: basketid:: "authorisations" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse("""{ "challengeData" : { @@ -478,7 +478,7 @@ There are the following request types on this access path: case "signing-baskets" :: basketid:: "authorisations" :: authorisationid :: Nil JsonPut _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) } yield { (json.parse(""""""""), callContext) } diff --git a/src/main/scala/code/api/util/APIUtil.scala b/src/main/scala/code/api/util/APIUtil.scala index 32f71d110..a30e8b5c9 100644 --- a/src/main/scala/code/api/util/APIUtil.scala +++ b/src/main/scala/code/api/util/APIUtil.scala @@ -2129,7 +2129,7 @@ Returns a string showed to the developer * This function is used to factor out common code at endpoints regarding Authorized access * @param emptyUserErrorMsg is a message which will be provided as a response in case that Box[User] = Empty */ - def authorizedAccess(emptyUserErrorMsg: String, cc: CallContext): OBPReturnType[Box[User]] = { + def authorizedAccess(cc: CallContext, emptyUserErrorMsg: String = UserNotLoggedIn): OBPReturnType[Box[User]] = { getUserAndSessionContextFuture(cc) map { x => underCallLimits(x) } map { diff --git a/src/main/scala/code/api/v1_4_0/APIMethods140.scala b/src/main/scala/code/api/v1_4_0/APIMethods140.scala index 045636a29..7db5470d3 100644 --- a/src/main/scala/code/api/v1_4_0/APIMethods140.scala +++ b/src/main/scala/code/api/v1_4_0/APIMethods140.scala @@ -425,7 +425,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.isEnabledTransactionRequests() (bank, callContext ) <- NewStyle.function.getBank(bankId, callContext) (fromAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) diff --git a/src/main/scala/code/api/v2_0_0/APIMethods200.scala b/src/main/scala/code/api/v2_0_0/APIMethods200.scala index be4004e38..cc1523da3 100644 --- a/src/main/scala/code/api/v2_0_0/APIMethods200.scala +++ b/src/main/scala/code/api/v2_0_0/APIMethods200.scala @@ -274,7 +274,7 @@ trait APIMethods200 { case "banks" :: BankId(bankId) :: "accounts" :: Nil JsonGet req => { cc => for{ - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bank, callContext) <- NewStyle.function.getBank(bankId, callContext) } yield { val privateViewsUserCanAccessAtOneBank = Views.views.vend.privateViewsUserCanAccess(u).filter(_.bankId == bankId) @@ -322,7 +322,7 @@ trait APIMethods200 { case "my" :: "banks" :: BankId(bankId) :: "accounts" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bank, callContext) <- NewStyle.function.getBank(bankId, callContext) } yield { @@ -336,7 +336,7 @@ trait APIMethods200 { case "my" :: "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bank, callContext) <- NewStyle.function.getBank(bankId, callContext) } yield { val privateViewsUserCanAccessAtOneBank = Views.views.vend.privateViewsUserCanAccess(u).filter(_.bankId == bankId) @@ -349,7 +349,7 @@ trait APIMethods200 { case "bank" :: "accounts" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bank, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext) } yield { val privateViewsUserCanAccessAtOneBank = Views.views.vend.privateViewsUserCanAccess(u).filter(_.bankId == bankId) @@ -391,7 +391,7 @@ trait APIMethods200 { case "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bank, callContext) <- NewStyle.function.getBank(bankId, callContext) } yield { val privateViewsUserCanAccessAtOneBank = Views.views.vend.privateViewsUserCanAccess(u).filter(_.bankId == bankId) @@ -2077,7 +2077,7 @@ trait APIMethods200 { case "entitlements" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = UserNotSuperAdmin) { isSuperAdmin(u.userId) } diff --git a/src/main/scala/code/api/v2_1_0/APIMethods210.scala b/src/main/scala/code/api/v2_1_0/APIMethods210.scala index e13c1d0f8..1c7d012e8 100644 --- a/src/main/scala/code/api/v2_1_0/APIMethods210.scala +++ b/src/main/scala/code/api/v2_1_0/APIMethods210.scala @@ -402,7 +402,7 @@ trait APIMethods210 { TransactionRequestType(transactionRequestType) :: "transaction-requests" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.isEnabledTransactionRequests() _ <- Helper.booleanToFuture(InvalidAccountIdFormat) {isValidID(accountId.value)} _ <- Helper.booleanToFuture(InvalidBankIdFormat) {isValidID(bankId.value)} @@ -604,7 +604,7 @@ trait APIMethods210 { cc => for { // Check we have a User - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.isEnabledTransactionRequests() _ <- Helper.booleanToFuture(InvalidAccountIdFormat) {isValidID(accountId.value)} _ <- Helper.booleanToFuture(InvalidBankIdFormat) {isValidID(bankId.value)} @@ -763,7 +763,7 @@ trait APIMethods210 { case "roles" :: Nil JsonGet _ => { cc => for { - _ <- authorizedAccess(UserNotLoggedIn, cc) + _ <- authorizedAccess(cc) } yield { // Format the data as V2.1.0 json @@ -1047,7 +1047,7 @@ trait APIMethods210 { case "users" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = UserHasMissingRoles + CanGetAnyUser) { hasEntitlement("", u.userId, ApiRole.canGetAnyUser) } diff --git a/src/main/scala/code/api/v2_2_0/APIMethods220.scala b/src/main/scala/code/api/v2_2_0/APIMethods220.scala index 831545fa0..909fa3d73 100644 --- a/src/main/scala/code/api/v2_2_0/APIMethods220.scala +++ b/src/main/scala/code/api/v2_2_0/APIMethods220.scala @@ -95,7 +95,7 @@ trait APIMethods220 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "views" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) _ <- Helper.booleanToFuture(failMsg = UserNoOwnerView +"userId : " + u.userId + ". account : " + accountId) { u.hasOwnerViewAccess(BankIdAccountId(account.bankId, account.accountId)) @@ -242,7 +242,7 @@ trait APIMethods220 { case "banks" :: BankId(bankId) :: "fx" :: fromCurrencyCode :: toCurrencyCode :: Nil JsonGet _ => { cc => for { - (_, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (_, callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = ConsumerHasMissingRoles + CanReadFx) { checkScope(bankId.value, getConsumerPrimaryKey(callContext), ApiRole.canReadFx) } @@ -313,7 +313,7 @@ trait APIMethods220 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) _ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}canAddCounterparty") { @@ -367,7 +367,7 @@ trait APIMethods220 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: CounterpartyId(counterpartyId) :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) _ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}canAddCounterparty") { @@ -832,7 +832,7 @@ trait APIMethods220 { case "config" :: Nil JsonGet _ => cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetConfig) } yield { (JSONFactory220.getConfigInfoJSON(), callContext) diff --git a/src/main/scala/code/api/v3_0_0/APIMethods300.scala b/src/main/scala/code/api/v3_0_0/APIMethods300.scala index e0f7eaab3..0bc62487a 100644 --- a/src/main/scala/code/api/v3_0_0/APIMethods300.scala +++ b/src/main/scala/code/api/v3_0_0/APIMethods300.scala @@ -102,7 +102,7 @@ trait APIMethods300 { cc => val res = for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) _ <- Helper.booleanToFuture(failMsg = UserNoOwnerView +"userId : " + u.userId + ". account : " + accountId){ u.hasOwnerViewAccess(BankIdAccountId(account.bankId, account.accountId)) @@ -159,7 +159,7 @@ trait APIMethods300 { cc => val res = for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) createViewJson <- Future { tryo{json.extract[CreateViewJson]} } map { val msg = s"$InvalidJsonFormat The Json body should be the $CreateViewJson " x => fullBoxOrException(x ~> APIFailureNewStyle(msg, 400, callContext.map(_.toLight))) @@ -204,7 +204,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: provider :: providerId :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) permission <- Future { account permission(u, provider, providerId) } map { @@ -247,7 +247,7 @@ trait APIMethods300 { cc => val res = for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) updateJson <- Future { tryo{json.extract[UpdateViewJSON]} } map { val msg = s"$InvalidJsonFormat The Json body should be the $UpdateViewJSON " x => fullBoxOrException(x ~> APIFailureNewStyle(msg, 400, callContext.map(_.toLight))) @@ -308,7 +308,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "account" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) _ <- Helper.booleanToFuture(failMsg = UserNoPermissionAccessView) { @@ -399,7 +399,7 @@ trait APIMethods300 { case "my" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "account" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) // Assume owner view was requested view <- NewStyle.function.view(ViewId("owner"), BankIdAccountId(account.bankId, account.accountId), callContext) @@ -440,7 +440,7 @@ trait APIMethods300 { case "my" :: "accounts" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) availablePrivateAccounts <- Views.views.vend.getPrivateBankAccountsFuture(u) Full((coreAccounts, callContext)) <- {Connector.connector.vend.getCoreBankAccountsFuture(availablePrivateAccounts, callContext)} } yield { @@ -486,7 +486,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId):: "firehose" :: "accounts" :: "views" :: ViewId(viewId):: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = FirehoseViewsNotAllowedOnThisInstance +" or " + UserHasMissingRoles + CanUseFirehoseAtAnyBank ) { canUseFirehose(u) } @@ -544,7 +544,7 @@ trait APIMethods300 { cc => val res = for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = FirehoseViewsNotAllowedOnThisInstance +" or " + UserHasMissingRoles + CanUseFirehoseAtAnyBank ) { canUseFirehose(u) } @@ -603,7 +603,7 @@ trait APIMethods300 { case "my" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "transactions" :: Nil JsonGet req => { cc => for { - (user, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (user, callContext) <- authorizedAccess(cc) (bankAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) // Assume owner view was requested view <- NewStyle.function.view(ViewId("owner"), BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext) @@ -662,7 +662,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transactions" :: Nil JsonGet req => { cc => for { - (user, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (user, callContext) <- authorizedAccess(cc) (bankAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext) params <- createQueriesByHttpParamsFuture(callContext.get.requestHeaders)map { @@ -727,7 +727,7 @@ trait APIMethods300 { case "search" :: "warehouse" :: index :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canSearchWarehouse) _ <- Helper.booleanToFuture(failMsg = ElasticSearchDisabled) { esw.isEnabled() @@ -796,7 +796,7 @@ trait APIMethods300 { cc => //if (field == "/") throw new RuntimeException("No aggregation field supplied") with NoStackTrace for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canSearchWarehouseStatistics) _ <- Helper.booleanToFuture(failMsg = ElasticSearchDisabled) { esw.isEnabled() @@ -840,7 +840,7 @@ trait APIMethods300 { case "users" :: "email" :: email :: "terminator" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetAnyUser) users <- Users.users.vend.getUserByEmailFuture(email) } yield { @@ -874,7 +874,7 @@ trait APIMethods300 { case "users" :: "user_id" :: userId :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetAnyUser) user <- Users.users.vend.getUserByUserIdFuture(userId) map { x => fullBoxOrException(x ~> APIFailureNewStyle(UserNotFoundByUsername, 400, callContext.map(_.toLight))) @@ -912,7 +912,7 @@ trait APIMethods300 { case "users" :: "username" :: username :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetAnyUser) user <- Users.users.vend.getUserByUserNameFuture(username) map { x => fullBoxOrException(x ~> APIFailureNewStyle(UserNotFoundByUsername, 400, callContext.map(_.toLight))) @@ -1171,7 +1171,7 @@ trait APIMethods300 { for { (_, callContext) <- getBranchesIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -1227,7 +1227,7 @@ trait APIMethods300 { for { (_, callContext) <- getBranchesIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } _ <- Helper.booleanToFuture(failMsg = s"${InvalidNumber } limit:${limit.getOrElse("")}") { @@ -1303,7 +1303,7 @@ trait APIMethods300 { for { (_, callContext) <- getAtmsIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -1352,7 +1352,7 @@ trait APIMethods300 { for { (_, callContext) <- getAtmsIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } _ <- Helper.booleanToFuture(failMsg = s"${InvalidNumber } limit:${limit.getOrElse("")}") { @@ -1427,7 +1427,7 @@ trait APIMethods300 { case "users" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetAnyUser) httpParams <- NewStyle.function.createHttpParams(cc.url) @@ -1479,7 +1479,7 @@ trait APIMethods300 { cc => { for { // Extract the user from the headers and get an updated callContext - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) // Now here is the business logic. // Get The customers related to a user. Process the resonse which might be an Exception (customers,callContext) <- Connector.connector.vend.getCustomersByUserIdFuture(u.userId, callContext) map { @@ -1514,7 +1514,7 @@ trait APIMethods300 { case "users" :: "current" :: Nil JsonGet _ => { cc => { for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) entitlements <- NewStyle.function.getEntitlementsByUserId(u.userId, callContext) } yield { (JSONFactory300.createUserJSON (u, entitlements), HttpCode.`200`(callContext)) @@ -1549,7 +1549,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) availablePrivateAccounts <- Views.views.vend.getPrivateBankAccountsFuture(u, bankId) ((accounts, callContext)) <- Connector.connector.vend.getCoreBankAccountsFuture(availablePrivateAccounts, callContext) map { @@ -1590,7 +1590,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: "account_ids" :: "private"::Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext)<- NewStyle.function.getBank(bankId, callContext) bankAccountIds <- Views.views.vend.getPrivateBankAccountsFuture(u, bankId) } yield { @@ -1626,7 +1626,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "other_accounts" :: Nil JsonGet req => { cc => for { - (u, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (u, callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) otherBankAccounts <- Future(account.moderatedOtherBankAccounts(view, u)) map { @@ -1665,7 +1665,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "other_accounts":: other_account_id :: Nil JsonGet _ => { cc => for { - (u, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (u, callContext) <- authorizedAccess(cc) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) otherBankAccount <- Future(account.moderatedOtherBankAccount(other_account_id, view, u)) map { @@ -1721,7 +1721,7 @@ trait APIMethods300 { case "entitlement-requests" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) postedData <- Future { tryo{json.extract[CreateEntitlementRequestJSON]} } map { val msg = s"$InvalidJsonFormat The Json body should be the $CreateEntitlementRequestJSON " x => fullBoxOrException(x ~> APIFailureNewStyle(msg, 400, callContext.map(_.toLight))) @@ -1777,7 +1777,7 @@ trait APIMethods300 { val allowedEntitlements = canGetEntitlementRequestsAtAnyBank :: Nil val allowedEntitlementsTxt = allowedEntitlements.mkString(" or ") for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = UserHasMissingRoles + allowedEntitlementsTxt)("", u.userId, allowedEntitlements) getEntitlementRequests <- EntitlementRequest.entitlementRequest.vend.getEntitlementRequestsFuture() map { unboxFullOrFail(_, callContext, ConnectorEmptyResponse, 400) @@ -1820,7 +1820,7 @@ trait APIMethods300 { val allowedEntitlements = canGetEntitlementRequestsAtAnyBank :: Nil val allowedEntitlementsTxt = allowedEntitlements.mkString(" or ") for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = UserHasMissingRoles + allowedEntitlementsTxt)("", u.userId, allowedEntitlements) getEntitlementRequests <- EntitlementRequest.entitlementRequest.vend.getEntitlementRequestsFuture(userId) map { unboxFullOrFail(_, callContext, ConnectorEmptyResponse, 400) @@ -1861,7 +1861,7 @@ trait APIMethods300 { case "my" :: "entitlement-requests" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) getEntitlementRequests <- EntitlementRequest.entitlementRequest.vend.getEntitlementRequestsFuture(u.userId) map { unboxFullOrFail(_, callContext, ConnectorEmptyResponse, 400) } @@ -1902,7 +1902,7 @@ trait APIMethods300 { val allowedEntitlements = canDeleteEntitlementRequestsAtAnyBank :: Nil val allowedEntitlementsTxt = UserHasMissingRoles + allowedEntitlements.mkString(" or ") for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = allowedEntitlementsTxt)("", u.userId, allowedEntitlements) deleteEntitlementRequest <- EntitlementRequest.entitlementRequest.vend.deleteEntitlementRequestFuture(entitlementRequestId) map { unboxFullOrFail(_, callContext, ConnectorEmptyResponse, 400) @@ -1942,7 +1942,7 @@ trait APIMethods300 { case "my" :: "entitlements" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) getEntitlements <- NewStyle.function.getEntitlementsByUserId(u.userId, callContext) } yield { (JSONFactory200.createEntitlementJSONs(getEntitlements), HttpCode.`200`(callContext)) @@ -1999,7 +1999,7 @@ trait APIMethods300 { case "banks" :: BankId(bankId) :: "accounts-held" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) availableAccounts <- Future{ AccountHolders.accountHolders.vend.getAccountsHeld(bankId, u)} accounts <- Connector.connector.vend.getCoreBankAccountsHeldFuture(availableAccounts.toList, callContext) map { @@ -2077,7 +2077,7 @@ trait APIMethods300 { case "management" :: "aggregate-metrics" :: Nil JsonGet _ => { cc => { for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canReadAggregateMetrics) @@ -2137,7 +2137,7 @@ trait APIMethods300 { case "consumers" :: consumerId :: "scopes" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) consumerIdInt <- Future { tryo{consumerId.toInt} } map { val msg = s"$ConsumerNotFoundById Current Value is $consumerId" @@ -2207,7 +2207,7 @@ trait APIMethods300 { case "consumers" :: consumerId :: "scope" :: scopeId :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) consumer <- Future{callContext.get.consumer} map { x => fullBoxOrException(x ~> APIFailureNewStyle(InvalidConsumerCredentials, 400, callContext.map(_.toLight))) } map { unboxFull(_) } @@ -2250,7 +2250,7 @@ trait APIMethods300 { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) consumer <- Future{callContext.get.consumer} map { x => fullBoxOrException(x ~> APIFailureNewStyle(InvalidConsumerCredentials, 400, callContext.map(_.toLight))) } map { unboxFull(_) } diff --git a/src/main/scala/code/api/v3_1_0/APIMethods310.scala b/src/main/scala/code/api/v3_1_0/APIMethods310.scala index 0d00aea7d..fa853b5a7 100644 --- a/src/main/scala/code/api/v3_1_0/APIMethods310.scala +++ b/src/main/scala/code/api/v3_1_0/APIMethods310.scala @@ -78,7 +78,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "checkbook" :: "orders" :: Nil JsonGet req => { cc => for { - (_, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (_, callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -120,7 +120,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "credit_cards" :: "orders" :: Nil JsonGet req => { cc => for { - (_, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (_, callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -300,7 +300,7 @@ trait APIMethods310 { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canReadMetrics) @@ -390,7 +390,7 @@ trait APIMethods310 { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canReadMetrics) @@ -456,7 +456,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId):: "firehose" :: "customers" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- Helper.booleanToFuture(failMsg = FirehoseViewsNotAllowedOnThisInstance +" or " + UserHasMissingRoles + CanUseFirehoseAtAnyBank ) { canUseFirehose(u) @@ -497,7 +497,7 @@ trait APIMethods310 { case "users" :: username:: "lock-status" :: Nil JsonGet req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canReadUserLockedStatus) badLoginStatus <- Future { LoginAttempt.getBadLoginStatus(username) } map { unboxFullOrFail(_, callContext, s"$UserNotFoundByUsername($username)",400) } } yield { @@ -533,7 +533,7 @@ trait APIMethods310 { case "users" :: username:: "lock-status" :: Nil JsonPut req => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canUnlockUser) _ <- Future { LoginAttempt.resetBadLoginAttempts(username) } badLoginStatus <- Future { LoginAttempt.getBadLoginStatus(username) } map { unboxFullOrFail(_, callContext, s"$UserNotFoundByUsername($username)",400) } @@ -586,7 +586,7 @@ trait APIMethods310 { case "management" :: "consumers" :: consumerId :: "consumer" :: "call-limits" :: Nil JsonPut json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canSetCallLimits) postJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $CallLimitPostJson ", 400, callContext) { json.extract[CallLimitPostJson] @@ -646,7 +646,7 @@ trait APIMethods310 { case "management" :: "consumers" :: consumerId :: "consumer" :: "call-limits" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canReadCallLimits) consumerIdToLong <- NewStyle.function.tryons(s"$InvalidConsumerId", 400, callContext) { consumerId.toLong @@ -695,7 +695,7 @@ trait APIMethods310 { val amount = "amount" val currency = "currency" for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) @@ -762,7 +762,7 @@ trait APIMethods310 { case "management" :: "consumers" :: consumerId :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetConsumers) consumer <- NewStyle.function.getConsumerByConsumerId(consumerId, callContext) user <- Users.users.vend.getUserByUserIdFuture(consumer.createdByUserId.get) @@ -798,7 +798,7 @@ trait APIMethods310 { case "management" :: "users" :: "current" :: "consumers" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) consumer <- Consumers.consumers.vend.getConsumersByUserIdFuture(u.userId) } yield { (createConsumersJson(consumer, Full(u)), HttpCode.`200`(callContext)) @@ -835,7 +835,7 @@ trait APIMethods310 { case "management" :: "consumers" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetConsumers) consumers <- Consumers.consumers.vend.getConsumersFuture() users <- Users.users.vend.getUsersByUserIdsFuture(consumers.map(_.createdByUserId.get)) @@ -878,7 +878,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "account-web-hooks" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, ApiRole.canCreateWebhook) failMsg = s"$InvalidJsonFormat The Json body should be the $AccountWebhookPostJson " @@ -936,7 +936,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "account-web-hooks" :: Nil JsonPut json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, ApiRole.canUpdateWebhook) failMsg = s"$InvalidJsonFormat The Json body should be the $AccountWebhookPutJson " @@ -998,7 +998,7 @@ trait APIMethods310 { case "management" :: "banks" :: BankId(bankId) ::"account-web-hooks" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, ApiRole.canGetWebhooks) httpParams <- NewStyle.function.createHttpParams(cc.url) @@ -1040,7 +1040,7 @@ trait APIMethods310 { case "config" :: Nil JsonGet _ => cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canGetConfig) } yield { (JSONFactory310.getConfigInfoJSON(), HttpCode.`200`(callContext)) @@ -1103,7 +1103,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transactions" :: TransactionId(transactionId) :: "transaction" :: Nil JsonGet _ => { cc => for { - (user, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (user, callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) view <- NewStyle.function.view(viewId, BankIdAccountId(account.bankId, account.accountId), callContext) @@ -1164,7 +1164,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transaction-requests" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.isEnabledTransactionRequests() (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) @@ -1217,7 +1217,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = UserHasMissingRoles + canCreateCustomer + " or " + canCreateCustomerAtAnyBank) { hasAtLeastOneEntitlement(bankId.value, u.userId, canCreateCustomer :: canCreateCustomerAtAnyBank :: Nil) @@ -1333,7 +1333,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canGetCustomer) (customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext) @@ -1371,7 +1371,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: "customer-number" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (bank, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canGetCustomer) failMsg = s"$InvalidJsonFormat The Json body should be the $PostCustomerNumberJsonV310 " @@ -1410,7 +1410,7 @@ trait APIMethods310 { case "users" :: userId ::"auth-context" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canCreateUserAuthContext) failMsg = s"$InvalidJsonFormat The Json body should be the $PostUserAuthContextJson " postedData <- NewStyle.function.tryons(failMsg, 400, callContext) { @@ -1452,7 +1452,7 @@ trait APIMethods310 { case "users" :: userId :: "auth-context" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canGetUserAuthContext) (_, callContext) <- NewStyle.function.findByUserId(userId, callContext) (userAuthContexts, callContext) <- NewStyle.function.getUserAuthContexts(userId, callContext) @@ -1490,7 +1490,7 @@ trait APIMethods310 { case "users" :: userId :: "auth-context" :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canDeleteUserAuthContext) (_, callContext) <- NewStyle.function.findByUserId(userId, callContext) (userAuthContext, callContext) <- NewStyle.function.deleteUserAuthContexts(userId, callContext) @@ -1528,7 +1528,7 @@ trait APIMethods310 { case "users" :: userId :: "auth-context" :: userAuthContextId :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canDeleteUserAuthContext) (_, callContext) <- NewStyle.function.findByUserId(userId, callContext) (userAuthContext, callContext) <- NewStyle.function.deleteUserAuthContextById(userAuthContextId, callContext) @@ -1567,7 +1567,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "tax-residence" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canCreateTaxResidence) failMsg = s"$InvalidJsonFormat The Json body should be the $PostTaxResidenceJsonV310 " @@ -1610,7 +1610,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "tax-residence" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canGetTaxResidence) (_, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext) @@ -1649,7 +1649,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "tax_residencies" :: taxResidenceId :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canDeleteTaxResidence) (_, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext) @@ -1688,7 +1688,7 @@ trait APIMethods310 { case "entitlements" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- Helper.booleanToFuture(failMsg = UserNotSuperAdmin) { isSuperAdmin(u.userId) } @@ -1733,7 +1733,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "address" :: Nil JsonPost json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canCreateCustomerAddress) failMsg = s"$InvalidJsonFormat The Json body should be the $PostCustomerAddressJsonV310 " @@ -1790,7 +1790,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "address" :: customerAddressId :: Nil JsonPut json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canCreateCustomer) failMsg = s"$InvalidJsonFormat The Json body should be the $PostCustomerAddressJsonV310 " @@ -1846,7 +1846,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "address" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canGetCustomerAddress) (_, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext) @@ -1886,7 +1886,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "customers" :: customerId :: "addresses" :: customerAddressId :: Nil JsonDelete _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canDeleteCustomerAddress) (_, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, callContext) @@ -1961,7 +1961,7 @@ trait APIMethods310 { case "users" :: userId :: "refresh" :: Nil JsonPost _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", userId, canRefreshUser) startTime <- Future{Helpers.now} _ <- NewStyle.function.findByUserId(userId, callContext) @@ -2033,7 +2033,7 @@ trait APIMethods310 { case "banks" :: bankId :: "products" :: productCode:: "attribute" :: Nil JsonPost json -> _=> { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId, u.userId, canCreateProductAttribute) (_, callContext) <- NewStyle.function.getBank(BankId(bankId), callContext) failMsg = s"$InvalidJsonFormat The Json body should be the $ProductAttributeJson " @@ -2084,7 +2084,7 @@ trait APIMethods310 { case "banks" :: bankId :: "products" :: productCode:: "attributes" :: productAttributeId :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId, u.userId, canGetProductAttribute) (_, callContext) <- NewStyle.function.getBank(BankId(bankId), callContext) (productAttribute, callContext) <- NewStyle.function.getProductAttributeById(productAttributeId, callContext) @@ -2125,7 +2125,7 @@ trait APIMethods310 { case "banks" :: bankId :: "products" :: productCode:: "attributes" :: productAttributeId :: Nil JsonPut json -> _ =>{ cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId, u.userId, canUpdateProductAttribute) (_, callContext) <- NewStyle.function.getBank(BankId(bankId), callContext) failMsg = s"$InvalidJsonFormat The Json body should be the $ProductAttributeJson " @@ -2176,7 +2176,7 @@ trait APIMethods310 { case "banks" :: bankId :: "products" :: productCode:: "attributes" :: productAttributeId :: Nil JsonDelete _=> { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId, u.userId, canDeleteProductAttribute) (_, callContext) <- NewStyle.function.getBank(BankId(bankId), callContext) (productAttribute, callContext) <- NewStyle.function.deleteProductAttribute(productAttributeId, callContext) @@ -2211,7 +2211,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "account-applications" :: Nil JsonPost json -> _=> { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) failMsg = s"$InvalidJsonFormat The Json body should be the $AccountApplicationJson " postedData <- NewStyle.function.tryons(failMsg, 400, callContext) { @@ -2274,7 +2274,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) ::"account-applications" :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, canGetAccountApplications) @@ -2318,7 +2318,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) ::"account-applications":: accountApplicationId :: Nil JsonGet _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -2366,7 +2366,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) ::"account-applications" :: accountApplicationId :: Nil JsonPut json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)("", u.userId, ApiRole.canUpdateAccountApplications) failMsg = s"$InvalidJsonFormat The Json body should be the $AccountApplicationUpdateStatusJson " @@ -2476,7 +2476,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "products" :: ProductCode(productCode) :: Nil JsonPut json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = createProductEntitlementsRequiredText)(bankId.value, u.userId, createProductEntitlements) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) failMsg = s"$InvalidJsonFormat The Json body should be the $PostPutProductJsonV310 " @@ -2555,7 +2555,7 @@ trait APIMethods310 { for { (_, callContext) <- getProductsIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -2620,7 +2620,7 @@ trait APIMethods310 { for { (_, callContext) <- getProductsIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -2673,7 +2673,7 @@ trait APIMethods310 { for { (_, callContext) <- getProductsIsPublic match { - case false => authorizedAccess(UserNotLoggedIn, cc) + case false => authorizedAccess(cc) case true => anonymousAccess(cc) } (_, callContext) <- NewStyle.function.getBank(bankId, callContext) @@ -2742,7 +2742,7 @@ trait APIMethods310 { case "banks" :: bankId :: "accounts" :: accountId :: "products" :: productCode :: "attribute" :: Nil JsonPost json -> _=> { cc => for { - (_, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (_, callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(BankId(bankId), callContext) (_, callContext) <- NewStyle.function.getBankAccount(BankId(bankId), AccountId(accountId), callContext) _ <- Future(Connector.connector.vend.getProduct(BankId(bankId), ProductCode(productCode))) map { @@ -2819,7 +2819,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "product-collections" :: collectionCode :: Nil JsonPut json -> _ => { cc => for { - (Full(u), callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (Full(u), callContext) <- authorizedAccess(cc) _ <- NewStyle.function.hasEntitlement(failMsg = UserHasMissingRoles)(bankId.value, u.userId, canMaintainProductCollection) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) failMsg = s"$InvalidJsonFormat The Json body should be the $PutProductCollectionsV310 " @@ -2879,7 +2879,7 @@ trait APIMethods310 { case "banks" :: BankId(bankId) :: "product-collections" :: collectionCode :: Nil JsonGet _ => { cc => { for { - (_, callContext) <- authorizedAccess(UserNotLoggedIn, cc) + (_, callContext) <- authorizedAccess(cc) (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (payload, callContext) <- NewStyle.function.getProductCollectionItemsTree(collectionCode, bankId.value, callContext) } yield {