mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 18:46:46 +00:00
Merge branch 'OpenBankProject:develop' into develop
This commit is contained in:
commit
eda1076934
@ -39,7 +39,7 @@ import code.accountattribute.MappedAccountAttribute
|
||||
import code.accountholders.MapperAccountHolders
|
||||
import code.actorsystem.ObpActorSystem
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.ResourceDocs300.{ResourceDocs310, ResourceDocs400}
|
||||
import code.api.ResourceDocs1_4_0.ResourceDocs300.{ResourceDocs310, ResourceDocs400, ResourceDocs500}
|
||||
import code.api.ResourceDocs1_4_0._
|
||||
import code.api._
|
||||
import code.api.attributedefinition.AttributeDefinition
|
||||
@ -102,6 +102,7 @@ import code.apicollectionendpoint.ApiCollectionEndpoint
|
||||
import code.apicollection.ApiCollection
|
||||
import code.bankattribute.BankAttribute
|
||||
import code.connectormethod.ConnectorMethod
|
||||
import code.customeraccountlinks.CustomerAccountLink
|
||||
import code.dynamicMessageDoc.DynamicMessageDoc
|
||||
import code.dynamicResourceDoc.DynamicResourceDoc
|
||||
import code.endpointMapping.EndpointMapping
|
||||
@ -466,6 +467,7 @@ class Boot extends MdcLoggable {
|
||||
LiftRules.statelessDispatch.append(ResourceDocs300)
|
||||
LiftRules.statelessDispatch.append(ResourceDocs310)
|
||||
LiftRules.statelessDispatch.append(ResourceDocs400)
|
||||
LiftRules.statelessDispatch.append(ResourceDocs500)
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -725,8 +727,8 @@ class Boot extends MdcLoggable {
|
||||
val owner = Views.views.vend.getOrCreateSystemView(SYSTEM_OWNER_VIEW_ID).isDefined
|
||||
val auditor = Views.views.vend.getOrCreateSystemView(SYSTEM_AUDITOR_VIEW_ID).isDefined
|
||||
val accountant = Views.views.vend.getOrCreateSystemView(SYSTEM_ACCOUNTANT_VIEW_ID).isDefined
|
||||
val smallPaymentVerified = Views.views.vend.getOrCreateSystemView(SYSTEM_SMALL_PAYMENT_VERIFIED_VIEW_ID).isDefined
|
||||
val accountHolder = Views.views.vend.getOrCreateSystemView(SYSTEM_STAGE_ONE_VIEW_ID).isDefined
|
||||
val standard = Views.views.vend.getOrCreateSystemView(SYSTEM_STANDARD_VIEW_ID).isDefined
|
||||
val stageOne = Views.views.vend.getOrCreateSystemView(SYSTEM_STAGE_ONE_VIEW_ID).isDefined
|
||||
// Only create Firehose view if they are enabled at instance.
|
||||
val accountFirehose = if (ApiPropsWithAlias.allowAccountFirehose)
|
||||
Views.views.vend.getOrCreateSystemView(SYSTEM_FIREHOSE_VIEW_ID).isDefined
|
||||
@ -738,8 +740,8 @@ class Boot extends MdcLoggable {
|
||||
|System view ${SYSTEM_AUDITOR_VIEW_ID} exists/created at the instance: ${auditor}
|
||||
|System view ${SYSTEM_ACCOUNTANT_VIEW_ID} exists/created at the instance: ${accountant}
|
||||
|System view ${SYSTEM_FIREHOSE_VIEW_ID} exists/created at the instance: ${accountFirehose}
|
||||
|System view ${SYSTEM_SMALL_PAYMENT_VERIFIED_VIEW_ID} exists/created at the instance: ${smallPaymentVerified}
|
||||
|System view ${SYSTEM_STAGE_ONE_VIEW_ID} exists/created at the instance: ${accountHolder}
|
||||
|System view ${SYSTEM_STANDARD_VIEW_ID} exists/created at the instance: ${standard}
|
||||
|System view ${SYSTEM_STAGE_ONE_VIEW_ID} exists/created at the instance: ${stageOne}
|
||||
|""".stripMargin
|
||||
logger.info(comment)
|
||||
|
||||
@ -967,7 +969,8 @@ object ToSchemify {
|
||||
BankAttribute,
|
||||
RateLimiting,
|
||||
MappedCustomerDependant,
|
||||
AttributeDefinition
|
||||
AttributeDefinition,
|
||||
CustomerAccountLink
|
||||
)
|
||||
|
||||
// The following tables are accessed directly via Mapper / JDBC
|
||||
|
||||
@ -104,6 +104,22 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md
|
||||
ImplementationsResourceDocs.getResourceDocsObpV400,
|
||||
ImplementationsResourceDocs.getResourceDocsSwagger,
|
||||
ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp,
|
||||
// ImplementationsResourceDocs.getStaticResourceDocsObp
|
||||
)
|
||||
routes.foreach(route => {
|
||||
oauthServe(apiPrefix {
|
||||
route
|
||||
})
|
||||
})
|
||||
}
|
||||
// Hack to provide Resource Docs / Swagger on endpoints other than 1.4.0 where it is defined.
|
||||
object ResourceDocs500 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
|
||||
val version: ApiVersion = ApiVersion.v5_0_0 // = "4.0.0" // We match other api versions so API explorer can easily use the path.
|
||||
val versionStatus = "BLEEDING-EDGE"
|
||||
val routes = List(
|
||||
ImplementationsResourceDocs.getResourceDocsObpV400,
|
||||
ImplementationsResourceDocs.getResourceDocsSwagger,
|
||||
ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp,
|
||||
// ImplementationsResourceDocs.getStaticResourceDocsObp
|
||||
)
|
||||
routes.foreach(route => {
|
||||
|
||||
@ -4905,6 +4905,26 @@ object SwaggerDefinitionsJSON {
|
||||
card_attributes = List(cardAttributeCommons),
|
||||
brand = brandExample.value
|
||||
)
|
||||
|
||||
val createCustomerAccountLinkJson = CreateCustomerAccountLinkJson(
|
||||
customer_id = customerIdExample.value,
|
||||
account_id = accountIdExample.value,
|
||||
relationship_type= relationshipTypeExample.value
|
||||
)
|
||||
val updateCustomerAccountLinkJson = UpdateCustomerAccountLinkJson(
|
||||
relationship_type= relationshipTypeExample.value
|
||||
)
|
||||
|
||||
val customerAccountLinkJson = CustomerAccountLinkJson(
|
||||
customer_account_link_id = customerAccountLinkIdExample.value,
|
||||
customer_id = customerIdExample.value,
|
||||
account_id = accountIdExample.value,
|
||||
relationship_type= relationshipTypeExample.value
|
||||
)
|
||||
|
||||
val customerAccountLinksJson = CustomerAccountLinksJson(
|
||||
List(customerAccountLinkJson)
|
||||
)
|
||||
//The common error or success format.
|
||||
//Just some helper format to use in Json
|
||||
case class NotSupportedYet()
|
||||
|
||||
@ -22,18 +22,12 @@ object Constant extends MdcLoggable {
|
||||
// This is the part before the version. Do not change this default!
|
||||
final val ApiPathZero = APIUtil.getPropsValue("apiPathZero", ApiStandards.obp.toString)
|
||||
|
||||
//Set this to `owner`. This is fro legacy.for the existing accounts, we do not modify them, just keep them as it is
|
||||
//eg: one account, already have the owner view with bankId and accountId, so we keep it. actually it is a custom view,
|
||||
// but there is no underscore there.
|
||||
//But for new accounts, we only allow to create with with under score, and all the accounts will share the same System Views.
|
||||
final val CUSTOM_PUBLIC_VIEW_ID = "_public"
|
||||
// If two owner views exists OBP will return custom owner view. But from this commit custom owner views are forbidden.
|
||||
final val CUSTOM_OWNER_VIEW_ID = "owner" // Legacy custom owner view maybe called this but creation of new custom owner views is now disabled with this commit
|
||||
final val SYSTEM_OWNER_VIEW_ID = "owner" // From this commit new owner views are system views
|
||||
final val SYSTEM_AUDITOR_VIEW_ID = "auditor"
|
||||
final val SYSTEM_ACCOUNTANT_VIEW_ID = "accountant"
|
||||
final val SYSTEM_FIREHOSE_VIEW_ID = "firehose"
|
||||
final val SYSTEM_SMALL_PAYMENT_VERIFIED_VIEW_ID = "SmallPaymentVerified"
|
||||
final val SYSTEM_STANDARD_VIEW_ID = "standard"
|
||||
final val SYSTEM_STAGE_ONE_VIEW_ID = "StageOne"
|
||||
final val SYSTEM_READ_ACCOUNTS_BASIC_VIEW_ID = "ReadAccountsBasic"
|
||||
final val SYSTEM_READ_ACCOUNTS_DETAIL_VIEW_ID = "ReadAccountsDetail"
|
||||
|
||||
@ -3390,7 +3390,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
def isOwnerView(viewId: ViewId): Boolean = {
|
||||
viewId.value == SYSTEM_OWNER_VIEW_ID ||
|
||||
viewId.value == "_" + SYSTEM_OWNER_VIEW_ID || // New views named like this are forbidden from this commit
|
||||
viewId.value == CUSTOM_OWNER_VIEW_ID // New views named like this are forbidden from this commit
|
||||
viewId.value == SYSTEM_OWNER_VIEW_ID // New views named like this are forbidden from this commit
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -96,6 +96,12 @@ object ApiRole {
|
||||
|
||||
case class CanGetCustomer(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canGetCustomer = CanGetCustomer()
|
||||
|
||||
case class CanGetCustomerOverview(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canGetCustomerOverview = CanGetCustomerOverview()
|
||||
|
||||
case class CanGetCustomerOverviewFlat(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canGetCustomerOverviewFlat = CanGetCustomerOverviewFlat()
|
||||
|
||||
case class CanCreateCustomer(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canCreateCustomer = CanCreateCustomer()
|
||||
@ -243,6 +249,21 @@ object ApiRole {
|
||||
|
||||
case class CanGetCardsForBank(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canGetCardsForBank = CanGetCardsForBank()
|
||||
|
||||
case class CanCreateCustomerAccountLink(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canCreateCustomerAccountLink = CanCreateCustomerAccountLink()
|
||||
|
||||
case class CanUpdateCustomerAccountLink(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canUpdateCustomerAccountLink = CanUpdateCustomerAccountLink()
|
||||
|
||||
case class CanDeleteCustomerAccountLink(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canDeleteCustomerAccountLink = CanDeleteCustomerAccountLink()
|
||||
|
||||
case class CanGetCustomerAccountLink(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canGetCustomerAccountLink = CanGetCustomerAccountLink()
|
||||
|
||||
case class CanGetCustomerAccountLinks(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canGetCustomerAccountLinks = CanGetCustomerAccountLinks()
|
||||
|
||||
case class CanCreateBranch(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canCreateBranch = CanCreateBranch()
|
||||
|
||||
@ -142,7 +142,7 @@ object ErrorMessages {
|
||||
|
||||
val InvalidInternalRedirectUrl = "OBP-20018: Login failed, invalid internal redirectUrl."
|
||||
val UserNoOwnerView = "OBP-20019: User does not have access to owner view. "
|
||||
val InvalidCustomViewFormat = s"OBP-20020: View name must start with `_`. eg: _work, _life. Reserved names: $CUSTOM_OWNER_VIEW_ID "
|
||||
val InvalidCustomViewFormat = s"OBP-20020: View name must start with `_`. eg: _work, _life. "
|
||||
val SystemViewsCanNotBeModified = "OBP-20021: System Views can not be modified. Only the created views can be modified."
|
||||
val ViewDoesNotPermitAccess = "OBP-20022: View does not permit the access."
|
||||
|
||||
@ -287,7 +287,7 @@ object ErrorMessages {
|
||||
val CreateCardError = "OBP-30032: Could not insert the Card"
|
||||
val UpdateCardError = "OBP-30033: Could not update the Card"
|
||||
|
||||
val ViewIdNotSupported = "OBP-30034: This ViewId is do not supported. Only support four now: Owner, Accountant, Auditor, _Public."
|
||||
val ViewIdNotSupported = "OBP-30034: This ViewId is do not supported. Only support four now: Owner, Accountant, Auditor, StageOne, SmallPaymentVerified, _Public."
|
||||
|
||||
val UserCustomerLinkNotFound = "OBP-30035: User Customer Link not found"
|
||||
|
||||
@ -401,6 +401,7 @@ object ErrorMessages {
|
||||
|
||||
val InvalidCardNumber = "OBP-30200: Card not found. Please specify a valid value for CARD_NUMBER. "
|
||||
|
||||
val CustomerAccountLinkNotFound = "OBP-30204: Customer Account Link not found"
|
||||
|
||||
val EntitlementIsBankRole = "OBP-30205: This entitlement is a Bank Role. Please set bank_id to a valid bank id."
|
||||
val EntitlementIsSystemRole = "OBP-30206: This entitlement is a System Role. Please set bank_id to empty string."
|
||||
@ -428,6 +429,12 @@ object ErrorMessages {
|
||||
val EntitlementCannotBeGrantedGrantorIssue = "OBP-30221: Entitlement cannot be granted due to the grantor's insufficient privileges."
|
||||
|
||||
val CounterpartyNotFoundByRoutings = "OBP-30222: Counterparty not found. Please specify valid value for Routings."
|
||||
val AccountAlreadyExistsForCustomer = "OBP-30223: The Account is already linked to a Customer at the bank specified by BANK_ID"
|
||||
val CreateCustomerAccountLinkError = "OBP-30224: Could not create the customer account link."
|
||||
val CustomerAccountLinkNotFoundById = "OBP-30225: Customer Account Link not found. Please specify valid values for CUSTOMER_ACCOUNT_LINK_ID."
|
||||
val GetCustomerAccountLinksError = "OBP-30226: Could not get the customer account links."
|
||||
val UpdateCustomerAccountLinkError = "OBP-30227: Could not update the customer account link."
|
||||
val DeleteCustomerAccountLinkError = "OBP-30228: Could not delete the customer account link."
|
||||
|
||||
val CreateSystemViewError = "OBP-30250: Could not create the system view"
|
||||
val DeleteSystemViewError = "OBP-30251: Could not delete the system view"
|
||||
|
||||
@ -40,7 +40,10 @@ object ExampleValue {
|
||||
lazy val sessionIdExample = ConnectorField("b4e0352a-9a0f-4bfa-b30b-9003aa467f50", s"A string that MUST uniquely identify the session on this OBP instance, can be used in all cache. ")
|
||||
|
||||
lazy val userIdExample = ConnectorField("9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1", s"A string that MUST uniquely identify the user on this OBP instance.")
|
||||
glossaryItems += makeGlossaryItem("User.userId", userIdExample)
|
||||
glossaryItems += makeGlossaryItem("User.userId", userIdExample)
|
||||
|
||||
lazy val relationshipTypeExample = ConnectorField("Owner", s"Relationship between two parties.")
|
||||
glossaryItems += makeGlossaryItem("Customer.relationshipType", relationshipTypeExample)
|
||||
|
||||
|
||||
lazy val usernameExample = ConnectorField("felixsmith", s"The username the user uses to authenticate.")
|
||||
@ -59,6 +62,9 @@ object ExampleValue {
|
||||
|
||||
lazy val customerIdExample = ConnectorField("7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh", s"A non human friendly string that identifies the customer and is used in URLs. This SHOULD NOT be the customer number. The combination of customerId and bankId MUST be unique on an OBP instance. customerId SHOULD be unique on an OBP instance. Ideally customerId is a UUID. A mapping between customer number and customer id is kept in OBP.")
|
||||
glossaryItems += makeGlossaryItem("Customer.customerId", customerIdExample)
|
||||
|
||||
lazy val customerAccountLinkIdExample = ConnectorField("xyz8a7e4-6d02-40e3-a129-0b2bf89de8uh", s"A non human friendly string that identifies the Customer Account Link and is used in URLs. ")
|
||||
glossaryItems += makeGlossaryItem("Customer.customerAccountLinkId", customerAccountLinkIdExample)
|
||||
|
||||
lazy val customerAttributeId = ConnectorField("7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh", s"A non human friendly string that identifies the customer attribute and is used in URLs.")
|
||||
glossaryItems += makeGlossaryItem("Customer.customerAttributeId", customerAttributeId)
|
||||
|
||||
@ -3,7 +3,6 @@ package code.api.util
|
||||
|
||||
import java.util.Date
|
||||
import java.util.UUID.randomUUID
|
||||
|
||||
import akka.http.scaladsl.model.HttpMethod
|
||||
import code.DynamicEndpoint.{DynamicEndpointProvider, DynamicEndpointT}
|
||||
import code.api.{APIFailureNewStyle, Constant, JsonResponseException}
|
||||
@ -69,6 +68,7 @@ import code.api.v4_0_0.JSONFactory400
|
||||
import code.api.dynamic.endpoint.helper.DynamicEndpointHelper
|
||||
import code.bankattribute.BankAttribute
|
||||
import code.connectormethod.{ConnectorMethodProvider, JsonConnectorMethod}
|
||||
import code.customeraccountlinks.CustomerAccountLinkTrait
|
||||
import code.dynamicMessageDoc.{DynamicMessageDocProvider, JsonDynamicMessageDoc}
|
||||
import code.dynamicResourceDoc.{DynamicResourceDocProvider, JsonDynamicResourceDoc}
|
||||
import code.endpointMapping.{EndpointMappingProvider, EndpointMappingT}
|
||||
@ -3736,5 +3736,36 @@ object NewStyle extends MdcLoggable{
|
||||
i => (connectorEmptyResponse(i._1, callContext), i._2)
|
||||
}
|
||||
}
|
||||
|
||||
def createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String, callContext: Option[CallContext]): OBPReturnType[CustomerAccountLinkTrait] =
|
||||
Connector.connector.vend.createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String, callContext: Option[CallContext]) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, CreateCustomerAccountLinkError), i._2)
|
||||
}
|
||||
|
||||
def getCustomerAccountLinksByCustomerId(customerId: String, callContext: Option[CallContext]): OBPReturnType[List[CustomerAccountLinkTrait]] =
|
||||
Connector.connector.vend.getCustomerAccountLinksByCustomerId(customerId: String, callContext: Option[CallContext]) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, GetCustomerAccountLinksError), i._2)
|
||||
}
|
||||
|
||||
def getCustomerAccountLinksByAccountId(accountId: String, callContext: Option[CallContext]): OBPReturnType[List[CustomerAccountLinkTrait]] =
|
||||
Connector.connector.vend.getCustomerAccountLinksByAccountId(accountId: String, callContext: Option[CallContext]) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, GetCustomerAccountLinksError), i._2)
|
||||
}
|
||||
|
||||
def getCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]): OBPReturnType[CustomerAccountLinkTrait] =
|
||||
Connector.connector.vend.getCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, CustomerAccountLinkNotFoundById), i._2)
|
||||
}
|
||||
|
||||
def deleteCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]): OBPReturnType[Boolean] =
|
||||
Connector.connector.vend.deleteCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, DeleteCustomerAccountLinkError), i._2)
|
||||
}
|
||||
|
||||
def updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String, callContext: Option[CallContext]): OBPReturnType[CustomerAccountLinkTrait] =
|
||||
Connector.connector.vend.updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String, callContext: Option[CallContext]) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, UpdateCustomerAccountLinkError), i._2)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
50
obp-api/src/main/scala/code/api/util/NotificationUtil.scala
Normal file
50
obp-api/src/main/scala/code/api/util/NotificationUtil.scala
Normal file
@ -0,0 +1,50 @@
|
||||
package code.api.util
|
||||
|
||||
import code.api.Constant
|
||||
import code.entitlement.Entitlement
|
||||
import code.users.Users
|
||||
import code.util.Helper.MdcLoggable
|
||||
import com.openbankproject.commons.model.User
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.util.Mailer
|
||||
import net.liftweb.util.Mailer._
|
||||
|
||||
import scala.collection.immutable.List
|
||||
|
||||
object NotificationUtil extends MdcLoggable {
|
||||
def sendEmailRegardingAssignedRole(userId : String, entitlement: Entitlement): Unit = {
|
||||
val user = Users.users.vend.getUserByUserId(userId)
|
||||
sendEmailRegardingAssignedRole(user, entitlement)
|
||||
}
|
||||
def sendEmailRegardingAssignedRole(user: Box[User], entitlement: Entitlement): Unit = {
|
||||
val mailSent = for {
|
||||
user <- user
|
||||
from <- APIUtil.getPropsValue("mail.api.consumer.registered.sender.address") ?~ "Could not send mail: Missing props param for 'from'"
|
||||
} yield {
|
||||
val bodyOfMessage : String = s"""Dear ${user.name},
|
||||
|
|
||||
|You have been granted the entitlement to use ${entitlement.roleName} on ${Constant.HostName}
|
||||
|
|
||||
|Cheers
|
||||
|""".stripMargin
|
||||
val params = PlainMailBodyType(bodyOfMessage) :: List(To(user.emailAddress))
|
||||
val subjectOfMessage = "You have been granted the role"
|
||||
//this is an async call
|
||||
Mailer.sendMail(
|
||||
From(from),
|
||||
Subject(subjectOfMessage),
|
||||
params :_*
|
||||
)
|
||||
}
|
||||
if(mailSent.isEmpty) {
|
||||
val info =
|
||||
s"""
|
||||
|Sending email is omitted.
|
||||
|User: $user
|
||||
|Props mail.api.consumer.registered.sender.address: ${APIUtil.getPropsValue("mail.api.consumer.registered.sender.address")}
|
||||
|""".stripMargin
|
||||
this.logger.warn(info)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -408,7 +408,7 @@ object JSONFactory1_4_0 extends MdcLoggable{
|
||||
|
||||
if(findMatches.nonEmpty) {
|
||||
val urlParameters: List[String] = findMatches.toList.sorted
|
||||
val parametersDescription: List[String] = urlParameters.map(prepareDescription)
|
||||
val parametersDescription: List[String] = urlParameters.map(i => prepareDescription(i, Nil))
|
||||
parametersDescription.mkString("\n\n\n**URL Parameters:**", "", "\n")
|
||||
} else {
|
||||
""
|
||||
@ -420,31 +420,44 @@ object JSONFactory1_4_0 extends MdcLoggable{
|
||||
* @param parameter BANK_ID
|
||||
* @return [BANK_ID](/glossary#Bank.bank_id):gh.29.uk
|
||||
*/
|
||||
def prepareDescription(parameter: String): String = {
|
||||
def prepareDescription(parameter: String, types: List[(String, Boolean)]): String = {
|
||||
val glossaryItemTitle = getGlossaryItemTitle(parameter)
|
||||
val exampleFieldValue = getExampleFieldValue(parameter)
|
||||
def boldIfMandatory() = {
|
||||
types.exists(i => i._1 == parameter && i._2 == false) match {
|
||||
case true =>
|
||||
s"**$parameter**"
|
||||
case false =>
|
||||
s"$parameter"
|
||||
}
|
||||
}
|
||||
if(exampleFieldValue.contains(ExampleValue.NoExampleProvided)){
|
||||
""
|
||||
} else {
|
||||
s"""
|
||||
|
|
||||
|* [${parameter}](/glossary#$glossaryItemTitle): $exampleFieldValue
|
||||
|* [${boldIfMandatory()}](/glossary#$glossaryItemTitle): $exampleFieldValue
|
||||
|
|
||||
|""".stripMargin
|
||||
}
|
||||
}
|
||||
|
||||
def prepareJsonFieldDescription(jsonBody: scala.Product, jsonType: String): String = {
|
||||
|
||||
val jsonBodyJValue = jsonBody match {
|
||||
jsonBody.productIterator
|
||||
val (jsonBodyJValue: json.JValue, types) = jsonBody match {
|
||||
case JvalueCaseClass(jValue) =>
|
||||
jValue
|
||||
case _ => decompose(jsonBody)
|
||||
val types = Nil
|
||||
(jValue, types)
|
||||
case _ =>
|
||||
val types = jsonBody.getClass()
|
||||
.getDeclaredFields().toList
|
||||
.map(f => (f.getName(), f.getType().getCanonicalName().contains("Option")))
|
||||
(decompose(jsonBody), types)
|
||||
}
|
||||
|
||||
val jsonBodyFields =JsonUtils.collectFieldNames(jsonBodyJValue).keySet.toList.sorted
|
||||
|
||||
val jsonFieldsDescription = jsonBodyFields.map(prepareDescription)
|
||||
val jsonFieldsDescription = jsonBodyFields.map(i => prepareDescription(i, types))
|
||||
|
||||
val jsonTitleType = if (jsonType.contains("request")) "\n\n\n**JSON request body fields:**\n\n" else "\n\n\n**JSON response body fields:**\n\n"
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package code.api.v5_0_0
|
||||
|
||||
import java.util.Date
|
||||
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ApiRole._
|
||||
@ -38,6 +37,7 @@ import net.liftweb.util.Props
|
||||
import java.util.concurrent.ThreadLocalRandom
|
||||
|
||||
import code.accountattribute.AccountAttributeX
|
||||
import code.util.Helper.booleanToFuture
|
||||
|
||||
import scala.collection.immutable.{List, Nil}
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
@ -1040,21 +1040,17 @@ trait APIMethods500 {
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagKyc ,apiTagNewStyle),
|
||||
Some(List(canGetCustomer))
|
||||
Some(List(canGetCustomerOverview))
|
||||
)
|
||||
|
||||
lazy val getCustomerOverview : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "customers" :: "customer-number-query" :: "overview" :: Nil JsonPost json -> req => {
|
||||
cc =>
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
_ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, canGetCustomer, callContext)
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $PostCustomerOverviewJsonV500 "
|
||||
postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $PostCustomerOverviewJsonV500 ", 400, cc.callContext) {
|
||||
json.extract[PostCustomerOverviewJsonV500]
|
||||
}
|
||||
(customer, callContext) <- NewStyle.function.getCustomerByCustomerNumber(postedData.customer_number, bank.bankId, callContext)
|
||||
(customer, callContext) <- NewStyle.function.getCustomerByCustomerNumber(postedData.customer_number, bankId, cc.callContext)
|
||||
(customerAttributes, callContext) <- NewStyle.function.getCustomerAttributes(
|
||||
bankId,
|
||||
CustomerId(customer.customerId),
|
||||
@ -1093,21 +1089,17 @@ trait APIMethods500 {
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagKyc ,apiTagNewStyle),
|
||||
Some(List(canGetCustomer))
|
||||
Some(List(canGetCustomerOverviewFlat))
|
||||
)
|
||||
|
||||
lazy val getCustomerOverviewFlat : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "customers" :: "customer-number-query" :: "overview-flat" :: Nil JsonPost json -> req => {
|
||||
cc =>
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
_ <- NewStyle.function.hasEntitlement(bankId.value, u.userId, canGetCustomer, callContext)
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $PostCustomerOverviewJsonV500 "
|
||||
postedData <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $PostCustomerOverviewJsonV500 ", 400, cc.callContext) {
|
||||
json.extract[PostCustomerOverviewJsonV500]
|
||||
}
|
||||
(customer, callContext) <- NewStyle.function.getCustomerByCustomerNumber(postedData.customer_number, bank.bankId, callContext)
|
||||
(customer, callContext) <- NewStyle.function.getCustomerByCustomerNumber(postedData.customer_number, bankId, cc.callContext)
|
||||
(customerAttributes, callContext) <- NewStyle.function.getCustomerAttributes(
|
||||
bankId,
|
||||
CustomerId(customer.customerId),
|
||||
@ -1451,6 +1443,241 @@ trait APIMethods500 {
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
createCustomerAccountLink,
|
||||
implementedInApiVersion,
|
||||
nameOf(createCustomerAccountLink),
|
||||
"POST",
|
||||
"/banks/BANK_ID/customer-account-links",
|
||||
"Create Customer Account Link",
|
||||
s"""Link a Customer to a Account
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""",
|
||||
createCustomerAccountLinkJson,
|
||||
customerAccountLinkJson,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
BankAccountNotFound,
|
||||
InvalidJsonFormat,
|
||||
CustomerNotFoundByCustomerId,
|
||||
UserHasMissingRoles,
|
||||
AccountAlreadyExistsForCustomer,
|
||||
CreateCustomerAccountLinkError,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagAccount),
|
||||
Some(List(canCreateCustomerAccountLink)))
|
||||
lazy val createCustomerAccountLink : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId):: "customer-account-links" :: Nil JsonPost json -> _ => {
|
||||
cc =>
|
||||
for {
|
||||
(_, _,callContext) <- SS.userBank
|
||||
|
||||
postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $CreateCustomerAccountLinkJson ", 400, callContext) {
|
||||
json.extract[CreateCustomerAccountLinkJson]
|
||||
}
|
||||
(customer, callContext) <- NewStyle.function.getCustomerByCustomerId(postedData.customer_id, callContext)
|
||||
_ <- booleanToFuture(s"Bank of the customer specified by the CUSTOMER_ID(${customer.bankId}) has to matches BANK_ID(${bankId.value}) in URL", 400, callContext) {
|
||||
customer.bankId == bankId.value
|
||||
}
|
||||
(_, callContext) <- NewStyle.function.getBankAccount(bankId, AccountId(postedData.account_id), callContext)
|
||||
_ <- booleanToFuture("Field customer_id is not defined in the posted json!", 400, callContext) {
|
||||
postedData.customer_id.nonEmpty
|
||||
}
|
||||
(customerAccountLinkExists, callContext) <- Connector.connector.vend.getCustomerAccountLink(postedData.customer_id, postedData.account_id, callContext)
|
||||
_ <- booleanToFuture(AccountAlreadyExistsForCustomer, 400, callContext) {
|
||||
customerAccountLinkExists.isEmpty
|
||||
}
|
||||
(customerAccountLink, callContext) <- NewStyle.function.createCustomerAccountLink(postedData.customer_id, postedData.account_id, postedData.relationship_type, callContext)
|
||||
} yield {
|
||||
(JSONFactory500.createCustomerAccountLinkJson(customerAccountLink), HttpCode.`201`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
getCustomerAccountLinksByCustomerId,
|
||||
implementedInApiVersion,
|
||||
nameOf(getCustomerAccountLinksByCustomerId),
|
||||
"GET",
|
||||
"/banks/BANK_ID/customers/CUSTOMER_ID/customer-account-links",
|
||||
"Get Customer Account Links by CUSTOMER_ID",
|
||||
s""" Get Customer Account Links by CUSTOMER_ID
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""",
|
||||
EmptyBody,
|
||||
customerAccountLinksJson,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
CustomerNotFoundByCustomerId,
|
||||
UserHasMissingRoles,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagNewStyle),
|
||||
Some(List(canGetCustomerAccountLinks)))
|
||||
lazy val getCustomerAccountLinksByCustomerId : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "customers" :: customerId :: "customer-account-links" :: Nil JsonGet _ => {
|
||||
cc =>
|
||||
for {
|
||||
(customer, callContext) <- NewStyle.function.getCustomerByCustomerId(customerId, cc.callContext)
|
||||
_ <- booleanToFuture(s"Bank of the customer specified by the CUSTOMER_ID(${customer.bankId}) has to matches BANK_ID(${bankId.value}) in URL", 400, callContext) {
|
||||
customer.bankId == bankId.value
|
||||
}
|
||||
(customerAccountLinks, callContext) <- NewStyle.function.getCustomerAccountLinksByCustomerId(customerId, callContext)
|
||||
} yield {
|
||||
(JSONFactory500.createCustomerAccountLinksJon(customerAccountLinks), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
getCustomerAccountLinksByAccountId,
|
||||
implementedInApiVersion,
|
||||
nameOf(getCustomerAccountLinksByAccountId),
|
||||
"GET",
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/customer-account-links",
|
||||
"Get Customer Account Links by ACCOUNT_ID",
|
||||
s""" Get Customer Account Links by ACCOUNT_ID
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""",
|
||||
EmptyBody,
|
||||
customerAccountLinksJson,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
BankAccountNotFound,
|
||||
UserHasMissingRoles,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagNewStyle),
|
||||
Some(List(canGetCustomerAccountLinks)))
|
||||
lazy val getCustomerAccountLinksByAccountId : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: accountId :: "customer-account-links" :: Nil JsonGet _ => {
|
||||
cc =>
|
||||
for {
|
||||
(_, _,callContext) <- SS.userBank
|
||||
(customerAccountLinks, callContext) <- NewStyle.function.getCustomerAccountLinksByAccountId(accountId, callContext)
|
||||
} yield {
|
||||
(JSONFactory500.createCustomerAccountLinksJon(customerAccountLinks), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
getCustomerAccountLinkById,
|
||||
implementedInApiVersion,
|
||||
nameOf(getCustomerAccountLinkById),
|
||||
"GET",
|
||||
"/banks/BANK_ID/customer-account-links/CUSTOMER_ACCOUNT_LINK_ID",
|
||||
"Get Customer Account Link by Id",
|
||||
s""" Get Customer Account Link by CUSTOMER_ACCOUNT_LINK_ID
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""",
|
||||
EmptyBody,
|
||||
customerAccountLinkJson,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
UserHasMissingRoles,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagNewStyle),
|
||||
Some(List(canGetCustomerAccountLink)))
|
||||
lazy val getCustomerAccountLinkById : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "customer-account-links" :: customerAccountLinkId :: Nil JsonGet _ => {
|
||||
cc =>
|
||||
for {
|
||||
(_, _,callContext) <- SS.userBank
|
||||
(customerAccountLink, callContext) <- NewStyle.function.getCustomerAccountLinkById(customerAccountLinkId, callContext)
|
||||
} yield {
|
||||
(JSONFactory500.createCustomerAccountLinkJson(customerAccountLink), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
updateCustomerAccountLinkById,
|
||||
implementedInApiVersion,
|
||||
nameOf(updateCustomerAccountLinkById),
|
||||
"PUT",
|
||||
"/banks/BANK_ID/customer-account-links/CUSTOMER_ACCOUNT_LINK_ID",
|
||||
"Update Customer Account Link by Id",
|
||||
s""" Update Customer Account Link by CUSTOMER_ACCOUNT_LINK_ID
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""",
|
||||
updateCustomerAccountLinkJson,
|
||||
customerAccountLinkJson,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
UserHasMissingRoles,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagNewStyle),
|
||||
Some(List(canUpdateCustomerAccountLink)))
|
||||
lazy val updateCustomerAccountLinkById : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "customer-account-links" :: customerAccountLinkId :: Nil JsonPut json -> _ => {
|
||||
cc =>
|
||||
for {
|
||||
(Full(u), _,callContext) <- SS.userBank
|
||||
postedData <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $UpdateCustomerAccountLinkJson ", 400, callContext) {
|
||||
json.extract[UpdateCustomerAccountLinkJson]
|
||||
}
|
||||
(_, callContext) <- NewStyle.function.getCustomerAccountLinkById(customerAccountLinkId, callContext)
|
||||
|
||||
(customerAccountLink, callContext) <- NewStyle.function.updateCustomerAccountLinkById(customerAccountLinkId, postedData.relationship_type, callContext)
|
||||
} yield {
|
||||
(JSONFactory500.createCustomerAccountLinkJson(customerAccountLink), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
deleteCustomerAccountLinkById,
|
||||
implementedInApiVersion,
|
||||
nameOf(deleteCustomerAccountLinkById),
|
||||
"DELETE",
|
||||
"/banks/BANK_ID/customer-account-links/CUSTOMER_ACCOUNT_LINK_ID",
|
||||
"Delete Customer Account Link",
|
||||
s""" Delete Customer Account Link by CUSTOMER_ACCOUNT_LINK_ID
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|""",
|
||||
EmptyBody,
|
||||
EmptyBody,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
UserHasMissingRoles,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCustomer, apiTagNewStyle),
|
||||
Some(List(canDeleteCustomerAccountLink)))
|
||||
lazy val deleteCustomerAccountLinkById : OBPEndpoint = {
|
||||
case "banks" :: BankId(bankId) :: "customer-account-links" :: customerAccountLinkId :: Nil JsonDelete _ => {
|
||||
cc =>
|
||||
for {
|
||||
(Full(u), _,callContext) <- SS.userBank
|
||||
(_, callContext) <- NewStyle.function.getCustomerAccountLinkById(customerAccountLinkId, callContext)
|
||||
(deleted, callContext) <- NewStyle.function.deleteCustomerAccountLinkById(customerAccountLinkId, callContext)
|
||||
} yield {
|
||||
(Full(deleted), HttpCode.`204`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ package code.api.v5_0_0
|
||||
|
||||
import java.lang
|
||||
import java.util.Date
|
||||
|
||||
import code.api.util.APIUtil.{stringOptionOrNull, stringOrNull}
|
||||
import code.api.v1_2_1.BankRoutingJsonV121
|
||||
import code.api.v1_4_0.JSONFactory1_4_0.{CustomerFaceImageJson, MetaJsonV140}
|
||||
@ -40,6 +39,7 @@ import code.api.v3_0_0.{CustomerAttributeResponseJsonV300, JSONFactory300}
|
||||
import code.api.v3_1_0.{AccountAttributeResponseJson, AccountBasicV310, CustomerWithAttributesJsonV310, PhysicalCardWithAttributesJsonV310, PostConsentEntitlementJsonV310}
|
||||
import code.api.v4_0_0.BankAttributeBankResponseJsonV400
|
||||
import code.bankattribute.BankAttribute
|
||||
import code.customeraccountlinks.CustomerAccountLinkTrait
|
||||
import com.openbankproject.commons.model.{AccountAttribute, AccountRouting, AccountRoutingJsonV121, AmountOfMoneyJsonV121, Bank, BankAccount, CardAttribute, Customer, CustomerAttribute, PhysicalCardTrait, User, UserAuthContext, UserAuthContextUpdate, View, ViewBasic}
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
|
||||
@ -349,6 +349,28 @@ case class UpdatePhysicalCardJsonV500(
|
||||
brand: String
|
||||
)
|
||||
|
||||
case class CreateCustomerAccountLinkJson(
|
||||
customer_id: String,
|
||||
account_id: String,
|
||||
relationship_type: String
|
||||
)
|
||||
|
||||
case class UpdateCustomerAccountLinkJson(
|
||||
relationship_type: String
|
||||
)
|
||||
|
||||
case class CustomerAccountLinkJson(
|
||||
customer_account_link_id: String,
|
||||
customer_id: String,
|
||||
account_id: String,
|
||||
relationship_type: String
|
||||
)
|
||||
|
||||
case class CustomerAccountLinksJson(
|
||||
links:List[CustomerAccountLinkJson]
|
||||
)
|
||||
|
||||
|
||||
object JSONFactory500 {
|
||||
|
||||
def createUserAuthContextJson(userAuthContext: UserAuthContext): UserAuthContextJsonV500 = {
|
||||
@ -560,5 +582,19 @@ object JSONFactory500 {
|
||||
brand = stringOptionOrNull(card.brand)
|
||||
)
|
||||
}
|
||||
|
||||
def createCustomerAccountLinkJson(customerAccountLink: CustomerAccountLinkTrait): CustomerAccountLinkJson ={
|
||||
CustomerAccountLinkJson(
|
||||
customerAccountLink.customerAccountLinkId,
|
||||
customerAccountLink.customerId,
|
||||
customerAccountLink.accountId,
|
||||
customerAccountLink.relationshipType
|
||||
)
|
||||
}
|
||||
|
||||
def createCustomerAccountLinksJon(customerAccountLinks: List[CustomerAccountLinkTrait]): CustomerAccountLinksJson = {
|
||||
CustomerAccountLinksJson(customerAccountLinks.map(createCustomerAccountLinkJson))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package code.bankconnectors
|
||||
|
||||
import java.util.Date
|
||||
import java.util.UUID.randomUUID
|
||||
|
||||
import _root_.akka.http.scaladsl.model.HttpMethod
|
||||
import code.accountholders.{AccountHolders, MapperAccountHolders}
|
||||
import code.api.attributedefinition.AttributeDefinition
|
||||
@ -22,6 +21,7 @@ import code.bankconnectors.rest.RestConnector_vMar2019
|
||||
import code.bankconnectors.storedprocedure.StoredProcedureConnector_vDec2019
|
||||
import code.bankconnectors.vMay2019.KafkaMappedConnector_vMay2019
|
||||
import code.bankconnectors.vSept2018.KafkaMappedConnector_vSept2018
|
||||
import code.customeraccountlinks.CustomerAccountLinkTrait
|
||||
import code.endpointTag.EndpointTagT
|
||||
import code.fx.fx.TTL
|
||||
import code.management.ImporterAPI.ImporterTransaction
|
||||
@ -2574,5 +2574,19 @@ trait Connector extends MdcLoggable {
|
||||
message: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[String]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def getCustomerAccountLink(customerId: String, accountId: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAccountLinkTrait]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def getCustomerAccountLinksByCustomerId(customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[CustomerAccountLinkTrait]]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def getCustomerAccountLinksByAccountId(accountId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[CustomerAccountLinkTrait]]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def getCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAccountLinkTrait]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def deleteCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]): OBPReturnType[Box[Boolean]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAccountLinkTrait]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAccountLinkTrait]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package code.bankconnectors
|
||||
|
||||
import java.util.Date
|
||||
import java.util.UUID.randomUUID
|
||||
|
||||
import _root_.akka.http.scaladsl.model.HttpMethod
|
||||
import code.DynamicData.DynamicDataProvider
|
||||
import code.DynamicEndpoint.{DynamicEndpointProvider, DynamicEndpointT}
|
||||
@ -31,6 +30,7 @@ import code.cardattribute.CardAttributeX
|
||||
import code.cards.MappedPhysicalCard
|
||||
import code.context.{UserAuthContextProvider, UserAuthContextUpdateProvider}
|
||||
import code.customer._
|
||||
import code.customeraccountlinks.CustomerAccountLinkTrait
|
||||
import code.customeraddress.CustomerAddressX
|
||||
import code.customerattribute.CustomerAttributeX
|
||||
import code.database.authorisation.Authorisations
|
||||
@ -5560,5 +5560,34 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
} else
|
||||
Future{(Full("Success"), callContext)}
|
||||
}
|
||||
|
||||
|
||||
override def getCustomerAccountLink(customerId: String, accountId: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAccountLinkTrait]] = Future{
|
||||
(CustomerAccountLinkTrait.customerAccountLink.vend.getCustomerAccountLink(customerId, accountId), callContext)
|
||||
}
|
||||
|
||||
override def getCustomerAccountLinksByCustomerId(customerId: String, callContext: Option[CallContext]) = Future{
|
||||
(CustomerAccountLinkTrait.customerAccountLink.vend.getCustomerAccountLinksByCustomerId(customerId),callContext)
|
||||
}
|
||||
|
||||
|
||||
override def getCustomerAccountLinksByAccountId(accountId: String, callContext: Option[CallContext]): OBPReturnType[Box[List[CustomerAccountLinkTrait]]] = Future{
|
||||
(CustomerAccountLinkTrait.customerAccountLink.vend.getCustomerAccountLinksByAccountId(accountId),callContext)
|
||||
}
|
||||
|
||||
override def getCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]) = Future{
|
||||
(CustomerAccountLinkTrait.customerAccountLink.vend.getCustomerAccountLinkById(customerAccountLinkId),callContext)
|
||||
}
|
||||
|
||||
|
||||
override def deleteCustomerAccountLinkById(customerAccountLinkId: String, callContext: Option[CallContext]) =
|
||||
CustomerAccountLinkTrait.customerAccountLink.vend.deleteCustomerAccountLinkById(customerAccountLinkId).map {(_, callContext)}
|
||||
|
||||
override def updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String, callContext: Option[CallContext]) = Future{
|
||||
(CustomerAccountLinkTrait.customerAccountLink.vend.updateCustomerAccountLinkById(customerAccountLinkId, relationshipType),callContext)
|
||||
}
|
||||
|
||||
override def createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String, callContext: Option[CallContext]): OBPReturnType[Box[CustomerAccountLinkTrait]] = Future{
|
||||
CustomerAccountLinkTrait.customerAccountLink.vend.createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String) map { ( _, callContext) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package code.customeraccountlinks
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.remotedata.RemotedataCustomerAccountLinks
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.util.SimpleInjector
|
||||
|
||||
import scala.concurrent.Future
|
||||
|
||||
|
||||
object CustomerAccountLinkTrait extends SimpleInjector {
|
||||
|
||||
val customerAccountLink = new Inject(buildOne _) {}
|
||||
|
||||
def buildOne: CustomerAccountLinkProvider =
|
||||
APIUtil.getPropsAsBoolValue("use_akka", false) match {
|
||||
case false => MappedCustomerAccountLinkProvider
|
||||
case true => RemotedataCustomerAccountLinks // We will use Akka as a middleware
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
trait CustomerAccountLinkProvider {
|
||||
def createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String): Box[CustomerAccountLinkTrait]
|
||||
def getOrCreateCustomerAccountLink(customerId: String, accountId: String, relationshipType: String): Box[CustomerAccountLinkTrait]
|
||||
def getCustomerAccountLinkByCustomerId(customerId: String): Box[CustomerAccountLinkTrait]
|
||||
def getCustomerAccountLinksByCustomerId(customerId: String): Box[List[CustomerAccountLinkTrait]]
|
||||
def getCustomerAccountLinksByAccountId(accountId: String): Box[List[CustomerAccountLinkTrait]]
|
||||
def getCustomerAccountLink(customerId: String, accountId: String): Box[CustomerAccountLinkTrait]
|
||||
def getCustomerAccountLinkById(customerAccountLinkId: String): Box[CustomerAccountLinkTrait]
|
||||
def updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String): Box[CustomerAccountLinkTrait]
|
||||
def getCustomerAccountLinks: Box[List[CustomerAccountLinkTrait]]
|
||||
def bulkDeleteCustomerAccountLinks(): Boolean
|
||||
def deleteCustomerAccountLinkById(customerAccountLinkId: String): Future[Box[Boolean]]
|
||||
}
|
||||
|
||||
class RemotedataCustomerAccountLinkProviderCaseClass {
|
||||
case class createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String)
|
||||
case class getOrCreateCustomerAccountLink(customerId: String, accountId: String, relationshipType: String)
|
||||
case class getCustomerAccountLinkByCustomerId(customerId: String)
|
||||
case class getCustomerAccountLinksByCustomerId(customerId: String)
|
||||
case class getCustomerAccountLinksByAccountId(accountId: String)
|
||||
case class getCustomerAccountLinkById(customerAccountLinkId: String)
|
||||
case class updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String)
|
||||
case class getCustomerAccountLink(customerId: String, accountId: String)
|
||||
case class getCustomerAccountLinks()
|
||||
case class bulkDeleteCustomerAccountLinks()
|
||||
case class deleteCustomerAccountLinkById(customerAccountLinkId: String)
|
||||
}
|
||||
|
||||
object RemotedataCustomerAccountLinkProviderCaseClass extends RemotedataCustomerAccountLinkProviderCaseClass
|
||||
|
||||
trait CustomerAccountLinkTrait {
|
||||
def customerAccountLinkId: String
|
||||
def customerId: String
|
||||
def accountId: String
|
||||
def relationshipType: String
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package code.customeraccountlinks
|
||||
|
||||
import code.api.util.ErrorMessages
|
||||
import code.util.{MappedUUID, UUIDString}
|
||||
import net.liftweb.common.{Box, Empty, Failure, Full}
|
||||
import net.liftweb.mapper._
|
||||
|
||||
import scala.concurrent.Future
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import net.liftweb.util.Helpers.tryo
|
||||
|
||||
object MappedCustomerAccountLinkProvider extends CustomerAccountLinkProvider {
|
||||
def createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String): Box[CustomerAccountLinkTrait] = {
|
||||
tryo {
|
||||
CustomerAccountLink.create
|
||||
.CustomerId(customerId)
|
||||
.AccountId(accountId)
|
||||
.RelationshipType(relationshipType)
|
||||
.saveMe()
|
||||
}
|
||||
}
|
||||
def getOrCreateCustomerAccountLink(customerId: String, accountId: String, relationshipType: String): Box[CustomerAccountLinkTrait] = {
|
||||
getCustomerAccountLink(accountId, customerId) match {
|
||||
case Empty =>
|
||||
val createCustomerAccountLink = CustomerAccountLink.create
|
||||
.CustomerId(customerId)
|
||||
.AccountId(accountId)
|
||||
.RelationshipType(relationshipType)
|
||||
.saveMe()
|
||||
Some(createCustomerAccountLink)
|
||||
case everythingElse => everythingElse
|
||||
}
|
||||
}
|
||||
|
||||
def getCustomerAccountLinkByCustomerId(customerId: String): Box[CustomerAccountLinkTrait] = {
|
||||
CustomerAccountLink.find(
|
||||
By(CustomerAccountLink.CustomerId, customerId))
|
||||
}
|
||||
|
||||
def getCustomerAccountLinksByCustomerId(customerId: String): Box[List[CustomerAccountLinkTrait]] = {
|
||||
tryo {
|
||||
CustomerAccountLink.findAll(
|
||||
By(CustomerAccountLink.CustomerId, customerId))
|
||||
}
|
||||
}
|
||||
|
||||
def getCustomerAccountLinksByAccountId(accountId: String): Box[List[CustomerAccountLinkTrait]] = {
|
||||
tryo {
|
||||
CustomerAccountLink.findAll(
|
||||
By(CustomerAccountLink.AccountId, accountId)).sortWith(_.id.get < _.id.get)
|
||||
}
|
||||
}
|
||||
|
||||
def getCustomerAccountLink(customerId: String, accountId : String): Box[CustomerAccountLinkTrait] = {
|
||||
CustomerAccountLink.find(
|
||||
By(CustomerAccountLink.CustomerId, customerId),
|
||||
By(CustomerAccountLink.AccountId, accountId)
|
||||
)
|
||||
}
|
||||
|
||||
def getCustomerAccountLinkById(customerAccountLinkId: String): Box[CustomerAccountLinkTrait] = {
|
||||
CustomerAccountLink.find(
|
||||
By(CustomerAccountLink.CustomerAccountLinkId, customerAccountLinkId)
|
||||
)
|
||||
}
|
||||
|
||||
def updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String): Box[CustomerAccountLinkTrait] = {
|
||||
CustomerAccountLink.find(By(CustomerAccountLink.CustomerAccountLinkId, customerAccountLinkId)) match {
|
||||
case Full(t) => Full(t.RelationshipType(relationshipType).saveMe())
|
||||
case Empty => Empty ?~! ErrorMessages.CustomerAccountLinkNotFound
|
||||
case Failure(msg, exception, chain) => Failure(msg, exception, chain)
|
||||
}
|
||||
}
|
||||
|
||||
def getCustomerAccountLinks: Box[List[CustomerAccountLinkTrait]] = {
|
||||
tryo {CustomerAccountLink.findAll()}
|
||||
}
|
||||
|
||||
def bulkDeleteCustomerAccountLinks(): Boolean = {
|
||||
CustomerAccountLink.bulkDelete_!!()
|
||||
}
|
||||
|
||||
def deleteCustomerAccountLinkById(customerAccountLinkId: String): Future[Box[Boolean]] = {
|
||||
Future {
|
||||
CustomerAccountLink.find(By(CustomerAccountLink.CustomerAccountLinkId, customerAccountLinkId)) match {
|
||||
case Full(t) => Full(t.delete_!)
|
||||
case Empty => Empty ?~! ErrorMessages.CustomerAccountLinkNotFound
|
||||
case Failure(msg, exception, chain) => Failure(msg, exception, chain)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CustomerAccountLink extends CustomerAccountLinkTrait with LongKeyedMapper[CustomerAccountLink] with IdPK with CreatedUpdated {
|
||||
|
||||
def getSingleton = CustomerAccountLink
|
||||
|
||||
object CustomerAccountLinkId extends MappedUUID(this)
|
||||
object CustomerId extends UUIDString(this)
|
||||
object AccountId extends UUIDString(this)
|
||||
object RelationshipType extends MappedString(this, 255)
|
||||
|
||||
override def customerAccountLinkId: String = CustomerAccountLinkId.get
|
||||
override def customerId: String = CustomerId.get // id.toString
|
||||
override def accountId: String = AccountId.get
|
||||
override def relationshipType: String = RelationshipType.get
|
||||
}
|
||||
|
||||
object CustomerAccountLink extends CustomerAccountLink with LongKeyedMetaMapper[CustomerAccountLink] {
|
||||
override def dbIndexes = UniqueIndex(CustomerAccountLinkId) :: UniqueIndex(AccountId, CustomerId) :: super.dbIndexes
|
||||
|
||||
}
|
||||
@ -2,7 +2,7 @@ package code.entitlement
|
||||
|
||||
import code.api.dynamic.endpoint.helper.DynamicEntityInfo
|
||||
import code.api.util.ApiRole.{CanCreateEntitlementAtAnyBank, CanCreateEntitlementAtOneBank}
|
||||
import code.api.util.ErrorMessages
|
||||
import code.api.util.{ErrorMessages, NotificationUtil}
|
||||
import code.util.{MappedUUID, UUIDString}
|
||||
import net.liftweb.common.{Box, Failure, Full}
|
||||
import net.liftweb.mapper._
|
||||
@ -110,6 +110,8 @@ object MappedEntitlementsProvider extends EntitlementProvider {
|
||||
val addEntitlement: MappedEntitlement =
|
||||
MappedEntitlement.create.mBankId(bankId).mUserId(userId).mRoleName(roleName).mCreatedByProcess(createdByProcess)
|
||||
.saveMe()
|
||||
// When a role is Granted, we should send an email to the Recipient telling them they have been granted the role.
|
||||
NotificationUtil.sendEmailRegardingAssignedRole(userId: String, addEntitlement: Entitlement)
|
||||
Full(addEntitlement)
|
||||
}
|
||||
// Return a Box so we can handle errors later.
|
||||
|
||||
@ -93,7 +93,7 @@ case class UserExtended(val user: User) extends MdcLoggable {
|
||||
}
|
||||
|
||||
final def checkOwnerViewAccessAndReturnOwnerView(bankIdAccountId: BankIdAccountId) = {
|
||||
//Note: now SYSTEM_OWNER_VIEW_ID == CUSTOM_OWNER_VIEW_ID is the same `owner` so we only use one here.
|
||||
//Note: now SYSTEM_OWNER_VIEW_ID == SYSTEM_OWNER_VIEW_ID is the same `owner` so we only use one here.
|
||||
//And in side the checkViewAccessAndReturnView, it will first check the customer view and then will check system view.
|
||||
APIUtil.checkViewAccessAndReturnView(ViewId(SYSTEM_OWNER_VIEW_ID), bankIdAccountId, Some(this.user))
|
||||
}
|
||||
|
||||
@ -1419,9 +1419,43 @@ def restoreSomeSessions(): Unit = {
|
||||
Views.views.vend.grantAccessToCustomView(view.uid, user)
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
}
|
||||
//3rd: if the ids are not change, but views are changed, we still need compare the view for each account:
|
||||
if(cbsRemovedBankAccountIds.equals(csbNewBankAccountIds)) {
|
||||
for {
|
||||
bankAccountId <- obpBankAccountIds
|
||||
// we can not get the views from the `viewDefinition` table, because we can not delete system views at all. we need to read the view from accountAccess table.
|
||||
//obpViewsForAccount = MapperViews.availableViewsForAccount(bankAccountId).map(_.viewId.value)
|
||||
obpViewsForAccount = Views.views.vend.privateViewsUserCanAccessForAccount(user, bankAccountId).map(_.viewId.value)
|
||||
|
||||
cbsViewsForAccount = accountsHeld.find(account => account.bankId.equals(bankAccountId.bankId.value) && account.accountId.equals(bankAccountId.accountId.value)).map(_.viewsToGenerate).getOrElse(Nil)
|
||||
|
||||
//cbs removed these views, but OBP still contains the data for them, so we need to clean data in OBP side.
|
||||
cbsRemovedViewsForAccount = obpViewsForAccount diff cbsViewsForAccount
|
||||
_ = if(cbsRemovedViewsForAccount.nonEmpty){
|
||||
val cbsRemovedViewIdBankIdAccountIds = cbsRemovedViewsForAccount.map(view => ViewIdBankIdAccountId(ViewId(view), bankAccountId.bankId, bankAccountId.accountId))
|
||||
Views.views.vend.revokeAccessToMultipleViews(cbsRemovedViewIdBankIdAccountIds, user)
|
||||
cbsRemovedViewsForAccount.map(view =>Views.views.vend.removeCustomView(ViewId(view), bankAccountId))
|
||||
UserRefreshes.UserRefreshes.vend.createOrUpdateRefreshUser(user.userId)
|
||||
}
|
||||
//cbs has new views which are not in obp yet, we need to create new data for these accounts.
|
||||
csbNewViewsForAccount = cbsViewsForAccount diff obpViewsForAccount
|
||||
_ = if(csbNewViewsForAccount.nonEmpty){
|
||||
for{
|
||||
newViewForAccount <- csbNewViewsForAccount
|
||||
view <- Views.views.vend.getOrCreateAccountView(bankAccountId, newViewForAccount) //this method will return both system views and custom views back.
|
||||
}yield{
|
||||
if (view.isSystem)//if the view is a system view, we will call `grantAccessToSystemView`
|
||||
Views.views.vend.grantAccessToSystemView(bankAccountId.bankId, bankAccountId.accountId, view, user)
|
||||
else //otherwise, we will call `grantAccessToCustomView`
|
||||
Views.views.vend.grantAccessToCustomView(view.uid, user)
|
||||
UserRefreshes.UserRefreshes.vend.createOrUpdateRefreshUser(user.userId)
|
||||
}
|
||||
}
|
||||
} yield {
|
||||
bankAccountId
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Find the authUser by author user name(authUser and resourceUser are the same).
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package code.remotedata
|
||||
|
||||
import akka.pattern.ask
|
||||
import code.actorsystem.ObpActorInit
|
||||
import code.customeraccountlinks.{RemotedataCustomerAccountLinkProviderCaseClass, CustomerAccountLinkTrait, CustomerAccountLinkProvider}
|
||||
import net.liftweb.common._
|
||||
import scala.concurrent.Future
|
||||
|
||||
|
||||
object RemotedataCustomerAccountLinks extends ObpActorInit with CustomerAccountLinkProvider {
|
||||
|
||||
val cc = RemotedataCustomerAccountLinkProviderCaseClass
|
||||
|
||||
def createCustomerAccountLink(customerId: String, accountId: String, relationshipType: String) : Box[CustomerAccountLinkTrait] = getValueFromFuture(
|
||||
(actor ? cc.createCustomerAccountLink(accountId, customerId, relationshipType)).mapTo[Box[CustomerAccountLinkTrait]]
|
||||
)
|
||||
|
||||
def getOrCreateCustomerAccountLink(customerId: String, accountId: String, relationshipType: String) : Box[CustomerAccountLinkTrait] = getValueFromFuture(
|
||||
(actor ? cc.getOrCreateCustomerAccountLink(accountId, customerId, relationshipType)).mapTo[Box[CustomerAccountLinkTrait]]
|
||||
)
|
||||
|
||||
def getCustomerAccountLinkByCustomerId(customerId: String): Box[CustomerAccountLinkTrait] = getValueFromFuture(
|
||||
(actor ? cc.getCustomerAccountLinkByCustomerId(customerId)).mapTo[Box[CustomerAccountLinkTrait]]
|
||||
)
|
||||
def getCustomerAccountLinksByCustomerId(customerId: String): Box[List[CustomerAccountLinkTrait]] = getValueFromFuture(
|
||||
(actor ? cc.getCustomerAccountLinksByCustomerId(customerId)).mapTo[Box[List[CustomerAccountLinkTrait]]]
|
||||
)
|
||||
|
||||
def getCustomerAccountLinksByAccountId(accountId: String): Box[List[CustomerAccountLinkTrait]] = getValueFromFuture(
|
||||
(actor ? cc.getCustomerAccountLinksByAccountId(accountId)).mapTo[Box[List[CustomerAccountLinkTrait]]]
|
||||
)
|
||||
|
||||
def getCustomerAccountLinkById(customerAccountLinkId: String): Box[CustomerAccountLinkTrait] = getValueFromFuture(
|
||||
(actor ? cc.getCustomerAccountLinkById(customerAccountLinkId)).mapTo[Box[CustomerAccountLinkTrait]]
|
||||
)
|
||||
|
||||
def updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String): Box[CustomerAccountLinkTrait] = getValueFromFuture(
|
||||
(actor ? cc.updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String)).mapTo[Box[CustomerAccountLinkTrait]]
|
||||
)
|
||||
|
||||
def getCustomerAccountLink(customerId: String, accountId: String): Box[CustomerAccountLinkTrait] = getValueFromFuture(
|
||||
(actor ? cc.getCustomerAccountLink(accountId, customerId)).mapTo[Box[CustomerAccountLinkTrait]]
|
||||
)
|
||||
|
||||
def getCustomerAccountLinks: Box[List[CustomerAccountLinkTrait]] = getValueFromFuture(
|
||||
(actor ? cc.getCustomerAccountLinks()).mapTo[Box[List[CustomerAccountLinkTrait]]]
|
||||
)
|
||||
|
||||
def bulkDeleteCustomerAccountLinks(): Boolean = getValueFromFuture(
|
||||
(actor ? cc.bulkDeleteCustomerAccountLinks()).mapTo[Boolean]
|
||||
)
|
||||
def deleteCustomerAccountLinkById(customerAccountLinkId: String): Future[Box[Boolean]] =
|
||||
(actor ? cc.deleteCustomerAccountLinkById(customerAccountLinkId)).mapTo[Box[Boolean]]
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package code.remotedata
|
||||
|
||||
import akka.actor.Actor
|
||||
import akka.pattern.pipe
|
||||
import code.actorsystem.ObpActorHelper
|
||||
import code.customeraccountlinks.{MappedCustomerAccountLinkProvider, RemotedataCustomerAccountLinkProviderCaseClass}
|
||||
import code.util.Helper.MdcLoggable
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
|
||||
class RemotedataCustomerAccountLinksActor extends Actor with ObpActorHelper with MdcLoggable {
|
||||
|
||||
val mapper = MappedCustomerAccountLinkProvider
|
||||
val cc = RemotedataCustomerAccountLinkProviderCaseClass
|
||||
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
|
||||
case cc.createCustomerAccountLink(customerId: String, accountId: String, relationshipType) =>
|
||||
logger.debug(s"createCustomerAccountLink($accountId, $relationshipType)")
|
||||
sender ! (mapper.createCustomerAccountLink(accountId, customerId, relationshipType))
|
||||
|
||||
case cc.getOrCreateCustomerAccountLink(customerId: String, accountId: String, relationshipType) =>
|
||||
logger.debug(s"getOrCreateCustomerAccountLink($accountId, $relationshipType)")
|
||||
sender ! (mapper.getOrCreateCustomerAccountLink(accountId, customerId, relationshipType))
|
||||
|
||||
case cc.getCustomerAccountLinkByCustomerId(customerId: String) =>
|
||||
logger.debug(s"getCustomerAccountLinkByCustomerId($customerId)")
|
||||
sender ! (mapper.getCustomerAccountLinkByCustomerId(customerId))
|
||||
|
||||
case cc.getCustomerAccountLinksByCustomerId(customerId: String) =>
|
||||
logger.debug(s"getCustomerAccountLinksByCustomerId($customerId)")
|
||||
sender ! (mapper.getCustomerAccountLinksByCustomerId(customerId))
|
||||
|
||||
case cc.getCustomerAccountLinksByAccountId(accountId: String) =>
|
||||
logger.debug(s"getCustomerAccountLinksByAccountId($accountId)")
|
||||
sender ! (mapper.getCustomerAccountLinksByAccountId(accountId))
|
||||
|
||||
case cc.getCustomerAccountLinkById(customerAccountLinkId: String)=>
|
||||
logger.debug(s"getCustomerAccountLinkById($customerAccountLinkId)")
|
||||
sender ! (mapper.getCustomerAccountLinkById(customerAccountLinkId))
|
||||
|
||||
case cc.updateCustomerAccountLinkById(customerAccountLinkId: String, relationshipType: String)=>
|
||||
logger.debug(s"updateCustomerAccountLinkById($customerAccountLinkId, $relationshipType)")
|
||||
sender ! (mapper.updateCustomerAccountLinkById(customerAccountLinkId, relationshipType))
|
||||
|
||||
case cc.getCustomerAccountLink(customerId: String, accountId: String) =>
|
||||
logger.debug(s"getCustomerAccountLink($accountId, $customerId)")
|
||||
sender ! (mapper.getCustomerAccountLink(accountId, customerId))
|
||||
|
||||
case cc.getCustomerAccountLinks() =>
|
||||
logger.debug(s"getCustomerAccountLinks()")
|
||||
sender ! (mapper.getCustomerAccountLinks)
|
||||
|
||||
case cc.bulkDeleteCustomerAccountLinks() =>
|
||||
logger.debug(s"bulkDeleteCustomerAccountLinks()")
|
||||
sender ! (mapper.bulkDeleteCustomerAccountLinks())
|
||||
|
||||
case cc.deleteCustomerAccountLinkById(customerAccountLinkId) =>
|
||||
logger.debug(s"deleteCustomerAccountLink($customerAccountLinkId)")
|
||||
mapper.deleteCustomerAccountLinkById(customerAccountLinkId) pipeTo sender
|
||||
|
||||
case message => logger.warn("[AKKA ACTOR ERROR - REQUEST NOT RECOGNIZED] " + message)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
|
||||
|
||||
def canRevokeAccess(viewDefinition: ViewDefinition, user : User) : Boolean = {
|
||||
if(viewDefinition.viewId == ViewId(CUSTOM_OWNER_VIEW_ID)) {
|
||||
if(viewDefinition.viewId == ViewId(SYSTEM_OWNER_VIEW_ID)) {
|
||||
//if the user is an account holder, we can't revoke access to the owner view
|
||||
val accountHolders = MapperAccountHolders.getAccountHolders(viewDefinition.bankId, viewDefinition.accountId)
|
||||
if(accountHolders.map(h => h.userPrimaryKey).contains(user.userPrimaryKey)) {
|
||||
@ -565,7 +565,8 @@ object MapperViews extends Views with MdcLoggable {
|
||||
val publicView = CUSTOM_PUBLIC_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val accountantsView = SYSTEM_ACCOUNTANT_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val auditorsView = SYSTEM_AUDITOR_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val smallPaymentVerifiedView = SYSTEM_SMALL_PAYMENT_VERIFIED_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val standardView = SYSTEM_STANDARD_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val stageOneView = SYSTEM_STAGE_ONE_VIEW_ID.toLowerCase.equals(viewId.toLowerCase)
|
||||
|
||||
val theView =
|
||||
if (ownerView)
|
||||
@ -576,8 +577,10 @@ object MapperViews extends Views with MdcLoggable {
|
||||
getOrCreateSystemView(SYSTEM_ACCOUNTANT_VIEW_ID)
|
||||
else if (auditorsView)
|
||||
getOrCreateSystemView(SYSTEM_AUDITOR_VIEW_ID)
|
||||
else if (smallPaymentVerifiedView)
|
||||
getOrCreateSystemView(SYSTEM_SMALL_PAYMENT_VERIFIED_VIEW_ID)
|
||||
else if (standardView)
|
||||
getOrCreateSystemView(SYSTEM_STANDARD_VIEW_ID)
|
||||
else if (stageOneView)
|
||||
getOrCreateSystemView(SYSTEM_STAGE_ONE_VIEW_ID)
|
||||
else {
|
||||
logger.error(ViewIdNotSupported+ s"Your input viewId is :$viewId")
|
||||
Failure(ViewIdNotSupported+ s"Your input viewId is :$viewId")
|
||||
@ -589,7 +592,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
}
|
||||
|
||||
def getOrCreateOwnerView(bankId: BankId, accountId: AccountId, description: String = "Owner View") : Box[View] = {
|
||||
getExistingView(bankId, accountId, CUSTOM_OWNER_VIEW_ID) match {
|
||||
getExistingView(bankId, accountId, SYSTEM_OWNER_VIEW_ID) match {
|
||||
case Empty => createDefaultOwnerView(bankId, accountId, description)
|
||||
case Full(v) => Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
@ -656,7 +659,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
isSystem_(false).
|
||||
isFirehose_(false).
|
||||
name_("_" + randomString(5)).
|
||||
metadataView_(CUSTOM_OWNER_VIEW_ID).
|
||||
metadataView_(SYSTEM_OWNER_VIEW_ID).
|
||||
description_(randomString(3)).
|
||||
view_id("_" + randomString(3)).
|
||||
isPublic_(false).
|
||||
@ -813,7 +816,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
.bank_id(bankId.value)
|
||||
.account_id(accountId.value)
|
||||
.name_("Owner")
|
||||
.view_id(CUSTOM_OWNER_VIEW_ID)
|
||||
.view_id(SYSTEM_OWNER_VIEW_ID)
|
||||
.description_(description)
|
||||
.isPublic_(false) //(default is false anyways)
|
||||
.usePrivateAliasIfOneExists_(false) //(default is false anyways)
|
||||
|
||||
@ -78,6 +78,26 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with
|
||||
|
||||
|
||||
feature(s"test ${ApiEndpoint1.name} ") {
|
||||
scenario(s"We will test ${ApiEndpoint1.name} Api -v5.0.0", ApiEndpoint1, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v5.0.0" / "obp").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
And("We should get 200 and the response can be extract to case classes")
|
||||
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
|
||||
responseGetObp.code should equal(200)
|
||||
//This should not throw any exceptions
|
||||
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
|
||||
}
|
||||
|
||||
scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv5.0.0", ApiEndpoint1, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "OBPv5.0.0" / "obp").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
And("We should get 200 and the response can be extract to case classes")
|
||||
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
|
||||
responseGetObp.code should equal(200)
|
||||
//This should not throw any exceptions
|
||||
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
|
||||
}
|
||||
|
||||
scenario(s"We will test ${ApiEndpoint1.name} Api -v4.0.0", ApiEndpoint1, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v4.0.0" / "obp").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
@ -336,6 +356,30 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with
|
||||
}
|
||||
|
||||
feature(s"test ${ApiEndpoint2.name} ") {
|
||||
scenario(s"We will test ${ApiEndpoint2.name} Api - v5.0.0/v5.0.0 ", ApiEndpoint2, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v5.0.0" / "swagger").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
And("We should get 200 and the response can be extract to case classes")
|
||||
responseGetObp.code should equal(200)
|
||||
val swaggerJsonString = json.compactRender(responseGetObp.body)
|
||||
val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString)
|
||||
val errors = validatedSwaggerResult._1
|
||||
if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString")
|
||||
errors.isEmpty should be (true)
|
||||
}
|
||||
|
||||
scenario(s"We will test ${ApiEndpoint2.name} Api - v5.0.0/v4.0.0", ApiEndpoint2, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v4.0.0" / "swagger").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
And("We should get 200 and the response can be extract to case classes")
|
||||
responseGetObp.code should equal(200)
|
||||
val swaggerJsonString = json.compactRender(responseGetObp.body)
|
||||
val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString)
|
||||
val errors = validatedSwaggerResult._1
|
||||
if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString")
|
||||
errors.isEmpty should be (true)
|
||||
}
|
||||
|
||||
scenario(s"We will test ${ApiEndpoint2.name} Api - v4.0.0", ApiEndpoint2, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v4.0.0" / "swagger").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
@ -445,6 +489,16 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with
|
||||
}
|
||||
|
||||
feature(s"test ${ApiEndpoint3.name} ") {
|
||||
scenario(s"We will test ${ApiEndpoint3.name} Api -v5.0.0/v4.0.0", ApiEndpoint1, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v5.0.0" / "obp").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
And("We should get 200 and the response can be extract to case classes")
|
||||
val responseDocs = responseGetObp.body.extract[ResourceDocsJson]
|
||||
responseGetObp.code should equal(200)
|
||||
//This should not throw any exceptions
|
||||
responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description))
|
||||
}
|
||||
|
||||
scenario(s"We will test ${ApiEndpoint3.name} Api -v4.0.0", ApiEndpoint1, VersionOfApi) {
|
||||
val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v4.0.0" / "obp").GET
|
||||
val responseGetObp = makeGetRequest(requestGetObp)
|
||||
|
||||
@ -11,5 +11,6 @@ trait ResourceDocsV140ServerSetup extends ServerSetupWithTestData {
|
||||
def ResourceDocsV3_0Request = baseRequest / "obp" / "v3.0.0"
|
||||
def ResourceDocsV3_1Request = baseRequest / "obp" / "v3.1.0"
|
||||
def ResourceDocsV4_0Request = baseRequest / "obp" / "v4.0.0"
|
||||
def ResourceDocsV5_0Request = baseRequest / "obp" / "v5.0.0"
|
||||
|
||||
}
|
||||
|
||||
@ -172,8 +172,8 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
}
|
||||
|
||||
//In default for each account, we create 6 views. But for this method, it only return the random view one, not others.
|
||||
//also see `@def createRandomView(bankId: BankId, accountId: AccountId)`. we prepare the metadataView_(CUSTOM_OWNER_VIEW_ID) there.
|
||||
//this metadataView_(CUSTOM_OWNER_VIEW_ID) is used for some tests.
|
||||
//also see `@def createRandomView(bankId: BankId, accountId: AccountId)`. we prepare the metadataView_(SYSTEM_OWNER_VIEW_ID) there.
|
||||
//this metadataView_(SYSTEM_OWNER_VIEW_ID) is used for some tests.
|
||||
def getTheRandomView(bankId: String, account: AccountJSON) : String = {
|
||||
val request = v1_2_1Request / "banks" / bankId / "accounts" / account.id / "views" <@(consumer, token1)
|
||||
val reply = makeGetRequest(request)
|
||||
@ -1672,7 +1672,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
def getOwnerView() = {
|
||||
val views = getAccountViews(bankId, bankAccount.id, user1).body.extract[ViewsJSONV121].views
|
||||
views.find(v => v.id == CUSTOM_OWNER_VIEW_ID)
|
||||
views.find(v => v.id == SYSTEM_OWNER_VIEW_ID)
|
||||
}
|
||||
|
||||
Given("The owner view exists")
|
||||
@ -2012,7 +2012,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val viewId = CUSTOM_OWNER_VIEW_ID
|
||||
val viewId = SYSTEM_OWNER_VIEW_ID
|
||||
val userId1 = resourceUser2.idGivenByProvider
|
||||
val userId2 = resourceUser2.idGivenByProvider
|
||||
grantUserAccessToView(bankId, bankAccount.id, userId1, viewId, user1)
|
||||
@ -2040,7 +2040,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("A user is the account holder of an account (and has access to the owner view)")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val ownerViewId = ViewId(CUSTOM_OWNER_VIEW_ID)
|
||||
val ownerViewId = ViewId(SYSTEM_OWNER_VIEW_ID)
|
||||
|
||||
//set up: make authuser3 the account holder and make sure they have access to the owner view
|
||||
grantUserAccessToView(bankId, bankAccount.id, resourceUser3.idGivenByProvider, ownerViewId.value, user1)
|
||||
@ -2134,7 +2134,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val viewId = ViewId(CUSTOM_OWNER_VIEW_ID)
|
||||
val viewId = ViewId(SYSTEM_OWNER_VIEW_ID)
|
||||
val view = Views.views.vend.customView(viewId, BankIdAccountId(BankId(bankId), AccountId(bankAccount.id))).openOrThrowException(attemptedToOpenAnEmptyBox)
|
||||
val userId = resourceUser1.idGivenByProvider
|
||||
|
||||
@ -2156,7 +2156,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("A user is the account holder of an account (and has access to the owner view)")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val ownerViewId = CUSTOM_OWNER_VIEW_ID
|
||||
val ownerViewId = SYSTEM_OWNER_VIEW_ID
|
||||
|
||||
//set up: make authuser3 the account holder and make sure they have access to the owner view
|
||||
grantUserAccessToView(bankId, bankAccount.id, resourceUser3.idGivenByProvider, ownerViewId, user1)
|
||||
@ -2169,7 +2169,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
reply.code should equal (204)
|
||||
|
||||
And("The user should have had his access revoked")
|
||||
val view = Views.views.vend.customView(ViewId(CUSTOM_OWNER_VIEW_ID), BankIdAccountId(BankId(bankId), AccountId(bankAccount.id))).openOrThrowException(attemptedToOpenAnEmptyBox)
|
||||
val view = Views.views.vend.customView(ViewId(SYSTEM_OWNER_VIEW_ID), BankIdAccountId(BankId(bankId), AccountId(bankAccount.id))).openOrThrowException(attemptedToOpenAnEmptyBox)
|
||||
Views.views.vend.getOwners(view).toList should not contain (resourceUser3)
|
||||
}
|
||||
}
|
||||
@ -4810,7 +4810,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
When("the request is sent")
|
||||
val randomNarrative = randomString(20)
|
||||
@ -4828,7 +4828,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will not use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
When("the request is sent")
|
||||
@ -4849,7 +4849,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
When("the request is sent")
|
||||
@ -4868,7 +4868,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
When("the request is sent")
|
||||
@ -4903,7 +4903,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
When("the request is sent")
|
||||
val randomNarrative = randomString(20)
|
||||
@ -4921,7 +4921,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will not use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
When("the request is sent")
|
||||
@ -4940,7 +4940,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
When("the request is sent")
|
||||
@ -4976,7 +4976,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set a narrative first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1)
|
||||
@ -4994,7 +4994,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will not use an access token and will set a narrative first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1)
|
||||
@ -5012,7 +5012,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set a narrative first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomNarrative = randomString(20)
|
||||
postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1)
|
||||
@ -5326,7 +5326,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set a comment first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val ownerViewId = CUSTOM_OWNER_VIEW_ID
|
||||
val ownerViewId = SYSTEM_OWNER_VIEW_ID
|
||||
val notOwnerViewId = getTheRandomView(bankId, bankAccount)
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, notOwnerViewId)
|
||||
|
||||
@ -5665,7 +5665,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
scenario("we will get,post and delete view(not owner) Tag of one random transaction if we set the metedata_view = owner", API1_2_1, MeataViewTag) {
|
||||
|
||||
Given("We will use an access token and will set a tag first")
|
||||
val ownerViewId = CUSTOM_OWNER_VIEW_ID
|
||||
val ownerViewId = SYSTEM_OWNER_VIEW_ID
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val notOwnerViewId = getTheRandomView(bankId, bankAccount)
|
||||
@ -6005,7 +6005,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
scenario("we will get,post and delete view(not owner) iamge of transaction if we set the metedata_view = owner", API1_2_1, MeataViewImage) {
|
||||
|
||||
Given("We will use an access token and will set a image first")
|
||||
val ownerViewId = CUSTOM_OWNER_VIEW_ID
|
||||
val ownerViewId = SYSTEM_OWNER_VIEW_ID
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val notOwnerViewId = getTheRandomView(bankId, bankAccount)
|
||||
@ -6392,7 +6392,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
scenario("we will get,post and delete view(not owner) where of one random transaction if we set the metedata_view = owner", API1_2_1, MeataViewWhere) {
|
||||
|
||||
Given("We will use an access token and will set a where first")
|
||||
val ownerViewId = CUSTOM_OWNER_VIEW_ID
|
||||
val ownerViewId = SYSTEM_OWNER_VIEW_ID
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val notOwnerViewId = getTheRandomView(bankId, bankAccount)
|
||||
@ -6525,7 +6525,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
When("the request is sent")
|
||||
val randomLabel = randomString(20)
|
||||
val postReply = updateAccountLabel(bankId, bankAccount.id, randomLabel, user1)
|
||||
@ -6545,7 +6545,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
When("the request is sent")
|
||||
val randomLabel = randomString(20)
|
||||
val postReply = updateAccountLabel(bankId, bankAccount.id, randomLabel, None)
|
||||
|
||||
@ -47,7 +47,7 @@ class JSONFactory1_4_0Test extends V140ServerSetup with DefaultUsers {
|
||||
feature("Test JSONFactory1_4_0") {
|
||||
|
||||
scenario("prepareDescription should work well, extract the parameters from URL") {
|
||||
val description = JSONFactory1_4_0.prepareDescription("BANK_ID")
|
||||
val description = JSONFactory1_4_0.prepareDescription("BANK_ID", Nil)
|
||||
description.contains("[BANK_ID](/glossary#Bank.bank_id): gh.29.uk") should be (true)
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
object TransactionRequest extends Tag("transactionRequests")
|
||||
|
||||
feature("we can make transaction requests") {
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
|
||||
def transactionCount(accounts: BankAccount*) : Int = {
|
||||
accounts.foldLeft(0)((accumulator, account) => {
|
||||
@ -75,7 +75,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest
|
||||
var request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -105,7 +105,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -126,7 +126,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction (since no challenge)
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -205,7 +205,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest API method
|
||||
var request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@ (user1)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -240,7 +240,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -261,7 +261,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
//call answerTransactionRequestChallenge, give a false answer
|
||||
var answerJson = ChallengeAnswerJSON(id = challenge_id, answer = "hello") //wrong answer, not a number
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transId / "challenge").POST <@ (user1)
|
||||
response = makePostRequest(request, write(answerJson))
|
||||
Then("we should get a 400 bad request code")
|
||||
response.code should equal(400)
|
||||
@ -271,7 +271,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
//call answerTransactionRequestChallenge again, give a good answer
|
||||
answerJson = ChallengeAnswerJSON(id = challenge_id, answer = "12345") //wrong answer, not a number
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transId / "challenge").POST <@ (user1)
|
||||
response = makePostRequest(request, write(answerJson))
|
||||
Then("we should get a 202 accepted code")
|
||||
response.code should equal(202)
|
||||
@ -291,7 +291,7 @@ class TransactionRequestsTest extends V140ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
|
||||
@ -26,7 +26,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
object TransactionRequest extends Tag("transactionRequests")
|
||||
|
||||
feature("we can make transaction requests") {
|
||||
val view = CUSTOM_OWNER_VIEW_ID
|
||||
val view = SYSTEM_OWNER_VIEW_ID
|
||||
|
||||
def transactionCount(accounts: BankAccount*) : Int = {
|
||||
accounts.foldLeft(0)((accumulator, account) => {
|
||||
@ -84,7 +84,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest
|
||||
var request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user3)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user3)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -121,7 +121,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -145,7 +145,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction (since no challenge)
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -228,7 +228,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest
|
||||
var request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -262,7 +262,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -286,7 +286,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction (since no challenge)
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -354,7 +354,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest with a user without owner view access
|
||||
val request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user2)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user2)
|
||||
val response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 400 created code")
|
||||
response.code should equal(400)
|
||||
@ -414,7 +414,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest
|
||||
val request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@ (user3)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@ (user3)
|
||||
val response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 400 created code")
|
||||
response.code should equal(400)
|
||||
@ -494,7 +494,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest
|
||||
var request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -529,7 +529,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -550,7 +550,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction (since no challenge)
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -585,7 +585,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction (since no challenge)
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / toAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -689,7 +689,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest API method
|
||||
var request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@ (user1)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -724,7 +724,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -745,7 +745,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
//call answerTransactionRequestChallenge, give a false answer
|
||||
var answerJson = ChallengeAnswerJSON(id = challenge_id, answer = "hello") //wrong answer, not a number
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
response = makePostRequest(request, write(answerJson))
|
||||
Then("we should get a 400 bad request code")
|
||||
response.code should equal(400)
|
||||
@ -755,7 +755,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
//call answerTransactionRequestChallenge again, give a good answer
|
||||
answerJson = ChallengeAnswerJSON(id = challenge_id, answer = "12345") //good answer, not a number
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
response = makePostRequest(request, write(answerJson))
|
||||
Then("we should get a 202 accepted code")
|
||||
response.code should equal(202)
|
||||
@ -775,7 +775,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction
|
||||
request = (v1_4Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -878,7 +878,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call createTransactionRequest
|
||||
var request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests").POST <@(user1)
|
||||
var response = makePostRequest(request, write(transactionRequestBody))
|
||||
Then("we should get a 201 created code")
|
||||
response.code should equal(201)
|
||||
@ -914,7 +914,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -936,7 +936,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
//call answerTransactionRequestChallenge, give a false answer
|
||||
var answerJson = ChallengeAnswerJSON(id = challenge_id, answer = "hello") //wrong answer, not a number
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
response = makePostRequest(request, write(answerJson))
|
||||
Then("we should get a 400 bad request code")
|
||||
response.code should equal(400)
|
||||
@ -946,7 +946,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
//call answerTransactionRequestChallenge again, give a good answer
|
||||
answerJson = ChallengeAnswerJSON(id = challenge_id, answer = "12345") //good answer, not a number
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / SANDBOX_TAN.toString / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
response = makePostRequest(request, write(answerJson))
|
||||
Then("we should get a 202 accepted code")
|
||||
response.code should equal(202)
|
||||
@ -966,7 +966,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//call getTransactionRequests, check that we really created a transaction request
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@(user1)
|
||||
response = makeGetRequest(request)
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -988,7 +988,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction (since no challenge)
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
@ -1023,7 +1023,7 @@ class TransactionRequestsTest extends V200ServerSetup with DefaultUsers {
|
||||
|
||||
//check that we created a new transaction
|
||||
request = (v2_0Request / "banks" / testBank.bankId.value / "accounts" / toAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transactions").GET <@(user1)
|
||||
response = makeGetRequest(request, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
Then("we should get a 200 ok code")
|
||||
|
||||
@ -307,7 +307,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
|
||||
//there should be an owner view
|
||||
//Note: system views not bankId, accountId, so here, we need to get all the views
|
||||
val (views,accountAccess) = Views.views.vend.privateViewsUserCanAccess(owner)
|
||||
val ownerView = views.find(v => v.viewId.value == CUSTOM_OWNER_VIEW_ID)
|
||||
val ownerView = views.find(v => v.viewId.value == SYSTEM_OWNER_VIEW_ID)
|
||||
owner.hasOwnerViewAccess(BankIdAccountId(foundAccount.bankId, foundAccount.accountId)) should equal(true)
|
||||
|
||||
//and the owners should have access to it
|
||||
|
||||
@ -113,14 +113,14 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
this.transRequestId = transRequestId
|
||||
answerJson = ChallengeAnswerJSON(id = challengeId, answer = "123")
|
||||
val answerRequestNew = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
answerRequest = answerRequestNew
|
||||
}
|
||||
|
||||
def setCreateTransactionRequestType(transactionRequestType: String) = {
|
||||
this.transactionRequestType = transactionRequestType
|
||||
val createTransReqRequestNew = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
createTransReqRequest = createTransReqRequestNew
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
* Create Transaction Request. -- V210
|
||||
*/
|
||||
var createTransReqRequest = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
|
||||
def makeCreateTransReqRequest: APIResponse = makePostRequest(createTransReqRequest, write(transactionRequestBody))
|
||||
def makeCreateTransReqRequestSEPA: APIResponse = makePostRequest(createTransReqRequest, write(transactionRequestBodySEPA))
|
||||
@ -169,7 +169,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
* Get all Transaction Requests. - V210
|
||||
*/
|
||||
var getTransReqRequest = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
|
||||
def makeGetTransReqRequest = makeGetRequest(getTransReqRequest, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
@ -205,7 +205,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
/**
|
||||
* Get Transactions for Account (Full) -- V210
|
||||
*/
|
||||
var getTransactionRequest = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value / CUSTOM_OWNER_VIEW_ID / "transactions").GET <@ (user1)
|
||||
var getTransactionRequest = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value / SYSTEM_OWNER_VIEW_ID / "transactions").GET <@ (user1)
|
||||
|
||||
def makeGetTransRequest = makeGetRequest(getTransactionRequest, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
@ -267,7 +267,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
*/
|
||||
|
||||
var answerRequest = (v2_1Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
|
||||
def makeAnswerRequest = makePostRequest(answerRequest, write(answerJson))
|
||||
|
||||
@ -298,7 +298,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
|
||||
Then("We call the 'Create Transaction Request.' without the login user")
|
||||
var request = (v2_1Request / "banks" / helper.fromAccount.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST
|
||||
var response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
|
||||
@ -320,7 +320,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
|
||||
Then("We used the login user2, but it does not have the owner view and CreateTransactionRequest role ")
|
||||
val request = (v2_1Request / "banks" / helper.testBank.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user2)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user2)
|
||||
val response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
Then("we should get a 400 created code")
|
||||
@ -344,7 +344,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
|
||||
Then("We used the login user3, it does not have the owner view ,but has the CreateTransactionRequest role ")
|
||||
var request = (v2_1Request / "banks" / helper.testBank.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
var response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
Then("we should get a 201 created code")
|
||||
@ -366,7 +366,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
|
||||
Then("We call createTransactionRequest with invalid transactionRequestType - V210")
|
||||
val invalidTransactionRequestType = "invalidTransactionRequestType"
|
||||
var request = (v2_1Request / "banks" / helper.fromAccount.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / invalidTransactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / invalidTransactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
var response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
Then("we should get a 400 created code")
|
||||
|
||||
@ -29,7 +29,7 @@ class CreateCounterpartyTest extends V220ServerSetup with DefaultUsers {
|
||||
val testBank = createBank("transactions-test-bank1")
|
||||
val bankId = testBank.bankId
|
||||
val accountId = AccountId("__acc1")
|
||||
val viewId =ViewId(CUSTOM_OWNER_VIEW_ID)
|
||||
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
|
||||
|
||||
|
||||
// Note: The view created below has can_add_counterparty set to true
|
||||
@ -108,7 +108,7 @@ class CreateCounterpartyTest extends V220ServerSetup with DefaultUsers {
|
||||
val testBank = createBank("transactions-test-bank")
|
||||
val bankId = testBank.bankId
|
||||
val accountId = AccountId("__acc1")
|
||||
val viewId =ViewId(CUSTOM_OWNER_VIEW_ID)
|
||||
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
|
||||
val bankAccount = createAccountRelevantResource(Some(resourceUser1), bankId, accountId, "EUR")
|
||||
|
||||
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
|
||||
|
||||
@ -23,7 +23,7 @@ class CounterpartyTest extends V300ServerSetup {
|
||||
Given("We prepare all the parameters, just check the response")
|
||||
val bankId = randomBankId
|
||||
val accountId = randomPrivateAccountId(bankId)
|
||||
val viewId = CUSTOM_OWNER_VIEW_ID
|
||||
val viewId = SYSTEM_OWNER_VIEW_ID
|
||||
val loginedUser = user1
|
||||
|
||||
When("we call the `Get Other Accounts of one Account.`")
|
||||
|
||||
@ -77,7 +77,7 @@ trait V300ServerSetup extends ServerSetupWithTestData with DefaultUsers {
|
||||
* Get Transactions for Account (Full)-- V300
|
||||
*/
|
||||
def getTransactionsForAccountFull(bankId:String, accountId:String, consumerAndToken: Option[(Consumer, Token)]): APIResponse = {
|
||||
val request = (v3_0Request / "banks" / bankId / "accounts" / accountId / CUSTOM_OWNER_VIEW_ID / "transactions").GET <@ (user1)
|
||||
val request = (v3_0Request / "banks" / bankId / "accounts" / accountId / SYSTEM_OWNER_VIEW_ID / "transactions").GET <@ (user1)
|
||||
makeGetRequest(request)
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ class TransactionRequestTest extends V310ServerSetup {
|
||||
val account = createAccountRelevantResource(Some(resourceUser1), BankId(bankId), AccountId(APIUtil.generateUUID()), "EUR")
|
||||
val request310 = (
|
||||
v3_1_0_Request / "banks" / bankId / "accounts" / account.accountId.value
|
||||
/ Constant.CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@(user2)
|
||||
/ Constant.SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@(user2)
|
||||
val response310 = makeGetRequest(request310)
|
||||
Then("We should get a 403")
|
||||
response310.code should equal(403)
|
||||
|
||||
@ -182,7 +182,7 @@ class TransactionTest extends V310ServerSetup {
|
||||
|
||||
Then("We can get the transaction back")
|
||||
val transactionNewId = responseJson.transaction_id
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / CUSTOM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / SYSTEM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdResponse = makeGetRequest(getTransactionbyIdRequest)
|
||||
|
||||
getTransactionbyIdResponse.code should equal(200)
|
||||
@ -255,7 +255,7 @@ class TransactionTest extends V310ServerSetup {
|
||||
|
||||
Then("We can get the transaction back")
|
||||
val transactionNewId = responseJson.transaction_id
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / CUSTOM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / SYSTEM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdResponse = makeGetRequest(getTransactionbyIdRequest)
|
||||
|
||||
getTransactionbyIdResponse.code should equal(200)
|
||||
@ -327,7 +327,7 @@ class TransactionTest extends V310ServerSetup {
|
||||
|
||||
Then("We can get the transaction back")
|
||||
val transactionNewId = responseJson.transaction_id
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / CUSTOM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / SYSTEM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdResponse = makeGetRequest(getTransactionbyIdRequest)
|
||||
|
||||
getTransactionbyIdResponse.code should equal(200)
|
||||
@ -411,7 +411,7 @@ class TransactionTest extends V310ServerSetup {
|
||||
|
||||
Then("We can get the transaction back")
|
||||
val transactionNewId = responseJson.transaction_id
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / CUSTOM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdRequest = (v3_1_0_Request / "banks" / bankId1/ "accounts" / bankAccountId1 / SYSTEM_OWNER_VIEW_ID / "transactions" / transactionNewId / "transaction").GET <@ (user1)
|
||||
val getTransactionbyIdResponse = makeGetRequest(getTransactionbyIdRequest)
|
||||
|
||||
getTransactionbyIdResponse.code should equal(200)
|
||||
|
||||
@ -169,14 +169,14 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
this.transRequestId = transRequestId
|
||||
answerJson = ChallengeAnswerJson400(id = challengeId, answer = challengeAnswer)
|
||||
val answerRequestNew = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (consumerAndToken)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (consumerAndToken)
|
||||
answerRequest = answerRequestNew
|
||||
}
|
||||
|
||||
def setCreateTransactionRequestType(transactionRequestType: String) = {
|
||||
this.transactionRequestType = transactionRequestType
|
||||
val createTransReqRequestNew = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
createTransReqRequest = createTransReqRequestNew
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
* Create Transaction Request. -- V400
|
||||
*/
|
||||
var createTransReqRequest = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests").POST <@ (user1)
|
||||
|
||||
var createTransReqRequestCard = (v4_0_0_Request / "transaction-request-types" / "CARD" / "transaction-requests").POST <@ (user1)
|
||||
|
||||
@ -229,7 +229,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
* Get all Transaction Requests. - V400
|
||||
*/
|
||||
var getTransReqRequest = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-requests").GET <@ (user1)
|
||||
|
||||
def makeGetTransReqRequest = makeGetRequest(getTransReqRequest, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
@ -265,7 +265,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
/**
|
||||
* Get Transactions for Account (Full) -- V400
|
||||
*/
|
||||
var getTransactionRequest = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value / CUSTOM_OWNER_VIEW_ID / "transactions").GET <@ (user1)
|
||||
var getTransactionRequest = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value / SYSTEM_OWNER_VIEW_ID / "transactions").GET <@ (user1)
|
||||
|
||||
def makeGetTransRequest = makeGetRequest(getTransactionRequest, List(("from_date", APIUtil.epochTimeString),("to_date", APIUtil.DefaultToDateString)))
|
||||
|
||||
@ -327,7 +327,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
*/
|
||||
|
||||
var answerRequest = (v4_0_0_Request / "banks" / testBank.bankId.value / "accounts" / fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / transactionRequestType / "transaction-requests" / transRequestId / "challenge").POST <@ (user1)
|
||||
|
||||
def makeAnswerRequest = makePostRequest(answerRequest, write(answerJson))
|
||||
|
||||
@ -358,7 +358,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
|
||||
Then("We call the 'Create Transaction Request.' without the login user")
|
||||
var request = (v4_0_0_Request / "banks" / helper.fromAccount.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST
|
||||
var response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
|
||||
@ -380,7 +380,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
|
||||
Then("We used the login user2, but it does not have the owner view and CreateTransactionRequest role ")
|
||||
val request = (v4_0_0_Request / "banks" / helper.testBank.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user2)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user2)
|
||||
val response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
Then("we should get a 400 created code")
|
||||
@ -404,7 +404,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
|
||||
Then("We used the login user3, it does not have the owner view ,but has the CreateTransactionRequest role ")
|
||||
var request = (v4_0_0_Request / "banks" / helper.testBank.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / helper.transactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
var response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
Then("we should get a 201 created code")
|
||||
@ -426,7 +426,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
|
||||
Then("We call createTransactionRequest with invalid transactionRequestType - V400")
|
||||
val invalidTransactionRequestType = "invalidTransactionRequestType"
|
||||
var request = (v4_0_0_Request / "banks" / helper.fromAccount.bankId.value / "accounts" / helper.fromAccount.accountId.value /
|
||||
CUSTOM_OWNER_VIEW_ID / "transaction-request-types" / invalidTransactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
SYSTEM_OWNER_VIEW_ID / "transaction-request-types" / invalidTransactionRequestType / "transaction-requests").POST <@ (user3)
|
||||
var response = makePostRequest(request, write(helper.transactionRequestBody))
|
||||
|
||||
Then("we should get a 400 created code")
|
||||
|
||||
@ -70,7 +70,7 @@ trait V400ServerSetup extends ServerSetupWithTestData with DefaultUsers {
|
||||
def randomOwnerViewPermalinkViaEndpoint(bankId: String, account: AccountJSON) : String = {
|
||||
val request = v4_0_0_Request / "banks" / bankId / "accounts" / account.id / "views" <@(consumer, token1)
|
||||
val reply = makeGetRequest(request)
|
||||
val possibleViewsPermalinks = reply.body.extract[ViewsJSONV121].views.filterNot(_.is_public==true).filter(_.id == CUSTOM_OWNER_VIEW_ID)
|
||||
val possibleViewsPermalinks = reply.body.extract[ViewsJSONV121].views.filterNot(_.is_public==true).filter(_.id == SYSTEM_OWNER_VIEW_ID)
|
||||
val randomPosition = nextInt(possibleViewsPermalinks.size)
|
||||
possibleViewsPermalinks(randomPosition).id
|
||||
}
|
||||
|
||||
@ -0,0 +1,236 @@
|
||||
package code.api.v5_0_0
|
||||
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.v5_0_0.OBPAPI5_0_0.Implementations5_0_0
|
||||
import code.setup.DefaultUsers
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
import org.scalatest.Tag
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import code.api.util.ApiRole
|
||||
import code.api.util.ApiRole.{canCreateCustomerAccountLink, canDeleteCustomerAccountLink, canGetCustomerAccountLink, canGetCustomerAccountLinks, canUpdateCustomerAccountLink}
|
||||
import code.api.util.ErrorMessages.{UserHasMissingRoles, UserNotLoggedIn}
|
||||
import code.entitlement.Entitlement
|
||||
import com.openbankproject.commons.model.ErrorMessage
|
||||
import net.liftweb.json.Serialization.write
|
||||
|
||||
class CustomerAccountLinkTest extends V500ServerSetup with DefaultUsers {
|
||||
|
||||
object VersionOfApi extends Tag(ApiVersion.v5_0_0.toString)
|
||||
object ApiEndpoint1 extends Tag(nameOf(Implementations5_0_0.createCustomerAccountLink))
|
||||
object ApiEndpoint2 extends Tag(nameOf(Implementations5_0_0.getCustomerAccountLinkById))
|
||||
object ApiEndpoint3 extends Tag(nameOf(Implementations5_0_0.updateCustomerAccountLinkById))
|
||||
object ApiEndpoint4 extends Tag(nameOf(Implementations5_0_0.getCustomerAccountLinksByCustomerId))
|
||||
object ApiEndpoint5 extends Tag(nameOf(Implementations5_0_0.getCustomerAccountLinksByAccountId))
|
||||
object ApiEndpoint6 extends Tag(nameOf(Implementations5_0_0.deleteCustomerAccountLinkById))
|
||||
|
||||
|
||||
|
||||
|
||||
feature(s"customer account link $VersionOfApi - Error cases ") {
|
||||
|
||||
lazy val testBankId = randomBankId
|
||||
lazy val testAccountId = testAccountId1
|
||||
lazy val createCustomerAccountLinkJson = SwaggerDefinitionsJSON.createCustomerAccountLinkJson
|
||||
lazy val updateCustomerAccountLinkJson = SwaggerDefinitionsJSON.updateCustomerAccountLinkJson
|
||||
lazy val customerAccountLinkId1 = "wrongId"
|
||||
lazy val customerId1 = "wrongId"
|
||||
|
||||
scenario("We will call the endpoints without user credentials", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, ApiEndpoint6, VersionOfApi) {
|
||||
val requestApiEndpoint1 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links" ).POST
|
||||
val responseApiEndpoint1 = makePostRequest(requestApiEndpoint1, write(createCustomerAccountLinkJson))
|
||||
Then("We should get a 401")
|
||||
responseApiEndpoint1.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
responseApiEndpoint1.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint2")
|
||||
val requestApiEndpoint2 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1 ).GET
|
||||
val responseApiEndpoint2 = makeGetRequest(requestApiEndpoint2)
|
||||
Then("We should get a 401")
|
||||
responseApiEndpoint2.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
responseApiEndpoint2.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint3")
|
||||
val requestApiEndpoint3 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1 ).PUT
|
||||
val responseApiEndpoint3 = makePutRequest(requestApiEndpoint3, write(updateCustomerAccountLinkJson))
|
||||
Then("We should get a 401")
|
||||
responseApiEndpoint2.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
responseApiEndpoint2.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint4")
|
||||
val requestApiEndpoint4 = (v5_0_0_Request / "banks" / testBankId /"customers"/customerId1 / "customer-account-links" )
|
||||
val responseApiEndpoint4 = makeGetRequest(requestApiEndpoint4)
|
||||
Then("We should get a 401")
|
||||
responseApiEndpoint4.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
responseApiEndpoint4.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint5")
|
||||
val requestApiEndpoint5 = (v5_0_0_Request / "banks" / testBankId /"accounts"/testAccountId.value / "customer-account-links")
|
||||
val responseApiEndpoint5 = makeGetRequest(requestApiEndpoint5)
|
||||
Then("We should get a 401")
|
||||
responseApiEndpoint5.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
responseApiEndpoint5.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
|
||||
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint6")
|
||||
val requestApiEndpoint6 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1)
|
||||
val responseApiEndpoint6 = makeDeleteRequest(requestApiEndpoint6)
|
||||
Then("We should get a 401")
|
||||
responseApiEndpoint2.code should equal(401)
|
||||
And("error should be " + UserNotLoggedIn)
|
||||
responseApiEndpoint2.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
|
||||
}
|
||||
|
||||
scenario("We will call the endpoint without roles", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, ApiEndpoint6, VersionOfApi) {
|
||||
val requestApiEndpoint1 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links" ).POST <@(user1)
|
||||
val responseApiEndpoint1 = makePostRequest(requestApiEndpoint1, write(createCustomerAccountLinkJson))
|
||||
Then("We should get a 403")
|
||||
responseApiEndpoint1.code should equal(403)
|
||||
And("error should be " + UserHasMissingRoles)
|
||||
responseApiEndpoint1.body.extract[ErrorMessage].message contains (UserHasMissingRoles) should be (true)
|
||||
responseApiEndpoint1.body.extract[ErrorMessage].message contains (canCreateCustomerAccountLink.toString()) should be (true)
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint2")
|
||||
val requestApiEndpoint2 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1 ).GET <@(user1)
|
||||
val responseApiEndpoint2 = makeGetRequest(requestApiEndpoint2)
|
||||
Then("We should get a 403")
|
||||
responseApiEndpoint2.code should equal(403)
|
||||
And("error should be " + UserHasMissingRoles)
|
||||
responseApiEndpoint2.body.extract[ErrorMessage].message contains (UserHasMissingRoles) should be (true)
|
||||
responseApiEndpoint2.body.extract[ErrorMessage].message contains (canGetCustomerAccountLink.toString()) should be (true)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint3")
|
||||
val requestApiEndpoint3 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1 ).PUT<@(user1)
|
||||
val responseApiEndpoint3 = makePutRequest(requestApiEndpoint3, write(updateCustomerAccountLinkJson))
|
||||
Then("We should get a 403")
|
||||
responseApiEndpoint3.code should equal(403)
|
||||
And("error should be " + UserHasMissingRoles)
|
||||
responseApiEndpoint3.body.extract[ErrorMessage].message contains (UserHasMissingRoles) should be (true)
|
||||
responseApiEndpoint3.body.extract[ErrorMessage].message contains (canUpdateCustomerAccountLink.toString()) should be (true)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint4")
|
||||
val requestApiEndpoint4 = (v5_0_0_Request / "banks" / testBankId /"customers"/customerId1 / "customer-account-links" ).GET <@(user1)
|
||||
val responseApiEndpoint4 = makeGetRequest(requestApiEndpoint4)
|
||||
Then("We should get a 403")
|
||||
responseApiEndpoint4.code should equal(403)
|
||||
And("error should be " + UserHasMissingRoles)
|
||||
responseApiEndpoint4.body.extract[ErrorMessage].message contains (UserHasMissingRoles) should be (true)
|
||||
responseApiEndpoint4.body.extract[ErrorMessage].message contains (canGetCustomerAccountLinks.toString()) should be (true)
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint5")
|
||||
val requestApiEndpoint5 = (v5_0_0_Request / "banks" / testBankId /"accounts"/testAccountId.value / "customer-account-links").GET<@(user1)
|
||||
val responseApiEndpoint5 = makeGetRequest(requestApiEndpoint5)
|
||||
Then("We should get a 403")
|
||||
responseApiEndpoint5.code should equal(403)
|
||||
And("error should be " + UserHasMissingRoles)
|
||||
responseApiEndpoint5.body.extract[ErrorMessage].message contains (UserHasMissingRoles) should be (true)
|
||||
responseApiEndpoint5.body.extract[ErrorMessage].message contains (canGetCustomerAccountLink.toString()) should be (true)
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint6")
|
||||
val requestApiEndpoint6 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1).DELETE <@(user1)
|
||||
val responseApiEndpoint6 = makeDeleteRequest(requestApiEndpoint6)
|
||||
Then("We should get a 403")
|
||||
responseApiEndpoint6.code should equal(403)
|
||||
And("error should be " + UserHasMissingRoles)
|
||||
responseApiEndpoint6.body.extract[ErrorMessage].message contains (UserHasMissingRoles) should be (true)
|
||||
responseApiEndpoint6.body.extract[ErrorMessage].message contains (canDeleteCustomerAccountLink.toString()) should be (true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
feature(s"Create Account $VersionOfApi - Success access") {
|
||||
|
||||
|
||||
scenario("We will call the endpoint with user credentials", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, ApiEndpoint6, VersionOfApi) {
|
||||
When(s"We make a request $VersionOfApi $ApiEndpoint1")
|
||||
|
||||
lazy val testBankId = randomBankId
|
||||
lazy val testAccountId = testAccountId1
|
||||
val customerId = createAndGetCustomerIdViaEndpoint(testBankId, user1)
|
||||
lazy val createCustomerAccountLinkJson = SwaggerDefinitionsJSON.createCustomerAccountLinkJson.copy(customer_id = customerId, account_id= testAccountId.value)
|
||||
lazy val updateCustomerAccountLinkJson = SwaggerDefinitionsJSON.updateCustomerAccountLinkJson.copy(relationship_type ="test")
|
||||
|
||||
|
||||
Entitlement.entitlement.vend.addEntitlement(testBankId, resourceUser1.userId, ApiRole.canCreateCustomerAccountLink.toString())
|
||||
Entitlement.entitlement.vend.addEntitlement(testBankId, resourceUser1.userId, ApiRole.canUpdateCustomerAccountLink.toString())
|
||||
Entitlement.entitlement.vend.addEntitlement(testBankId, resourceUser1.userId, ApiRole.canGetCustomerAccountLink.toString())
|
||||
Entitlement.entitlement.vend.addEntitlement(testBankId, resourceUser1.userId, ApiRole.canGetCustomerAccountLinks.toString())
|
||||
Entitlement.entitlement.vend.addEntitlement(testBankId, resourceUser1.userId, ApiRole.canDeleteCustomerAccountLink.toString())
|
||||
|
||||
val requestApiEndpoint1 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links" ).POST <@(user1)
|
||||
val responseApiEndpoint1 = makePostRequest(requestApiEndpoint1, write(createCustomerAccountLinkJson))
|
||||
Then("We should get a 201")
|
||||
responseApiEndpoint1.code should equal(201)
|
||||
|
||||
val customerAccountLinkJson1 = responseApiEndpoint1.body.extract[CustomerAccountLinkJson]
|
||||
val customerAccountLinkId1 = customerAccountLinkJson1.customer_account_link_id
|
||||
customerAccountLinkId1.nonEmpty should be (true)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint2")
|
||||
val requestApiEndpoint2 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1 ).GET <@(user1)
|
||||
val responseApiEndpoint2 = makeGetRequest(requestApiEndpoint2)
|
||||
Then("We should get a 200")
|
||||
responseApiEndpoint2.code should equal(200)
|
||||
val customerAccountLinkJson2 = responseApiEndpoint2.body.extract[CustomerAccountLinkJson]
|
||||
val customerAccountLinkId2 = customerAccountLinkJson2.customer_account_link_id
|
||||
customerAccountLinkId2 should be (customerAccountLinkId1)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint3")
|
||||
val requestApiEndpoint3 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1 ).PUT <@(user1)
|
||||
val responseApiEndpoint3 = makePutRequest(requestApiEndpoint3, write(updateCustomerAccountLinkJson))
|
||||
Then("We should get a 200")
|
||||
responseApiEndpoint3.code should equal(200)
|
||||
val customerAccountLinkJson3 = responseApiEndpoint3.body.extract[CustomerAccountLinkJson]
|
||||
val customerAccountLinkId3 = customerAccountLinkJson3.customer_account_link_id
|
||||
customerAccountLinkId3 should be (customerAccountLinkId1)
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint4")
|
||||
val requestApiEndpoint4 = (v5_0_0_Request / "banks" / testBankId /"customers"/customerId / "customer-account-links" ).GET <@(user1)
|
||||
val responseApiEndpoint4 = makeGetRequest(requestApiEndpoint4)
|
||||
Then("We should get a 200")
|
||||
responseApiEndpoint4.code should equal(200)
|
||||
val customerAccountLinkJson4 = responseApiEndpoint4.body.extract[CustomerAccountLinksJson]
|
||||
val customerAccountLinkId4 = customerAccountLinkJson4.links.head.customer_account_link_id
|
||||
customerAccountLinkId4 should be (customerAccountLinkId1)
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint5")
|
||||
val requestApiEndpoint5 = (v5_0_0_Request / "banks" / testBankId /"accounts"/testAccountId.value / "customer-account-links").GET <@(user1)
|
||||
val responseApiEndpoint5 = makeGetRequest(requestApiEndpoint5)
|
||||
Then("We should get a 200")
|
||||
responseApiEndpoint5.code should equal(200)
|
||||
val customerAccountLinkJson5 = responseApiEndpoint5.body.extract[CustomerAccountLinksJson]
|
||||
val customerAccountLinkId5 = customerAccountLinkJson5.links.head.customer_account_link_id
|
||||
customerAccountLinkId5 should be (customerAccountLinkId1)
|
||||
|
||||
|
||||
|
||||
Then(s"We make a request $VersionOfApi $ApiEndpoint6")
|
||||
val requestApiEndpoint6 = (v5_0_0_Request / "banks" / testBankId / "customer-account-links"/customerAccountLinkId1).DELETE <@(user1)
|
||||
val responseApiEndpoint6 = makeDeleteRequest(requestApiEndpoint6)
|
||||
Then("We should get a 204")
|
||||
responseApiEndpoint6.code should equal(204)
|
||||
Then(s"We call $ApiEndpoint5 should return empty list")
|
||||
val responseApiEndpoint5AfterDelete = makeGetRequest(requestApiEndpoint5)
|
||||
Then("We should get a 200")
|
||||
responseApiEndpoint5AfterDelete.code should equal(200)
|
||||
val customerAccountLinkJson5AfterDelete = responseApiEndpoint5AfterDelete.body.extract[CustomerAccountLinksJson]
|
||||
customerAccountLinkJson5AfterDelete.links.length should be (0)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -87,13 +87,13 @@ class CustomerOverviewTest extends V500ServerSetup {
|
||||
val response = makePostRequest(request, write(getCustomerJson))
|
||||
Then("We should get a 403")
|
||||
response.code should equal(403)
|
||||
And("error should be " + canGetCustomer)
|
||||
And("error should be " + canGetCustomerOverview)
|
||||
val errorMessage = response.body.extract[ErrorMessage].message
|
||||
errorMessage contains (UserHasMissingRoles) should be (true)
|
||||
errorMessage contains (canGetCustomer.toString()) should be (true)
|
||||
errorMessage contains (canGetCustomerOverview.toString()) should be (true)
|
||||
}
|
||||
scenario(s"We will call the endpoint $ApiEndpoint1 with a user credentials and a proper role", ApiEndpoint1, VersionOfApi) {
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomer.toString)
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomerOverview.toString)
|
||||
When(s"We make a request $VersionOfApi")
|
||||
val request = (v5_0_0_Request / "banks" / bankId / "customers" / "customer-number-query" / "overview").POST <@(user1)
|
||||
val response = makePostRequest(request, write(getCustomerJson))
|
||||
@ -106,7 +106,7 @@ class CustomerOverviewTest extends V500ServerSetup {
|
||||
val legalName = "Evelin Doe"
|
||||
val mobileNumber = "+44 123 456"
|
||||
val customer: CustomerJsonV310 = createCustomerEndpointV500(bankId, legalName, mobileNumber)
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomer.toString)
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomerOverview.toString)
|
||||
When(s"We make a request $VersionOfApi")
|
||||
val request = (v5_0_0_Request / "banks" / bankId / "customers" / "customer-number-query" / "overview").POST <@(user1)
|
||||
val response = makePostRequest(request, write(PostCustomerOverviewJsonV500(customer.customer_number)))
|
||||
@ -140,13 +140,13 @@ class CustomerOverviewTest extends V500ServerSetup {
|
||||
val response = makePostRequest(request, write(getCustomerJson))
|
||||
Then("We should get a 403")
|
||||
response.code should equal(403)
|
||||
And("error should be " + canGetCustomer)
|
||||
And("error should be " + canGetCustomerOverviewFlat)
|
||||
val errorMessage = response.body.extract[ErrorMessage].message
|
||||
errorMessage contains (UserHasMissingRoles) should be (true)
|
||||
errorMessage contains (canGetCustomer.toString()) should be (true)
|
||||
errorMessage contains (canGetCustomerOverviewFlat.toString()) should be (true)
|
||||
}
|
||||
scenario(s"We will call the endpoint $ApiEndpoint2 with a user credentials and a proper role", ApiEndpoint1, VersionOfApi) {
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomer.toString)
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomerOverviewFlat.toString)
|
||||
When(s"We make a request $VersionOfApi")
|
||||
val request = (v5_0_0_Request / "banks" / bankId / "customers" / "customer-number-query" / "overview-flat").POST <@(user1)
|
||||
val response = makePostRequest(request, write(getCustomerJson))
|
||||
@ -159,7 +159,7 @@ class CustomerOverviewTest extends V500ServerSetup {
|
||||
val legalName = "Evelin Doe"
|
||||
val mobileNumber = "+44 123 456"
|
||||
val customer: CustomerJsonV310 = createCustomerEndpointV500(bankId, legalName, mobileNumber)
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomer.toString)
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanGetCustomerOverviewFlat.toString)
|
||||
When(s"We make a request $VersionOfApi")
|
||||
val request = (v5_0_0_Request / "banks" / bankId / "customers" / "customer-number-query" / "overview-flat").POST <@(user1)
|
||||
val response = makePostRequest(request, write(PostCustomerOverviewJsonV500(customer.customer_number)))
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package code.api.v5_0_0
|
||||
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.util.APIUtil.OAuth.{Consumer, Token}
|
||||
import code.api.util.ApiRole.CanCreateCustomer
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import code.api.util.ApiRole.CanCreateCustomer
|
||||
import code.api.v3_1_0.CustomerJsonV310
|
||||
@ -8,6 +11,7 @@ import code.entitlement.Entitlement
|
||||
import code.setup.{APIResponse, DefaultUsers, ServerSetupWithTestData}
|
||||
import com.openbankproject.commons.util.ApiShortVersions
|
||||
import dispatch.Req
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import net.liftweb.json.Serialization.write
|
||||
|
||||
import scala.util.Random.nextInt
|
||||
@ -28,6 +32,20 @@ trait V500ServerSetup extends ServerSetupWithTestData with DefaultUsers {
|
||||
val bank = banksJson.banks(randomPosition)
|
||||
bank.id
|
||||
}
|
||||
|
||||
// This will call create customer ,then return the customerId
|
||||
def createAndGetCustomerIdViaEndpoint(bankId:String, consumerAndToken: Option[(Consumer, Token)]) = {
|
||||
val postCustomerJson = SwaggerDefinitionsJSON.postCustomerJsonV310
|
||||
def createCustomer(consumerAndToken: Option[(Consumer, Token)]) ={
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanCreateCustomer.toString)
|
||||
val request310 = (v5_0_0_Request / "banks" / bankId / "customers").POST <@(user1)
|
||||
val response310 = makePostRequest(request310, write(postCustomerJson))
|
||||
response310.code should equal(201)
|
||||
response310.body.extract[CustomerJsonV310]
|
||||
}
|
||||
createCustomer(consumerAndToken).customer_id
|
||||
}
|
||||
|
||||
|
||||
def createCustomerEndpointV500(bankId: String, legalName: String, mobilePhoneNumber: String): CustomerJsonV310 = {
|
||||
Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanCreateCustomer.toString)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package code.connector
|
||||
|
||||
import code.api.Constant.SYSTEM_STANDARD_VIEW_ID
|
||||
import code.api.util.{CallContext, CustomJsonFormats}
|
||||
import code.bankconnectors._
|
||||
import code.setup.{DefaultConnectorTestSetup, DefaultUsers, ServerSetup}
|
||||
@ -37,7 +38,7 @@ object MockedCbsConnector extends ServerSetup
|
||||
balanceAmount = "",
|
||||
balanceCurrency = "",
|
||||
owners = List(""),
|
||||
viewsToGenerate = "Owner" :: "_Public" :: "Accountant" :: "Auditor" :: Nil,
|
||||
viewsToGenerate = SYSTEM_STANDARD_VIEW_ID :: "Owner" :: "_Public" :: "Accountant" :: "Auditor" :: Nil,
|
||||
bankRoutingScheme = "",
|
||||
bankRoutingAddress = "",
|
||||
branchRoutingScheme = "",
|
||||
@ -53,7 +54,7 @@ object MockedCbsConnector extends ServerSetup
|
||||
balanceAmount = "",
|
||||
balanceCurrency = "",
|
||||
owners = List(""),
|
||||
viewsToGenerate = "Owner" :: "_Public" :: "Accountant" :: "Auditor" :: Nil,
|
||||
viewsToGenerate = SYSTEM_STANDARD_VIEW_ID :: "Owner" :: "_Public" :: "Accountant" :: "Auditor" :: Nil,
|
||||
bankRoutingScheme = "",
|
||||
bankRoutingAddress = "",
|
||||
branchRoutingScheme = "",
|
||||
|
||||
@ -2,16 +2,16 @@ package code.model
|
||||
|
||||
import code.UserRefreshes.MappedUserRefreshes
|
||||
import code.accountholders.MapperAccountHolders
|
||||
import code.api.Constant.{SYSTEM_OWNER_VIEW_ID, SYSTEM_STAGE_ONE_VIEW_ID, SYSTEM_STANDARD_VIEW_ID}
|
||||
import code.bankconnectors.Connector
|
||||
import code.connector.MockedCbsConnector
|
||||
import code.model.dataAccess.{AuthUser, ViewImpl, ViewPrivileges}
|
||||
import code.model.dataAccess.AuthUser
|
||||
import code.setup.{DefaultUsers, PropsReset, ServerSetup}
|
||||
import code.views.MapperViews
|
||||
import code.views.system.{AccountAccess, ViewDefinition}
|
||||
import com.openbankproject.commons.model.{InboundAccount, InboundAccountCommons}
|
||||
import net.liftweb.mapper.{By, PreCache}
|
||||
import com.openbankproject.commons.model.InboundAccountCommons
|
||||
import net.liftweb.mapper.By
|
||||
|
||||
import scala.collection.immutable.List
|
||||
import scala.concurrent.Await
|
||||
import scala.concurrent.duration.Duration
|
||||
|
||||
@ -81,7 +81,67 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId1.bankId.value,
|
||||
accountId = bankIdAccountId1.accountId.value,
|
||||
viewsToGenerate = "Owner" :: Nil,
|
||||
viewsToGenerate = SYSTEM_STANDARD_VIEW_ID :: Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
balanceAmount = "",
|
||||
balanceCurrency = "",
|
||||
owners = List(""),
|
||||
bankRoutingScheme = "",
|
||||
bankRoutingAddress = "",
|
||||
branchRoutingScheme = "",
|
||||
branchRoutingAddress = "",
|
||||
accountRoutingScheme = "",
|
||||
accountRoutingAddress = ""
|
||||
)
|
||||
)
|
||||
|
||||
val account1HeldWithStageOneView = List(
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId1.bankId.value,
|
||||
accountId = bankIdAccountId1.accountId.value,
|
||||
viewsToGenerate = SYSTEM_STAGE_ONE_VIEW_ID :: Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
balanceAmount = "",
|
||||
balanceCurrency = "",
|
||||
owners = List(""),
|
||||
bankRoutingScheme = "",
|
||||
bankRoutingAddress = "",
|
||||
branchRoutingScheme = "",
|
||||
branchRoutingAddress = "",
|
||||
accountRoutingScheme = "",
|
||||
accountRoutingAddress = ""
|
||||
)
|
||||
)
|
||||
|
||||
val account1HeldWithBothViews = List(
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId1.bankId.value,
|
||||
accountId = bankIdAccountId1.accountId.value,
|
||||
viewsToGenerate = SYSTEM_STAGE_ONE_VIEW_ID :: SYSTEM_STANDARD_VIEW_ID:: Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
balanceAmount = "",
|
||||
balanceCurrency = "",
|
||||
owners = List(""),
|
||||
bankRoutingScheme = "",
|
||||
bankRoutingAddress = "",
|
||||
branchRoutingScheme = "",
|
||||
branchRoutingAddress = "",
|
||||
accountRoutingScheme = "",
|
||||
accountRoutingAddress = ""
|
||||
)
|
||||
)
|
||||
|
||||
val account1HeldWithEmptyView = List(
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId1.bankId.value,
|
||||
accountId = bankIdAccountId1.accountId.value,
|
||||
viewsToGenerate = Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
@ -101,7 +161,7 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId2.bankId.value,
|
||||
accountId = bankIdAccountId2.accountId.value,
|
||||
viewsToGenerate = "Owner" :: Nil,
|
||||
viewsToGenerate = SYSTEM_STANDARD_VIEW_ID :: Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
@ -121,7 +181,7 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId1.bankId.value,
|
||||
accountId = bankIdAccountId1.accountId.value,
|
||||
viewsToGenerate = "Owner" :: Nil,
|
||||
viewsToGenerate = SYSTEM_STANDARD_VIEW_ID :: Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
@ -138,7 +198,7 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
InboundAccountCommons(
|
||||
bankId = bankIdAccountId2.bankId.value,
|
||||
accountId = bankIdAccountId2.accountId.value,
|
||||
viewsToGenerate = "Owner" :: Nil,
|
||||
viewsToGenerate = SYSTEM_STANDARD_VIEW_ID :: Nil,
|
||||
branchId = "",
|
||||
accountNumber = "",
|
||||
accountType = "",
|
||||
@ -173,19 +233,20 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
val allViewsForAccount1 = MapperViews.availableViewsForAccount(bankIdAccountId1)
|
||||
val allViewsForAccount2 = MapperViews.availableViewsForAccount(bankIdAccountId2)
|
||||
val allViews = ViewDefinition.findAll()
|
||||
allViewsForAccount1.toString().contains("owner") should equal(true)
|
||||
allViewsForAccount1.toString().contains(SYSTEM_STANDARD_VIEW_ID) should equal(true)
|
||||
allViewsForAccount1.toString().contains(SYSTEM_OWNER_VIEW_ID) should equal(true)
|
||||
allViewsForAccount1.toString().contains("_public") should equal(true)
|
||||
allViewsForAccount1.toString().contains("accountant") should equal(true)
|
||||
allViewsForAccount1.toString().contains("auditor") should equal(true)
|
||||
allViewsForAccount2.toString().contains("owner") should equal(true)
|
||||
allViewsForAccount2.toString().contains(SYSTEM_STANDARD_VIEW_ID) should equal(true)
|
||||
allViewsForAccount2.toString().contains("_public") should equal(true)
|
||||
allViewsForAccount2.toString().contains("accountant") should equal(true)
|
||||
allViewsForAccount2.toString().contains("auditor") should equal(true)
|
||||
allViews.length should equal(5) // 3 system views + 2 custom views
|
||||
allViews.length should equal(6) // 3 system views + 2 custom views
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
val numberOfAccountAccess = AccountAccess.findAll().length
|
||||
numberOfAccountAccess should equal(8)
|
||||
numberOfAccountAccess should equal(10)
|
||||
|
||||
}
|
||||
}
|
||||
@ -219,8 +280,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system view. both accounts should have the `owner` view.")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(1)
|
||||
@ -238,8 +299,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system view. both accounts should have the `owner` view.")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(0)
|
||||
@ -278,8 +339,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system views")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(1)
|
||||
@ -296,8 +357,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(1)
|
||||
|
||||
Then("We check the views, only support the system views")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(1)
|
||||
@ -315,8 +376,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(1)
|
||||
|
||||
Then("We check the views, only support the system views")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(0)
|
||||
@ -333,8 +394,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system views")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(0)
|
||||
@ -373,8 +434,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system view. both accounts should have the `owner` view.")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(1)
|
||||
@ -394,8 +455,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system view. both accounts should have the `owner` view.")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(1)
|
||||
@ -414,8 +475,8 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
accountholder2.size should be(0)
|
||||
|
||||
Then("We check the views, only support the system views")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List("owner"))
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
allViewsForAccount2.map(_.viewId.value) should equal(List(SYSTEM_STANDARD_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(0)
|
||||
@ -427,6 +488,85 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
MappedUserRefreshes.findAll().length should be (2)
|
||||
|
||||
}
|
||||
|
||||
scenario("Test one user, but change the `viewsToGenerate` from `StageOne` to `Owner`, and check all the view accesses. ") {
|
||||
|
||||
When("1st Step: we create the `StageOneView` ")
|
||||
AuthUser.refreshViewsAccountAccessAndHolders(resourceUser1, account1HeldWithStageOneView)
|
||||
|
||||
Then("We check the accountHolders")
|
||||
accountholder1.size should be(1)
|
||||
|
||||
Then("There is system view `StageOne`")
|
||||
allViewsForAccount1.map(_.viewId.value) should equal(List(SYSTEM_STAGE_ONE_VIEW_ID))
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should be (1)
|
||||
account1Access.map(_.view_id.get).contains(SYSTEM_STAGE_ONE_VIEW_ID) should be (true)
|
||||
|
||||
Then("We check the MappedUserRefreshes table")
|
||||
MappedUserRefreshes.findAll().length should be (1)
|
||||
|
||||
Then("2rd Step: we create the `Owner` and remove the `StageOne` view")
|
||||
AuthUser.refreshViewsAccountAccessAndHolders(resourceUser1, account1Held)
|
||||
|
||||
Then("We check the accountHolders")
|
||||
accountholder1.size should be(1)
|
||||
|
||||
Then("We check the views, there should be two system views: Stage")
|
||||
allViewsForAccount1.length should be(2)
|
||||
allViewsForAccount1.map(_.viewId.value) contains (SYSTEM_STANDARD_VIEW_ID) should be (true)
|
||||
allViewsForAccount1.map(_.viewId.value) contains (SYSTEM_STAGE_ONE_VIEW_ID) should be (true)
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(1)
|
||||
account1Access.map(_.view_id.get).contains(SYSTEM_STANDARD_VIEW_ID) should be (true)
|
||||
|
||||
Then("We check the MappedUserRefreshes table")
|
||||
MappedUserRefreshes.findAll().length should be (1)
|
||||
|
||||
Then("3rd Step: we removed the all the views ")
|
||||
AuthUser.refreshViewsAccountAccessAndHolders(resourceUser1, account1HeldWithEmptyView)
|
||||
|
||||
Then("We check the AccountAccess, we can only remove the StageOne access, not owner view, if use is the account holder, we can not revoke the access")
|
||||
account1Access.length should equal(0)
|
||||
|
||||
Then("We check the MappedUserRefreshes table")
|
||||
MappedUserRefreshes.findAll().length should be (1)
|
||||
|
||||
Then("4th Step: we create both the views: owner and StageOne ")
|
||||
AuthUser.refreshViewsAccountAccessAndHolders(resourceUser1, account1HeldWithBothViews)
|
||||
|
||||
Then("We check the accountHolders")
|
||||
accountholder1.size should be(1)
|
||||
|
||||
Then("We check the views, only support the system view. both accounts should have the `owner` view.")
|
||||
allViewsForAccount1.length should be(2)
|
||||
allViewsForAccount1.map(_.viewId.value) contains (SYSTEM_STANDARD_VIEW_ID) should be (true)
|
||||
allViewsForAccount1.map(_.viewId.value) contains (SYSTEM_STAGE_ONE_VIEW_ID) should be (true)
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(2)
|
||||
account1Access.map(_.view_id.get).contains(SYSTEM_STANDARD_VIEW_ID) should be (true)
|
||||
account1Access.map(_.view_id.get).contains(SYSTEM_STAGE_ONE_VIEW_ID) should be (true)
|
||||
|
||||
Then("We check the MappedUserRefreshes table")
|
||||
MappedUserRefreshes.findAll().length should be (1)
|
||||
|
||||
|
||||
Then("5th Step: we removed all the views ")
|
||||
AuthUser.refreshViewsAccountAccessAndHolders(resourceUser1, account1HeldWithEmptyView)
|
||||
|
||||
Then("We check the accountHolders")
|
||||
accountholder1.size should be(1)
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
account1Access.length should equal(0)
|
||||
|
||||
Then("We check the MappedUserRefreshes table")
|
||||
MappedUserRefreshes.findAll().length should be (1)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user