diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala index e9cf374c9..c7f117117 100644 --- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala +++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala @@ -136,185 +136,179 @@ object SwaggerDefinitionsJSON { which_alias_to_use = "family", hide_metadata_if_alias_used = false, allowed_actions = List( - "can_see_transaction_this_bank_account", - "can_see_transaction_other_bank_account", - "can_see_transaction_metadata", - "can_see_transaction_label", - "can_see_transaction_amount", - "can_see_transaction_type", - "can_see_transaction_currency", - "can_see_transaction_start_date", - "can_see_transaction_finish_date", - "can_see_transaction_balance", - "can_see_comments", - "can_see_narrative", - "can_see_tags", - "can_see_images", - "can_see_bank_account_owners", - "can_see_bank_account_type", - "can_see_bank_account_balance", - "can_see_bank_account_currency", - "can_see_bank_account_label", - "can_see_bank_account_national_identifier", - "can_see_bank_account_swift_bic", - "can_see_bank_account_iban", - "can_see_bank_account_number", - "can_see_bank_account_bank_name", - "can_see_other_account_national_identifier", - "can_see_other_account_swift_bic", - "can_see_other_account_iban", - "can_see_other_account_bank_name", - "can_see_other_account_number", - "can_see_other_account_metadata", - "can_see_other_account_kind", - "can_see_more_info", - "can_see_url", - "can_see_image_url", - "can_see_open_corporates_url", - "can_see_corporate_location", - "can_see_physical_location", - "can_see_public_alias", - "can_see_private_alias", - "can_add_more_info", - "can_add_url", - "can_add_image_url", - "can_add_open_corporates_url", - "can_add_corporate_location", - "can_add_physical_location", - "can_add_public_alias", - "can_add_private_alias", - "can_delete_corporate_location", - "can_delete_physical_location", - "can_edit_narrative", - "can_add_comment", - "can_delete_comment", - "can_add_tag", - "can_delete_tag", - "can_add_image", - "can_delete_image", - "can_add_where_tag", - "can_see_where_tag", - "can_delete_where_tag", - "can_create_counterparty", + CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_METADATA, + CAN_SEE_TRANSACTION_AMOUNT, + CAN_SEE_TRANSACTION_TYPE, + CAN_SEE_TRANSACTION_CURRENCY, + CAN_SEE_TRANSACTION_START_DATE, + CAN_SEE_TRANSACTION_FINISH_DATE, + CAN_SEE_TRANSACTION_BALANCE, + CAN_SEE_COMMENTS, + CAN_SEE_TAGS, + CAN_SEE_IMAGES, + CAN_SEE_BANK_ACCOUNT_OWNERS, + CAN_SEE_BANK_ACCOUNT_TYPE, + CAN_SEE_BANK_ACCOUNT_BALANCE, + CAN_SEE_BANK_ACCOUNT_CURRENCY, + CAN_SEE_BANK_ACCOUNT_LABEL, + CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, + CAN_SEE_BANK_ACCOUNT_IBAN, + CAN_SEE_BANK_ACCOUNT_NUMBER, + CAN_SEE_BANK_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, + CAN_SEE_OTHER_ACCOUNT_IBAN, + CAN_SEE_OTHER_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NUMBER, + CAN_SEE_OTHER_ACCOUNT_METADATA, + CAN_SEE_OTHER_ACCOUNT_KIND, + CAN_SEE_MORE_INFO, + CAN_SEE_URL, + CAN_SEE_IMAGE_URL, + CAN_SEE_OPEN_CORPORATES_URL, + CAN_SEE_CORPORATE_LOCATION, + CAN_SEE_PHYSICAL_LOCATION, + CAN_SEE_PUBLIC_ALIAS, + CAN_SEE_PRIVATE_ALIAS, + CAN_ADD_MORE_INFO, + CAN_ADD_URL, + CAN_ADD_IMAGE_URL, + CAN_ADD_OPEN_CORPORATES_URL, + CAN_ADD_CORPORATE_LOCATION, + CAN_ADD_PHYSICAL_LOCATION, + CAN_ADD_PUBLIC_ALIAS, + CAN_ADD_PRIVATE_ALIAS, + CAN_DELETE_CORPORATE_LOCATION, + CAN_DELETE_PHYSICAL_LOCATION, + CAN_ADD_COMMENT, + CAN_DELETE_COMMENT, + CAN_ADD_TAG, + CAN_DELETE_TAG, + CAN_ADD_IMAGE, + CAN_DELETE_IMAGE, + CAN_ADD_WHERE_TAG, + CAN_SEE_WHERE_TAG, + CAN_DELETE_WHERE_TAG, //V300 New - "can_see_bank_routing_scheme", - "can_see_bank_routing_address", - "can_see_bank_account_routing_scheme", - "can_see_bank_account_routing_address", - "can_see_other_bank_routing_scheme", - "can_see_other_bank_routing_address", - "can_see_other_account_routing_scheme", - "can_see_other_account_routing_address", + CAN_SEE_BANK_ROUTING_SCHEME, + CAN_SEE_BANK_ROUTING_ADDRESS, + CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS, + CAN_SEE_OTHER_BANK_ROUTING_SCHEME, + CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, + CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS, //v310 - "can_query_available_funds", - "can_add_transaction_request_to_own_account", - "can_add_transaction_request_to_any_account", - "can_see_bank_account_credit_limit", + CAN_QUERY_AVAILABLE_FUNDS, + CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT, + CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT, + CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT, //v400 - "can_create_direct_debit", - "can_create_standing_order", - + CAN_CREATE_DIRECT_DEBIT, + CAN_CREATE_STANDING_ORDER, + //payments - "can_add_transaction_request_to_any_account" + CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT ) ) lazy val createSystemViewJsonV300 = createViewJsonV300.copy(name = "test", metadata_view = "test", is_public = false) lazy val allowedActionsV500 = List( - "can_see_transaction_this_bank_account", - "can_see_transaction_other_bank_account", - "can_see_transaction_metadata", - "can_see_transaction_label", - "can_see_transaction_amount", - "can_see_transaction_type", - "can_see_transaction_currency", - "can_see_transaction_start_date", - "can_see_transaction_finish_date", - "can_see_transaction_balance", - "can_see_comments", - "can_see_narrative", "can_see_tags", - "can_see_images", - "can_see_bank_account_owners", - "can_see_bank_account_type", - "can_see_bank_account_balance", - "can_see_bank_account_currency", - "can_see_bank_account_label", - "can_see_bank_account_national_identifier", - "can_see_bank_account_swift_bic", - "can_see_bank_account_iban", - "can_see_bank_account_number", - "can_see_bank_account_bank_name", - "can_see_other_account_national_identifier", - "can_see_other_account_swift_bic", - "can_see_other_account_iban", - "can_see_other_account_bank_name", - "can_see_other_account_number", - "can_see_other_account_metadata", - "can_see_other_account_kind", - "can_see_more_info", - "can_see_url", - "can_see_image_url", - "can_see_open_corporates_url", - "can_see_corporate_location", - "can_see_physical_location", - "can_see_public_alias", - "can_see_private_alias", - "can_add_more_info", - "can_add_url", - "can_add_image_url", - "can_add_open_corporates_url", - "can_add_corporate_location", - "can_add_physical_location", - "can_add_public_alias", - "can_add_private_alias", - "can_delete_corporate_location", - "can_delete_physical_location", - "can_edit_narrative", - "can_add_comment", - "can_delete_comment", - "can_add_tag", - "can_delete_tag", - "can_add_image", - "can_delete_image", - "can_add_where_tag", - "can_see_where_tag", - "can_delete_where_tag", - "can_create_counterparty", + CAN_EDIT_OWNER_COMMENT, + CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_METADATA, + CAN_SEE_TRANSACTION_AMOUNT, + CAN_SEE_TRANSACTION_TYPE, + CAN_SEE_TRANSACTION_CURRENCY, + CAN_SEE_TRANSACTION_START_DATE, + CAN_SEE_TRANSACTION_FINISH_DATE, + CAN_SEE_TRANSACTION_BALANCE, + CAN_SEE_COMMENTS, + CAN_SEE_TAGS, + CAN_SEE_IMAGES, + CAN_SEE_BANK_ACCOUNT_OWNERS, + CAN_SEE_BANK_ACCOUNT_TYPE, + CAN_SEE_BANK_ACCOUNT_BALANCE, + CAN_SEE_BANK_ACCOUNT_CURRENCY, + CAN_SEE_BANK_ACCOUNT_LABEL, + CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, + CAN_SEE_BANK_ACCOUNT_IBAN, + CAN_SEE_BANK_ACCOUNT_NUMBER, + CAN_SEE_BANK_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, + CAN_SEE_OTHER_ACCOUNT_IBAN, + CAN_SEE_OTHER_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NUMBER, + CAN_SEE_OTHER_ACCOUNT_METADATA, + CAN_SEE_OTHER_ACCOUNT_KIND, + CAN_SEE_MORE_INFO, + CAN_SEE_URL, + CAN_SEE_IMAGE_URL, + CAN_SEE_OPEN_CORPORATES_URL, + CAN_SEE_CORPORATE_LOCATION, + CAN_SEE_PHYSICAL_LOCATION, + CAN_SEE_PUBLIC_ALIAS, + CAN_SEE_PRIVATE_ALIAS, + CAN_ADD_MORE_INFO, + CAN_ADD_URL, + CAN_ADD_IMAGE_URL, + CAN_ADD_OPEN_CORPORATES_URL, + CAN_ADD_CORPORATE_LOCATION, + CAN_ADD_PHYSICAL_LOCATION, + CAN_ADD_PUBLIC_ALIAS, + CAN_ADD_PRIVATE_ALIAS, + CAN_DELETE_CORPORATE_LOCATION, + CAN_DELETE_PHYSICAL_LOCATION, + CAN_ADD_COMMENT, + CAN_DELETE_COMMENT, + CAN_ADD_TAG, + CAN_DELETE_TAG, + CAN_ADD_IMAGE, + CAN_DELETE_IMAGE, + CAN_ADD_WHERE_TAG, + CAN_SEE_WHERE_TAG, + CAN_DELETE_WHERE_TAG, //V300 New - "can_see_bank_routing_scheme", - "can_see_bank_routing_address", - "can_see_bank_account_routing_scheme", - "can_see_bank_account_routing_address", - "can_see_other_bank_routing_scheme", - "can_see_other_bank_routing_address", - "can_see_other_account_routing_scheme", - "can_see_other_account_routing_address", + CAN_SEE_BANK_ROUTING_SCHEME, + CAN_SEE_BANK_ROUTING_ADDRESS, + CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS, + CAN_SEE_OTHER_BANK_ROUTING_SCHEME, + CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, + CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS, //v310 - "can_query_available_funds", - "can_add_transaction_request_to_own_account", - "can_add_transaction_request_to_any_account", - "can_see_bank_account_credit_limit", + CAN_QUERY_AVAILABLE_FUNDS, + CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT, + CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT, + CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT, //v400 - "can_create_direct_debit", - "can_create_standing_order", + CAN_CREATE_DIRECT_DEBIT, + CAN_CREATE_STANDING_ORDER, //payments - "can_add_transaction_request_to_any_account", + CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT, - "can_see_transaction_request_types", - "can_see_transaction_requests", - "can_see_available_views_for_bank_account", - "can_update_bank_account_label", - "can_create_custom_view", - "can_delete_custom_view", - "can_update_custom_view", - "can_see_views_with_permissions_for_one_user", - "can_see_views_with_permissions_for_all_users", - "can_grant_access_to_custom_views", - "can_revoke_access_to_custom_views", - "can_see_transaction_status" + CAN_SEE_TRANSACTION_REQUEST_TYPES, + CAN_SEE_TRANSACTION_REQUESTS, + CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT, + CAN_UPDATE_BANK_ACCOUNT_LABEL, + CAN_CREATE_CUSTOM_VIEW, + CAN_DELETE_CUSTOM_VIEW, + CAN_UPDATE_CUSTOM_VIEW, + CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER, + CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS, + CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS, + CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS, + CAN_SEE_TRANSACTION_STATUS ) lazy val createCustomViewJson = CreateCustomViewJson( @@ -367,76 +361,76 @@ object SwaggerDefinitionsJSON { which_alias_to_use = "family", hide_metadata_if_alias_used = true, allowed_actions = List( - "can_see_transaction_this_bank_account", - "can_see_transaction_other_bank_account", - "can_see_transaction_metadata", - "can_see_transaction_label", - "can_see_transaction_amount", - "can_see_transaction_type", - "can_see_transaction_currency", - "can_see_transaction_start_date", - "can_see_transaction_finish_date", - "can_see_transaction_balance", - "can_see_comments", - "can_see_narrative", "can_see_tags", - "can_see_images", - "can_see_bank_account_owners", - "can_see_bank_account_type", - "can_see_bank_account_balance", - "can_see_bank_account_currency", - "can_see_bank_account_label", - "can_see_bank_account_national_identifier", - "can_see_bank_account_swift_bic", - "can_see_bank_account_iban", - "can_see_bank_account_number", - "can_see_bank_account_bank_name", - "can_see_other_account_national_identifier", - "can_see_other_account_swift_bic", - "can_see_other_account_iban", - "can_see_other_account_bank_name", - "can_see_other_account_number", - "can_see_other_account_metadata", - "can_see_other_account_kind", - "can_see_more_info", - "can_see_url", - "can_see_image_url", - "can_see_open_corporates_url", - "can_see_corporate_location", - "can_see_physical_location", - "can_see_public_alias", - "can_see_private_alias", - "can_add_more_info", - "can_add_url", - "can_add_image_url", - "can_add_open_corporates_url", - "can_add_corporate_location", - "can_add_physical_location", - "can_add_public_alias", - "can_add_private_alias", - "can_delete_corporate_location", - "can_delete_physical_location", - "can_edit_narrative", - "can_add_comment", - "can_delete_comment", - "can_add_tag", - "can_delete_tag", - "can_add_image", - "can_delete_image", - "can_add_where_tag", - "can_see_where_tag", - "can_delete_where_tag", - "can_create_counterparty", + CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_METADATA, + + CAN_SEE_TRANSACTION_AMOUNT, + CAN_SEE_TRANSACTION_TYPE, + CAN_SEE_TRANSACTION_CURRENCY, + CAN_SEE_TRANSACTION_START_DATE, + CAN_SEE_TRANSACTION_FINISH_DATE, + CAN_SEE_TRANSACTION_BALANCE, + CAN_SEE_COMMENTS, + CAN_SEE_TAGS, + CAN_SEE_IMAGES, + CAN_SEE_BANK_ACCOUNT_OWNERS, + CAN_SEE_BANK_ACCOUNT_TYPE, + CAN_SEE_BANK_ACCOUNT_BALANCE, + CAN_SEE_BANK_ACCOUNT_CURRENCY, + CAN_SEE_BANK_ACCOUNT_LABEL, + CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, + CAN_SEE_BANK_ACCOUNT_IBAN, + CAN_SEE_BANK_ACCOUNT_NUMBER, + CAN_SEE_BANK_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, + CAN_SEE_OTHER_ACCOUNT_IBAN, + CAN_SEE_OTHER_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NUMBER, + CAN_SEE_OTHER_ACCOUNT_METADATA, + CAN_SEE_OTHER_ACCOUNT_KIND, + CAN_SEE_MORE_INFO, + CAN_SEE_URL, + CAN_SEE_IMAGE_URL, + CAN_SEE_OPEN_CORPORATES_URL, + CAN_SEE_CORPORATE_LOCATION, + CAN_SEE_PHYSICAL_LOCATION, + CAN_SEE_PUBLIC_ALIAS, + CAN_SEE_PRIVATE_ALIAS, + CAN_ADD_MORE_INFO, + CAN_ADD_URL, + CAN_ADD_IMAGE_URL, + CAN_ADD_OPEN_CORPORATES_URL, + CAN_ADD_CORPORATE_LOCATION, + CAN_ADD_PHYSICAL_LOCATION, + CAN_ADD_PUBLIC_ALIAS, + CAN_ADD_PRIVATE_ALIAS, + CAN_DELETE_CORPORATE_LOCATION, + CAN_DELETE_PHYSICAL_LOCATION, + + CAN_ADD_COMMENT, + CAN_DELETE_COMMENT, + CAN_ADD_TAG, + CAN_DELETE_TAG, + CAN_ADD_IMAGE, + CAN_DELETE_IMAGE, + CAN_ADD_WHERE_TAG, + CAN_SEE_WHERE_TAG, + CAN_DELETE_WHERE_TAG, + //V300 New - "can_see_bank_routing_scheme", - "can_see_bank_routing_address", - "can_see_bank_account_routing_scheme", - "can_see_bank_account_routing_address", - "can_see_other_bank_routing_scheme", - "can_see_other_bank_routing_address", - "can_see_other_account_routing_scheme", - "can_see_other_account_routing_address", + CAN_SEE_BANK_ROUTING_SCHEME, + CAN_SEE_BANK_ROUTING_ADDRESS, + CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS, + CAN_SEE_OTHER_BANK_ROUTING_SCHEME, + CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, + CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS, //v310 - "can_query_available_funds" + CAN_QUERY_AVAILABLE_FUNDS ) ) lazy val updateSystemViewJson310 = updateViewJsonV300.copy(is_public = false, is_firehose = Some(false)) @@ -845,75 +839,72 @@ object SwaggerDefinitionsJSON { which_alias_to_use = "family", hide_metadata_if_alias_used = false, allowed_actions = List( - "can_see_transaction_this_bank_account", - "can_see_transaction_other_bank_account", - "can_see_transaction_metadata", - "can_see_transaction_label", - "can_see_transaction_amount", - "can_see_transaction_type", - "can_see_transaction_currency", - "can_see_transaction_start_date", - "can_see_transaction_finish_date", - "can_see_transaction_balance", - "can_see_comments", - "can_see_narrative", - "can_see_tags", - "can_see_images", - "can_see_bank_account_owners", - "can_see_bank_account_type", - "can_see_bank_account_balance", - "can_see_bank_account_currency", - "can_see_bank_account_label", - "can_see_bank_account_national_identifier", - "can_see_bank_account_swift_bic", - "can_see_bank_account_iban", - "can_see_bank_account_number", - "can_see_bank_account_bank_name", - "can_see_other_account_national_identifier", - "can_see_other_account_swift_bic", - "can_see_other_account_iban", - "can_see_other_account_bank_name", - "can_see_other_account_number", - "can_see_other_account_metadata", - "can_see_other_account_kind", - "can_see_more_info", - "can_see_url", - "can_see_image_url", - "can_see_open_corporates_url", - "can_see_corporate_location", - "can_see_physical_location", - "can_see_public_alias", - "can_see_private_alias", - "can_add_more_info", - "can_add_url", - "can_add_image_url", - "can_add_open_corporates_url", - "can_add_corporate_location", - "can_add_physical_location", - "can_add_public_alias", - "can_add_private_alias", - "can_delete_corporate_location", - "can_delete_physical_location", - "can_edit_narrative", - "can_add_comment", - "can_delete_comment", - "can_add_tag", - "can_delete_tag", - "can_add_image", - "can_delete_image", - "can_add_where_tag", - "can_see_where_tag", - "can_delete_where_tag", - "can_create_counterparty", + CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_METADATA, + CAN_SEE_TRANSACTION_AMOUNT, + CAN_SEE_TRANSACTION_TYPE, + CAN_SEE_TRANSACTION_CURRENCY, + CAN_SEE_TRANSACTION_START_DATE, + CAN_SEE_TRANSACTION_FINISH_DATE, + CAN_SEE_TRANSACTION_BALANCE, + CAN_SEE_COMMENTS, + CAN_SEE_TAGS, + CAN_SEE_IMAGES, + CAN_SEE_BANK_ACCOUNT_OWNERS, + CAN_SEE_BANK_ACCOUNT_TYPE, + CAN_SEE_BANK_ACCOUNT_BALANCE, + CAN_SEE_BANK_ACCOUNT_CURRENCY, + CAN_SEE_BANK_ACCOUNT_LABEL, + CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, + CAN_SEE_BANK_ACCOUNT_IBAN, + CAN_SEE_BANK_ACCOUNT_NUMBER, + CAN_SEE_BANK_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, + CAN_SEE_OTHER_ACCOUNT_IBAN, + CAN_SEE_OTHER_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NUMBER, + CAN_SEE_OTHER_ACCOUNT_METADATA, + CAN_SEE_OTHER_ACCOUNT_KIND, + CAN_SEE_MORE_INFO, + CAN_SEE_URL, + CAN_SEE_IMAGE_URL, + CAN_SEE_OPEN_CORPORATES_URL, + CAN_SEE_CORPORATE_LOCATION, + CAN_SEE_PHYSICAL_LOCATION, + CAN_SEE_PUBLIC_ALIAS, + CAN_SEE_PRIVATE_ALIAS, + CAN_ADD_MORE_INFO, + CAN_ADD_URL, + CAN_ADD_IMAGE_URL, + CAN_ADD_OPEN_CORPORATES_URL, + CAN_ADD_CORPORATE_LOCATION, + CAN_ADD_PHYSICAL_LOCATION, + CAN_ADD_PUBLIC_ALIAS, + CAN_ADD_PRIVATE_ALIAS, + CAN_DELETE_CORPORATE_LOCATION, + CAN_DELETE_PHYSICAL_LOCATION, + CAN_ADD_COMMENT, + CAN_DELETE_COMMENT, + CAN_ADD_TAG, + CAN_DELETE_TAG, + CAN_ADD_IMAGE, + CAN_DELETE_IMAGE, + CAN_ADD_WHERE_TAG, + CAN_SEE_WHERE_TAG, + CAN_DELETE_WHERE_TAG, + //V300 New - "can_see_bank_routing_scheme", - "can_see_bank_routing_address", - "can_see_bank_account_routing_scheme", - "can_see_bank_account_routing_address", - "can_see_other_bank_routing_scheme", - "can_see_other_bank_routing_address", - "can_see_other_account_routing_scheme", - "can_see_other_account_routing_address" + CAN_SEE_BANK_ROUTING_SCHEME, + CAN_SEE_BANK_ROUTING_ADDRESS, + CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS, + CAN_SEE_OTHER_BANK_ROUTING_SCHEME, + CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, + CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS ) ) @@ -923,75 +914,72 @@ object SwaggerDefinitionsJSON { which_alias_to_use = "family", hide_metadata_if_alias_used = false, allowed_actions = List( - "can_see_transaction_this_bank_account", - "can_see_transaction_other_bank_account", - "can_see_transaction_metadata", - "can_see_transaction_label", - "can_see_transaction_amount", - "can_see_transaction_type", - "can_see_transaction_currency", - "can_see_transaction_start_date", - "can_see_transaction_finish_date", - "can_see_transaction_balance", - "can_see_comments", - "can_see_narrative", - "can_see_tags", - "can_see_images", - "can_see_bank_account_owners", - "can_see_bank_account_type", - "can_see_bank_account_balance", - "can_see_bank_account_currency", - "can_see_bank_account_label", - "can_see_bank_account_national_identifier", - "can_see_bank_account_swift_bic", - "can_see_bank_account_iban", - "can_see_bank_account_number", - "can_see_bank_account_bank_name", - "can_see_other_account_national_identifier", - "can_see_other_account_swift_bic", - "can_see_other_account_iban", - "can_see_other_account_bank_name", - "can_see_other_account_number", - "can_see_other_account_metadata", - "can_see_other_account_kind", - "can_see_more_info", - "can_see_url", - "can_see_image_url", - "can_see_open_corporates_url", - "can_see_corporate_location", - "can_see_physical_location", - "can_see_public_alias", - "can_see_private_alias", - "can_add_more_info", - "can_add_url", - "can_add_image_url", - "can_add_open_corporates_url", - "can_add_corporate_location", - "can_add_physical_location", - "can_add_public_alias", - "can_add_private_alias", - "can_delete_corporate_location", - "can_delete_physical_location", - "can_edit_narrative", - "can_add_comment", - "can_delete_comment", - "can_add_tag", - "can_delete_tag", - "can_add_image", - "can_delete_image", - "can_add_where_tag", - "can_see_where_tag", - "can_delete_where_tag", - "can_create_counterparty", + CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_METADATA, + CAN_SEE_TRANSACTION_AMOUNT, + CAN_SEE_TRANSACTION_TYPE, + CAN_SEE_TRANSACTION_CURRENCY, + CAN_SEE_TRANSACTION_START_DATE, + CAN_SEE_TRANSACTION_FINISH_DATE, + CAN_SEE_TRANSACTION_BALANCE, + CAN_SEE_COMMENTS, + CAN_SEE_TAGS, + CAN_SEE_IMAGES, + CAN_SEE_BANK_ACCOUNT_OWNERS, + CAN_SEE_BANK_ACCOUNT_TYPE, + CAN_SEE_BANK_ACCOUNT_BALANCE, + CAN_SEE_BANK_ACCOUNT_CURRENCY, + CAN_SEE_BANK_ACCOUNT_LABEL, + CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, + CAN_SEE_BANK_ACCOUNT_IBAN, + CAN_SEE_BANK_ACCOUNT_NUMBER, + CAN_SEE_BANK_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, + CAN_SEE_OTHER_ACCOUNT_IBAN, + CAN_SEE_OTHER_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NUMBER, + CAN_SEE_OTHER_ACCOUNT_METADATA, + CAN_SEE_OTHER_ACCOUNT_KIND, + CAN_SEE_MORE_INFO, + CAN_SEE_URL, + CAN_SEE_IMAGE_URL, + CAN_SEE_OPEN_CORPORATES_URL, + CAN_SEE_CORPORATE_LOCATION, + CAN_SEE_PHYSICAL_LOCATION, + CAN_SEE_PUBLIC_ALIAS, + CAN_SEE_PRIVATE_ALIAS, + CAN_ADD_MORE_INFO, + CAN_ADD_URL, + CAN_ADD_IMAGE_URL, + CAN_ADD_OPEN_CORPORATES_URL, + CAN_ADD_CORPORATE_LOCATION, + CAN_ADD_PHYSICAL_LOCATION, + CAN_ADD_PUBLIC_ALIAS, + CAN_ADD_PRIVATE_ALIAS, + CAN_DELETE_CORPORATE_LOCATION, + CAN_DELETE_PHYSICAL_LOCATION, + CAN_ADD_COMMENT, + CAN_DELETE_COMMENT, + CAN_ADD_TAG, + CAN_DELETE_TAG, + CAN_ADD_IMAGE, + CAN_DELETE_IMAGE, + CAN_ADD_WHERE_TAG, + CAN_SEE_WHERE_TAG, + CAN_DELETE_WHERE_TAG, + //V300 New - "can_see_bank_routing_scheme", - "can_see_bank_routing_address", - "can_see_bank_account_routing_scheme", - "can_see_bank_account_routing_address", - "can_see_other_bank_routing_scheme", - "can_see_other_bank_routing_address", - "can_see_other_account_routing_scheme", - "can_see_other_account_routing_address" + CAN_SEE_BANK_ROUTING_SCHEME, + CAN_SEE_BANK_ROUTING_ADDRESS, + CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS, + CAN_SEE_OTHER_BANK_ROUTING_SCHEME, + CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, + CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME, + CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS ) ) lazy val viewsJSONV121 = ViewsJSONV121( diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala index 3f255eeee..a08076c4e 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -5054,7 +5054,6 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ } //get all the permission Pair from one record, eg: - //List("can_see_transaction_this_bank_account","can_see_transaction_requests"....) //Note, do not contain can_revoke_access_to_views and can_grant_access_to_views permission yet. def getViewPermissions(view: ViewDefinition) = view.allFields.map(x => (x.name, x.get)) .filter(pair =>pair._2.isInstanceOf[Boolean]) diff --git a/obp-api/src/main/scala/code/api/util/ExampleValue.scala b/obp-api/src/main/scala/code/api/util/ExampleValue.scala index e02db9cf2..0b516d606 100644 --- a/obp-api/src/main/scala/code/api/util/ExampleValue.scala +++ b/obp-api/src/main/scala/code/api/util/ExampleValue.scala @@ -2,6 +2,7 @@ package code.api.util import code.api.Constant +import code.api.Constant._ import code.api.util.APIUtil.{DateWithMs, DateWithMsExampleString, formatDate, oneYearAgoDate, parseDate} import code.api.util.ErrorMessages.{InvalidJsonFormat, UnknownError, UserHasMissingRoles, UserNotLoggedIn} import code.api.util.Glossary.{glossaryItems, makeGlossaryItem} @@ -709,7 +710,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("count", countExample) lazy val canSeeOtherAccountBankNameExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_bank_name", canSeeOtherAccountBankNameExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_BANK_NAME, canSeeOtherAccountBankNameExample) lazy val handleExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("handle", handleExample) @@ -730,7 +731,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("duration", durationExample) lazy val canSeeBankAccountTypeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_type", canSeeBankAccountTypeExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_TYPE, canSeeBankAccountTypeExample) lazy val toSepaExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("to_sepa", toSepaExample) @@ -739,7 +740,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("which_alias_to_use", whichAliasToUseExample) lazy val canAddImageExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_image", canAddImageExample) + glossaryItems += makeGlossaryItem(CAN_ADD_IMAGE, canAddImageExample) lazy val accountAttributeIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("account_attribute_id", accountAttributeIdExample) @@ -758,18 +759,18 @@ object ExampleValue { lazy val statusExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("status", statusExample) - + lazy val transactionStatusExample = ConnectorField(s" ${TransactionRequestStatus.COMPLETED.toString}",s"Status of the transaction, e.g. ${TransactionRequestStatus.COMPLETED.toString}, ${TransactionRequestStatus.PENDING.toString} ..") glossaryItems += makeGlossaryItem("status", transactionStatusExample) - + lazy val errorCodeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("errorCode", errorCodeExample) - + lazy val textExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("text", textExample) lazy val canSeeTransactionBalanceExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_balance", canSeeTransactionBalanceExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_BALANCE, canSeeTransactionBalanceExample) lazy val atmsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("atms", atmsExample) @@ -778,10 +779,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("overall_balance_date", overallBalanceDateExample) lazy val canDeletePhysicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_delete_physical_location", canDeletePhysicalLocationExample) + glossaryItems += makeGlossaryItem(CAN_DELETE_PHYSICAL_LOCATION, canDeletePhysicalLocationExample) lazy val canAddWhereTagExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_where_tag", canAddWhereTagExample) + glossaryItems += makeGlossaryItem(CAN_ADD_WHERE_TAG, canAddWhereTagExample) lazy val pinResetExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("pin_reset", pinResetExample) @@ -811,10 +812,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("active", activeExample) lazy val canSeeOtherAccountMetadataExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_metadata", canSeeOtherAccountMetadataExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_METADATA, canSeeOtherAccountMetadataExample) lazy val canSeeBankAccountIbanExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_iban", canSeeBankAccountIbanExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_IBAN, canSeeBankAccountIbanExample) lazy val lobbyExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("lobby", lobbyExample) @@ -844,7 +845,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("function_name", functionNameExample) lazy val canSeeBankRoutingSchemeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_routing_scheme", canSeeBankRoutingSchemeExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ROUTING_SCHEME, canSeeBankRoutingSchemeExample) lazy val line1Example = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("line1", line1Example) @@ -865,7 +866,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("counterparties", counterpartiesExample) lazy val canSeeMoreInfoExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_more_info", canSeeMoreInfoExample) + glossaryItems += makeGlossaryItem(CAN_SEE_MORE_INFO, canSeeMoreInfoExample) lazy val transactionAttributesExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("transaction_attributes", transactionAttributesExample) @@ -883,31 +884,31 @@ object ExampleValue { glossaryItems += makeGlossaryItem("images", imagesExample) lazy val canSeeBankAccountBalanceExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_balance", canSeeBankAccountBalanceExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_BALANCE, canSeeBankAccountBalanceExample) lazy val parametersExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("parameters", parametersExample) lazy val canAddTransactionRequestToAnyAccountExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_transaction_request_to_any_account", canAddTransactionRequestToAnyAccountExample) + glossaryItems += makeGlossaryItem(CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT, canAddTransactionRequestToAnyAccountExample) lazy val websiteExample = ConnectorField("www.openbankproject.com",NoDescriptionProvided) glossaryItems += makeGlossaryItem("website", websiteExample) lazy val atmIdExample = ConnectorField("atme-9a0f-4bfa-b30b-9003aa467f51","A string that MUST uniquely identify the ATM on this OBP instance.") glossaryItems += makeGlossaryItem("atm_id", atmIdExample) - + lazy val atmAttributeIdExample = ConnectorField("xxaf2a-9a0f-4bfa-b30b-9003aa467f51","A string that MUST uniquely identify the ATM Attribute on this OBP instance.") glossaryItems += makeGlossaryItem("ATM.attribute_id", atmIdExample) - + lazy val entityIdExample = ConnectorField("0af807d7-3c39-43ef-9712-82bcfde1b9ca", "A unique identifier for the entity.") glossaryItems += makeGlossaryItem("entity_id", entityIdExample) - + lazy val certificateAuthorityCaOwnerIdExample = ConnectorField("CY_CBC", "The certificate authority owner ID.") glossaryItems += makeGlossaryItem("certificate_authority_ca_owner_id", certificateAuthorityCaOwnerIdExample) - + lazy val entityCertificatePublicKeyExample = ConnectorField( - "MIICsjCCAZqgAwIBAgIGAYwQ62R0MA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbT" + + "MIICsjCCAZqgAwIBAgIGAYwQ62R0MA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbT" + "AeFw0yMzExMjcxMzE1MTFaFw0yNTExMjYxMzE1MTFaMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADC" + "CAQoCggEBAK9WIodZHWzKyCcf9YfWEhPURbfO6zKuMqzHN27GdqHsVVEGxP4F/J4mso+0ENcRr6ur4u81iREaVdCc40rHDHVJNEtniD8Icbz7tcsq" + "AewIVhc/q6WXGqImJpCq7hA0m247dDsaZT0lb/MVBiMoJxDEmAE/GYYnWTEn84R35WhJsMvuQ7QmLvNg6RkChY6POCT/YKe9NKwa1NqI1U+oA5RFz" + @@ -919,34 +920,34 @@ object ExampleValue { "The public key of the entity certificate." ) glossaryItems += makeGlossaryItem("entity_certificate_public_key", entityCertificatePublicKeyExample) - + lazy val entityNameExample = ConnectorField("EXAMPLE COMPANY LTD", "The name of the entity.") glossaryItems += makeGlossaryItem("entity_name", entityNameExample) - + lazy val entityCodeExample = ConnectorField("PSD_PICY_CBC!12345", "The code of the entity.") glossaryItems += makeGlossaryItem("entity_code", entityCodeExample) - + lazy val entityTypeExample = ConnectorField("PSD_PI", "The type of the entity.") glossaryItems += makeGlossaryItem("entity_type", entityTypeExample) - + lazy val entityAddressExample = ConnectorField("EXAMPLE COMPANY LTD, 5 SOME STREET", "The address of the entity.") glossaryItems += makeGlossaryItem("entity_address", entityAddressExample) - + lazy val entityTownCityExample = ConnectorField("SOME CITY", "The town or city of the entity.") glossaryItems += makeGlossaryItem("entity_town_city", entityTownCityExample) - + lazy val entityPostCodeExample = ConnectorField("1060", "The postal code of the entity.") glossaryItems += makeGlossaryItem("entity_post_code", entityPostCodeExample) - + lazy val entityCountryExample = ConnectorField("CY", "The country of the entity.") glossaryItems += makeGlossaryItem("entity_country", entityCountryExample) - + lazy val entityWebSiteExample = ConnectorField("www.example.com", "The website of the entity.") glossaryItems += makeGlossaryItem("entity_web_site", entityWebSiteExample) - + lazy val servicesExample = ConnectorField("""[{"CY":["PS_010","PS_020","PS_03C","PS_04C"]}]""", "The services provided by the entity.") glossaryItems += makeGlossaryItem("services", servicesExample) - + lazy val regulatedEntityAttributeIdExample = ConnectorField("attrafa-9a0f-4bfa-b30b-9003aa467f51","A string that MUST uniquely identify the Regulated Entity Attribute on this OBP instance.") glossaryItems += makeGlossaryItem("RegulatedEntity.attribute_id", regulatedEntityAttributeIdExample) @@ -1005,13 +1006,13 @@ object ExampleValue { glossaryItems += makeGlossaryItem("accessibility_features", accessibilityFeaturesExample) lazy val canSeeOtherBankRoutingSchemeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_bank_routing_scheme", canSeeOtherBankRoutingSchemeExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_BANK_ROUTING_SCHEME, canSeeOtherBankRoutingSchemeExample) lazy val physicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("physical_location", physicalLocationExample) lazy val canSeeBankAccountRoutingSchemeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_routing_scheme", canSeeBankAccountRoutingSchemeExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, canSeeBankAccountRoutingSchemeExample) lazy val rankAmount2Example = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("rank_amount2", rankAmount2Example) @@ -1026,7 +1027,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("image_url", imageUrlExample) lazy val canSeeTransactionMetadataExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_metadata", canSeeTransactionMetadataExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_METADATA, canSeeTransactionMetadataExample) lazy val documentsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("documents", documentsExample) @@ -1056,13 +1057,13 @@ object ExampleValue { glossaryItems += makeGlossaryItem("other_accounts", otherAccountsExample) lazy val canSeeTransactionFinishDateExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_finish_date", canSeeTransactionFinishDateExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_FINISH_DATE, canSeeTransactionFinishDateExample) lazy val satisfiedExample = ConnectorField(booleanFalse,NoDescriptionProvided) glossaryItems += makeGlossaryItem("satisfied", satisfiedExample) lazy val canSeeOtherAccountIbanExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_iban", canSeeOtherAccountIbanExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_IBAN, canSeeOtherAccountIbanExample) lazy val attributeIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("attribute_id", attributeIdExample) @@ -1074,7 +1075,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("id", idExample) lazy val canAddCorporateLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_corporate_location", canAddCorporateLocationExample) + glossaryItems += makeGlossaryItem(CAN_ADD_CORPORATE_LOCATION, canAddCorporateLocationExample) lazy val crmEventsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("crm_events", crmEventsExample) @@ -1107,7 +1108,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("requested_current_valid_end_date", requestedCurrentValidEndDateExample) lazy val canSeeOtherBankRoutingAddressExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_bank_routing_address", canSeeOtherBankRoutingAddressExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, canSeeOtherBankRoutingAddressExample) lazy val thursdayExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("thursday", thursdayExample) @@ -1117,27 +1118,27 @@ object ExampleValue { lazy val phoneExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("phone", phoneExample) - + lazy val sepaCreditTransferExample = ConnectorField("yes","no-description-provided") - glossaryItems += makeGlossaryItem("sepaCreditTransfer", sepaCreditTransferExample) - + glossaryItems += makeGlossaryItem("sepaCreditTransfer", sepaCreditTransferExample) + lazy val sepaSddCoreExample = ConnectorField("yes","no-description-provided") - glossaryItems += makeGlossaryItem("sepaSddCore", sepaSddCoreExample) - + glossaryItems += makeGlossaryItem("sepaSddCore", sepaSddCoreExample) + lazy val sepaB2bExample = ConnectorField("yes","no-description-provided") - glossaryItems += makeGlossaryItem("sepaB2b", sepaB2bExample) - + glossaryItems += makeGlossaryItem("sepaB2b", sepaB2bExample) + lazy val sepaCardClearingExample = ConnectorField("no","no-description-provided") - glossaryItems += makeGlossaryItem("sepaCardClearing", sepaCardClearingExample) - + glossaryItems += makeGlossaryItem("sepaCardClearing", sepaCardClearingExample) + lazy val bicExample = ConnectorField("BUKBGB22","The Business Identifier Code") - glossaryItems += makeGlossaryItem("bic", bicExample) - + glossaryItems += makeGlossaryItem("bic", bicExample) + lazy val sepaDirectDebitExample = ConnectorField("yes","no-description-provided") glossaryItems += makeGlossaryItem("sepaDirectDebit", sepaDirectDebitExample) lazy val canSeeTransactionOtherBankAccountExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_other_bank_account", canSeeTransactionOtherBankAccountExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, canSeeTransactionOtherBankAccountExample) lazy val itemsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("items", itemsExample) @@ -1149,7 +1150,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("bank_routings", bankRoutingsExample) lazy val canSeeOpenCorporatesUrlExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_open_corporates_url", canSeeOpenCorporatesUrlExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OPEN_CORPORATES_URL, canSeeOpenCorporatesUrlExample) lazy val branchesExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("branches", branchesExample) @@ -1233,7 +1234,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("comment_id", commentIdExample) lazy val canSeeBankAccountNationalIdentifierExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_national_identifier", canSeeBankAccountNationalIdentifierExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, canSeeBankAccountNationalIdentifierExample) lazy val perMinuteExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("per_minute", perMinuteExample) @@ -1266,7 +1267,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("this_view_id", thisViewIdExample) lazy val canSeeTransactionCurrencyExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_currency", canSeeTransactionCurrencyExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_CURRENCY, canSeeTransactionCurrencyExample) lazy val accountOtpExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("account_otp", accountOtpExample) @@ -1275,7 +1276,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("hide_metadata_if_alias_used", hideMetadataIfAliasUsedExample) lazy val canSeeBankAccountCurrencyExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_currency", canSeeBankAccountCurrencyExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_CURRENCY, canSeeBankAccountCurrencyExample) lazy val generateAuditorsViewExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("generate_auditors_view", generateAuditorsViewExample) @@ -1324,16 +1325,16 @@ object ExampleValue { glossaryItems += makeGlossaryItem("from_person", fromPersonExample) lazy val canSeePrivateAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_private_alias", canSeePrivateAliasExample) + glossaryItems += makeGlossaryItem(CAN_SEE_PRIVATE_ALIAS, canSeePrivateAliasExample) lazy val typeOfLockExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("type_of_lock", typeOfLockExample) lazy val canSeeOtherAccountKindExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_kind", canSeeOtherAccountKindExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_KIND, canSeeOtherAccountKindExample) lazy val canAddOpenCorporatesUrlExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_open_corporates_url", canAddOpenCorporatesUrlExample) + glossaryItems += makeGlossaryItem(CAN_ADD_OPEN_CORPORATES_URL, canAddOpenCorporatesUrlExample) lazy val metadataViewExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("metadata_view", metadataViewExample) @@ -1342,7 +1343,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("alias", aliasExample) lazy val canSeeTransactionThisBankAccountExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_this_bank_account", canSeeTransactionThisBankAccountExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, canSeeTransactionThisBankAccountExample) lazy val triggerNameExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("trigger_name", triggerNameExample) @@ -1375,7 +1376,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("address", addressExample) lazy val canAddPrivateAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_private_alias", canAddPrivateAliasExample) + glossaryItems += makeGlossaryItem(CAN_ADD_PRIVATE_ALIAS, canAddPrivateAliasExample) lazy val postcodeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("postcode", postcodeExample) @@ -1396,7 +1397,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("reset_password_url", resetPasswordUrlExample) lazy val canSeeBankAccountSwiftBicExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_swift_bic", canSeeBankAccountSwiftBicExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, canSeeBankAccountSwiftBicExample) lazy val jsonstringExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("jsonstring", jsonstringExample) @@ -1417,10 +1418,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("details", detailsExample) lazy val canSeeOwnerCommentExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_owner_comment", canSeeOwnerCommentExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OWNER_COMMENT, canSeeOwnerCommentExample) lazy val canSeeTagsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_tags", canSeeTagsExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TAGS, canSeeTagsExample) lazy val moreInfoUrlExample = ConnectorField("www.example.com/abc",NoDescriptionProvided) glossaryItems += makeGlossaryItem("more_info_url", moreInfoUrlExample) @@ -1441,7 +1442,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("terms_and_conditions_url_example", termsAndConditionsUrlExample) lazy val canAddUrlExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_url", canAddUrlExample) + glossaryItems += makeGlossaryItem(CAN_ADD_URL, canAddUrlExample) lazy val viewExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("view", viewExample) @@ -1450,7 +1451,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("display_name", displayNameExample) lazy val canDeleteTagExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_delete_tag", canDeleteTagExample) + glossaryItems += makeGlossaryItem(CAN_DELETE_TAG, canDeleteTagExample) lazy val hoursExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("hours", hoursExample) @@ -1513,7 +1514,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("kyc_document_id", kycDocumentIdExample) lazy val canSeePublicAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_public_alias", canSeePublicAliasExample) + glossaryItems += makeGlossaryItem(CAN_SEE_PUBLIC_ALIAS, canSeePublicAliasExample) lazy val webUiPropsIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("web_ui_props_id", webUiPropsIdExample) @@ -1522,7 +1523,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("provider", providerExample) lazy val canSeePhysicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_physical_location", canSeePhysicalLocationExample) + glossaryItems += makeGlossaryItem(CAN_SEE_PHYSICAL_LOCATION, canSeePhysicalLocationExample) lazy val accountRoutingsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("account_routings", accountRoutingsExample) @@ -1944,7 +1945,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("full_name", fullNameExample) lazy val canCreateDirectDebitExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_create_direct_debit", canCreateDirectDebitExample) + glossaryItems += makeGlossaryItem(CAN_CREATE_DIRECT_DEBIT, canCreateDirectDebitExample) lazy val futureDateExample = ConnectorField("20200127",NoDescriptionProvided) glossaryItems += makeGlossaryItem("future_date", futureDateExample) @@ -1962,19 +1963,19 @@ object ExampleValue { glossaryItems += makeGlossaryItem("document_number", documentNumberExample) lazy val canSeeOtherAccountNationalIdentifierExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_national_identifier", canSeeOtherAccountNationalIdentifierExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, canSeeOtherAccountNationalIdentifierExample) lazy val canSeeTransactionStartDateExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_start_date", canSeeTransactionStartDateExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_START_DATE, canSeeTransactionStartDateExample) lazy val canAddPhysicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_physical_location", canAddPhysicalLocationExample) + glossaryItems += makeGlossaryItem(CAN_ADD_PHYSICAL_LOCATION, canAddPhysicalLocationExample) lazy val cacheExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("cache", cacheExample) lazy val canSeeBankRoutingAddressExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_routing_address", canSeeBankRoutingAddressExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ROUTING_ADDRESS, canSeeBankRoutingAddressExample) lazy val usersExample = ConnectorField("user list", "Please refer to the user object.") glossaryItems += makeGlossaryItem("users", usersExample) @@ -2004,7 +2005,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("metadata", metadataExample) lazy val canSeeTransactionAmountExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_amount", canSeeTransactionAmountExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_AMOUNT, canSeeTransactionAmountExample) lazy val methodRoutingIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("method_routing_id", methodRoutingIdExample) @@ -2028,10 +2029,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("country_code", countryCodeExample) lazy val canSeeBankAccountCreditLimitExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_credit_limit", canSeeBankAccountCreditLimitExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT, canSeeBankAccountCreditLimitExample) lazy val canSeeOtherAccountNumberExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_number", canSeeOtherAccountNumberExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_NUMBER, canSeeOtherAccountNumberExample) lazy val orderExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("order", orderExample) @@ -2052,7 +2053,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("is_active", isActiveExample) lazy val canSeeBankAccountBankNameExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_bank_name", canSeeBankAccountBankNameExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_BANK_NAME, canSeeBankAccountBankNameExample) lazy val firstNameExample = ConnectorField("Tom","The first name") glossaryItems += makeGlossaryItem("first_name", firstNameExample) @@ -2067,7 +2068,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("transaction_ids", transactionIdsExample) lazy val canSeeBankAccountOwnersExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_owners", canSeeBankAccountOwnersExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_OWNERS, canSeeBankAccountOwnersExample) lazy val actualDateExample = ConnectorField("2020-01-27",NoDescriptionProvided) glossaryItems += makeGlossaryItem("actual_date", actualDateExample) @@ -2076,10 +2077,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("example_outbound_message", exampleOutboundMessageExample) lazy val canDeleteWhereTagExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_delete_where_tag", canDeleteWhereTagExample) + glossaryItems += makeGlossaryItem(CAN_DELETE_WHERE_TAG, canDeleteWhereTagExample) lazy val canSeeUrlExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_url", canSeeUrlExample) + glossaryItems += makeGlossaryItem(CAN_SEE_URL, canSeeUrlExample) lazy val versionExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("version", versionExample) @@ -2088,7 +2089,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("collected", collectedExample) lazy val canAddPublicAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_public_alias", canAddPublicAliasExample) + glossaryItems += makeGlossaryItem(CAN_ADD_PUBLIC_ALIAS, canAddPublicAliasExample) lazy val allowedActionsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("allowed_actions", allowedActionsExample) @@ -2106,7 +2107,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("implemented_in_version", implementedInVersionExample) lazy val canSeeImageUrlExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_image_url", canSeeImageUrlExample) + glossaryItems += makeGlossaryItem(CAN_SEE_IMAGE_URL, canSeeImageUrlExample) lazy val toTransferToPhoneExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("to_transfer_to_phone", toTransferToPhoneExample) @@ -2151,7 +2152,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("e", eExample) lazy val canSeeCorporateLocationExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_corporate_location", canSeeCorporateLocationExample) + glossaryItems += makeGlossaryItem(CAN_SEE_CORPORATE_LOCATION, canSeeCorporateLocationExample) lazy val userExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("user", userExample) @@ -2199,7 +2200,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("requiredfieldinfo", requiredfieldinfoExample) lazy val canSeeWhereTagExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_where_tag", canSeeWhereTagExample) + glossaryItems += makeGlossaryItem(CAN_SEE_WHERE_TAG, canSeeWhereTagExample) lazy val bankidExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("bankid", bankidExample) @@ -2262,10 +2263,10 @@ object ExampleValue { glossaryItems += makeGlossaryItem("to_sandbox_tan", toSandboxTanExample) lazy val canAddTagExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_tag", canAddTagExample) + glossaryItems += makeGlossaryItem(CAN_ADD_TAG, canAddTagExample) lazy val canSeeBankAccountLabelExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_label", canSeeBankAccountLabelExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_LABEL, canSeeBankAccountLabelExample) lazy val serviceAvailableExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("service_available", serviceAvailableExample) @@ -2280,7 +2281,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("link", linkExample) lazy val canSeeTransactionTypeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_type", canSeeTransactionTypeExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_TYPE, canSeeTransactionTypeExample) lazy val implementedByPartialFunctionExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("implemented_by_partial_function", implementedByPartialFunctionExample) @@ -2289,7 +2290,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("drive_up", driveUpExample) lazy val canAddMoreInfoExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_more_info", canAddMoreInfoExample) + glossaryItems += makeGlossaryItem(CAN_ADD_MORE_INFO, canAddMoreInfoExample) lazy val detailExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("detail", detailExample) @@ -2317,21 +2318,21 @@ object ExampleValue { lazy val maxNumberOfYearlyTransactionsExample = ConnectorField("100",NoDescriptionProvided) glossaryItems += makeGlossaryItem("max_number_of_yearly_transactions", maxNumberOfYearlyTransactionsExample) - + lazy val maxNumberOfTransactionsExample = ConnectorField("100",NoDescriptionProvided) glossaryItems += makeGlossaryItem("max_number_of_transactions", maxNumberOfTransactionsExample) - + lazy val maxTotalAmountExample = ConnectorField("10000.12",NoDescriptionProvided) glossaryItems += makeGlossaryItem("max_total_amount", maxTotalAmountExample) lazy val canAddImageUrlExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_add_image_url", canAddImageUrlExample) + glossaryItems += makeGlossaryItem(CAN_ADD_IMAGE_URL, canAddImageUrlExample) lazy val jwksUrisExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("jwks_uris", jwksUrisExample) lazy val canSeeOtherAccountSwiftBicExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_other_account_swift_bic", canSeeOtherAccountSwiftBicExample) + glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, canSeeOtherAccountSwiftBicExample) lazy val staffUserIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("staff_user_id", staffUserIdExample) @@ -2343,7 +2344,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("valid_from", validFromExample) lazy val canDeleteImageExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_delete_image", canDeleteImageExample) + glossaryItems += makeGlossaryItem(CAN_DELETE_IMAGE, canDeleteImageExample) lazy val toExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("to", toExample) @@ -2355,13 +2356,13 @@ object ExampleValue { glossaryItems += makeGlossaryItem("product_attributes", productAttributesExample) lazy val canSeeTransactionDescriptionExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_transaction_description", canSeeTransactionDescriptionExample) + glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_DESCRIPTION, canSeeTransactionDescriptionExample) lazy val faceImageExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("face_image", faceImageExample) lazy val canSeeBankAccountNumberExample = ConnectorField(booleanFalse,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_see_bank_account_number", canSeeBankAccountNumberExample) + glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_NUMBER, canSeeBankAccountNumberExample) lazy val glossaryItemsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("glossary_items", glossaryItemsExample) @@ -2391,8 +2392,8 @@ object ExampleValue { glossaryItems += makeGlossaryItem("DynamicResourceDoc.description", dynamicResourceDocDescriptionExample) lazy val canDeleteCommentExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_delete_comment", canDeleteCommentExample) - + glossaryItems += makeGlossaryItem(CAN_DELETE_COMMENT, canDeleteCommentExample) + lazy val commentsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("comments", commentsExample) @@ -2400,7 +2401,7 @@ object ExampleValue { glossaryItems += makeGlossaryItem("banks", banksExample) lazy val canCreateStandingOrderExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) - glossaryItems += makeGlossaryItem("can_create_standing_order", canCreateStandingOrderExample) + glossaryItems += makeGlossaryItem(CAN_CREATE_STANDING_ORDER, canCreateStandingOrderExample) lazy val adapterImplementationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided) glossaryItems += makeGlossaryItem("adapter_implementation", adapterImplementationExample) diff --git a/obp-api/src/main/scala/code/api/util/Glossary.scala b/obp-api/src/main/scala/code/api/util/Glossary.scala index 9507cc101..e8c8029ee 100644 --- a/obp-api/src/main/scala/code/api/util/Glossary.scala +++ b/obp-api/src/main/scala/code/api/util/Glossary.scala @@ -1,16 +1,13 @@ package code.api.util -import java.io.File import code.api.Constant -import code.api.Constant.{PARAM_LOCALE, directLoginHeaderName} +import code.api.Constant._ import code.api.util.APIUtil.{getObpApiRoot, getServerUrl} import code.api.util.ExampleValue.{accountIdExample, bankIdExample, customerIdExample, userIdExample} - import code.util.Helper.MdcLoggable -import code.util.HydraUtil import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue -import net.liftweb.http.LiftRules +import java.io.File import scala.collection.mutable.ArrayBuffer @@ -1336,7 +1333,7 @@ object Glossary extends MdcLoggable { | |Body: | - | { "name":"_test", "description":"This view is for family", "metadata_view":"_test", "is_public":true, "which_alias_to_use":"family", "hide_metadata_if_alias_used":false, "allowed_actions":["can_see_transaction_this_bank_account","can_see_transaction_other_bank_account","can_see_transaction_metadata","can_see_transaction_label","can_see_transaction_amount","can_see_transaction_type","can_see_transaction_currency","can_see_transaction_start_date","can_see_transaction_finish_date","can_see_transaction_balance","can_see_comments","can_see_narrative","can_see_tags","can_see_images","can_see_bank_account_owners","can_see_bank_account_type","can_see_bank_account_balance","can_see_bank_account_currency","can_see_bank_account_label","can_see_bank_account_national_identifier","can_see_bank_account_swift_bic","can_see_bank_account_iban","can_see_bank_account_number","can_see_bank_account_bank_name","can_see_other_account_national_identifier","can_see_other_account_swift_bic","can_see_other_account_iban","can_see_other_account_bank_name","can_see_other_account_number","can_see_other_account_metadata","can_see_other_account_kind","can_see_more_info","can_see_url","can_see_image_url","can_see_open_corporates_url","can_see_corporate_location","can_see_physical_location","can_see_public_alias","can_see_private_alias","can_add_more_info","can_add_url","can_add_image_url","can_add_open_corporates_url","can_add_corporate_location","can_add_physical_location","can_add_public_alias","can_add_private_alias","can_delete_corporate_location","can_delete_physical_location","can_edit_narrative","can_add_comment","can_delete_comment","can_add_tag","can_delete_tag","can_add_image","can_delete_image","can_add_where_tag","can_see_where_tag","can_delete_where_tag","can_create_counterparty","can_see_bank_routing_scheme","can_see_bank_routing_address","can_see_bank_account_routing_scheme","can_see_bank_account_routing_address","can_see_other_bank_routing_scheme","can_see_other_bank_routing_address","can_see_other_account_routing_scheme","can_see_other_account_routing_address","can_query_available_funds","can_add_transaction_request_to_own_account","can_add_transaction_request_to_any_account","can_see_bank_account_credit_limit","can_create_direct_debit","can_create_standing_order"]} | + | { "name":"_test", "description":"This view is for family", "metadata_view":"_test", "is_public":true, "which_alias_to_use":"family", "hide_metadata_if_alias_used":false, "allowed_actions":[$CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_METADATA,,$CAN_SEE_TRANSACTION_AMOUNT,$CAN_SEE_TRANSACTION_TYPE,$CAN_SEE_TRANSACTION_CURRENCY,$CAN_SEE_TRANSACTION_START_DATE,$CAN_SEE_TRANSACTION_FINISH_DATE,$CAN_SEE_TRANSACTION_BALANCE,$CAN_SEE_COMMENTS,$CAN_SEE_TAGS,$CAN_SEE_IMAGES,$CAN_SEE_BANK_ACCOUNT_OWNERS,$CAN_SEE_BANK_ACCOUNT_TYPE,$CAN_SEE_BANK_ACCOUNT_BALANCE,$CAN_SEE_BANK_ACCOUNT_CURRENCY,$CAN_SEE_BANK_ACCOUNT_LABEL,$CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,$CAN_SEE_BANK_ACCOUNT_IBAN,$CAN_SEE_BANK_ACCOUNT_NUMBER,$CAN_SEE_BANK_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,$CAN_SEE_OTHER_ACCOUNT_IBAN,$CAN_SEE_OTHER_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NUMBER,$CAN_SEE_OTHER_ACCOUNT_METADATA,$CAN_SEE_OTHER_ACCOUNT_KIND,$CAN_SEE_MORE_INFO,$CAN_SEE_URL,$CAN_SEE_IMAGE_URL,$CAN_SEE_OPEN_CORPORATES_URL,$CAN_SEE_CORPORATE_LOCATION,$CAN_SEE_PHYSICAL_LOCATION,$CAN_SEE_PUBLIC_ALIAS,$CAN_SEE_PRIVATE_ALIAS,$CAN_ADD_MORE_INFO,$CAN_ADD_URL,$CAN_ADD_IMAGE_URL,$CAN_ADD_OPEN_CORPORATES_URL,$CAN_ADD_CORPORATE_LOCATION,$CAN_ADD_PHYSICAL_LOCATION,$CAN_ADD_PUBLIC_ALIAS,$CAN_ADD_PRIVATE_ALIAS,$CAN_DELETE_CORPORATE_LOCATION,$CAN_DELETE_PHYSICAL_LOCATION,$CAN_ADD_COMMENT,$CAN_DELETE_COMMENT,$CAN_ADD_TAG,$CAN_DELETE_TAG,$CAN_ADD_IMAGE,$CAN_DELETE_IMAGE,$CAN_ADD_WHERE_TAG,$CAN_SEE_WHERE_TAG,$CAN_DELETE_WHERE_TAG,$CAN_SEE_BANK_ROUTING_SCHEME,$CAN_SEE_BANK_ROUTING_ADDRESS,$CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,$CAN_SEE_OTHER_BANK_ROUTING_SCHEME,$CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,$CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,$CAN_QUERY_AVAILABLE_FUNDS,$CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,$CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,$CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,$CAN_CREATE_DIRECT_DEBIT,$CAN_CREATE_STANDING_ORDER]} | | Headers: | | Content-Type: application/json @@ -1432,7 +1429,7 @@ object Glossary extends MdcLoggable { | |Body: | - | { "name":"_test", "description":"good", "is_public":false, "which_alias_to_use":"accountant", "hide_metadata_if_alias_used":false, "allowed_actions": ["can_see_transaction_this_bank_account", "can_see_transaction_other_bank_account", "can_see_transaction_metadata", "can_see_transaction_label", "can_see_transaction_amount", "can_see_transaction_type", "can_see_transaction_currency", "can_see_transaction_start_date", "can_see_transaction_finish_date", "can_see_transaction_balance", "can_see_comments", "can_see_narrative", "can_see_tags", "can_see_images", "can_see_bank_account_owners", "can_see_bank_account_type", "can_see_bank_account_balance", "can_see_bank_account_currency", "can_see_bank_account_label", "can_see_bank_account_national_identifier", "can_see_bank_account_swift_bic", "can_see_bank_account_iban", "can_see_bank_account_number", "can_see_bank_account_bank_name", "can_see_other_account_national_identifier", "can_see_other_account_swift_bic", "can_see_other_account_iban", "can_see_other_account_bank_name", "can_see_other_account_number", "can_see_other_account_metadata", "can_see_other_account_kind", "can_see_more_info", "can_see_url", "can_see_image_url", "can_see_open_corporates_url", "can_see_corporate_location", "can_see_physical_location", "can_see_public_alias", "can_see_private_alias", "can_add_more_info", "can_add_url", "can_add_image_url", "can_add_open_corporates_url", "can_add_corporate_location", "can_add_physical_location", "can_add_public_alias", "can_add_private_alias", "can_delete_corporate_location", "can_delete_physical_location", "can_edit_narrative", "can_add_comment", "can_delete_comment", "can_add_tag", "can_delete_tag", "can_add_image", "can_delete_image", "can_add_where_tag", "can_see_where_tag", "can_delete_where_tag", "can_create_counterparty", "can_see_bank_routing_scheme", "can_see_bank_routing_address", "can_see_bank_account_routing_scheme", "can_see_bank_account_routing_address", "can_see_other_bank_routing_scheme", "can_see_other_bank_routing_address", "can_see_other_account_routing_scheme", "can_see_other_account_routing_address"]} + | { "name":"_test", "description":"good", "is_public":false, "which_alias_to_use":"accountant", "hide_metadata_if_alias_used":false, "allowed_actions": [$CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_METADATA,,$CAN_SEE_TRANSACTION_AMOUNT,$CAN_SEE_TRANSACTION_TYPE,$CAN_SEE_TRANSACTION_CURRENCY,$CAN_SEE_TRANSACTION_START_DATE,$CAN_SEE_TRANSACTION_FINISH_DATE,$CAN_SEE_TRANSACTION_BALANCE,$CAN_SEE_COMMENTS,$CAN_SEE_TAGS,$CAN_SEE_IMAGES,$CAN_SEE_BANK_ACCOUNT_OWNERS,$CAN_SEE_BANK_ACCOUNT_TYPE,$CAN_SEE_BANK_ACCOUNT_BALANCE,$CAN_SEE_BANK_ACCOUNT_CURRENCY,$CAN_SEE_BANK_ACCOUNT_LABEL,$CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,$CAN_SEE_BANK_ACCOUNT_IBAN,$CAN_SEE_BANK_ACCOUNT_NUMBER,$CAN_SEE_BANK_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,$CAN_SEE_OTHER_ACCOUNT_IBAN,$CAN_SEE_OTHER_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NUMBER,$CAN_SEE_OTHER_ACCOUNT_METADATA,$CAN_SEE_OTHER_ACCOUNT_KIND,$CAN_SEE_MORE_INFO,$CAN_SEE_URL,$CAN_SEE_IMAGE_URL,$CAN_SEE_OPEN_CORPORATES_URL,$CAN_SEE_CORPORATE_LOCATION,$CAN_SEE_PHYSICAL_LOCATION,$CAN_SEE_PUBLIC_ALIAS,$CAN_SEE_PRIVATE_ALIAS,$CAN_ADD_MORE_INFO,$CAN_ADD_URL,$CAN_ADD_IMAGE_URL,$CAN_ADD_OPEN_CORPORATES_URL,$CAN_ADD_CORPORATE_LOCATION,$CAN_ADD_PHYSICAL_LOCATION,$CAN_ADD_PUBLIC_ALIAS,$CAN_ADD_PRIVATE_ALIAS,$CAN_DELETE_CORPORATE_LOCATION,$CAN_DELETE_PHYSICAL_LOCATION,$CAN_ADD_COMMENT,$CAN_DELETE_COMMENT,$CAN_ADD_TAG,$CAN_DELETE_TAG,$CAN_ADD_IMAGE,$CAN_DELETE_IMAGE,$CAN_ADD_WHERE_TAG,$CAN_SEE_WHERE_TAG,$CAN_DELETE_WHERE_TAG,$CAN_SEE_BANK_ROUTING_SCHEME,$CAN_SEE_BANK_ROUTING_ADDRESS,$CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,$CAN_SEE_OTHER_BANK_ROUTING_SCHEME,$CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,$CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,$CAN_QUERY_AVAILABLE_FUNDS,$CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,$CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,$CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,$CAN_CREATE_DIRECT_DEBIT,$CAN_CREATE_STANDING_ORDER]} | | Headers: | @@ -3352,7 +3349,7 @@ object Glossary extends MdcLoggable { | |Rule for calculating number of security challenges: |If product Account attribute REQUIRED_CHALLENGE_ANSWERS=N then create N challenges - |(one for every user that has a View where permission "can_add_transaction_request_to_any_account"=true) + |(one for every user that has a View where permission $CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT=true) |In case REQUIRED_CHALLENGE_ANSWERS is not defined as an account attribute default value is 1. | |Transaction Requests contain charge information giving the client the opportunity to proceed or not (as long as the challenge level is appropriate). diff --git a/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala b/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala index 0a49ae910..3eb76d5ea 100644 --- a/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala +++ b/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala @@ -605,7 +605,7 @@ trait APIMethods121 { createViewJsonV121.allowed_actions ) anyViewContainsCanCreateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_CREATE_CUSTOM_VIEW)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_CREATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- booleanToBox( anyViewContainsCanCreateCustomViewPermission, s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(CAN_CREATE_CUSTOM_VIEW)}` permission on any your views" @@ -667,7 +667,7 @@ trait APIMethods121 { allowed_actions = updateJsonV121.allowed_actions ) anyViewContainsCanUpdateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- booleanToBox( anyViewContainsCanUpdateCustomViewPermission, s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(CAN_UPDATE_CUSTOM_VIEW)}` permission on any your views" @@ -713,7 +713,7 @@ trait APIMethods121 { _ <- NewStyle.function.customView(viewId, BankIdAccountId(bankId, accountId), callContext) anyViewContainsCanDeleteCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_DELETE_CUSTOM_VIEW)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_DELETE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- Helper.booleanToFuture( s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(CAN_DELETE_CUSTOM_VIEW)}` permission on any your views", cc = callContext @@ -752,7 +752,7 @@ trait APIMethods121 { u <- cc.user ?~ UserNotLoggedIn account <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- booleanToBox( anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission, s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)}` permission on any your views" @@ -796,8 +796,8 @@ trait APIMethods121 { loggedInUser <- cc.user ?~ UserNotLoggedIn account <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound loggedInUserPermissionBox = Views.views.vend.permission(BankIdAccountId(bankId, accountId), loggedInUser) - anyViewContainsCanSeeViewsWithPermissionsForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)) - .find(_.==(true)).getOrElse(false)).getOrElse(false) + anyViewContainsCanSeeViewsWithPermissionsForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER))) + .getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- booleanToBox( anyViewContainsCanSeeViewsWithPermissionsForOneUserPermission, s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views" diff --git a/obp-api/src/main/scala/code/api/v1_2_1/JSONFactory1.2.1.scala b/obp-api/src/main/scala/code/api/v1_2_1/JSONFactory1.2.1.scala index 129383913..7d8313150 100644 --- a/obp-api/src/main/scala/code/api/v1_2_1/JSONFactory1.2.1.scala +++ b/obp-api/src/main/scala/code/api/v1_2_1/JSONFactory1.2.1.scala @@ -407,6 +407,8 @@ object JSONFactory{ else "" + val allowed_actions = view.allowed_actions + new ViewJSONV121( id = view.viewId.value, short_name = stringOrNull(view.name), @@ -414,65 +416,65 @@ object JSONFactory{ is_public = view.isPublic, alias = alias, hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias, - can_add_comment = view.allowed_actions.exists(_ == CAN_ADD_COMMENT), - can_add_corporate_location = view.allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), - can_add_image = view.allowed_actions.exists(_ == CAN_ADD_IMAGE), - can_add_image_url = view.allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), - can_add_more_info = view.allowed_actions.exists(_ == CAN_ADD_MORE_INFO), - can_add_open_corporates_url = view.allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), - can_add_physical_location = view.allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), - can_add_private_alias = view.allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), - can_add_public_alias = view.allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), - can_add_tag = view.allowed_actions.exists(_ == CAN_ADD_TAG), - can_add_url = view.allowed_actions.exists(_ == CAN_ADD_URL), - can_add_where_tag = view.allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), - can_delete_comment = view.allowed_actions.exists(_ == CAN_DELETE_COMMENT), - can_delete_corporate_location = view.allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), - can_delete_image = view.allowed_actions.exists(_ == CAN_DELETE_IMAGE), - can_delete_physical_location = view.allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), - can_delete_tag = view.allowed_actions.exists(_ == CAN_DELETE_TAG), - can_delete_where_tag = view.allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), - can_edit_owner_comment = view.allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), - can_see_bank_account_balance = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), - can_see_bank_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), - can_see_bank_account_currency = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), - can_see_bank_account_iban = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), - can_see_bank_account_label = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), - can_see_bank_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_bank_account_number = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), - can_see_bank_account_owners = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), - can_see_bank_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), - can_see_bank_account_type = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), - can_see_comments = view.allowed_actions.exists(_ == CAN_SEE_COMMENTS), - can_see_corporate_location = view.allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), - can_see_image_url = view.allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), - can_see_images = view.allowed_actions.exists(_ == CAN_SEE_IMAGES), - can_see_more_info = view.allowed_actions.exists(_ == CAN_SEE_MORE_INFO), - can_see_open_corporates_url = view.allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), - can_see_other_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), - can_see_other_account_iban = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), - can_see_other_account_kind = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), - can_see_other_account_metadata = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), - can_see_other_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_other_account_number = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), - can_see_other_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), - can_see_owner_comment = view.allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), - can_see_physical_location = view.allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), - can_see_private_alias = view.allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), - can_see_public_alias = view.allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), - can_see_tags = view.allowed_actions.exists(_ == CAN_SEE_TAGS), - can_see_transaction_amount = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), - can_see_transaction_balance = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), - can_see_transaction_currency = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), - can_see_transaction_description = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), - can_see_transaction_finish_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), - can_see_transaction_metadata = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), - can_see_transaction_other_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), - can_see_transaction_start_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), - can_see_transaction_this_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), - can_see_transaction_type = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), - can_see_url = view.allowed_actions.exists(_ == CAN_SEE_URL), - can_see_where_tag = view.allowed_actions.exists(_ == CAN_SEE_WHERE_TAG) + can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT), + can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), + can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE), + can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), + can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO), + can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), + can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), + can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), + can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), + can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG), + can_add_url = allowed_actions.exists(_ == CAN_ADD_URL), + can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), + can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT), + can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), + can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE), + can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), + can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG), + can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), + can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), + can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), + can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), + can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), + can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), + can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), + can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), + can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), + can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), + can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), + can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS), + can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), + can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), + can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES), + can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO), + can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), + can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), + can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), + can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), + can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), + can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), + can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), + can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), + can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), + can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), + can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), + can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS), + can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), + can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), + can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), + can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), + can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), + can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), + can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), + can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), + can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), + can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), + can_see_url = allowed_actions.exists(_ == CAN_SEE_URL), + can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG) ) } diff --git a/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala b/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala index e100c508d..148605b09 100644 --- a/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala +++ b/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala @@ -1050,7 +1050,7 @@ trait APIMethods200 { (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- Helper.booleanToFuture( s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)}` permission on any your views", cc = callContext @@ -1092,8 +1092,8 @@ trait APIMethods200 { (bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound // Check bank exists. account <- BankAccountX(bank.bankId, accountId) ?~! {ErrorMessages.AccountNotFound} // Check Account exists. loggedInUserPermissionBox = Views.views.vend.permission(BankIdAccountId(bankId, accountId), loggedInUser) - anyViewContainsCanSeePermissionForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists( _ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)) - .find(_.==(true)).getOrElse(false)).getOrElse(false) + anyViewContainsCanSeePermissionForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists( _ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER))) + .getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- booleanToBox( anyViewContainsCanSeePermissionForOneUserPermission, diff --git a/obp-api/src/main/scala/code/api/v2_1_0/JSONFactory2.1.0.scala b/obp-api/src/main/scala/code/api/v2_1_0/JSONFactory2.1.0.scala index a28849d92..0b271e328 100644 --- a/obp-api/src/main/scala/code/api/v2_1_0/JSONFactory2.1.0.scala +++ b/obp-api/src/main/scala/code/api/v2_1_0/JSONFactory2.1.0.scala @@ -793,6 +793,7 @@ object JSONFactory210{ else "" + val allowed_actions = view.allowed_actions new ViewJSON( id = view.viewId.value, short_name = stringOrNull(view.name), @@ -800,66 +801,66 @@ object JSONFactory210{ is_public = view.isPublic, alias = alias, hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias, - can_add_comment = view.allowed_actions.exists(_ == CAN_ADD_COMMENT), - can_add_corporate_location = view.allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), - can_add_image = view.allowed_actions.exists(_ == CAN_ADD_IMAGE), - can_add_image_url = view.allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), - can_add_more_info = view.allowed_actions.exists(_ == CAN_ADD_MORE_INFO), - can_add_open_corporates_url = view.allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), - can_add_physical_location = view.allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), - can_add_private_alias = view.allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), - can_add_public_alias = view.allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), - can_add_tag = view.allowed_actions.exists(_ == CAN_ADD_TAG), - can_add_url = view.allowed_actions.exists(_ == CAN_ADD_URL), - can_add_where_tag = view.allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), - can_add_counterparty = view.allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), - can_delete_comment = view.allowed_actions.exists(_ == CAN_DELETE_COMMENT), - can_delete_corporate_location = view.allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), - can_delete_image = view.allowed_actions.exists(_ == CAN_DELETE_IMAGE), - can_delete_physical_location = view.allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), - can_delete_tag = view.allowed_actions.exists(_ == CAN_DELETE_TAG), - can_delete_where_tag = view.allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), - can_edit_owner_comment = view.allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), - can_see_bank_account_balance = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), - can_see_bank_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), - can_see_bank_account_currency = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), - can_see_bank_account_iban = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), - can_see_bank_account_label = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), - can_see_bank_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_bank_account_number = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), - can_see_bank_account_owners = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), - can_see_bank_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), - can_see_bank_account_type = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), - can_see_comments = view.allowed_actions.exists(_ == CAN_SEE_COMMENTS), - can_see_corporate_location = view.allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), - can_see_image_url = view.allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), - can_see_images = view.allowed_actions.exists(_ == CAN_SEE_IMAGES), - can_see_more_info = view.allowed_actions.exists(_ == CAN_SEE_MORE_INFO), - can_see_open_corporates_url = view.allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), - can_see_other_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), - can_see_other_account_iban = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), - can_see_other_account_kind = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), - can_see_other_account_metadata = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), - can_see_other_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_other_account_number = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), - can_see_other_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), - can_see_owner_comment = view.allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), - can_see_physical_location = view.allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), - can_see_private_alias = view.allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), - can_see_public_alias = view.allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), - can_see_tags = view.allowed_actions.exists(_ == CAN_SEE_TAGS), - can_see_transaction_amount = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), - can_see_transaction_balance = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), - can_see_transaction_currency = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), - can_see_transaction_description = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), - can_see_transaction_finish_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), - can_see_transaction_metadata = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), - can_see_transaction_other_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), - can_see_transaction_start_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), - can_see_transaction_this_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), - can_see_transaction_type = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), - can_see_url = view.allowed_actions.exists(_ == CAN_SEE_URL), - can_see_where_tag = view.allowed_actions.exists(_ == CAN_SEE_WHERE_TAG) + can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT), + can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), + can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE), + can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), + can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO), + can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), + can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), + can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), + can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), + can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG), + can_add_url = allowed_actions.exists(_ == CAN_ADD_URL), + can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), + can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), + can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT), + can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), + can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE), + can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), + can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG), + can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), + can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), + can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), + can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), + can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), + can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), + can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), + can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), + can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), + can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), + can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), + can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS), + can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), + can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), + can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES), + can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO), + can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), + can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), + can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), + can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), + can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), + can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), + can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), + can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), + can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), + can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), + can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), + can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS), + can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), + can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), + can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), + can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), + can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), + can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), + can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), + can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), + can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), + can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), + can_see_url = allowed_actions.exists(_ == CAN_SEE_URL), + can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG) ) } diff --git a/obp-api/src/main/scala/code/api/v2_2_0/JSONFactory2.2.0.scala b/obp-api/src/main/scala/code/api/v2_2_0/JSONFactory2.2.0.scala index c0f649796..dcc955b3f 100644 --- a/obp-api/src/main/scala/code/api/v2_2_0/JSONFactory2.2.0.scala +++ b/obp-api/src/main/scala/code/api/v2_2_0/JSONFactory2.2.0.scala @@ -384,6 +384,7 @@ object JSONFactory220 { else "" + val allowed_actions = view.allowed_actions new ViewJSONV220( id = view.viewId.value, short_name = stringOrNull(view.name), @@ -391,66 +392,66 @@ object JSONFactory220 { is_public = view.isPublic, alias = alias, hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias, - can_add_comment = view.allowed_actions.exists(_ == CAN_ADD_COMMENT), - can_add_corporate_location = view.allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), - can_add_image = view.allowed_actions.exists(_ == CAN_ADD_IMAGE), - can_add_image_url = view.allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), - can_add_more_info = view.allowed_actions.exists(_ == CAN_ADD_MORE_INFO), - can_add_open_corporates_url = view.allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), - can_add_physical_location = view.allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), - can_add_private_alias = view.allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), - can_add_public_alias = view.allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), - can_add_tag = view.allowed_actions.exists(_ == CAN_ADD_TAG), - can_add_url = view.allowed_actions.exists(_ == CAN_ADD_URL), - can_add_where_tag = view.allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), - can_add_counterparty = view.allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), - can_delete_comment = view.allowed_actions.exists(_ == CAN_DELETE_COMMENT), - can_delete_corporate_location = view.allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), - can_delete_image = view.allowed_actions.exists(_ == CAN_DELETE_IMAGE), - can_delete_physical_location = view.allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), - can_delete_tag = view.allowed_actions.exists(_ == CAN_DELETE_TAG), - can_delete_where_tag = view.allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), - can_edit_owner_comment = view.allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), - can_see_bank_account_balance = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), - can_see_bank_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), - can_see_bank_account_currency = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), - can_see_bank_account_iban = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), - can_see_bank_account_label = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), - can_see_bank_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_bank_account_number = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), - can_see_bank_account_owners = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), - can_see_bank_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), - can_see_bank_account_type = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), - can_see_comments = view.allowed_actions.exists(_ == CAN_SEE_COMMENTS), - can_see_corporate_location = view.allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), - can_see_image_url = view.allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), - can_see_images = view.allowed_actions.exists(_ == CAN_SEE_IMAGES), - can_see_more_info = view.allowed_actions.exists(_ == CAN_SEE_MORE_INFO), - can_see_open_corporates_url = view.allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), - can_see_other_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), - can_see_other_account_iban = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), - can_see_other_account_kind = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), - can_see_other_account_metadata = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), - can_see_other_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_other_account_number = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), - can_see_other_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), - can_see_owner_comment = view.allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), - can_see_physical_location = view.allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), - can_see_private_alias = view.allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), - can_see_public_alias = view.allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), - can_see_tags = view.allowed_actions.exists(_ == CAN_SEE_TAGS), - can_see_transaction_amount = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), - can_see_transaction_balance = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), - can_see_transaction_currency = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), - can_see_transaction_description = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), - can_see_transaction_finish_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), - can_see_transaction_metadata = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), - can_see_transaction_other_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), - can_see_transaction_start_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), - can_see_transaction_this_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), - can_see_transaction_type = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), - can_see_url = view.allowed_actions.exists(_ == CAN_SEE_URL), - can_see_where_tag = view.allowed_actions.exists(_ == CAN_SEE_WHERE_TAG) + can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT), + can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), + can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE), + can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), + can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO), + can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), + can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), + can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), + can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), + can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG), + can_add_url = allowed_actions.exists(_ == CAN_ADD_URL), + can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), + can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), + can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT), + can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), + can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE), + can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), + can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG), + can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), + can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), + can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), + can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), + can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), + can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), + can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), + can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), + can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), + can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), + can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), + can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS), + can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), + can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), + can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES), + can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO), + can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), + can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), + can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), + can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), + can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), + can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), + can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), + can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), + can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), + can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), + can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), + can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS), + can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), + can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), + can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), + can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), + can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), + can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), + can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), + can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), + can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), + can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), + can_see_url = allowed_actions.exists(_ == CAN_SEE_URL), + can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG) ) } diff --git a/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala b/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala index c75b91a52..750ef0d8c 100644 --- a/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala +++ b/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala @@ -210,7 +210,7 @@ trait APIMethods300 { (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) anyViewContainsCanCreateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_CREATE_CUSTOM_VIEW)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_CREATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- Helper.booleanToFuture( s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(CAN_CREATE_CUSTOM_VIEW)}` permission on any your views", @@ -250,7 +250,7 @@ trait APIMethods300 { (_, callContext) <- NewStyle.function.getBank(bankId, callContext) (account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext) anyViewContainsCanSeePermissionForOneUserPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), loggedInUser) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- Helper.booleanToFuture( s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views", cc = callContext @@ -316,7 +316,7 @@ trait APIMethods300 { (account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext) anyViewContainsCancanUpdateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- Helper.booleanToFuture( s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(CAN_UPDATE_CUSTOM_VIEW)}` permission on any your views", diff --git a/obp-api/src/main/scala/code/api/v3_0_0/JSONFactory3.0.0.scala b/obp-api/src/main/scala/code/api/v3_0_0/JSONFactory3.0.0.scala index 90360ec62..838584229 100644 --- a/obp-api/src/main/scala/code/api/v3_0_0/JSONFactory3.0.0.scala +++ b/obp-api/src/main/scala/code/api/v3_0_0/JSONFactory3.0.0.scala @@ -730,6 +730,7 @@ object JSONFactory300{ else "" + val allowed_actions = view.allowed_actions ViewJsonV300( id = view.viewId.value, short_name = stringOrNull(view.name), @@ -739,81 +740,81 @@ object JSONFactory300{ is_system = view.isSystem, alias = alias, hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias, - can_add_comment = view.allowed_actions.exists(_ == CAN_ADD_COMMENT), - can_add_corporate_location = view.allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), - can_add_image = view.allowed_actions.exists(_ == CAN_ADD_IMAGE), - can_add_image_url = view.allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), - can_add_more_info = view.allowed_actions.exists(_ == CAN_ADD_MORE_INFO), - can_add_open_corporates_url = view.allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), - can_add_physical_location = view.allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), - can_add_private_alias = view.allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), - can_add_public_alias = view.allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), - can_add_tag = view.allowed_actions.exists(_ == CAN_ADD_TAG), - can_add_url = view.allowed_actions.exists(_ == CAN_ADD_URL), - can_add_where_tag = view.allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), - can_delete_comment = view.allowed_actions.exists(_ == CAN_DELETE_COMMENT), - can_add_counterparty = view.allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), - can_delete_corporate_location = view.allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), - can_delete_image = view.allowed_actions.exists(_ == CAN_DELETE_IMAGE), - can_delete_physical_location = view.allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), - can_delete_tag = view.allowed_actions.exists(_ == CAN_DELETE_TAG), - can_delete_where_tag = view.allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), - can_edit_owner_comment = view.allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), - can_see_bank_account_balance = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), - can_query_available_funds = view.allowed_actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS), - can_see_bank_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), - can_see_bank_account_currency = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), - can_see_bank_account_iban = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), - can_see_bank_account_label = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), - can_see_bank_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_bank_account_number = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), - can_see_bank_account_owners = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), - can_see_bank_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), - can_see_bank_account_type = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), - can_see_comments = view.allowed_actions.exists(_ == CAN_SEE_COMMENTS), - can_see_corporate_location = view.allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), - can_see_image_url = view.allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), - can_see_images = view.allowed_actions.exists(_ == CAN_SEE_IMAGES), - can_see_more_info = view.allowed_actions.exists(_ == CAN_SEE_MORE_INFO), - can_see_open_corporates_url = view.allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), - can_see_other_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), - can_see_other_account_iban = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), - can_see_other_account_kind = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), - can_see_other_account_metadata = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), - can_see_other_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_other_account_number = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), - can_see_other_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), - can_see_owner_comment = view.allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), - can_see_physical_location = view.allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), - can_see_private_alias = view.allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), - can_see_public_alias = view.allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), - can_see_tags = view.allowed_actions.exists(_ == CAN_SEE_TAGS), - can_see_transaction_amount = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), - can_see_transaction_balance = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), - can_see_transaction_currency = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), - can_see_transaction_description = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), - can_see_transaction_finish_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), - can_see_transaction_metadata = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), - can_see_transaction_other_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), - can_see_transaction_start_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), - can_see_transaction_this_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), - can_see_transaction_type = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), - can_see_url = view.allowed_actions.exists(_ == CAN_SEE_URL), - can_see_where_tag = view.allowed_actions.exists(_ == CAN_SEE_WHERE_TAG), + can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT), + can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), + can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE), + can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), + can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO), + can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), + can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), + can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), + can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), + can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG), + can_add_url = allowed_actions.exists(_ == CAN_ADD_URL), + can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), + can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT), + can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), + can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), + can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE), + can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), + can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG), + can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), + can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), + can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), + can_query_available_funds = allowed_actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS), + can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), + can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), + can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), + can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), + can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), + can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), + can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), + can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), + can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS), + can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), + can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), + can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES), + can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO), + can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), + can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), + can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), + can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), + can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), + can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), + can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), + can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), + can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), + can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), + can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), + can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS), + can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), + can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), + can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), + can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), + can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), + can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), + can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), + can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), + can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), + can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), + can_see_url = allowed_actions.exists(_ == CAN_SEE_URL), + can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG), //V300 new - can_see_bank_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME), - can_see_bank_routing_address = view.allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS), - can_see_bank_account_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME), - can_see_bank_account_routing_address = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS), - can_see_other_bank_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME), - can_see_other_bank_routing_address = view.allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS), - can_see_other_account_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME), - can_see_other_account_routing_address= view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS), - can_add_transaction_request_to_own_account = view.allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT), //added following two for payments - can_add_transaction_request_to_any_account = view.allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT), - can_see_bank_account_credit_limit = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT), - can_create_direct_debit = view.allowed_actions.exists(_ == CAN_CREATE_DIRECT_DEBIT), - can_create_standing_order = view.allowed_actions.exists(_ == CAN_CREATE_STANDING_ORDER) + can_see_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME), + can_see_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS), + can_see_bank_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME), + can_see_bank_account_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS), + can_see_other_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME), + can_see_other_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS), + can_see_other_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME), + can_see_other_account_routing_address= allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS), + can_add_transaction_request_to_own_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT), //added following two for payments + can_add_transaction_request_to_any_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT), + can_see_bank_account_credit_limit = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT), + can_create_direct_debit = allowed_actions.exists(_ == CAN_CREATE_DIRECT_DEBIT), + can_create_standing_order = allowed_actions.exists(_ == CAN_CREATE_STANDING_ORDER) ) } def createBasicViewJSON(view : View) : BasicViewJson = { diff --git a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala index c5bdea210..3b646d308 100644 --- a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala +++ b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala @@ -1014,7 +1014,7 @@ trait APIMethods400 extends MdcLoggable { "POST", "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/TRANSACTION_REQUEST_TYPE/transaction-requests/TRANSACTION_REQUEST_ID/challenge", "Answer Transaction Request Challenge", - """In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer. + s"""In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer. | |This endpoint totally depends on createTransactionRequest, it need get the following data from createTransactionRequest response body. | @@ -1051,7 +1051,7 @@ trait APIMethods400 extends MdcLoggable { | |Rule for calculating number of security challenges: |If Product Account attribute REQUIRED_CHALLENGE_ANSWERS=N then create N challenges - |(one for every user that has a View where permission "can_add_transaction_request_to_any_account"=true) + |(one for every user that has a View where permission $CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT=true) |In the case REQUIRED_CHALLENGE_ANSWERS is not defined as an account attribute, the default number of security challenges created is one. | """.stripMargin, @@ -2305,7 +2305,7 @@ trait APIMethods400 extends MdcLoggable { json.extract[UpdateAccountJsonV400] } anyViewContainsCanUpdateBankAccountLabelPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u) - .map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_BANK_ACCOUNT_LABEL)).find(_.==(true)).getOrElse(false)).getOrElse(false) + .map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_BANK_ACCOUNT_LABEL))).getOrElse(Nil).find(_.==(true)).getOrElse(false) _ <- Helper.booleanToFuture( s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(CAN_UPDATE_BANK_ACCOUNT_LABEL)}` permission on any your views", cc = callContext diff --git a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala index 0427e7ccf..35e2bc52e 100644 --- a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala +++ b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala @@ -986,9 +986,9 @@ trait APIMethods500 { val vrpViewId = s"_vrp-${UUID.randomUUID.toString}".dropRight(5)// to make sure the length of the viewId is 36. val targetPermissions = List(//may need getTransactionRequest . so far only these payments. - "can_add_transaction_request_to_beneficiary", - "can_get_counterparty", - "can_see_transaction_requests" + CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY, + CAN_GET_COUNTERPARTY, + CAN_SEE_TRANSACTION_REQUESTS, ) val targetCreateCustomViewJson = CreateCustomViewJson( diff --git a/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala b/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala index 340bb9828..73b2115c3 100644 --- a/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala +++ b/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala @@ -810,6 +810,8 @@ object JSONFactory500 { } def createViewJsonV500(view : View) : ViewJsonV500 = { + val allowed_actions = view.allowed_actions + val alias = if(view.usePublicAliasIfOneExists) "public" @@ -828,81 +830,81 @@ object JSONFactory500 { is_firehose = Some(view.isFirehose), alias = alias, hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias, - can_add_comment = view.allowed_actions.exists(_ == CAN_ADD_COMMENT), - can_add_corporate_location = view.allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), - can_add_image = view.allowed_actions.exists(_ == CAN_ADD_IMAGE), - can_add_image_url = view.allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), - can_add_more_info = view.allowed_actions.exists(_ == CAN_ADD_MORE_INFO), - can_add_open_corporates_url = view.allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), - can_add_physical_location = view.allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), - can_add_private_alias = view.allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), - can_add_public_alias = view.allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), - can_add_tag = view.allowed_actions.exists(_ == CAN_ADD_TAG), - can_add_url = view.allowed_actions.exists(_ == CAN_ADD_URL), - can_add_where_tag = view.allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), - can_delete_comment = view.allowed_actions.exists(_ == CAN_DELETE_COMMENT), - can_add_counterparty = view.allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), - can_delete_corporate_location = view.allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), - can_delete_image = view.allowed_actions.exists(_ == CAN_DELETE_IMAGE), - can_delete_physical_location = view.allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), - can_delete_tag = view.allowed_actions.exists(_ == CAN_DELETE_TAG), - can_delete_where_tag = view.allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), - can_edit_owner_comment = view.allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), - can_see_bank_account_balance = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), - can_query_available_funds = view.allowed_actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS), - can_see_bank_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), - can_see_bank_account_currency = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), - can_see_bank_account_iban = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), - can_see_bank_account_label = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), - can_see_bank_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_bank_account_number = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), - can_see_bank_account_owners = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), - can_see_bank_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), - can_see_bank_account_type = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), - can_see_comments = view.allowed_actions.exists(_ == CAN_SEE_COMMENTS), - can_see_corporate_location = view.allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), - can_see_image_url = view.allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), - can_see_images = view.allowed_actions.exists(_ == CAN_SEE_IMAGES), - can_see_more_info = view.allowed_actions.exists(_ == CAN_SEE_MORE_INFO), - can_see_open_corporates_url = view.allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), - can_see_other_account_bank_name = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), - can_see_other_account_iban = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), - can_see_other_account_kind = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), - can_see_other_account_metadata = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), - can_see_other_account_national_identifier = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), - can_see_other_account_number = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), - can_see_other_account_swift_bic = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), - can_see_owner_comment = view.allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), - can_see_physical_location = view.allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), - can_see_private_alias = view.allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), - can_see_public_alias = view.allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), - can_see_tags = view.allowed_actions.exists(_ == CAN_SEE_TAGS), - can_see_transaction_amount = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), - can_see_transaction_balance = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), - can_see_transaction_currency = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), - can_see_transaction_description = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), - can_see_transaction_finish_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), - can_see_transaction_metadata = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), - can_see_transaction_other_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), - can_see_transaction_start_date = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), - can_see_transaction_this_bank_account = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), - can_see_transaction_type = view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), - can_see_url = view.allowed_actions.exists(_ == CAN_SEE_URL), - can_see_where_tag = view.allowed_actions.exists(_ == CAN_SEE_WHERE_TAG), + can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT), + can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION), + can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE), + can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL), + can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO), + can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), + can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), + can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS), + can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS), + can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG), + can_add_url = allowed_actions.exists(_ == CAN_ADD_URL), + can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG), + can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT), + can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY), + can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), + can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE), + can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), + can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG), + can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG), + can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT), + can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE), + can_query_available_funds = allowed_actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS), + can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME), + can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY), + can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN), + can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL), + can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER), + can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS), + can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC), + can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE), + can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS), + can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION), + can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL), + can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES), + can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO), + can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), + can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME), + can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN), + can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND), + can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA), + can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER), + can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER), + can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC), + can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT), + can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), + can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS), + can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS), + can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS), + can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT), + can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE), + can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY), + can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION), + can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE), + can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA), + can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT), + can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE), + can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT), + can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE), + can_see_url = allowed_actions.exists(_ == CAN_SEE_URL), + can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG), //V300 new - can_see_bank_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME), - can_see_bank_routing_address = view.allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS), - can_see_bank_account_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME), - can_see_bank_account_routing_address = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS), - can_see_other_bank_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME), - can_see_other_bank_routing_address = view.allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS), - can_see_other_account_routing_scheme = view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME), - can_see_other_account_routing_address= view.allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS), - can_add_transaction_request_to_own_account = view.allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT), //added following two for payments - can_add_transaction_request_to_any_account = view.allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT), - can_see_bank_account_credit_limit = view.allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT), - can_create_direct_debit = view.allowed_actions.exists(_ == CAN_CREATE_DIRECT_DEBIT), - can_create_standing_order = view.allowed_actions.exists(_ == CAN_CREATE_STANDING_ORDER), + can_see_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME), + can_see_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS), + can_see_bank_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME), + can_see_bank_account_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS), + can_see_other_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME), + can_see_other_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS), + can_see_other_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME), + can_see_other_account_routing_address= allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS), + can_add_transaction_request_to_own_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT), //added following two for payments + can_add_transaction_request_to_any_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT), + can_see_bank_account_credit_limit = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT), + can_create_direct_debit = allowed_actions.exists(_ == CAN_CREATE_DIRECT_DEBIT), + can_create_standing_order = allowed_actions.exists(_ == CAN_CREATE_STANDING_ORDER), // Version 5.0.0 can_grant_access_to_views = view.canGrantAccessToViews.getOrElse(Nil), can_revoke_access_to_views = view.canRevokeAccessToViews.getOrElse(Nil), diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index f3fa9d7a0..19fcd715f 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -4719,7 +4719,8 @@ object LocalMappedConnector extends Connector with MdcLoggable { for ( permission <- Views.views.vend.permissions(BankIdAccountId(bankId, accountId)) ) yield { - permission.views.exists(_.allowed_actions.exists( _ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)) match { + permission.views.exists(view =>view.view.allowed_actions.exists( _ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)) + match { case true => Some(permission.user) case _ => None } diff --git a/obp-api/src/main/scala/code/model/View.scala b/obp-api/src/main/scala/code/model/View.scala index bd9dcc8fa..ddd4de222 100644 --- a/obp-api/src/main/scala/code/model/View.scala +++ b/obp-api/src/main/scala/code/model/View.scala @@ -67,60 +67,60 @@ case class ViewExtended(val view: View) { //transaction metadata val transactionMetadata = - if(viewPermissions.exists(_ == "canSeeTransactionMetadata")) + if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_METADATA)) { - val ownerComment = if (viewPermissions.exists(_ == "canSeeOwnerComment")) Some(transaction.metadata.ownerComment()) else None + val ownerComment = if (viewPermissions.exists(_ == CAN_SEE_OWNER_COMMENT)) Some(transaction.metadata.ownerComment()) else None val comments = - if (viewPermissions.exists(_ == "canSeeComments")) + if (viewPermissions.exists(_ == CAN_SEE_COMMENTS)) Some(transaction.metadata.comments(view.viewId)) else None - val addCommentFunc= if(viewPermissions.exists(_ == "canAddComment")) Some(transaction.metadata.addComment) else None + val addCommentFunc= if(viewPermissions.exists(_ == CAN_ADD_COMMENT)) Some(transaction.metadata.addComment) else None val deleteCommentFunc = - if(viewPermissions.exists(_ == "canDeleteComment")) + if(viewPermissions.exists(_ == CAN_DELETE_COMMENT)) Some(transaction.metadata.deleteComment) else None - val addOwnerCommentFunc:Option[String=> Boolean] = if (viewPermissions.exists(_ == "canEditOwnerComment")) Some(transaction.metadata.addOwnerComment) else None + val addOwnerCommentFunc:Option[String=> Boolean] = if (viewPermissions.exists(_ == CAN_EDIT_OWNER_COMMENT)) Some(transaction.metadata.addOwnerComment) else None val tags = - if(viewPermissions.exists(_ == "canSeeTags")) + if(viewPermissions.exists(_ == CAN_SEE_TAGS)) Some(transaction.metadata.tags(view.viewId)) else None val addTagFunc = - if(viewPermissions.exists(_ == "canAddTag")) + if(viewPermissions.exists(_ == CAN_ADD_TAG)) Some(transaction.metadata.addTag) else None val deleteTagFunc = - if(viewPermissions.exists(_ == "canDeleteTag")) + if(viewPermissions.exists(_ == CAN_DELETE_TAG)) Some(transaction.metadata.deleteTag) else None val images = - if(viewPermissions.exists(_ == "canSeeImages")) Some(transaction.metadata.images(view.viewId)) + if(viewPermissions.exists(_ == CAN_SEE_IMAGES)) Some(transaction.metadata.images(view.viewId)) else None val addImageFunc = - if(viewPermissions.exists(_ == "canAddImage")) Some(transaction.metadata.addImage) + if(viewPermissions.exists(_ == CAN_ADD_IMAGE)) Some(transaction.metadata.addImage) else None val deleteImageFunc = - if(viewPermissions.exists(_ == "canDeleteImage")) Some(transaction.metadata.deleteImage) + if(viewPermissions.exists(_ == CAN_DELETE_IMAGE)) Some(transaction.metadata.deleteImage) else None val whereTag = - if(viewPermissions.exists(_ == "canSeeWhereTag")) + if(viewPermissions.exists(_ == CAN_SEE_WHERE_TAG)) Some(transaction.metadata.whereTags(view.viewId)) else None val addWhereTagFunc : Option[(UserPrimaryKey, ViewId, Date, Double, Double) => Boolean] = - if(viewPermissions.exists(_ == "canAddWhereTag")) + if(viewPermissions.exists(_ == CAN_ADD_WHERE_TAG)) Some(transaction.metadata.addWhereTag) else Empty val deleteWhereTagFunc : Option[(ViewId) => Boolean] = - if (viewPermissions.exists(_ == "canDeleteWhereTag")) + if (viewPermissions.exists(_ == CAN_DELETE_WHERE_TAG)) Some(transaction.metadata.deleteWhereTag) else Empty @@ -149,35 +149,35 @@ case class ViewExtended(val view: View) { None val transactionType = - if (viewPermissions.exists(_ == "canSeeTransactionType")) Some(transaction.transactionType) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_TYPE)) Some(transaction.transactionType) else None val transactionAmount = - if (viewPermissions.exists(_ == "canSeeTransactionAmount")) Some(transaction.amount) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT)) Some(transaction.amount) else None val transactionCurrency = - if (viewPermissions.exists(_ == "canSeeTransactionCurrency")) Some(transaction.currency) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY)) Some(transaction.currency) else None val transactionDescription = - if (viewPermissions.exists(_ == "canSeeTransactionDescription")) transaction.description + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION)) transaction.description else None val transactionStartDate = - if (viewPermissions.exists(_ == "canSeeTransactionStartDate")) Some(transaction.startDate) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_START_DATE)) Some(transaction.startDate) else None val transactionFinishDate = - if (viewPermissions.exists(_ == "canSeeTransactionFinishDate")) Some(transaction.finishDate) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE)) Some(transaction.finishDate) else None val transactionBalance = - if (viewPermissions.exists(_ == "canSeeTransactionBalance") && transaction.balance != null) transaction.balance.toString() + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_BALANCE) && transaction.balance != null) transaction.balance.toString() else "" val transactionStatus = - if (viewPermissions.exists(_ == "canSeeTransactionStatus")) transaction.status + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_STATUS)) transaction.status else "" new ModeratedTransaction( @@ -223,31 +223,31 @@ case class ViewExtended(val view: View) { val otherBankAccount = moderateCore(transactionCore.otherAccount) val transactionType = - if (viewPermissions.exists(_ == "canSeeTransactionType")) Some(transactionCore.transactionType) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_TYPE)) Some(transactionCore.transactionType) else None val transactionAmount = - if (viewPermissions.exists(_ == "canSeeTransactionAmount")) Some(transactionCore.amount) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT)) Some(transactionCore.amount) else None val transactionCurrency = - if (viewPermissions.exists(_ == "canSeeTransactionCurrency")) Some(transactionCore.currency) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY)) Some(transactionCore.currency) else None val transactionDescription = - if (viewPermissions.exists(_ == "canSeeTransactionDescription")) transactionCore.description + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION)) transactionCore.description else None val transactionStartDate = - if (viewPermissions.exists(_ == "canSeeTransactionStartDate")) Some(transactionCore.startDate) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_START_DATE)) Some(transactionCore.startDate) else None val transactionFinishDate = - if (viewPermissions.exists(_ == "canSeeTransactionFinishDate")) Some(transactionCore.finishDate) + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE)) Some(transactionCore.finishDate) else None val transactionBalance = - if (viewPermissions.exists(_ == "canSeeTransactionBalance") && transactionCore.balance != null) transactionCore.balance.toString() + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_BALANCE) && transactionCore.balance != null) transactionCore.balance.toString() else "" new ModeratedTransactionCore( @@ -327,27 +327,27 @@ case class ViewExtended(val view: View) { def moderateAccount(bank: Bank, bankAccount: BankAccount) : Box[ModeratedBankAccount] = { val viewPermissions = getViewPermissions - if(viewPermissions.exists(_ == "canSeeTransactionThisBankAccount")) + if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)) { - val owners : Set[User] = if(viewPermissions.exists(_ == "canSeeBankAccountOwners")) bankAccount.userOwners else Set() - val balance = if(viewPermissions.exists(_ == "canSeeBankAccountBalance") && bankAccount.balance != null) bankAccount.balance.toString else "" - val accountType = if(viewPermissions.exists(_ == "canSeeBankAccountType")) Some(bankAccount.accountType) else None - val currency = if(viewPermissions.exists(_ == "canSeeBankAccountCurrency")) Some(bankAccount.currency) else None - val label = if (viewPermissions.exists(_ == "canSeeBankAccountLabel")) Some(bankAccount.label) else None - val iban = if (viewPermissions.exists(_ == "canSeeBankAccountIban")) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None - val number = if (viewPermissions.exists(_ == "canSeeBankAccountNumber")) Some(bankAccount.number) else None + val owners : Set[User] = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) bankAccount.userOwners else Set() + val balance = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE) && bankAccount.balance != null) bankAccount.balance.toString else "" + val accountType = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) Some(bankAccount.accountType) else None + val currency = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) Some(bankAccount.currency) else None + val label = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) Some(bankAccount.label) else None + val iban = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN)) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None + val number = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) Some(bankAccount.number) else None //From V300, use scheme and address stuff... - val accountRoutingScheme = if (viewPermissions.exists(_ == "canSeeBankAccountRoutingScheme")) bankAccount.accountRoutings.headOption.map(_.scheme) else None - val accountRoutingAddress = if (viewPermissions.exists(_ == "canSeeBankAccountRoutingAddress")) bankAccount.accountRoutings.headOption.map(_.address) else None - val accountRoutings = if (viewPermissions.exists(_ == "canSeeBankAccountRoutingScheme") && viewPermissions.exists(_ == "canSeeBankAccountRoutingAddress")) bankAccount.accountRoutings else Nil - val accountRules = if (viewPermissions.exists(_ == "canSeeBankAccountCreditLimit")) bankAccount.accountRules else Nil + val accountRoutingScheme = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME)) bankAccount.accountRoutings.headOption.map(_.scheme) else None + val accountRoutingAddress = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings.headOption.map(_.address) else None + val accountRoutings = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME) && viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings else Nil + val accountRules = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) bankAccount.accountRules else Nil //followings are from the bank object. val bankId = bank.bankId - val bankName = if (viewPermissions.exists(_ == "canSeeBankAccountBankName")) Some(bank.fullName) else None - val nationalIdentifier = if (viewPermissions.exists(_ == "canSeeBankAccountNationalIdentifier")) Some(bank.nationalIdentifier) else None - val bankRoutingScheme = if (viewPermissions.exists(_ == "canSeeBankRoutingScheme")) Some(bank.bankRoutingScheme) else None - val bankRoutingAddress = if (viewPermissions.exists(_ == "canSeeBankRoutingAddress")) Some(bank.bankRoutingAddress) else None + val bankName = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME)) Some(bank.fullName) else None + val nationalIdentifier = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER)) Some(bank.nationalIdentifier) else None + val bankRoutingScheme = if (viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME)) Some(bank.bankRoutingScheme) else None + val bankRoutingAddress = if (viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS)) Some(bank.bankRoutingAddress) else None Some( new ModeratedBankAccount( @@ -381,25 +381,25 @@ case class ViewExtended(val view: View) { def moderateAccountLegacy(bankAccount: BankAccount) : Box[ModeratedBankAccount] = { val viewPermissions = getViewPermissions - if(viewPermissions.exists(_ == "canSeeTransactionThisBankAccount")) + if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)) { - val owners : Set[User] = if(viewPermissions.exists(_ == "canSeeBankAccountOwners")) bankAccount.userOwners else Set() - val balance = if(viewPermissions.exists(_ == "canSeeBankAccountBalance") && bankAccount.balance !=null) bankAccount.balance.toString else "" - val accountType = if(viewPermissions.exists(_ == "canSeeBankAccountType")) Some(bankAccount.accountType) else None - val currency = if(viewPermissions.exists(_ == "canSeeBankAccountCurrency")) Some(bankAccount.currency) else None - val label = if(viewPermissions.exists(_ == "canSeeBankAccountLabel")) Some(bankAccount.label) else None - val nationalIdentifier = if(viewPermissions.exists(_ == "canSeeBankAccountNationalIdentifier")) Some(bankAccount.nationalIdentifier) else None - val iban = if(viewPermissions.exists(_ == "canSeeBankAccountIban")) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None - val number = if(viewPermissions.exists(_ == "canSeeBankAccountNumber")) Some(bankAccount.number) else None - val bankName = if(viewPermissions.exists(_ == "canSeeBankAccountBankName")) Some(bankAccount.bankName) else None + val owners : Set[User] = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) bankAccount.userOwners else Set() + val balance = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE) && bankAccount.balance !=null) bankAccount.balance.toString else "" + val accountType = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) Some(bankAccount.accountType) else None + val currency = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) Some(bankAccount.currency) else None + val label = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) Some(bankAccount.label) else None + val nationalIdentifier = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER)) Some(bankAccount.nationalIdentifier) else None + val iban = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN)) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None + val number = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) Some(bankAccount.number) else None + val bankName = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME)) Some(bankAccount.bankName) else None val bankId = bankAccount.bankId //From V300, use scheme and address stuff... - val bankRoutingScheme = if(viewPermissions.exists(_ == "canSeeBankRoutingScheme")) Some(bankAccount.bankRoutingScheme) else None - val bankRoutingAddress = if(viewPermissions.exists(_ == "canSeeBankRoutingAddress")) Some(bankAccount.bankRoutingAddress) else None - val accountRoutingScheme = if(viewPermissions.exists(_ == "canSeeBankAccountRoutingScheme")) bankAccount.accountRoutings.headOption.map(_.scheme) else None - val accountRoutingAddress = if(viewPermissions.exists(_ == "canSeeBankAccountRoutingAddress")) bankAccount.accountRoutings.headOption.map(_.address) else None - val accountRoutings = if(viewPermissions.exists(_ == "canSeeBankAccountRoutingScheme") && viewPermissions.exists(_ == "canSeeBankAccountRoutingAddress")) bankAccount.accountRoutings else Nil - val accountRules = if(viewPermissions.exists(_ == "canSeeBankAccountCreditLimit")) bankAccount.accountRules else Nil + val bankRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME)) Some(bankAccount.bankRoutingScheme) else None + val bankRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS)) Some(bankAccount.bankRoutingAddress) else None + val accountRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME)) bankAccount.accountRoutings.headOption.map(_.scheme) else None + val accountRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings.headOption.map(_.address) else None + val accountRoutings = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME) && viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings else Nil + val accountRules = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) bankAccount.accountRules else Nil Some( new ModeratedBankAccount( @@ -429,19 +429,19 @@ case class ViewExtended(val view: View) { def moderateAccountCore(bankAccount: BankAccount) : Box[ModeratedBankAccountCore] = { val viewPermissions = getViewPermissions - - if(viewPermissions.exists(_ == "canSeeTransactionThisBankAccount")) + + if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)) { - val owners : Set[User] = if(viewPermissions.exists(_ == "canSeeBankAccountOwners")) bankAccount.userOwners else Set() - val balance = if(viewPermissions.exists(_ == "canSeeBankAccountBalance") && bankAccount.balance != null) Some(bankAccount.balance.toString) else None - val accountType = if(viewPermissions.exists(_ == "canSeeBankAccountType")) Some(bankAccount.accountType) else None - val currency = if(viewPermissions.exists(_ == "canSeeBankAccountCurrency")) Some(bankAccount.currency) else None - val label = if(viewPermissions.exists(_ == "canSeeBankAccountLabel")) Some(bankAccount.label) else None - val number = if(viewPermissions.exists(_ == "canSeeBankAccountNumber")) Some(bankAccount.number) else None + val owners : Set[User] = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) bankAccount.userOwners else Set() + val balance = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE) && bankAccount.balance != null) Some(bankAccount.balance.toString) else None + val accountType = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) Some(bankAccount.accountType) else None + val currency = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) Some(bankAccount.currency) else None + val label = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) Some(bankAccount.label) else None + val number = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) Some(bankAccount.number) else None val bankId = bankAccount.bankId //From V300, use scheme and address stuff... - val accountRoutings = if(viewPermissions.exists(_ == "canSeeBankAccountRoutingScheme") && viewPermissions.exists(_ == "canSeeBankAccountRoutingAddress")) bankAccount.accountRoutings else Nil - val accountRules = if(viewPermissions.exists(_ == "canSeeBankAccountCreditLimit")) bankAccount.accountRules else Nil + val accountRoutings = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME) && viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings else Nil + val accountRules = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) bankAccount.accountRules else Nil Some( ModeratedBankAccountCore( @@ -465,8 +465,8 @@ case class ViewExtended(val view: View) { // Moderate the Counterparty side of the Transaction (i.e. the Other Account involved in the transaction) def moderateOtherAccount(otherBankAccount : Counterparty) : Box[ModeratedOtherBankAccount] = { val viewPermissions = getViewPermissions - - if (viewPermissions.exists(_ == "canSeeTransactionOtherBankAccount")) + + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT)) { //other account data val otherAccountId = otherBankAccount.counterpartyId @@ -507,37 +507,37 @@ case class ViewExtended(val view: View) { } implicit def optionStringToString(x : Option[String]) : String = x.getOrElse("") - val otherAccountNationalIdentifier = if(viewPermissions.exists(_ == "canSeeOtherAccountNationalIdentifier")) Some(otherBankAccount.nationalIdentifier) else None - val otherAccountSWIFT_BIC = if(viewPermissions.exists(_ == "canSeeOtherAccountSWIFT_BIC")) otherBankAccount.otherBankRoutingAddress else None - val otherAccountIBAN = if(viewPermissions.exists(_ == "canSeeOtherAccountIBAN")) otherBankAccount.otherAccountRoutingAddress else None - val otherAccountBankName = if(viewPermissions.exists(_ == "canSeeOtherAccountBankName")) Some(otherBankAccount.thisBankId.value) else None - val otherAccountNumber = if(viewPermissions.exists(_ == "canSeeOtherAccountNumber")) Some(otherBankAccount.thisAccountId.value) else None - val otherAccountKind = if(viewPermissions.exists(_ == "canSeeOtherAccountKind")) Some(otherBankAccount.kind) else None - val otherBankRoutingScheme = if(viewPermissions.exists(_ == "canSeeOtherBankRoutingScheme")) Some(otherBankAccount.otherBankRoutingScheme) else None - val otherBankRoutingAddress = if(viewPermissions.exists(_ == "canSeeOtherBankRoutingAddress")) otherBankAccount.otherBankRoutingAddress else None - val otherAccountRoutingScheme = if(viewPermissions.exists(_ == "canSeeOtherAccountRoutingScheme")) Some(otherBankAccount.otherAccountRoutingScheme) else None - val otherAccountRoutingAddress = if(viewPermissions.exists(_ == "canSeeOtherAccountRoutingAddress")) otherBankAccount.otherAccountRoutingAddress else None + val otherAccountNationalIdentifier = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER)) Some(otherBankAccount.nationalIdentifier) else None + val otherAccountSWIFT_BIC = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC)) otherBankAccount.otherBankRoutingAddress else None + val otherAccountIBAN = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN)) otherBankAccount.otherAccountRoutingAddress else None + val otherAccountBankName = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME)) Some(otherBankAccount.thisBankId.value) else None + val otherAccountNumber = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER)) Some(otherBankAccount.thisAccountId.value) else None + val otherAccountKind = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND)) Some(otherBankAccount.kind) else None + val otherBankRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME)) Some(otherBankAccount.otherBankRoutingScheme) else None + val otherBankRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS)) otherBankAccount.otherBankRoutingAddress else None + val otherAccountRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME)) Some(otherBankAccount.otherAccountRoutingScheme) else None + val otherAccountRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS)) otherBankAccount.otherAccountRoutingAddress else None val otherAccountMetadata = - if(viewPermissions.exists(_ == "canSeeOtherAccountMetadata")){ + if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA)){ //other bank account metadata - val moreInfo = moderateField(viewPermissions.exists(_ == "canSeeMoreInfo"), Counterparties.counterparties.vend.getMoreInfo(otherBankAccount.counterpartyId).getOrElse("Unknown")) - val url = moderateField(viewPermissions.exists(_ == "canSeeUrl"), Counterparties.counterparties.vend.getUrl(otherBankAccount.counterpartyId).getOrElse("Unknown")) - val imageUrl = moderateField(viewPermissions.exists(_ == "canSeeImageUrl"), Counterparties.counterparties.vend.getImageURL(otherBankAccount.counterpartyId).getOrElse("Unknown")) - val openCorporatesUrl = moderateField (viewPermissions.exists(_ == "canSeeOpenCorporatesUrl"), Counterparties.counterparties.vend.getOpenCorporatesURL(otherBankAccount.counterpartyId).getOrElse("Unknown")) - val corporateLocation : Option[Option[GeoTag]] = moderateField(viewPermissions.exists(_ == "canSeeCorporateLocation"), Counterparties.counterparties.vend.getCorporateLocation(otherBankAccount.counterpartyId).toOption) - val physicalLocation : Option[Option[GeoTag]] = moderateField(viewPermissions.exists(_ == "canSeePhysicalLocation"), Counterparties.counterparties.vend.getPhysicalLocation(otherBankAccount.counterpartyId).toOption) - val addMoreInfo = moderateField(viewPermissions.exists(_ == "canAddMoreInfo"), otherBankAccount.metadata.addMoreInfo) - val addURL = moderateField(viewPermissions.exists(_ == "canAddURL"), otherBankAccount.metadata.addURL) - val addImageURL = moderateField(viewPermissions.exists(_ == "canAddImageURL"), otherBankAccount.metadata.addImageURL) - val addOpenCorporatesUrl = moderateField(viewPermissions.exists(_ == "canAddOpenCorporatesUrl"), otherBankAccount.metadata.addOpenCorporatesURL) - val addCorporateLocation = moderateField(viewPermissions.exists(_ == "canAddCorporateLocation"), otherBankAccount.metadata.addCorporateLocation) - val addPhysicalLocation = moderateField(viewPermissions.exists(_ == "canAddPhysicalLocation"), otherBankAccount.metadata.addPhysicalLocation) - val publicAlias = moderateField(viewPermissions.exists(_ == "canSeePublicAlias"), Counterparties.counterparties.vend.getPublicAlias(otherBankAccount.counterpartyId).getOrElse("Unknown")) - val privateAlias = moderateField(viewPermissions.exists(_ == "canSeePrivateAlias"), Counterparties.counterparties.vend.getPrivateAlias(otherBankAccount.counterpartyId).getOrElse("Unknown")) - val addPublicAlias = moderateField(viewPermissions.exists(_ == "canAddPublicAlias"), otherBankAccount.metadata.addPublicAlias) - val addPrivateAlias = moderateField(viewPermissions.exists(_ == "canAddPrivateAlias"), otherBankAccount.metadata.addPrivateAlias) - val deleteCorporateLocation = moderateField(viewPermissions.exists(_ == "canDeleteCorporateLocation"), otherBankAccount.metadata.deleteCorporateLocation) - val deletePhysicalLocation= moderateField(viewPermissions.exists(_ == "canDeletePhysicalLocation"), otherBankAccount.metadata.deletePhysicalLocation) + val moreInfo = moderateField(viewPermissions.exists(_ == CAN_SEE_MORE_INFO), Counterparties.counterparties.vend.getMoreInfo(otherBankAccount.counterpartyId).getOrElse("Unknown")) + val url = moderateField(viewPermissions.exists(_ == CAN_SEE_URL), Counterparties.counterparties.vend.getUrl(otherBankAccount.counterpartyId).getOrElse("Unknown")) + val imageUrl = moderateField(viewPermissions.exists(_ == CAN_SEE_IMAGE_URL), Counterparties.counterparties.vend.getImageURL(otherBankAccount.counterpartyId).getOrElse("Unknown")) + val openCorporatesUrl = moderateField (viewPermissions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), Counterparties.counterparties.vend.getOpenCorporatesURL(otherBankAccount.counterpartyId).getOrElse("Unknown")) + val corporateLocation : Option[Option[GeoTag]] = moderateField(viewPermissions.exists(_ == CAN_SEE_CORPORATE_LOCATION), Counterparties.counterparties.vend.getCorporateLocation(otherBankAccount.counterpartyId).toOption) + val physicalLocation : Option[Option[GeoTag]] = moderateField(viewPermissions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), Counterparties.counterparties.vend.getPhysicalLocation(otherBankAccount.counterpartyId).toOption) + val addMoreInfo = moderateField(viewPermissions.exists(_ == CAN_ADD_MORE_INFO), otherBankAccount.metadata.addMoreInfo) + val addURL = moderateField(viewPermissions.exists(_ == CAN_ADD_URL), otherBankAccount.metadata.addURL) + val addImageURL = moderateField(viewPermissions.exists(_ == CAN_ADD_IMAGE_URL), otherBankAccount.metadata.addImageURL) + val addOpenCorporatesUrl = moderateField(viewPermissions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), otherBankAccount.metadata.addOpenCorporatesURL) + val addCorporateLocation = moderateField(viewPermissions.exists(_ == CAN_ADD_CORPORATE_LOCATION), otherBankAccount.metadata.addCorporateLocation) + val addPhysicalLocation = moderateField(viewPermissions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), otherBankAccount.metadata.addPhysicalLocation) + val publicAlias = moderateField(viewPermissions.exists(_ == CAN_SEE_PUBLIC_ALIAS), Counterparties.counterparties.vend.getPublicAlias(otherBankAccount.counterpartyId).getOrElse("Unknown")) + val privateAlias = moderateField(viewPermissions.exists(_ == CAN_SEE_PRIVATE_ALIAS), Counterparties.counterparties.vend.getPrivateAlias(otherBankAccount.counterpartyId).getOrElse("Unknown")) + val addPublicAlias = moderateField(viewPermissions.exists(_ == CAN_ADD_PUBLIC_ALIAS), otherBankAccount.metadata.addPublicAlias) + val addPrivateAlias = moderateField(viewPermissions.exists(_ == CAN_ADD_PRIVATE_ALIAS), otherBankAccount.metadata.addPrivateAlias) + val deleteCorporateLocation = moderateField(viewPermissions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), otherBankAccount.metadata.deleteCorporateLocation) + val deletePhysicalLocation= moderateField(viewPermissions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), otherBankAccount.metadata.deletePhysicalLocation) Some( new ModeratedOtherBankAccountMetadata( @@ -589,8 +589,8 @@ case class ViewExtended(val view: View) { def moderateCore(counterpartyCore : CounterpartyCore) : Box[ModeratedOtherBankAccountCore] = { val viewPermissions = getViewPermissions - - if (viewPermissions.exists(_ == "canSeeTransactionOtherBankAccount")) + + if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT)) { //other account data val otherAccountId = counterpartyCore.counterpartyId @@ -609,15 +609,15 @@ case class ViewExtended(val view: View) { } implicit def optionStringToString(x : Option[String]) : String = x.getOrElse("") - val otherAccountSWIFT_BIC = if(viewPermissions.exists(_ == "canSeeOtherAccountSWIFT_BIC")) counterpartyCore.otherBankRoutingAddress else None - val otherAccountIBAN = if(viewPermissions.exists(_ == "canSeeOtherAccountIBAN")) counterpartyCore.otherAccountRoutingAddress else None - val otherAccountBankName = if(viewPermissions.exists(_ == "canSeeOtherAccountBankName")) Some(counterpartyCore.thisBankId.value) else None - val otherAccountNumber = if(viewPermissions.exists(_ == "canSeeOtherAccountNumber")) Some(counterpartyCore.thisAccountId.value) else None - val otherAccountKind = if(viewPermissions.exists(_ == "canSeeOtherAccountKind")) Some(counterpartyCore.kind) else None - val otherBankRoutingScheme = if(viewPermissions.exists(_ == "canSeeOtherBankRoutingScheme")) Some(counterpartyCore.otherBankRoutingScheme) else None - val otherBankRoutingAddress = if(viewPermissions.exists(_ == "canSeeOtherBankRoutingAddress")) counterpartyCore.otherBankRoutingAddress else None - val otherAccountRoutingScheme = if(viewPermissions.exists(_ == "canSeeOtherAccountRoutingScheme")) Some(counterpartyCore.otherAccountRoutingScheme) else None - val otherAccountRoutingAddress = if(viewPermissions.exists(_ == "canSeeOtherAccountRoutingAddress")) counterpartyCore.otherAccountRoutingAddress else None + val otherAccountSWIFT_BIC = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC)) counterpartyCore.otherBankRoutingAddress else None + val otherAccountIBAN = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN)) counterpartyCore.otherAccountRoutingAddress else None + val otherAccountBankName = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME)) Some(counterpartyCore.thisBankId.value) else None + val otherAccountNumber = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER)) Some(counterpartyCore.thisAccountId.value) else None + val otherAccountKind = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND)) Some(counterpartyCore.kind) else None + val otherBankRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME)) Some(counterpartyCore.otherBankRoutingScheme) else None + val otherBankRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS)) counterpartyCore.otherBankRoutingAddress else None + val otherAccountRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME)) Some(counterpartyCore.otherAccountRoutingScheme) else None + val otherAccountRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS)) counterpartyCore.otherAccountRoutingAddress else None Some( new ModeratedOtherBankAccountCore( id = counterpartyCore.counterpartyId, diff --git a/obp-api/src/main/scala/code/views/MapperViews.scala b/obp-api/src/main/scala/code/views/MapperViews.scala index 6c6217dad..6f01d4edd 100644 --- a/obp-api/src/main/scala/code/views/MapperViews.scala +++ b/obp-api/src/main/scala/code/views/MapperViews.scala @@ -655,7 +655,7 @@ object MapperViews extends Views with MdcLoggable { permission.delete_! // If the permission already exists and permissionValueFromViewDefinition is defined, we update the metadata. case Full(permission) if permissionValueFromViewDefinition.isDefined => - permission.metaData(permissionValueFromViewDefinition.get.mkString(",")).save + permission.extraData(permissionValueFromViewDefinition.get.mkString(",")).save //if the permission is not existing in ViewPermission,but it is defined in the viewDefinition, we create it. --systemView case Empty if (viewDefinition.isSystem && permissionValueFromViewDefinition.isDefined) => ViewPermission.create @@ -663,7 +663,7 @@ object MapperViews extends Views with MdcLoggable { .account_id(null) .view_id(viewDefinition.viewId.value) .permission(permissionName) - .metaData(permissionValueFromViewDefinition.get.mkString(",")) + .extraData(permissionValueFromViewDefinition.get.mkString(",")) .save //if the permission is not existing in ViewPermission,but it is defined in the viewDefinition, we create it. --customView case Empty if (!viewDefinition.isSystem && permissionValueFromViewDefinition.isDefined) => @@ -672,7 +672,7 @@ object MapperViews extends Views with MdcLoggable { .account_id(viewDefinition.accountId.value) .view_id(viewDefinition.viewId.value) .permission(permissionName) - .metaData(permissionValueFromViewDefinition.get.mkString(",")) + .extraData(permissionValueFromViewDefinition.get.mkString(",")) .save case _ => // This case should not happen, but if it does, we add an error log diff --git a/obp-api/src/main/scala/code/views/system/ViewDefinition.scala b/obp-api/src/main/scala/code/views/system/ViewDefinition.scala index a5f7312b5..43c0c627a 100644 --- a/obp-api/src/main/scala/code/views/system/ViewDefinition.scala +++ b/obp-api/src/main/scala/code/views/system/ViewDefinition.scala @@ -1,5 +1,6 @@ package code.views.system +import code.api.Constant._ import code.api.util.APIUtil.{isValidCustomViewId, isValidSystemViewId} import code.api.util.ErrorMessages.{CreateSystemViewError, InvalidCustomViewFormat, InvalidSystemViewFormat} import code.util.{AccountIdString, UUIDString} @@ -364,99 +365,99 @@ class ViewDefinition extends View with LongKeyedMapper[ViewDefinition] with Many val actions = viewData.allowed_actions if (isSystem) { //The following are admin permissions, only system views are allowed to use them. - canGrantAccessToCustomViews_(actions.exists(_ == "can_grant_access_to_custom_views")) - canRevokeAccessToCustomViews_(actions.exists(_ == "can_revoke_access_to_custom_views")) + canGrantAccessToCustomViews_(actions.exists(_ == CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS)) + canRevokeAccessToCustomViews_(actions.exists(_ == CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS)) canGrantAccessToViews_(viewData.can_grant_access_to_views.getOrElse(Nil).mkString(",")) canRevokeAccessToViews_(viewData.can_revoke_access_to_views.getOrElse(Nil).mkString(",")) - canCreateCustomView_(actions.exists(_ == "can_create_custom_view")) - canDeleteCustomView_(actions.exists(_ == "can_delete_custom_view")) - canUpdateCustomView_(actions.exists(_ == "can_update_custom_view")) + canCreateCustomView_(actions.exists(_ == CAN_CREATE_CUSTOM_VIEW)) + canDeleteCustomView_(actions.exists(_ == CAN_DELETE_CUSTOM_VIEW)) + canUpdateCustomView_(actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW)) } - - canSeeTransactionThisBankAccount_(actions.exists(_ =="can_see_transaction_this_bank_account")) - canSeeTransactionOtherBankAccount_(actions.exists(_ =="can_see_transaction_other_bank_account")) - canSeeTransactionMetadata_(actions.exists(_ == "can_see_transaction_metadata")) - canSeeTransactionDescription_(actions.exists(a => a == "can_see_transaction_label" || a == "can_see_transaction_description")) - canSeeTransactionAmount_(actions.exists(_ == "can_see_transaction_amount")) - canSeeTransactionType_(actions.exists(_ == "can_see_transaction_type")) - canSeeTransactionCurrency_(actions.exists(_ == "can_see_transaction_currency")) - canSeeTransactionStartDate_(actions.exists(_ == "can_see_transaction_start_date")) - canSeeTransactionFinishDate_(actions.exists(_ == "can_see_transaction_finish_date")) - canSeeTransactionBalance_(actions.exists(_ == "can_see_transaction_balance")) - canSeeComments_(actions.exists(_ == "can_see_comments")) - canSeeOwnerComment_(actions.exists(_ == "can_see_narrative")) - canSeeTags_(actions.exists(_ == "can_see_tags")) - canSeeImages_(actions.exists(_ == "can_see_images")) - canSeeBankAccountOwners_(actions.exists(_ == "can_see_bank_account_owners")) - canSeeBankAccountType_(actions.exists(_ == "can_see_bank_account_type")) - canSeeBankAccountBalance_(actions.exists(_ == "can_see_bank_account_balance")) - canQueryAvailableFunds_(actions.exists(_ == "can_query_available_funds")) - canSeeBankAccountCurrency_(actions.exists(_ == "can_see_bank_account_currency")) - canSeeBankAccountLabel_(actions.exists(_ == "can_see_bank_account_label")) - canSeeBankAccountNationalIdentifier_(actions.exists(_ == "can_see_bank_account_national_identifier")) - canSeeBankAccountSwift_bic_(actions.exists(_ == "can_see_bank_account_swift_bic")) - canSeeBankAccountIban_(actions.exists(_ == "can_see_bank_account_iban")) - canSeeBankAccountNumber_(actions.exists(_ == "can_see_bank_account_number")) - canSeeBankAccountBankName_(actions.exists(_ == "can_see_bank_account_bank_name")) - canSeeBankAccountBankPermalink_(actions.exists(_ == "can_see_bank_account_bank_permalink")) - canSeeBankRoutingScheme_(actions.exists(_ == "can_see_bank_routing_scheme")) - canSeeBankRoutingAddress_(actions.exists(_ == "can_see_bank_routing_address")) - canSeeBankAccountRoutingScheme_(actions.exists(_ == "can_see_bank_account_routing_scheme")) - canSeeBankAccountRoutingAddress_(actions.exists(_ == "can_see_bank_account_routing_address")) - canSeeOtherAccountNationalIdentifier_(actions.exists(_ == "can_see_other_account_national_identifier")) - canSeeOtherAccountSWIFT_BIC_(actions.exists(_ == "can_see_other_account_swift_bic")) - canSeeOtherAccountIBAN_(actions.exists(_ == "can_see_other_account_iban")) - canSeeOtherAccountBankName_(actions.exists(_ == "can_see_other_account_bank_name")) - canSeeOtherAccountNumber_(actions.exists(_ == "can_see_other_account_number")) - canSeeOtherAccountMetadata_(actions.exists(_ == "can_see_other_account_metadata")) - canSeeOtherAccountKind_(actions.exists(_ == "can_see_other_account_kind")) - canSeeOtherBankRoutingScheme_(actions.exists(_ == "can_see_other_bank_routing_scheme")) - canSeeOtherBankRoutingAddress_(actions.exists(_ == "can_see_other_bank_routing_address")) - canSeeOtherAccountRoutingScheme_(actions.exists(_ == "can_see_other_account_routing_scheme")) - canSeeOtherAccountRoutingAddress_(actions.exists(_ == "can_see_other_account_routing_address")) - canSeeMoreInfo_(actions.exists(_ == "can_see_more_info")) - canSeeUrl_(actions.exists(_ == "can_see_url")) - canSeeImageUrl_(actions.exists(_ == "can_see_image_url")) - canSeeOpenCorporatesUrl_(actions.exists(_ == "can_see_open_corporates_url")) - canSeeCorporateLocation_(actions.exists(_ == "can_see_corporate_location")) - canSeePhysicalLocation_(actions.exists(_ == "can_see_physical_location")) - canSeePublicAlias_(actions.exists(_ == "can_see_public_alias")) - canSeePrivateAlias_(actions.exists(_ == "can_see_private_alias")) - canAddMoreInfo_(actions.exists(_ == "can_add_more_info")) - canAddURL_(actions.exists(_ == "can_add_url")) - canAddImageURL_(actions.exists(_ == "can_add_image_url")) - canAddOpenCorporatesUrl_(actions.exists(_ == "can_add_open_corporates_url")) - canAddCorporateLocation_(actions.exists(_ == "can_add_corporate_location")) - canAddPhysicalLocation_(actions.exists(_ == "can_add_physical_location")) - canAddPublicAlias_(actions.exists(_ == "can_add_public_alias")) - canAddPrivateAlias_(actions.exists(_ == "can_add_private_alias")) - canAddCounterparty_(actions.exists(_ == "can_add_counterparty")) - canDeleteCounterparty_(actions.exists(_ == "can_delete_counterparty")) - canGetCounterparty_(actions.exists(_ == "can_get_counterparty")) - canDeleteCorporateLocation_(actions.exists(_ == "can_delete_corporate_location")) - canDeletePhysicalLocation_(actions.exists(_ == "can_delete_physical_location")) - canEditOwnerComment_(actions.exists(_ == "can_edit_narrative")) - canAddComment_(actions.exists(_ == "can_add_comment")) - canDeleteComment_(actions.exists(_ == "can_delete_comment")) - canAddTag_(actions.exists(_ == "can_add_tag")) - canDeleteTag_(actions.exists(_ == "can_delete_tag")) - canAddImage_(actions.exists(_ == "can_add_image")) - canDeleteImage_(actions.exists(_ == "can_delete_image")) - canAddWhereTag_(actions.exists(_ == "can_add_where_tag")) - canSeeWhereTag_(actions.exists(_ == "can_see_where_tag")) - canDeleteWhereTag_(actions.exists(_ == "can_delete_where_tag")) - canAddTransactionRequestToBeneficiary_(actions.exists(_ == "can_add_transaction_request_to_beneficiary")) - canAddTransactionRequestToAnyAccount_(actions.exists(_ == "can_add_transaction_request_to_any_account")) - canSeeBankAccountCreditLimit_(actions.exists(_ == "can_see_bank_account_credit_limit")) - canCreateDirectDebit_(actions.exists(_ == "can_create_direct_debit")) - canCreateStandingOrder_(actions.exists(_ == "can_create_standing_order")) - canSeeTransactionRequests_(actions.exists(_ == "can_see_transaction_requests")) - canSeeTransactionRequestTypes_(actions.exists(_ == "can_see_transaction_request_types")) - canUpdateBankAccountLabel_(actions.exists(_ == "can_update_bank_account_label")) - canSeeAvailableViewsForBankAccount_(actions.exists(_ == "can_see_available_views_for_bank_account")) - canSeeViewsWithPermissionsForAllUsers_(actions.exists(_ == "can_see_views_with_permissions_for_all_users")) - canSeeViewsWithPermissionsForOneUser_(actions.exists(_ == "can_see_views_with_permissions_for_one_user")) - canSeeTransactionStatus_(actions.exists(_ == "can_see_transaction_status")) + + canSeeTransactionThisBankAccount_(actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)) + canSeeTransactionOtherBankAccount_(actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT)) + canSeeTransactionMetadata_(actions.exists(_ == CAN_SEE_TRANSACTION_METADATA)) + canSeeTransactionDescription_(actions.exists(_ ==CAN_SEE_TRANSACTION_DESCRIPTION)) + canSeeTransactionAmount_(actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT)) + canSeeTransactionType_(actions.exists(_ == CAN_SEE_TRANSACTION_TYPE)) + canSeeTransactionCurrency_(actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY)) + canSeeTransactionStartDate_(actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE)) + canSeeTransactionFinishDate_(actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE)) + canSeeTransactionBalance_(actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE)) + canSeeComments_(actions.exists(_ == CAN_SEE_COMMENTS)) + canSeeOwnerComment_(actions.exists(_ == CAN_SEE_OWNER_COMMENT)) + canSeeTags_(actions.exists(_ == CAN_SEE_TAGS)) + canSeeImages_(actions.exists(_ == CAN_SEE_IMAGES)) + canSeeBankAccountOwners_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) + canSeeBankAccountType_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) + canSeeBankAccountBalance_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE)) + canQueryAvailableFunds_(actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS)) + canSeeBankAccountCurrency_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) + canSeeBankAccountLabel_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) + canSeeBankAccountNationalIdentifier_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER)) + canSeeBankAccountSwift_bic_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC)) + canSeeBankAccountIban_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN)) + canSeeBankAccountNumber_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) + canSeeBankAccountBankName_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME)) + canSeeBankAccountBankPermalink_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_PERMALINK)) + canSeeBankRoutingScheme_(actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME)) + canSeeBankRoutingAddress_(actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS)) + canSeeBankAccountRoutingScheme_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME)) + canSeeBankAccountRoutingAddress_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) + canSeeOtherAccountNationalIdentifier_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER)) + canSeeOtherAccountSWIFT_BIC_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC)) + canSeeOtherAccountIBAN_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN)) + canSeeOtherAccountBankName_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME)) + canSeeOtherAccountNumber_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER)) + canSeeOtherAccountMetadata_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA)) + canSeeOtherAccountKind_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND)) + canSeeOtherBankRoutingScheme_(actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME)) + canSeeOtherBankRoutingAddress_(actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS)) + canSeeOtherAccountRoutingScheme_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME)) + canSeeOtherAccountRoutingAddress_(actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS)) + canSeeMoreInfo_(actions.exists(_ == CAN_SEE_MORE_INFO)) + canSeeUrl_(actions.exists(_ == CAN_SEE_URL)) + canSeeImageUrl_(actions.exists(_ == CAN_SEE_IMAGE_URL)) + canSeeOpenCorporatesUrl_(actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL)) + canSeeCorporateLocation_(actions.exists(_ == CAN_SEE_CORPORATE_LOCATION)) + canSeePhysicalLocation_(actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION)) + canSeePublicAlias_(actions.exists(_ == CAN_SEE_PUBLIC_ALIAS)) + canSeePrivateAlias_(actions.exists(_ == CAN_SEE_PRIVATE_ALIAS)) + canAddMoreInfo_(actions.exists(_ == CAN_ADD_MORE_INFO)) + canAddURL_(actions.exists(_ == CAN_ADD_URL)) + canAddImageURL_(actions.exists(_ == CAN_ADD_IMAGE_URL)) + canAddOpenCorporatesUrl_(actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL)) + canAddCorporateLocation_(actions.exists(_ == CAN_ADD_CORPORATE_LOCATION)) + canAddPhysicalLocation_(actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION)) + canAddPublicAlias_(actions.exists(_ == CAN_ADD_PUBLIC_ALIAS)) + canAddPrivateAlias_(actions.exists(_ == CAN_ADD_PRIVATE_ALIAS)) + canAddCounterparty_(actions.exists(_ == CAN_ADD_COUNTERPARTY)) + canDeleteCounterparty_(actions.exists(_ == CAN_DELETE_COUNTERPARTY)) + canGetCounterparty_(actions.exists(_ == CAN_GET_COUNTERPARTY)) + canDeleteCorporateLocation_(actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION)) + canDeletePhysicalLocation_(actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION)) + canEditOwnerComment_(actions.exists(_ == CAN_EDIT_OWNER_COMMENT)) + canAddComment_(actions.exists(_ == CAN_ADD_COMMENT)) + canDeleteComment_(actions.exists(_ == CAN_DELETE_COMMENT)) + canAddTag_(actions.exists(_ == CAN_ADD_TAG)) + canDeleteTag_(actions.exists(_ == CAN_DELETE_TAG)) + canAddImage_(actions.exists(_ == CAN_ADD_IMAGE)) + canDeleteImage_(actions.exists(_ == CAN_DELETE_IMAGE)) + canAddWhereTag_(actions.exists(_ == CAN_ADD_WHERE_TAG)) + canSeeWhereTag_(actions.exists(_ == CAN_SEE_WHERE_TAG)) + canDeleteWhereTag_(actions.exists(_ == CAN_DELETE_WHERE_TAG)) + canAddTransactionRequestToBeneficiary_(actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY)) + canAddTransactionRequestToAnyAccount_(actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)) + canSeeBankAccountCreditLimit_(actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) + canCreateDirectDebit_(actions.exists(_ == CAN_CREATE_DIRECT_DEBIT)) + canCreateStandingOrder_(actions.exists(_ == CAN_CREATE_STANDING_ORDER)) + canSeeTransactionRequests_(actions.exists(_ == CAN_SEE_TRANSACTION_REQUESTS)) + canSeeTransactionRequestTypes_(actions.exists(_ == CAN_SEE_TRANSACTION_REQUEST_TYPES)) + canUpdateBankAccountLabel_(actions.exists(_ == CAN_UPDATE_BANK_ACCOUNT_LABEL)) + canSeeAvailableViewsForBankAccount_(actions.exists(_ == CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)) + canSeeViewsWithPermissionsForAllUsers_(actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)) + canSeeViewsWithPermissionsForOneUser_(actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)) + canSeeTransactionStatus_(actions.exists(_ == CAN_SEE_TRANSACTION_STATUS)) } diff --git a/obp-api/src/main/scala/code/views/system/ViewPermission.scala b/obp-api/src/main/scala/code/views/system/ViewPermission.scala index 17c09f643..3de76e629 100644 --- a/obp-api/src/main/scala/code/views/system/ViewPermission.scala +++ b/obp-api/src/main/scala/code/views/system/ViewPermission.scala @@ -12,9 +12,9 @@ class ViewPermission extends LongKeyedMapper[ViewPermission] with IdPK with Crea object view_id extends UUIDString(this) object permission extends MappedString(this, 255) - //this is for special permissions like "canRevokeAccessToViews" and "canGrantAccessToViews", it will be a list of view ids , - // eg: owner,auditor,accountant,firehose,standard,StageOne,ManageCustomViews,ReadAccountsBasic,ReadAccountsDetail,ReadBalances,ReadTransactionsBasic,ReadTransactionsDebits, - object metaData extends MappedString(this, 1024) + //this is for special permissions like CAN_REVOKE_ACCESS_TO_VIEWS and CAN_GRANT_ACCESS_TO_VIEWS, it will be a list of view ids , + // eg: owner,auditor,accountant,firehose,standard,StageOne,ManageCustomViews,ReadAccountsBasic + object extraData extends MappedString(this, 1024) } object ViewPermission extends ViewPermission with LongKeyedMetaMapper[ViewPermission] { override def dbIndexes: List[BaseIndex[ViewPermission]] = UniqueIndex(bank_id, account_id, view_id, permission) :: super.dbIndexes diff --git a/obp-api/src/test/scala/code/api/v1_2_0/API12Test.scala b/obp-api/src/test/scala/code/api/v1_2_0/API12Test.scala deleted file mode 100644 index c85d5d896..000000000 --- a/obp-api/src/test/scala/code/api/v1_2_0/API12Test.scala +++ /dev/null @@ -1,5588 +0,0 @@ -///** -//Open Bank Project - API -//Copyright (C) 2011-2019, TESOBE GmbH -// -//This program is free software: you can redistribute it and/or modify -//it under the terms of the GNU Affero General Public License as published by -//the Free Software Foundation, either version 3 of the License, or -//(at your option) any later version. -// -//This program is distributed in the hope that it will be useful, -//but WITHOUT ANY WARRANTY; without even the implied warranty of -//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//GNU Affero General Public License for more details. -// -//You should have received a copy of the GNU Affero General Public License -//along with this program. If not, see . -// -//Email: contact@tesobe.com -//TESOBE GmbH -//Osloerstrasse 16/17 -//Berlin 13359, Germany -// -// This product includes software developed at -// TESOBE (http://www.tesobe.com/) -// by -// Simon Redfern : simon AT tesobe DOT com -// Stefan Bethge : stefan AT tesobe DOT com -// Everett Sochowski : everett AT tesobe DOT com -// Ayoub Benali: ayoub AT tesobe DOT com -// -// */ -//package code.api.v1_2_0 -// -//import java.util.Date -// -//import _root_.net.liftweb.json.JsonAST.JObject -//import _root_.net.liftweb.json.Serialization.write -//import _root_.net.liftweb.util._ -//import code.api.util.APIUtil -//import code.api.util.APIUtil.OAuth._ -//import code.api.v1_2._ -//import code.model.{Consumer => OBPConsumer, Token => OBPToken, _} -//import code.setup.{APIResponse, DefaultUsers, User1AllPrivileges} -//import code.views.Views -//import net.liftweb.json.JsonDSL._ -//import net.liftweb.util.Helpers._ -//import org.scalatest._ -// -//import scala.util.Random._ -// -// -//class API1_2Test extends User1AllPrivileges with DefaultUsers { -// -// def v1_2Request = baseRequest / "obp" / "v1.2" -// -// val viewfields = List( -// "can_see_transaction_this_bank_account","can_see_transaction_other_bank_account", -// "can_see_transaction_metadata","can_see_transaction_label","can_see_transaction_amount", -// "can_see_transaction_type","can_see_transaction_currency","can_see_transaction_start_date", -// "can_see_transaction_finish_date","can_see_transaction_balance","can_see_comments", -// "can_see_narrative","can_see_tags","can_see_images","can_see_bank_account_owners", -// "can_see_bank_account_type","can_see_bank_account_balance","can_see_bank_account_currency", -// "can_see_bank_account_label","can_see_bank_account_national_identifier", -// "can_see_bank_account_swift_bic","can_see_bank_account_iban","can_see_bank_account_number", -// "can_see_bank_account_bank_name","can_see_other_account_national_identifier", -// "can_see_other_account_swift_bic","can_see_other_account_iban", -// "can_see_other_account_bank_name","can_see_other_account_number", -// "can_see_other_account_metadata","can_see_other_account_kind","can_see_more_info", -// "can_see_url","can_see_image_url","can_see_open_corporates_url","can_see_corporate_location", -// "can_see_physical_location","can_see_public_alias","can_see_private_alias","can_add_more_info", -// "can_add_url","can_add_image_url","can_add_open_corporates_url","can_add_corporate_location", -// "can_add_physical_location","can_add_public_alias","can_add_private_alias", -// "can_delete_corporate_location","can_delete_physical_location","can_edit_narrative", -// "can_add_comment","can_delete_comment","can_add_tag","can_delete_tag","can_add_image", -// "can_delete_image","can_add_where_tag","can_see_where_tag","can_delete_where_tag" -// ) -// -// /************************* test tags ************************/ -// -// /** -// * Example: To run tests with tag "getPermissions": -// * mvn test -D tagsToInclude -// * -// * This is made possible by the scalatest maven plugin -// */ -// -// object CurrentTest extends Tag("currentScenario") -// object API1_2 extends Tag("api1.2") -// object APIInfo extends Tag("apiInfo") -// object GetHostedBanks extends Tag("hostedBanks") -// object GetHostedBank extends Tag("getHostedBank") -// object GetBankAccounts extends Tag("getBankAccounts") -// object GetPublicBankAccounts extends Tag("getPublicBankAccounts") -// object GetPrivateBankAccounts extends Tag("getPrivateBankAccounts") -// object GetBankAccount extends Tag("getBankAccount") -// object GetViews extends Tag("getViews") -// object PostView extends Tag("postView") -// object PutView extends Tag("putView") -// object DeleteView extends Tag("deleteView") -// object GetPermissions extends Tag("getPermissions") -// object GetPermission extends Tag("getPermission") -// object PostPermission extends Tag("postPermission") -// object PostPermissions extends Tag("postPermissions") -// object DeletePermission extends Tag("deletePermission") -// object DeletePermissions extends Tag("deletePermissions") -// object GetOtherBankAccounts extends Tag("getOtherBankAccounts") -// object GetOtherBankAccount extends Tag("getOtherBankAccount") -// object GetOtherBankAccountMetadata extends Tag("getOtherBankAccountMetadata") -// object GetPublicAlias extends Tag("getPublicAlias") -// object PostPublicAlias extends Tag("postPublicAlias") -// object PutPublicAlias extends Tag("putPublicAlias") -// object DeletePublicAlias extends Tag("deletePublicAlias") -// object GetPrivateAlias extends Tag("getPrivateAlias") -// object PostPrivateAlias extends Tag("postPrivateAlias") -// object PutPrivateAlias extends Tag("putPrivateAlias") -// object DeletePrivateAlias extends Tag("deletePrivateAlias") -// object PostMoreInfo extends Tag("postMoreInfo") -// object PutMoreInfo extends Tag("putMoreInfo") -// object DeleteMoreInfo extends Tag("deleteMoreInfo") -// object PostURL extends Tag("postURL") -// object PutURL extends Tag("putURL") -// object DeleteURL extends Tag("deleteURL") -// object PostImageURL extends Tag("postImageURL") -// object PutImageURL extends Tag("putImageURL") -// object DeleteImageURL extends Tag("DeleteImageURL") -// object PostOpenCorporatesURL extends Tag("postOpenCorporatesURL") -// object PutOpenCorporatesURL extends Tag("putOpenCorporatesURL") -// object DeleteOpenCorporatesURL extends Tag("deleteOpenCorporatesURL") -// object PostCorporateLocation extends Tag("postCorporateLocation") -// object PutCorporateLocation extends Tag("putCorporateLocation") -// object DeleteCorporateLocation extends Tag("deleteCorporateLocation") -// object PostPhysicalLocation extends Tag("postPhysicalLocation") -// object PutPhysicalLocation extends Tag("putPhysicalLocation") -// object DeletePhysicalLocation extends Tag("deletePhysicalLocation") -// object GetTransactions extends Tag("getTransactions") -// object GetTransactionsWithParams extends Tag("getTransactionsWithParams") -// object GetTransaction extends Tag("getTransaction") -// object GetNarrative extends Tag("getNarrative") -// object PostNarrative extends Tag("postNarrative") -// object PutNarrative extends Tag("putNarrative") -// object DeleteNarrative extends Tag("deleteNarrative") -// object GetComments extends Tag("getComments") -// object PostComment extends Tag("postComment") -// object DeleteComment extends Tag("deleteComment") -// object GetTags extends Tag("getTags") -// object PostTag extends Tag("postTag") -// object DeleteTag extends Tag("deleteTag") -// object GetImages extends Tag("getImages") -// object PostImage extends Tag("postImage") -// object DeleteImage extends Tag("deleteImage") -// object GetWhere extends Tag("getWhere") -// object PostWhere extends Tag("postWhere") -// object PutWhere extends Tag("putWhere") -// object DeleteWhere extends Tag("deleteWhere") -// object GetTransactionAccount extends Tag("getTransactionAccount") -// -// /********************* API test methods ********************/ -// -// def randomViewPermalink(bankId: String, account: AccountJSON) : String = { -// val request = v1_2Request / "banks" / bankId / "accounts" / account.id / "views" <@(consumer, token1) -// val reply = makeGetRequest(request) -// val possibleViewsPermalinks = reply.body.extract[ViewsJSON].views.filterNot(_.is_public==true) -// val randomPosition = nextInt(possibleViewsPermalinks.size) -// possibleViewsPermalinks(randomPosition).id -// } -// -// def randomViewPermalinkButNotOwner(bankId: String, account: AccountJSON) : String = { -// val request = v1_2Request / "banks" / bankId / "accounts" / account.id / "views" <@(consumer, token1) -// val reply = makeGetRequest(request) -// val possibleViewsPermalinksWithoutOwner = reply.body.extract[ViewsJSON].views.filterNot(_.is_public==true).filterNot(_.id == Constant.SYSTEM_OWNER_VIEW_ID) -// val randomPosition = nextInt(possibleViewsPermalinksWithoutOwner.size) -// possibleViewsPermalinksWithoutOwner(randomPosition).id -// } -// -// def randomBank : String = { -// val banksJson = getBanksInfo.body.extract[BanksJSON] -// val randomPosition = nextInt(banksJson.banks.size) -// val bank = banksJson.banks(randomPosition) -// bank.id -// } -// -// def randomPublicAccount(bankId : String) : AccountJSON = { -// val accountsJson = getPublicAccounts(bankId).body.extract[AccountsJSON].accounts -// val randomPosition = nextInt(accountsJson.size) -// accountsJson(randomPosition) -// } -// -// def randomPrivateAccount(bankId : String) : AccountJSON = { -// val accountsJson = getPrivateAccounts(bankId, user1).body.extract[AccountsJSON].accounts -// val randomPosition = nextInt(accountsJson.size) -// accountsJson(randomPosition) -// } -// -// def randomAccountPermission(bankId : String, accountId : String) : PermissionJSON = { -// val persmissionsInfo = getAccountPermissions(bankId, accountId, user1).body.extract[PermissionsJSON] -// val randomPermission = nextInt(persmissionsInfo.permissions.size) -// persmissionsInfo.permissions(randomPermission) -// } -// -// def randomOtherBankAccount(bankId : String, accountId : String, viewId : String): OtherAccountJSON = { -// val otherAccounts = getTheOtherBankAccounts(bankId, accountId, viewId, user1).body.extract[OtherAccountsJSON].other_accounts -// otherAccounts(nextInt(otherAccounts.size)) -// } -// -// def randomLocation : LocationPlainJSON = { -// def sign = { -// val b = nextBoolean -// if(b) 1 -// else -1 -// } -// val longitude : Double = nextInt(180)*sign*nextDouble -// val latitude : Double = nextInt(90)*sign*nextDouble -// JSONFactory.createLocationPlainJSON(latitude, longitude) -// } -// -// def randomTransaction(bankId : String, accountId : String, viewId: String) : TransactionJSON = { -// val transactionsJson = getTransactions(bankId, accountId, viewId, user1).body.extract[TransactionsJSON].transactions -// val randomPosition = nextInt(transactionsJson.size) -// transactionsJson(randomPosition) -// } -// -// def randomViewsIdsToGrant(bankId : String, accountId : String) : List[String]= { -// //get the view ids of the available views on the bank accounts -// val viewsIds = getAccountViews(bankId, accountId, user1).body.extract[ViewsJSON].views.map(_.id) -// //choose randomly some view ids to grant -// val (viewsIdsToGrant, _) = viewsIds.splitAt(nextInt(viewsIds.size) + 1) -// viewsIdsToGrant -// } -// -// def randomView(isPublic: Boolean, alias: String) : CreateViewJson = { -// CreateViewJson( -// name = randomString(3), -// description = randomString(3), -// is_public = isPublic, -// which_alias_to_use=alias, -// hide_metadata_if_alias_used=false, -// allowed_actions = viewfields -// ) -// } -// def getAPIInfo : APIResponse = { -// val request = v1_2Request -// makeGetRequest(request) -// } -// -// def getBanksInfo : APIResponse = { -// val request = v1_2Request / "banks" -// makeGetRequest(request) -// } -// -// def getBankInfo(bankId : String) : APIResponse = { -// val request = v1_2Request / "banks" / bankId -// makeGetRequest(request) -// } -// -// def getPublicAccounts(bankId : String) : APIResponse= { -// val request = v1_2Request / "banks" / bankId / "accounts" / "public" -// makeGetRequest(request) -// } -// -// def getPrivateAccounts(bankId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / "private" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getBankAccounts(bankId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getPublicBankAccountDetails(bankId : String, accountId : String, viewId : String) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "account" -// makeGetRequest(request) -// } -// -// def getPrivateBankAccountDetails(bankId : String, accountId : String, viewId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "account" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getAccountViews(bankId : String, accountId : String, consumerAndToken: Option[(Consumer, Token)]): APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / "views" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postView(bankId: String, accountId: String, view: CreateViewJson, consumerAndToken: Option[(Consumer, Token)]): APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "views").POST <@(consumerAndToken) -// makePostRequest(request, write(view)) -// } -// -// def putView(bankId: String, accountId: String, viewId : String, view: UpdateViewJSON, consumerAndToken: Option[(Consumer, Token)]): APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "views" / viewId).PUT <@(consumerAndToken) -// makePutRequest(request, write(view)) -// } -// -// def deleteView(bankId: String, accountId: String, viewId: String, consumerAndToken: Option[(Consumer, Token)]): APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "views" / viewId).DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getAccountPermissions(bankId : String, accountId : String, consumerAndToken: Option[(Consumer, Token)]): APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / "permissions" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getUserAccountPermission(bankId : String, accountId : String, userId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse= { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / "permissions"/ userId <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def grantUserAccessToView(bankId : String, accountId : String, userId : String, viewId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse= { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "permissions"/ userId / "views" / viewId).POST <@(consumerAndToken) -// makePostRequest(request) -// } -// -// def grantUserAccessToViews(bankId : String, accountId : String, userId : String, viewIds : List[String], consumerAndToken: Option[(Consumer, Token)]) : APIResponse= { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "permissions"/ userId / "views").POST <@(consumerAndToken) -// val viewsJson = ViewIdsJson(viewIds) -// makePostRequest(request, write(viewsJson)) -// } -// -// def revokeUserAccessToView(bankId : String, accountId : String, userId : String, viewId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse= { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "permissions"/ userId / "views" / viewId).DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def revokeUserAccessToAllViews(bankId : String, accountId : String, userId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse= { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / "permissions"/ userId / "views").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getTheOtherBankAccounts(bankId : String, accountId : String, viewId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getTheOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getMetadataOfOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "metadata" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getThePublicAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "public_alias" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postAPublicAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, alias : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "public_alias").POST <@(consumerAndToken) -// val aliasJson = AliasJSON(alias) -// makePostRequest(request, write(aliasJson)) -// } -// -// def updateThePublicAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, alias : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "public_alias").PUT <@(consumerAndToken) -// val aliasJson = AliasJSON(alias) -// makePutRequest(request, write(aliasJson)) -// } -// -// def deleteThePublicAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "public_alias").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getThePrivateAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "private_alias" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postAPrivateAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, alias : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "private_alias").POST <@(consumerAndToken) -// val aliasJson = AliasJSON(alias) -// makePostRequest(request, write(aliasJson)) -// } -// -// def updateThePrivateAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, alias : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "private_alias").PUT <@(consumerAndToken) -// val aliasJson = AliasJSON(alias) -// makePutRequest(request, write(aliasJson)) -// } -// -// def deleteThePrivateAliasForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "private_alias").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getMoreInfoForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : String = { -// getMetadataOfOneOtherBankAccount(bankId,accountId,viewId,otherBankAccountId,consumerAndToken).body.extract[OtherAccountMetadataJSON].more_info -// } -// -// def postMoreInfoForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, moreInfo : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "more_info").POST <@(consumerAndToken) -// val moreInfoJson = MoreInfoJSON(moreInfo) -// makePostRequest(request, write(moreInfoJson)) -// } -// -// def updateMoreInfoForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, moreInfo : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "more_info").PUT <@(consumerAndToken) -// val moreInfoJson = MoreInfoJSON(moreInfo) -// makePutRequest(request, write(moreInfoJson)) -// } -// -// def deleteMoreInfoForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "more_info").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : String = { -// getMetadataOfOneOtherBankAccount(bankId,accountId, viewId,otherBankAccountId,consumerAndToken).body.extract[OtherAccountMetadataJSON].URL -// } -// -// def postUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, url : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "url").POST <@(consumerAndToken) -// val urlJson = UrlJSON(url) -// makePostRequest(request, write(urlJson)) -// } -// -// def updateUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, url : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "url").PUT <@(consumerAndToken) -// val urlJson = UrlJSON(url) -// makePutRequest(request, write(urlJson)) -// } -// -// def deleteUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "url").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getImageUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : String = { -// getMetadataOfOneOtherBankAccount(bankId,accountId, viewId,otherBankAccountId,consumerAndToken).body.extract[OtherAccountMetadataJSON].image_URL -// } -// -// def postImageUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, imageUrl : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "image_url").POST <@(consumerAndToken) -// val imageUrlJson = ImageUrlJSON(imageUrl) -// makePostRequest(request, write(imageUrlJson)) -// } -// -// def updateImageUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, imageUrl : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "image_url").PUT <@(consumerAndToken) -// val imageUrlJson = ImageUrlJSON(imageUrl) -// makePutRequest(request, write(imageUrlJson)) -// } -// -// def deleteImageUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "image_url").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getOpenCorporatesUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : String = { -// getMetadataOfOneOtherBankAccount(bankId,accountId, viewId,otherBankAccountId, consumerAndToken).body.extract[OtherAccountMetadataJSON].open_corporates_URL -// } -// -// def postOpenCorporatesUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, openCorporateUrl : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "open_corporates_url").POST <@(consumerAndToken) -// val openCorporateUrlJson = OpenCorporateUrlJSON(openCorporateUrl) -// makePostRequest(request, write(openCorporateUrlJson)) -// } -// -// def updateOpenCorporatesUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, openCorporateUrl : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "open_corporates_url").PUT <@(consumerAndToken) -// val openCorporateUrlJson = OpenCorporateUrlJSON(openCorporateUrl) -// makePutRequest(request, write(openCorporateUrlJson)) -// } -// -// def deleteOpenCorporatesUrlForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "open_corporates_url").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getCorporateLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : LocationJSON = { -// getMetadataOfOneOtherBankAccount(bankId,accountId, viewId,otherBankAccountId, consumerAndToken).body.extract[OtherAccountMetadataJSON].corporate_location -// } -// -// def postCorporateLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, corporateLocation : LocationPlainJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "corporate_location").POST <@(consumerAndToken) -// val corpLocationJson = CorporateLocationJSON(corporateLocation) -// makePostRequest(request, write(corpLocationJson)) -// } -// -// def updateCorporateLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, corporateLocation : LocationPlainJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "corporate_location").PUT <@(consumerAndToken) -// val corpLocationJson = CorporateLocationJSON(corporateLocation) -// makePutRequest(request, write(corpLocationJson)) -// } -// -// def deleteCorporateLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "corporate_location").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getPhysicalLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : LocationJSON = { -// getMetadataOfOneOtherBankAccount(bankId,accountId, viewId,otherBankAccountId, consumerAndToken).body.extract[OtherAccountMetadataJSON].physical_location -// } -// -// def postPhysicalLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, physicalLocation : LocationPlainJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "physical_location").POST <@(consumerAndToken) -// val physLocationJson = PhysicalLocationJSON(physicalLocation) -// makePostRequest(request, write(physLocationJson)) -// } -// -// def updatePhysicalLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, physicalLocation : LocationPlainJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "physical_location").PUT <@(consumerAndToken) -// val physLocationJson = PhysicalLocationJSON(physicalLocation) -// makePutRequest(request, write(physLocationJson)) -// } -// -// def deletePhysicalLocationForOneOtherBankAccount(bankId : String, accountId : String, viewId : String, otherBankAccountId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "other_accounts" / otherBankAccountId / "physical_location").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getTransactions(bankId : String, accountId : String, viewId : String, consumerAndToken: Option[(Consumer, Token)], params: List[(String, String)] = Nil) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" <@(consumerAndToken) -// makeGetRequest(request, params) -// } -// -// def getTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]): APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "transaction" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def getNarrativeForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "narrative" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postNarrativeForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, narrative: String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "narrative").POST <@(consumerAndToken) -// val narrativeJson = TransactionNarrativeJSON(narrative) -// makePostRequest(request, write(narrativeJson)) -// } -// -// def updateNarrativeForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, narrative: String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "narrative").PUT <@(consumerAndToken) -// val narrativeJson = TransactionNarrativeJSON(narrative) -// makePutRequest(request, write(narrativeJson)) -// } -// -// def deleteNarrativeForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "narrative").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getCommentsForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "comments" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postCommentForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, comment: PostTransactionCommentJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "comments").POST <@(consumerAndToken) -// makePostRequest(request, write(comment)) -// } -// -// def deleteCommentForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, commentId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "comments" / commentId).DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getTagsForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "tags" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postTagForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, tag: PostTransactionTagJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "tags").POST <@(consumerAndToken) -// makePostRequest(request, write(tag)) -// } -// -// def deleteTagForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, tagId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "tags" / tagId).DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getImagesForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "images" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postImageForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, image: PostTransactionImageJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "images").POST <@(consumerAndToken) -// makePostRequest(request, write(image)) -// } -// -// def deleteImageForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, imageId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "images" / imageId).DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getWhereForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "where" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// def postWhereForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, where : LocationPlainJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "where").POST <@(consumerAndToken) -// val whereJson = PostTransactionWhereJSON(where) -// makePostRequest(request, write(whereJson)) -// } -// -// def updateWhereForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, where : LocationPlainJSON, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "where").PUT <@(consumerAndToken) -// val whereJson = PostTransactionWhereJSON(where) -// makePutRequest(request, write(whereJson)) -// } -// -// def deleteWhereForOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = (v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "metadata" / "where").DELETE <@(consumerAndToken) -// makeDeleteRequest(request) -// } -// -// def getTheOtherBankAccountOfOneTransaction(bankId : String, accountId : String, viewId : String, transactionId : String, consumerAndToken: Option[(Consumer, Token)]) : APIResponse = { -// val request = v1_2Request / "banks" / bankId / "accounts" / accountId / viewId / "transactions" / transactionId / "other_account" <@(consumerAndToken) -// makeGetRequest(request) -// } -// -// -///************************ the tests ************************/ -// feature("base line URL works"){ -// scenario("we get the api information", API1_2, APIInfo) { -// Given("We will not use an access token") -// When("the request is sent") -// val reply = getAPIInfo -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val apiInfo = reply.body.extract[APIInfoJSON] -// apiInfo.version should equal ("v1.2") -///* apiInfo.git_commit.nonEmpty should equal (true)*/ -// } -// } -// -// feature("Information about the hosted banks"){ -// scenario("we get the hosted banks information", API1_2, GetHostedBanks) { -// Given("We will not use an access token") -// When("the request is sent") -// val reply = getBanksInfo -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val banksInfo = reply.body.extract[BanksJSON] -// banksInfo.banks.foreach(b => { -// b.id.nonEmpty should equal (true) -// }) -// } -// } -// -// feature("Information about one hosted bank"){ -// scenario("we get the hosted bank information", API1_2, GetHostedBank) { -// Given("We will not use an access token") -// When("the request is sent") -// val reply = getBankInfo(randomBank) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val bankInfo = reply.body.extract[BankJSON] -// bankInfo.id.nonEmpty should equal (true) -// } -// -// scenario("we don't get the hosted bank information", API1_2, GetHostedBank) { -// Given("We will not use an access token and request a random bankId") -// When("the request is sent") -// val reply = getBankInfo(randomString(5)) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// def assertViewExistsWithCondition(accJson: AccountsJSON, cond: ViewJSON => Boolean): Unit = { -// val exists = accJson.accounts.exists(acc => acc.views_available.exists(cond)) -// exists should equal(true) -// } -// -// def assertAllAccountsHaveAViewWithCondition(accJson: AccountsJSON, cond: ViewJSON => Boolean): Unit = { -// val forAll = accJson.accounts.forall(acc => acc.views_available.exists(cond)) -// forAll should equal(true) -// } -// -// def assertAccountsFromOneBank(accJson : AccountsJSON) : Unit = { -// accJson.accounts.size should be > 0 -// val theBankId = accJson.accounts.head.bank_id -// theBankId should not be ("") -// -// accJson.accounts.foreach(acc => acc.bank_id should equal (theBankId)) -// } -// -// def assertNoDuplicateAccounts(accJson : AccountsJSON) : Unit = { -// //bankId : String, accountId: String -// type AccountIdentifier = (String, String) -// //unique accounts have unique bankId + accountId -// val accountIdentifiers : Set[AccountIdentifier] = { -// accJson.accounts.map(acc => (acc.bank_id, acc.id)).toSet -// } -// //if they are all unique, the set will contain the same number of elements as the list -// accJson.accounts.size should equal(accountIdentifiers.size) -// } -// -// feature("Information about all the bank accounts for a single bank"){ -// scenario("we get only the public bank accounts", API1_2, GetBankAccounts) { -// Given("We will not use an access token") -// When("the request is sent") -// val reply = getBankAccounts(randomBank, None) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val publicAccountsInfo = reply.body.extract[AccountsJSON] -// And("some fields should not be empty") -// publicAccountsInfo.accounts.foreach(a => { -// a.id.nonEmpty should equal (true) -// a.views_available.nonEmpty should equal (true) -// a.views_available.foreach( -// //check that all the views are public -// v => v.is_public should equal (true) -// ) -// }) -// -// And("The accounts are only from one bank") -// assertAccountsFromOneBank(publicAccountsInfo) -// -// And("There are no duplicate accounts") -// assertNoDuplicateAccounts(publicAccountsInfo) -// } -// scenario("we get the bank accounts the user have access to", API1_2, GetBankAccounts) { -// Given("We will use an access token") -// When("the request is sent") -// val reply = getBankAccounts(randomBank, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val accountsInfo = reply.body.extract[AccountsJSON] -// And("some fields should not be empty") -// accountsInfo.accounts.foreach(a => { -// a.id.nonEmpty should equal (true) -// a.views_available.nonEmpty should equal (true) -// }) -// -// //Note: this API call is technically wrong, as it was originally intended to have returned -// // public + private accounts when logged in, but actually returned only the accounts with -// // more than public access. This test therefore does not test that condition as the v1.2 API -// // call is being kept that way to avoid breaking any existing applications using it. This API -// // call is fixed in v1.2.1 -// And("Some accounts should have private views") -// assertViewExistsWithCondition(accountsInfo, !_.is_public) -// -// And("The accounts are only from one bank") -// assertAccountsFromOneBank(accountsInfo) -// -// And("There are no duplicate accounts") -// assertNoDuplicateAccounts(accountsInfo) -// } -// } -// -// feature("Information about the public bank accounts for a single bank"){ -// scenario("we get the public bank accounts", API1_2, GetPublicBankAccounts) { -// Given("We will not use an access token") -// When("the request is sent") -// val reply = getPublicAccounts(randomBank) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val publicAccountsInfo = reply.body.extract[AccountsJSON] -// And("some fields should not be empty") -// publicAccountsInfo.accounts.foreach(a => { -// a.id.nonEmpty should equal (true) -// a.views_available.nonEmpty should equal (true) -// a.views_available.foreach( -// //check that all the views are public -// v => v.is_public should equal (true) -// ) -// }) -// -// And("The accounts are only from one bank") -// assertAccountsFromOneBank(publicAccountsInfo) -// -// And("There are no duplicate accounts") -// assertNoDuplicateAccounts(publicAccountsInfo) -// } -// } -// -// feature("Information about the private bank accounts for a single bank"){ -// scenario("we get the private bank accounts", API1_2, GetPrivateBankAccounts) { -// Given("We will use an access token") -// When("the request is sent") -// val reply = getPrivateAccounts(randomBank, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// And("some fields should not be empty") -// val privateAccountsInfo = reply.body.extract[AccountsJSON] -// privateAccountsInfo.accounts.foreach(a => { -// a.id.nonEmpty should equal (true) -// a.views_available.nonEmpty should equal (true) -// }) -// -// And("All accounts should have at least one private view") -// assertAllAccountsHaveAViewWithCondition(privateAccountsInfo, !_.is_public) -// -// And("The accounts are only from one bank") -// assertAccountsFromOneBank(privateAccountsInfo) -// -// And("There are no duplicate accounts") -// assertNoDuplicateAccounts(privateAccountsInfo) -// } -// scenario("we don't get the private bank accounts", API1_2, GetPrivateBankAccounts) { -// Given("We will not use an access token") -// When("the request is sent") -// val reply = getPrivateAccounts(randomBank, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Information about a bank account"){ -// scenario("we get data without using an access token", API1_2, GetBankAccount) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPublicAccount(bankId) -// val randomPosition = nextInt(bankAccount.views_available.size) -// val view = bankAccount.views_available.toList(randomPosition) -// When("the request is sent") -// val reply = getPublicBankAccountDetails(bankId, bankAccount.id, view.id) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// And("some fields should not be empty") -// val publicAccountDetails = reply.body.extract[ModeratedAccountJSON] -// publicAccountDetails.id.nonEmpty should equal (true) -// publicAccountDetails.bank_id.nonEmpty should equal (true) -// publicAccountDetails.views_available.nonEmpty should equal (true) -// } -// -// scenario("we get data by using an access token", API1_2, GetBankAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val randomPosition = nextInt(bankAccount.views_available.size) -// val view = bankAccount.views_available.toList(randomPosition) -// When("the request is sent") -// val reply = getPrivateBankAccountDetails(bankId, bankAccount.id, view.id, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val privateAccountDetails = reply.body.extract[ModeratedAccountJSON] -// And("some fields should not be empty") -// privateAccountDetails.id.nonEmpty should equal (true) -// privateAccountDetails.bank_id.nonEmpty should equal (true) -// privateAccountDetails.views_available.nonEmpty should equal (true) -// } -// } -// -// feature("List of the views of specific bank account"){ -// scenario("We will get the list of the available views on a bank account", API1_2, GetViews) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getAccountViews(bankId, bankAccount.id, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// reply.body.extract[ViewsJSON] -// } -// -// scenario("We will not get the list of the available views on a bank account due to missing token", API1_2, GetViews) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getAccountViews(bankId, bankAccount.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("We will not get the list of the available views on a bank account due to insufficient privileges", API1_2, GetViews) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getAccountViews(bankId, bankAccount.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// feature("Create a view on a bank account"){ -// scenario("we will create a view on a bank account", API1_2, PostView) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val viewsBefore = getAccountViews(bankId, bankAccount.id, user1).body.extract[ViewsJSON].views -// val view = randomView(true, "") -// When("the request is sent") -// val reply = postView(bankId, bankAccount.id, view, user1) -// Then("we should get a 201 code") -// reply.code should equal (201) -// reply.body.extract[ViewJSON] -// And("we should get a new view") -// val viewsAfter = getAccountViews(bankId, bankAccount.id, user1).body.extract[ViewsJSON].views -// viewsBefore.size should equal (viewsAfter.size -1) -// } -// -// scenario("We will not create a view on a bank account due to missing token", API1_2, PostView) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomView(true, "") -// When("the request is sent") -// val reply = postView(bankId, bankAccount.id, view, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("We will not create a view on a bank account due to insufficient privileges", API1_2, PostView) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomView(true, "") -// When("the request is sent") -// val reply = postView(bankId, bankAccount.id, view, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("We will not create a view because the bank account does not exist", API1_2, PostView) { -// Given("We will use an access token") -// val bankId = randomBank -// val view = randomView(true, "") -// When("the request is sent") -// val reply = postView(bankId, randomString(3), view, user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("We will not create a view because the view already exists", API1_2, PostView) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomView(true, "") -// postView(bankId, bankAccount.id, view, user1) -// When("the request is sent") -// val reply = postView(bankId, bankAccount.id, view, user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Update a view on a bank account") { -// -// val updatedViewDescription = "aloha" -// val updatedAliasToUse = "public" -// val allowedActions = List("can_see_images", "can_delete_comment") -// -// def viewUpdateJson(originalView : ViewJSON) = { -// //it's not perfect, assumes too much about originalView (i.e. randomView(true, "")) -// new UpdateViewJSON( -// description = updatedViewDescription, -// is_public = !originalView.is_public, -// which_alias_to_use = updatedAliasToUse, -// hide_metadata_if_alias_used = !originalView.hide_metadata_if_alias, -// allowed_actions = allowedActions -// ) -// } -// -// def someViewUpdateJson() = { -// new UpdateViewJSON( -// description = updatedViewDescription, -// is_public = true, -// which_alias_to_use = updatedAliasToUse, -// hide_metadata_if_alias_used = true, -// allowed_actions = allowedActions -// ) -// } -// -// scenario("we will update a view on a bank account", API1_2, PutView) { -// Given("A view exists") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomView(true, "") -// val creationReply = postView(bankId, bankAccount.id, view, user1) -// creationReply.code should equal (201) -// val createdView : ViewJSON = creationReply.body.extract[ViewJSON] -// createdView.can_see_images should equal(true) -// createdView.can_delete_comment should equal(true) -// createdView.can_delete_physical_location should equal(true) -// createdView.can_edit_owner_comment should equal(true) -// createdView.description should not equal(updatedViewDescription) -// createdView.is_public should equal(true) -// createdView.hide_metadata_if_alias should equal(false) -// -// When("We use a valid access token and valid put json") -// val reply = putView(bankId, bankAccount.id, createdView.id, viewUpdateJson(createdView), user1) -// Then("We should get back the updated view") -// reply.code should equal (200) -// val updatedView = reply.body.extract[ViewJSON] -// updatedView.can_see_images should equal(true) -// updatedView.can_delete_comment should equal(true) -// updatedView.can_delete_physical_location should equal(false) -// updatedView.can_edit_owner_comment should equal(false) -// updatedView.description should equal(updatedViewDescription) -// updatedView.is_public should equal(false) -// updatedView.hide_metadata_if_alias should equal(true) -// } -// -// scenario("we will not update a view that doesn't exist", API1_2, PutView) { -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// -// Given("a view does not exist") -// val nonExistantViewId = "asdfasdfasdfasdfasdf" -// val getReply = getAccountViews(bankId, bankAccount.id, user1) -// getReply.code should equal (200) -// val views : ViewsJSON = getReply.body.extract[ViewsJSON] -// views.views.foreach(v => v.id should not equal(nonExistantViewId)) -// -// When("we try to update that view") -// val reply = putView(bankId, bankAccount.id, nonExistantViewId, someViewUpdateJson(), user1) -// Then("We should get a 404") -// reply.code should equal(404) -// } -// -// scenario("We will not update a view on a bank account due to missing token", API1_2, PutView) { -// Given("A view exists") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomView(true, "") -// val creationReply = postView(bankId, bankAccount.id, view, user1) -// creationReply.code should equal (201) -// val createdView : ViewJSON = creationReply.body.extract[ViewJSON] -// -// When("we don't use an access token") -// val reply = putView(bankId, bankAccount.id, createdView.id, viewUpdateJson(createdView), None) -// Then("we should get a 400") -// reply.code should equal(400) -// -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update a view on a bank account due to insufficient privileges", API1_2, PutView) { -// Given("A view exists") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomView(true, "") -// val creationReply = postView(bankId, bankAccount.id, view, user1) -// creationReply.code should equal (201) -// val createdView : ViewJSON = creationReply.body.extract[ViewJSON] -// -// When("we try to update a view without having sufficient privileges to do so") -// val reply = putView(bankId, bankAccount.id, createdView.id, viewUpdateJson(createdView), user3) -// Then("we should get a 400") -// reply.code should equal(400) -// -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// //TODO: no get view call? just get views? -// -// feature("Delete a view on a bank account"){ -// scenario("we will delete a view on a bank account", API1_2, DeleteView) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = postView(bankId, bankAccount.id, randomView(true, ""), user1).body.extract[ViewJSON] -// val viewsBefore = getAccountViews(bankId, bankAccount.id, user1).body.extract[ViewsJSON].views -// When("the request is sent") -// val reply = deleteView(bankId, bankAccount.id, view.id, user1) -// Then("we should get a 204 code") -// reply.code should equal (204) -// And("the views should be updated") -// val viewsAfter = getAccountViews(bankId, bankAccount.id, user1).body.extract[ViewsJSON].views -// viewsBefore.size should equal (viewsAfter.size +1) -// } -// -// scenario("We will not delete a view on a bank account due to missing token", API1_2, DeleteView) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = deleteView(bankId, bankAccount.id, view, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("We will not delete a view on a bank account due to insufficient privileges", API1_2, DeleteView) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = deleteView(bankId, bankAccount.id, view, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("We will not delete a view on a bank account because it does not exist", API1_2, PostView) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = deleteView(bankId, bankAccount.id, randomString(3), user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Information about the permissions of a specific bank account"){ -// scenario("we will get one bank account permissions by using an access token", API1_2, GetPermissions) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getAccountPermissions(bankId, bankAccount.id, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// reply.body.extract[PermissionsJSON] -// -// val permissions = reply.body.extract[PermissionsJSON] -// -// def stringNotEmpty(s : String) { -// s should not equal null -// s should not equal "" -// } -// -// for { -// permission <- permissions.permissions -// } { -// val user = permission.user -// -// //TODO: Need to come up with a better way to check that information is not missing -// // idea: reflection on all the json case classes, marking "required" information with annotations -// stringNotEmpty(user.id) -// stringNotEmpty(user.provider) -// -// for { -// view <- permission.views -// } { -// stringNotEmpty(view.id) -// } -// } -// } -// -// scenario("we will not get one bank account permissions", API1_2, GetPermissions) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getAccountPermissions(bankId, bankAccount.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get one bank account permissions by using an other access token", API1_2, GetPermissions) { -// Given("We will use an access token, but that does not grant owner view") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getAccountPermissions(bankId, bankAccount.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Information about the permissions of a specific user on a specific bank account"){ -// scenario("we will get the permissions by using an access token", API1_2, GetPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val permission = randomAccountPermission(bankId, bankAccount.id) -// val userID = permission.user.id -// When("the request is sent") -// val reply = getUserAccountPermission(bankId, bankAccount.id, userID, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val viewsInfo = reply.body.extract[ViewsJSON] -// And("some fields should not be empty") -// viewsInfo.views.foreach(v => v.id.nonEmpty should equal (true)) -// } -// -// scenario("we will not get the permissions of a specific user", API1_2, GetPermission) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val permission = randomAccountPermission(bankId, bankAccount.id) -// val userID = permission.user.id -// When("the request is sent") -// val reply = getUserAccountPermission(bankId, bankAccount.id, userID, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the permissions of a random user", API1_2, GetPermission) { -// Given("We will use an access token with random user id") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getUserAccountPermission(bankId, bankAccount.id, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Grant a user access to a view on a bank account"){ -// scenario("we will grant a user access to a view on an bank account", API1_2, PostPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val userId = resourceUser2.idGivenByProvider -// val reply = grantUserAccessToView(bankId, bankAccount.id, userId, randomViewPermalink(bankId, bankAccount), user1) -// Then("we should get a 201 ok code") -// reply.code should equal (201) -// val viewInfo = reply.body.extract[ViewJSON] -// And("some fields should not be empty") -// viewInfo.id.nonEmpty should equal (true) -// } -// -// scenario("we cannot grant a user access to a view on an bank account because the user does not exist", API1_2, PostPermission) { -// Given("We will use an access token with a random user Id") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = grantUserAccessToView(bankId, bankAccount.id, randomString(5), randomViewPermalink(bankId, bankAccount), user1) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we cannot grant a user access to a view on an bank account because the view does not exist", API1_2, PostPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser2.idGivenByProvider -// When("the request is sent") -// val reply = grantUserAccessToView(bankId, bankAccount.id, userId, randomString(5), user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we cannot grant a user access to a view on an bank account because the user does not have owner view access", API1_2, PostPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser2.idGivenByProvider -// When("the request is sent") -// val reply = grantUserAccessToView(bankId, bankAccount.id, userId, randomViewPermalink(bankId, bankAccount), user3) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Grant a user access to a list of views on a bank account"){ -// scenario("we will grant a user access to a list of views on an bank account", API1_2, PostPermissions) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser3.idGivenByProvider -// val viewsIdsToGrant = randomViewsIdsToGrant(bankId, bankAccount.id) -// When("the request is sent") -// val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// Then("we should get a 201 ok code") -// reply.code should equal (201) -// val viewsInfo = reply.body.extract[ViewsJSON] -// And("some fields should not be empty") -// viewsInfo.views.foreach(v => v.id.nonEmpty should equal (true)) -// And("the granted views should be the same") -// viewsIdsToGrant.toSet should equal(viewsInfo.views.map(_.id).toSet) -// //we revoke access to the granted views for the next tests -// revokeUserAccessToAllViews(bankId, bankAccount.id, userId, user1) -// } -// -// scenario("we cannot grant a user access to a list of views on an bank account because the user does not exist", API1_2, PostPermissions) { -// Given("We will use an access token with a random user Id") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = randomString(5) -// val viewsIdsToGrant= randomViewsIdsToGrant(bankId, bankAccount.id) -// When("the request is sent") -// val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we cannot grant a user access to a list of views on an bank account because they don't exist", API1_2, PostPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser3.idGivenByProvider -// val viewsIdsToGrant= List(randomString(3),randomString(3)) -// When("the request is sent") -// val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we cannot grant a user access to a list of views on an bank account because some views don't exist", API1_2, PostPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser3.idGivenByProvider -// val viewsIdsToGrant= randomViewsIdsToGrant(bankId, bankAccount.id) ++ List(randomString(3),randomString(3)) -// When("the request is sent") -// val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we cannot grant a user access to a list of views on an bank account because the user does not have owner view access", API1_2, PostPermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser3.idGivenByProvider -// val viewsIdsToGrant= randomViewsIdsToGrant(bankId, bankAccount.id) ++ List(randomString(3),randomString(3)) -// When("the request is sent") -// val reply = grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user3) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("Revoke a user access to a view on a bank account"){ -// scenario("we will revoke the access of a user to a view different from owner on an bank account", API1_2, DeletePermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser2.idGivenByProvider -// val viewId = randomViewPermalinkButNotOwner(bankId, bankAccount) -// val viewsIdsToGrant = viewId :: Nil -// grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSON].views.length -// When("the request is sent") -// val reply = revokeUserAccessToView(bankId, bankAccount.id, userId, viewId, user1) -// Then("we should get a 204 no content code") -// reply.code should equal (204) -// val viewsAfter = getUserAccountPermission(bankId, bankAccount.id, userId, user1).body.extract[ViewsJSON].views.length -// viewsAfter should equal(viewsBefore -1) -// } -// -// scenario("we will revoke the access of a user to owner view on an bank account if there is more than one user", API1_2, DeletePermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val viewId = Constant.SYSTEM_OWNER_VIEW_ID -// val userId1 = resourceUser2.idGivenByProvider -// val userId2 = resourceUser2.idGivenByProvider -// grantUserAccessToView(bankId, bankAccount.id, userId1, viewId, user1) -// grantUserAccessToView(bankId, bankAccount.id, userId2, viewId, user1) -// val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId1, user1).body.extract[ViewsJSON].views.length -// When("the request is sent") -// val reply = revokeUserAccessToView(bankId, bankAccount.id, userId1, viewId, user1) -// Then("we should get a 204 no content code") -// reply.code should equal (204) -// val viewsAfter = getUserAccountPermission(bankId, bankAccount.id, userId1, user1).body.extract[ViewsJSON].views.length -// viewsAfter should equal(viewsBefore -1) -// } -// -// scenario("we cannot revoke the access of a user to owner view on an bank account if there is only one user", API1_2, DeletePermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val viewId = ViewId(Constant.SYSTEM_OWNER_VIEW_ID) -// val view = Views.views.vend.view(BankIdAccountIdViewId(BankId(bankId), AccountId(bankAccount.id), viewId)).get -// if(Views.views.vend.getOwners(view).toList.length == 0){ -// val userId = resourceUser2.idGivenByProvider -// grantUserAccessToView(bankId, bankAccount.id, userId, viewId.value, user1) -// } -// while(Views.views.vend.getOwners(view).toList.length > 1){ -// revokeUserAccessToView(bankId, bankAccount.id, Views.views.vend.getOwners(view).toList(0).idGivenByProvider, viewId.value, user1) -// } -// val viewUsersBefore = Views.views.vend.getOwners(view).toList -// When("the request is sent") -// val reply = revokeUserAccessToView(bankId, bankAccount.id, viewUsersBefore(0).idGivenByProvider, viewId.value, user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// val viewUsersAfter = Views.views.vend.getOwners(view).toList -// viewUsersAfter.length should equal(viewUsersBefore.length) -// } -// -// scenario("we cannot revoke the access to a user that does not exist", API1_2, DeletePermission) { -// Given("We will use an access token with a random user Id") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = revokeUserAccessToView(bankId, bankAccount.id, randomString(5), randomViewPermalink(bankId, bankAccount), user1) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// } -// -// scenario("we cannot revoke a user access to a view on an bank account because the view does not exist", API1_2, DeletePermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId =resourceUser2.idGivenByProvider -// When("the request is sent") -// val reply = revokeUserAccessToView(bankId, bankAccount.id, userId, randomString(5), user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// } -// -// scenario("we cannot revoke a user access to a view on an bank account because the user does not have owner view access", API1_2, DeletePermission) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser2.idGivenByProvider -// When("the request is sent") -// val reply = revokeUserAccessToView(bankId, bankAccount.id, userId, randomViewPermalink(bankId, bankAccount), user3) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// } -// } -// -// feature("Revoke a user access to all the views on a bank account"){ -// scenario("we will revoke the access of a user to all the views on an bank account", API1_2, DeletePermissions) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser2.idGivenByProvider -// val viewId = randomViewPermalink(bankId, bankAccount) -// val viewsIdsToGrant = viewId :: Nil -// grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// When("the request is sent") -// val reply = revokeUserAccessToAllViews(bankId, bankAccount.id, userId, user1) -// Then("we should get a 204 no content code") -// reply.code should equal (204) -// } -// scenario("we cannot revoke the access to a user that does not exist", API1_2, DeletePermissions) { -// Given("We will use an access token with a random user Id") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = revokeUserAccessToAllViews(bankId, bankAccount.id, randomString(5), user1) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// } -// -// scenario("we cannot revoke a user access to a view on an bank account because the user does not have owner view access", API1_2, DeletePermissions) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val userId = resourceUser2.idGivenByProvider -// val viewId = randomViewPermalink(bankId, bankAccount) -// val viewsIdsToGrant = viewId :: Nil -// grantUserAccessToViews(bankId, bankAccount.id, userId, viewsIdsToGrant, user1) -// When("the request is sent") -// val reply = revokeUserAccessToAllViews(bankId, bankAccount.id, userId, user3) -// Then("we should get a 400 ok code") -// reply.code should equal (400) -// } -// } -// -// feature("We get the list of the other bank accounts linked with a bank account"){ -// scenario("we will get the other bank accounts of a bank account", API1_2, GetOtherBankAccounts) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getTheOtherBankAccounts(bankId, bankAccount.id, randomViewPermalink(bankId, bankAccount), user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// val accountsJson = reply.body.extract[OtherAccountsJSON] -// And("some fields should not be empty") -// accountsJson.other_accounts.foreach( a => -// a.id.nonEmpty should equal (true) -// ) -// } -// -// scenario("we will not get the other bank accounts of a bank account due to missing access token", API1_2, GetOtherBankAccounts) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getTheOtherBankAccounts(bankId, bankAccount.id, randomViewPermalink(bankId, bankAccount), None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the other bank accounts of a bank account because the user does not have enough privileges", API1_2, GetOtherBankAccounts) { -// Given("We will use an access token ") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getTheOtherBankAccounts(bankId, bankAccount.id, randomViewPermalink(bankId, bankAccount), user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the other bank accounts of a bank account because the view does not exist", API1_2, GetOtherBankAccounts) { -// Given("We will use an access token ") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// When("the request is sent") -// val reply = getTheOtherBankAccounts(bankId, bankAccount.id, randomString(5), user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We get one specific other bank account among the other accounts "){ -// scenario("we will get one random other bank account of a bank account", API1_2, GetOtherBankAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// val accountJson = reply.body.extract[OtherAccountJSON] -// And("some fields should not be empty") -// accountJson.id.nonEmpty should equal (true) -// } -// -// scenario("we will not get one random other bank account of a bank account due to a missing token", API1_2, GetOtherBankAccount) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get one random other bank account of a bank account because the user does not have enough privileges", API1_2, GetOtherBankAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get one random other bank account of a bank account because the view does not exist", API1_2, GetOtherBankAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, randomViewPermalink(bankId, bankAccount)) -// When("the request is sent") -// val reply = getTheOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get one random other bank account of a bank account because the account does not exist", API1_2, GetOtherBankAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getTheOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We get the metadata of one specific other bank account among the other accounts"){ -// scenario("we will get the metadata of one random other bank account", API1_2, GetOtherBankAccountMetadata) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getMetadataOfOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("some fields should not be empty") -// reply.body.extract[OtherAccountMetadataJSON] -// } -// -// scenario("we will not get the metadata of one random other bank account due to a missing token", API1_2, GetOtherBankAccountMetadata) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getMetadataOfOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the metadata of one random other bank account because the user does not have enough privileges", API1_2, GetOtherBankAccountMetadata) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getMetadataOfOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the metadata of one random other bank account because the view does not exist", API1_2, GetOtherBankAccountMetadata) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getMetadataOfOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the metadata of one random other bank account because the account does not exist", API1_2, GetOtherBankAccountMetadata) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getMetadataOfOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We get the public alias of one specific other bank account among the other accounts "){ -// scenario("we will get the public alias of one random other bank account", API1_2, GetPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// reply.body.extract[AliasJSON] -// } -// -// scenario("we will not get the public alias of one random other bank account due to a missing token", API1_2, GetPublicAlias) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the public alias of one random other bank account because the user does not have enough privileges", API1_2, GetPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the public alias of one random other bank account because the view does not exist", API1_2, GetPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the public alias of one random other bank account because the account does not exist", API1_2, GetPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post a public alias for one specific other bank"){ -// scenario("we will post a public alias for one random other bank account", API1_2, PostPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomAlias = randomString(5) -// val postReply = postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the alias should be changed") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a public alias for a random other bank account due to a missing token", API1_2, PostPublicAlias) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a public alias for a random other bank account because the user does not have enough privileges", API1_2, PostPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a public alias for a random other bank account because the view does not exist", API1_2, PostPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomAlias, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a public alias for a random other bank account because the account does not exist", API1_2, PostPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomAlias, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the public alias for one specific other bank"){ -// scenario("we will update the public alias for one random other bank account", API1_2, PutPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomAlias = randomString(5) -// val putReply = updateThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the alias should be changed") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not update the public alias for a random other bank account due to a missing token", API1_2, PutPublicAlias) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val putReply = updateThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not update the public alias for a random other bank account because the user does not have enough privileges", API1_2, PutPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val putReply = updateThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the public alias for a random other bank account because the account does not exist", API1_2, PutPublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomAlias = randomString(5) -// When("the request is sent") -// val putReply = updateThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomAlias, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the public alias for one specific other bank"){ -// scenario("we will delete the public alias for one random other bank account", API1_2, DeletePublicAlias) { -// Given("We will use an access token and will set an alias first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// When("the delete request is sent") -// val deleteReply = deleteThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the public alias should be null") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterTheDelete : AliasJSON = getReply.body.extract[AliasJSON] -// theAliasAfterTheDelete.alias should equal (null) -// } -// scenario("we will not delete the public alias for a random other bank account due to a missing token", API1_2, DeletePublicAlias) { -// Given("We will not use an access token and will set an alias first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// When("the delete request is sent") -// val deleteReply = deleteThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the public alias should not be null") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterTheDelete : AliasJSON = getReply.body.extract[AliasJSON] -// theAliasAfterTheDelete.alias should not equal (null) -// } -// scenario("we will not delete the public alias for a random other bank account because the user does not have enough privileges", API1_2, DeletePublicAlias) { -// Given("We will use an access token and will set an alias first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// postAPublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// When("the delete request is sent") -// val deleteReply = deleteThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the public alias should not be null") -// val getReply = getThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterTheDelete : AliasJSON = getReply.body.extract[AliasJSON] -// theAliasAfterTheDelete.alias should not equal (null) -// } -// scenario("we will not delete the public alias for a random other bank account because the account does not exist", API1_2, DeletePublicAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomAlias = randomString(5) -// When("the delete request is sent") -// val deleteReply = deleteThePublicAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We get the private alias of one specific other bank account among the other accounts "){ -// scenario("we will get the private alias of one random other bank account", API1_2, GetPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// reply.body.extract[AliasJSON] -// } -// -// scenario("we will not get the private alias of one random other bank account due to a missing token", API1_2, GetPrivateAlias) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the private alias of one random other bank account because the user does not have enough privileges", API1_2, GetPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the private alias of one random other bank account because the view does not exist", API1_2, GetPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the private alias of one random other bank account because the account does not exist", API1_2, GetPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// -// When("the request is sent") -// val reply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post a private alias for one specific other bank"){ -// scenario("we will post a private alias for one random other bank account", API1_2, PostPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomAlias = randomString(5) -// val postReply = postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the alias should be changed") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a private alias for a random other bank account due to a missing token", API1_2, PostPrivateAlias) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a private alias for a random other bank account because the user does not have enough privileges", API1_2, PostPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a private alias for a random other bank account because the view does not exist", API1_2, PostPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomAlias, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not post a private alias for a random other bank account because the account does not exist", API1_2, PostPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomAlias = randomString(5) -// When("the request is sent") -// val postReply = postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomAlias, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the private alias for one specific other bank"){ -// scenario("we will update the private alias for one random other bank account", API1_2, PutPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomAlias = randomString(5) -// val putReply = updateThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the alias should be changed") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not update the private alias for a random other bank account due to a missing token", API1_2, PutPrivateAlias) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val putReply = updateThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the alias should not be changed") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterThePost : AliasJSON = getReply.body.extract[AliasJSON] -// randomAlias should not equal (theAliasAfterThePost.alias) -// } -// -// scenario("we will not update the private alias for a random other bank account because the user does not have enough privileges", API1_2, PutPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// When("the request is sent") -// val putReply = updateThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the private alias for a random other bank account because the account does not exist", API1_2, PutPrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomAlias = randomString(5) -// When("the request is sent") -// val putReply = updateThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomAlias, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the private alias for one specific other bank"){ -// scenario("we will delete the private alias for one random other bank account", API1_2, DeletePrivateAlias) { -// Given("We will use an access token and will set an alias first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// When("the delete request is sent") -// val deleteReply = deleteThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the Private alias should be null") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterTheDelete : AliasJSON = getReply.body.extract[AliasJSON] -// theAliasAfterTheDelete.alias should equal (null) -// } -// scenario("we will not delete the private alias for a random other bank account due to a missing token", API1_2, DeletePrivateAlias) { -// Given("We will not use an access token and will set an alias first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// When("the delete request is sent") -// val deleteReply = deleteThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the Private alias should not be null") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterTheDelete : AliasJSON = getReply.body.extract[AliasJSON] -// theAliasAfterTheDelete.alias should not equal (null) -// } -// scenario("we will not delete the private alias for a random other bank account because the user does not have enough privileges", API1_2, DeletePrivateAlias) { -// Given("We will use an access token and will set an alias first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomAlias = randomString(5) -// postAPrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomAlias, user1) -// When("the delete request is sent") -// val deleteReply = deleteThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the Private alias should not be null") -// val getReply = getThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// val theAliasAfterTheDelete : AliasJSON = getReply.body.extract[AliasJSON] -// theAliasAfterTheDelete.alias should not equal (null) -// } -// scenario("we will not delete the private alias for a random other bank account because the account does not exist", API1_2, DeletePrivateAlias) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomAlias = randomString(5) -// When("the delete request is sent") -// val deleteReply = deleteThePrivateAliasForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We post more information for one specific other bank"){ -// scenario("we will post more information for one random other bank account", API1_2, PostMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomInfo = randomString(20) -// val postReply = postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the information should be changed") -// val moreInfo = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomInfo should equal (moreInfo) -// } -// -// scenario("we will not post more information for a random other bank account due to a missing token", API1_2, PostMoreInfo) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// When("the request is sent") -// val postReply = postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the information should not be changed") -// val moreInfo = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomInfo should not equal (moreInfo) -// } -// -// scenario("we will not post more information for a random other bank account because the user does not have enough privileges", API1_2, PostMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// When("the request is sent") -// val postReply = postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the information should not be changed") -// val moreInfo = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomInfo should not equal (moreInfo) -// } -// -// scenario("we will not post more information for a random other bank account because the view does not exist", API1_2, PostMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// When("the request is sent") -// val postReply = postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomInfo, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the information should not be changed") -// val moreInfo = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomInfo should not equal (moreInfo) -// } -// -// scenario("we will not post more information for a random other bank account because the account does not exist", API1_2, PostMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomInfo = randomString(20) -// When("the request is sent") -// val postReply = postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomInfo, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the information for one specific other bank"){ -// scenario("we will update the information for one random other bank account", API1_2, PutMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomInfo = randomString(20) -// val putReply = updateMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the information should be changed") -// val moreInfo = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomInfo should equal (moreInfo) -// } -// -// scenario("we will not update the information for a random other bank account due to a missing token", API1_2, PutMoreInfo) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// When("the request is sent") -// val putReply = updateMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the information should not be changed") -// val moreInfo = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomInfo should not equal (moreInfo) -// } -// -// scenario("we will not update the information for a random other bank account because the user does not have enough privileges", API1_2, PutMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// When("the request is sent") -// val putReply = updateMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the information for a random other bank account because the account does not exist", API1_2, PutMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomInfo = randomString(20) -// When("the request is sent") -// val putReply = updateMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomInfo, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the information for one specific other bank"){ -// scenario("we will delete the information for one random other bank account", API1_2, DeleteMoreInfo) { -// Given("We will use an access token and will set an info first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user1) -// When("the delete request is sent") -// val deleteReply = deleteMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the info should be null") -// val infoAfterDelete = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// infoAfterDelete should equal (null) -// } -// -// scenario("we will not delete the information for a random other bank account due to a missing token", API1_2, DeleteMoreInfo) { -// Given("We will not use an access token and will set an info first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user1) -// When("the delete request is sent") -// val deleteReply = deleteMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the info should not be null") -// val infoAfterDelete = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// infoAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the information for a random other bank account because the user does not have enough privileges", API1_2, DeleteMoreInfo) { -// Given("We will use an access token and will set an info first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomInfo = randomString(20) -// postMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomInfo, user1) -// When("the delete request is sent") -// val deleteReply = deleteMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the info should not be null") -// val infoAfterDelete = getMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// infoAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the information for a random other bank account because the account does not exist", API1_2, DeleteMoreInfo) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomInfo = randomString(20) -// When("the delete request is sent") -// val deleteReply = deleteMoreInfoForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We post the url for one specific other bank"){ -// scenario("we will post the url for one random other bank account", API1_2, PostURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomURL = randomString(20) -// val postReply = postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the url should be changed") -// val url = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should equal (url) -// } -// -// scenario("we will not post the url for a random other bank account due to a missing token", API1_2, PostURL) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the url should not be changed") -// val url = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not post the url for a random other bank account because the user does not have enough privileges", API1_2, PostURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the url should not be changed") -// val url = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not post the url for a random other bank account because the view does not exist", API1_2, PostURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postUrlForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomURL, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the url should not be changed") -// val url = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not post the url for a random other bank account because the account does not exist", API1_2, PostURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomURL, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the url for one specific other bank"){ -// scenario("we will update the url for one random other bank account", API1_2, PutURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomURL = randomString(20) -// val putReply = updateUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the url should be changed") -// val url = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should equal (url) -// } -// -// scenario("we will not update the url for a random other bank account due to a missing token", API1_2, PutURL) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val putReply = updateUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the url should not be changed") -// val url = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not update the url for a random other bank account because the user does not have enough privileges", API1_2, PutURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val putReply = updateUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the url for a random other bank account because the account does not exist", API1_2, PutURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomURL = randomString(20) -// When("the request is sent") -// val putReply = updateUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomURL, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the url for one specific other bank"){ -// scenario("we will delete the url for one random other bank account", API1_2, DeleteURL) { -// Given("We will use an access token and will set an open corporates url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the url should be null") -// val urlAfterDelete = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should equal (null) -// } -// -// scenario("we will not delete the url for a random other bank account due to a missing token", API1_2, DeleteURL) { -// Given("We will not use an access token and will set an open corporates url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the url should not be null") -// val urlAfterDelete = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the url for a random other bank account because the user does not have enough privileges", API1_2, DeleteURL) { -// Given("We will use an access token and will set an open corporates url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// postUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the url should not be null") -// val urlAfterDelete = getUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the url for a random other bank account because the account does not exist", API1_2, DeleteURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomURL = randomString(20) -// When("the delete request is sent") -// val deleteReply = deleteUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We post the image url for one specific other bank"){ -// scenario("we will post the image url for one random other bank account", API1_2, PostImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomImageURL = randomString(20) -// val postReply = postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the image url should be changed") -// val url = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomImageURL should equal (url) -// } -// -// scenario("we will not post the image url for a random other bank account due to a missing token", API1_2, PostImageURL) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val postReply = postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image url should not be changed") -// val url = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomImageURL should not equal (url) -// } -// -// scenario("we will not post the image url for a random other bank account because the user does not have enough privileges", API1_2, PostImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val postReply = postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image url should not be changed") -// val url = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomImageURL should not equal (url) -// } -// -// scenario("we will not post the image url for a random other bank account because the view does not exist", API1_2, PostImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val postReply = postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomImageURL, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image url should not be changed") -// val url = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomImageURL should not equal (url) -// } -// -// scenario("we will not post the image url for a random other bank account because the account does not exist", API1_2, PostImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val postReply = postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomImageURL, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the image url for one specific other bank"){ -// scenario("we will update the image url for one random other bank account", API1_2, PutImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomImageURL = randomString(20) -// val putReply = updateImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the image url should be changed") -// val url = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomImageURL should equal (url) -// } -// -// scenario("we will not update the image url for a random other bank account due to a missing token", API1_2, PutImageURL) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val putReply = updateImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image url should not be changed") -// val url = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomImageURL should not equal (url) -// } -// -// scenario("we will not update the image url for a random other bank account because the user does not have enough privileges", API1_2, PutImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val putReply = updateImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the image url for a random other bank account because the account does not exist", API1_2, PutImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomImageURL = randomString(20) -// When("the request is sent") -// val putReply = updateImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomImageURL, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the image url for one specific other bank"){ -// scenario("we will delete the image url for one random other bank account", API1_2, DeleteImageURL) { -// Given("We will use an access token and will set a url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the image url should be null") -// val urlAfterDelete = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should equal (null) -// } -// -// scenario("we will not delete the image url for a random other bank account due to a missing token", API1_2, DeleteImageURL) { -// Given("We will not use an access token and will set a url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the image url should not be null") -// val urlAfterDelete = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the image url for a random other bank account because the user does not have enough privileges", API1_2, DeleteImageURL) { -// Given("We will use an access token and will set a url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomImageURL = randomString(20) -// postImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomImageURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the image url should not be null") -// val urlAfterDelete = getImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the image url for a random other bank account because the account does not exist", API1_2, DeleteImageURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomImageURL = randomString(20) -// When("the delete request is sent") -// val deleteReply = deleteImageUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We post the open corporates url for one specific other bank"){ -// scenario("we will post the open corporates url for one random other bank account", API1_2, PostOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomURL = randomString(20) -// val postReply = postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the open corporates url should be changed") -// val url = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should equal (url) -// } -// -// scenario("we will not post the open corporates url for a random other bank account due to a missing token", API1_2, PostOpenCorporatesURL) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the open corporates url should not be changed") -// val url = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not post the open corporates url for a random other bank account because the user does not have enough privileges", API1_2, PostOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the open corporates url should not be changed") -// val url = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not post the open corporates url for a random other bank account because the view does not exist", API1_2, PostOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomURL, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the open corporates url should not be changed") -// val url = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not post the open corporates url for a random other bank account because the account does not exist", API1_2, PostOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomURL = randomString(20) -// When("the request is sent") -// val postReply = postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomURL, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the open corporates url for one specific other bank"){ -// scenario("we will update the open corporates url for one random other bank account", API1_2, PutOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomURL = randomString(20) -// val putReply = updateOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the open corporates url should be changed") -// val url = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should equal (url) -// } -// -// scenario("we will not update the open corporates url for a random other bank account due to a missing token", API1_2, PutOpenCorporatesURL) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val putReply = updateOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the open corporates url should not be changed") -// val url = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomURL should not equal (url) -// } -// -// scenario("we will not update the open corporates url for a random other bank account because the user does not have enough privileges", API1_2, PutOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// When("the request is sent") -// val putReply = updateOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the open corporates url for a random other bank account because the account does not exist", API1_2, PutOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomURL = randomString(20) -// When("the request is sent") -// val putReply = updateOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomURL, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the open corporates url for one specific other bank"){ -// scenario("we will delete the open corporates url for one random other bank account", API1_2, DeleteOpenCorporatesURL) { -// Given("We will use an access token and will set an open corporates url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the open corporates url should be null") -// val urlAfterDelete = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should equal (null) -// } -// -// scenario("we will not delete the open corporates url for a random other bank account due to a missing token", API1_2, DeleteOpenCorporatesURL) { -// Given("We will not use an access token and will set an open corporates url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the open corporates url should not be null") -// val urlAfterDelete = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the open corporates url for a random other bank account because the user does not have enough privileges", API1_2, DeleteOpenCorporatesURL) { -// Given("We will use an access token and will set an open corporates url first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomURL = randomString(20) -// postOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomURL, user1) -// When("the delete request is sent") -// val deleteReply = deleteOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the open corporates url should not be null") -// val urlAfterDelete = getOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// urlAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the open corporates url for a random other bank account because the account does not exist", API1_2, DeleteOpenCorporatesURL) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomURL = randomString(20) -// When("the delete request is sent") -// val deleteReply = deleteOpenCorporatesUrlForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We post the corporate location for one specific other bank"){ -// scenario("we will post the corporate location for one random other bank account", API1_2, PostCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the corporate location should be changed") -// val location = getCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomLoc.latitude should equal (location.latitude) -// randomLoc.longitude should equal (location.longitude) -// } -// -// scenario("we will not post the corporate location for a random other bank account due to a missing token", API1_2, PostCorporateLocation) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the corporate location for one random other bank account because the coordinates don't exist", API1_2, PostCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// var randomLoc = JSONFactory.createLocationPlainJSON(400,200) -// When("the request is sent") -// val postReply = postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the corporate location for a random other bank account because the user does not have enough privileges", API1_2, PostCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the corporate location for a random other bank account because the view does not exist", API1_2, PostCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomLoc, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the corporate location for a random other bank account because the account does not exist", API1_2, PostCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomLoc, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the corporate location for one specific other bank"){ -// scenario("we will update the corporate location for one random other bank account", API1_2, PutCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomLoc = randomLocation -// val putReply = updateCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the corporate location should be changed") -// val location = getCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomLoc.latitude should equal (location.latitude) -// randomLoc.longitude should equal (location.longitude) -// } -// -// scenario("we will not update the corporate location for one random other bank account because the coordinates don't exist", API1_2, PutCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// var randomLoc = JSONFactory.createLocationPlainJSON(400,200) -// When("the request is sent") -// val putReply = updateCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the corporate location for a random other bank account due to a missing token", API1_2, PutCorporateLocation) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updateCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the corporate location for a random other bank account because the user does not have enough privileges", API1_2, PutCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updateCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the corporate location for a random other bank account because the account does not exist", API1_2, PutCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updateCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomLoc, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the corporate location for one specific other bank"){ -// scenario("we will delete the corporate location for one random other bank account", API1_2, DeleteCorporateLocation) { -// Given("We will use an access token and will set a corporate location first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the corporate location should be null") -// val locationAfterDelete = getCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// locationAfterDelete should equal (null) -// } -// -// scenario("we will not delete the corporate location for a random other bank account due to a missing token", API1_2, DeleteCorporateLocation) { -// Given("We will not use an access token and will set a corporate location first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the corporate location should not be null") -// val locationAfterDelete = getCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// locationAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the corporate location for a random other bank account because the user does not have enough privileges", API1_2, DeleteCorporateLocation) { -// Given("We will use an access token and will set a corporate location first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the corporate location should not be null") -// val locationAfterDelete = getCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// locationAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the corporate location for a random other bank account because the account does not exist", API1_2, DeleteCorporateLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the delete request is sent") -// val deleteReply = deleteCorporateLocationForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We post the physical location for one specific other bank"){ -// scenario("we will post the physical location for one random other bank account", API1_2, PostPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the physical location should be changed") -// val location = getPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomLoc.latitude should equal (location.latitude) -// randomLoc.longitude should equal (location.longitude) -// } -// -// scenario("we will not post the physical location for one random other bank account because the coordinates don't exist", API1_2, PostPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// var randomLoc = JSONFactory.createLocationPlainJSON(400,200) -// When("the request is sent") -// val postReply = postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the physical location for a random other bank account due to a missing token", API1_2, PostPhysicalLocation) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the physical location for a random other bank account because the user does not have enough privileges", API1_2, PostPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the physical location for a random other bank account because the view does not exist", API1_2, PostPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, randomString(5), otherBankAccount.id, randomLoc, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the physical location for a random other bank account because the account does not exist", API1_2, PostPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomLoc, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the physical location for one specific other bank"){ -// scenario("we will update the physical location for one random other bank account", API1_2, PutPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomLoc = randomLocation -// val putReply = updatePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the physical location should be changed") -// val location = getPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// randomLoc.latitude should equal (location.latitude) -// randomLoc.longitude should equal (location.longitude) -// } -// -// scenario("we will not update the physical location for one random other bank account because the coordinates don't exist", API1_2, PutPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// var randomLoc = JSONFactory.createLocationPlainJSON(400,200) -// When("the request is sent") -// val putReply = updatePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the physical location for a random other bank account due to a missing token", API1_2, PutPhysicalLocation) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updatePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the physical location for a random other bank account because the user does not have enough privileges", API1_2, PutPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updatePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the physical location for a random other bank account because the account does not exist", API1_2, PutPhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updatePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), randomLoc, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the physical location for one specific other bank"){ -// scenario("we will delete the physical location for one random other bank account", API1_2, DeletePhysicalLocation) { -// Given("We will use an access token and will set a physical location first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deletePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the physical location should be null") -// val locationAfterDelete = getPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// locationAfterDelete should equal (null) -// } -// -// scenario("we will not delete the physical location for a random other bank account due to a missing token", API1_2, DeletePhysicalLocation) { -// Given("We will not use an access token and will set a physical location first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deletePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the physical location should not be null") -// val locationAfterDelete = getPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// locationAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the physical location for a random other bank account because the user does not have enough privileges", API1_2, DeletePhysicalLocation) { -// Given("We will use an access token and will set a physical location first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val otherBankAccount = randomOtherBankAccount(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deletePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the physical location should not be null") -// val locationAfterDelete = getPhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, otherBankAccount.id, user1) -// locationAfterDelete should not equal (null) -// } -// -// scenario("we will not delete the physical location for a random other bank account because the account does not exist", API1_2, DeletePhysicalLocation) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the delete request is sent") -// val deleteReply = deletePhysicalLocationForOneOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("Information about all the transaction"){ -// scenario("we get all the transactions of one random (private) bank account", API1_2, GetTransactions) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getTransactions(bankId,bankAccount.id,view, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions array should not be empty") -// transactions.transactions.size should not equal (0) -// -// } -// -// scenario("we do not get transactions of one random bank account, because the account doesn't exist", API1_2, GetTransactions) { -// Given("We will use an access token") -// When("the request is sent") -// val bankId = randomBank -// val reply = getTransactions(bankId,randomString(5),randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// -// scenario("we do not get transactions of one random bank account, because the view doesn't exist", API1_2, GetTransactions) { -// Given("We will use an access token") -// When("the request is sent") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val reply = getTransactions(bankId,bankAccount.id,randomString(5), user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// } -// } -// -// feature("transactions with params"){ -// import java.text.SimpleDateFormat -// import java.util.Calendar -// val defaultFormat = APIUtil.DateWithMsFormat -// val rollbackFormat = APIUtil.DateWithMsRollbackFormat -// scenario("we don't get transactions due to wrong value for obp_sort_direction parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_sort_direction") -// val params = ("obp_sort_direction", "foo") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we get all the transactions sorted by ASC", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with the value ASC for param obp_sort_by") -// val params = ("obp_sort_direction", "ASC") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions array should not be empty") -// transactions.transactions.size should not equal (0) -// val transaction1 = transactions.transactions(0) -// val transaction2 = transactions.transactions(1) -// transaction1.details.completed.before(transaction2.details.completed) should equal(true) -// } -// scenario("we get all the transactions sorted by asc", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with the value asc for param obp_sort_by") -// val params = ("obp_sort_direction", "asc") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions array should not be empty") -// transactions.transactions.size should not equal (0) -// val transaction1 = transactions.transactions(0) -// val transaction2 = transactions.transactions(1) -// transaction1.details.completed.before(transaction2.details.completed) should equal(true) -// } -// scenario("we get all the transactions sorted by DESC", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with the value DESC for param obp_sort_by") -// val params = ("obp_sort_direction", "DESC") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions array should not be empty") -// transactions.transactions.size should not equal (0) -// val transaction1 = transactions.transactions(0) -// val transaction2 = transactions.transactions(1) -// transaction1.details.completed.before(transaction2.details.completed) should equal(false) -// } -// scenario("we get all the transactions sorted by desc", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with the value desc for param obp_sort_by") -// val params = ("obp_sort_direction", "desc") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions array should not be empty") -// transactions.transactions.size should not equal (0) -// val transaction1 = transactions.transactions(0) -// val transaction2 = transactions.transactions(1) -// transaction1.details.completed.before(transaction2.details.completed) should equal(false) -// -// } -// scenario("we don't get transactions due to wrong value (not a number) for obp_limit parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_limit") -// val params = ("obp_limit", "foo") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we don't get transactions due to wrong value (0) for obp_limit parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_limit") -// val params = ("obp_limit", "0") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we don't get transactions due to wrong value (-100) for obp_limit parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_limit") -// val params = ("obp_limit", "-100") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we get only 5 transactions due to the obp_limit parameter value", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with the value ASC for parameter obp_limit") -// val params = ("obp_limit", "5") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions size should be equal to 5") -// transactions.transactions.size should equal (5) -// } -// scenario("we don't get transactions due to wrong value for obp_from_date parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_from_date") -// val params = ("obp_from_date", "foo") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we get transactions from a previous date with the right format", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with obp_from_date into a proper format") -// val currentDate = new Date() -// val calendar = Calendar.getInstance -// calendar.setTime(currentDate) -// calendar.add(Calendar.YEAR, -1) -// val pastDate = calendar.getTime -// val formatedPastDate = defaultFormat.format(pastDate) -// val params = ("obp_from_date", formatedPastDate) :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should not be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should not equal (0) -// } -// scenario("we get transactions from a previous date (obp_from_date) with the fallback format", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with obp_from_date into an accepted format") -// val currentDate = new Date() -// val calendar = Calendar.getInstance -// calendar.setTime(currentDate) -// calendar.add(Calendar.YEAR, -1) -// val pastDate = calendar.getTime -// val formatedPastDate = rollbackFormat.format(pastDate) -// val params = ("obp_from_date", formatedPastDate) :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should not be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should not equal (0) -// } -// scenario("we don't get transactions from a date in the future", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with obp_from_date into a proper format") -// val currentDate = new Date() -// val calendar = Calendar.getInstance -// calendar.setTime(currentDate) -// calendar.add(Calendar.YEAR, 1) -// val futureDate = calendar.getTime -// val formatedFutureDate = defaultFormat.format(futureDate) -// val params = ("obp_from_date", formatedFutureDate) :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should not be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should equal (0) -// } -// scenario("we don't get transactions due to wrong value for obp_to_date parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_to_date") -// val params = ("obp_to_date", "foo") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we get transactions from a previous (obp_to_date) date with the right format", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with obp_to_date into a proper format") -// val currentDate = new Date() -// val formatedCurrentDate = defaultFormat.format(currentDate) -// val params = ("obp_to_date", formatedCurrentDate) :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should not be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should not equal (0) -// } -// scenario("we get transactions from a previous date with the fallback format", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with obp_to_date into an accepted format") -// val currentDate = new Date() -// val formatedCurrentDate = defaultFormat.format(currentDate) -// val params = ("obp_to_date", formatedCurrentDate) :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should not be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should not equal (0) -// } -// scenario("we don't get transactions from a date in the past", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with obp_to_date into a proper format") -// val currentDate = new Date() -// val calendar = Calendar.getInstance -// calendar.setTime(currentDate) -// calendar.add(Calendar.YEAR, -1) -// val pastDate = calendar.getTime -// val formatedPastDate = defaultFormat.format(pastDate) -// val params = ("obp_to_date", formatedPastDate) :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should equal (0) -// } -// scenario("we don't get transactions due to wrong value (not a number) for obp_offset parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_offset") -// val params = ("obp_offset", "foo") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we don't get transactions due to the (2000) for obp_offset parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_offset") -// val params = ("obp_offset", "2000") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 code") -// reply.code should equal (200) -// And("transactions size should be empty") -// val transactions = reply.body.extract[TransactionsJSON] -// transactions.transactions.size should equal (0) -// } -// scenario("we don't get transactions due to wrong value (-100) for obp_offset parameter", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with a wrong value for param obp_offset") -// val params = ("obp_offset", "-100") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// scenario("we get only 5 transactions due to the obp_offset parameter value", API1_2, GetTransactions, GetTransactionsWithParams) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent with the value ASC for parameter obp_offset") -// val params = ("obp_offset", "5") :: Nil -// val reply = getTransactions(bankId,bankAccount.id,view, user1, params) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// val transactions = reply.body.extract[TransactionsJSON] -// And("transactions size should be equal to 5") -// transactions.transactions.size should equal (5) -// } -// } -// -// feature("Information about a transaction"){ -// scenario("we get transaction data by using an access token", API1_2, GetTransaction) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 ok code") -// reply.code should equal (200) -// reply.body.extract[TransactionJSON] -// } -// -// scenario("we will not get transaction data due to a missing token", API1_2, GetTransaction) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// -// scenario("we will not get transaction data because user does not have enough privileges", API1_2, GetTransaction) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// -// scenario("we will not get transaction data because the account does not exist", API1_2, GetTransaction) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTransaction(bankId, randomString(5), view, transaction.id, user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// -// scenario("we will not get transaction data because the view does not exist", API1_2, GetTransaction) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// } -// -// scenario("we will not get transaction data because the transaction does not exist", API1_2, GetTransaction) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// } -// -// } -// -// feature("We get the narrative of one random transaction"){ -// scenario("we will get the narrative of one random transaction", API1_2, GetNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// reply.body.extract[TransactionNarrativeJSON] -// } -// -// scenario("we will not get the narrative of one random transaction due to a missing token", API1_2, GetNarrative) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the narrative of one random transaction because the user does not have enough privileges", API1_2, GetNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the narrative of one random transaction because the view does not exist", API1_2, GetNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getNarrativeForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the narrative of one random transaction because the transaction does not exist", API1_2, GetNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post the narrative for one random transaction"){ -// scenario("we will post the narrative for one random transaction", API1_2, PostNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomNarrative = randomString(20) -// val postReply = postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the narrative should be added") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theNarrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should equal (theNarrativeAfterThePost.narrative) -// } -// -// scenario("we will not post the narrative for one random transaction due to a missing token", API1_2, PostNarrative) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// When("the request is sent") -// val postReply = postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the narrative should not be added") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theNarrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should not equal (theNarrativeAfterThePost.narrative) -// } -// -// scenario("we will not post the narrative for one random transaction because the user does not have enough privileges", API1_2, PostNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// When("the request is sent") -// val postReply = postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the narrative should not be added") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theNarrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should not equal (theNarrativeAfterThePost.narrative) -// } -// -// scenario("we will not post the narrative for one random transaction because the view does not exist", API1_2, PostNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// When("the request is sent") -// val postReply = postNarrativeForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, randomNarrative, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the narrative should not be added") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theNarrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should not equal (theNarrativeAfterThePost.narrative) -// } -// -// scenario("we will not post the narrative for one random transaction because the transaction does not exist", API1_2, PostNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val randomNarrative = randomString(20) -// When("the request is sent") -// val postReply = postNarrativeForOneTransaction(bankId, bankAccount.id, view, randomString(5), randomNarrative, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the narrative for one random transaction"){ -// scenario("we will the narrative for one random transaction", API1_2, PutNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomNarrative = randomString(20) -// val putReply = updateNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the narrative should be changed") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val narrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should equal (narrativeAfterThePost.narrative) -// } -// -// scenario("we will not update the narrative for one random transaction due to a missing token", API1_2, PutNarrative) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// When("the request is sent") -// val putReply = updateNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the narrative should not be changed") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val narrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should not equal (narrativeAfterThePost.narrative) -// } -// -// scenario("we will not update the narrative for one random transaction because the user does not have enough privileges", API1_2, PutNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// When("the request is sent") -// val putReply = updateNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the narrative should not be changed") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val narrativeAfterThePost : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// randomNarrative should not equal (narrativeAfterThePost.narrative) -// } -// -// scenario("we will not update the narrative for one random transaction because the transaction does not exist", API1_2, PutNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transactionId = randomString(5) -// val randomNarrative = randomString(20) -// When("the request is sent") -// val putReply = updateNarrativeForOneTransaction(bankId, bankAccount.id, view, transactionId, randomNarrative, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the narrative for one random transaction"){ -// scenario("we will delete the narrative for one random transaction", API1_2, DeleteNarrative) { -// Given("We will use an access token and will set a narrative first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1) -// When("the delete request is sent") -// val deleteReply = deleteNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the narrative should be null") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val narrativeAfterTheDelete : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// narrativeAfterTheDelete.narrative should equal (null) -// } -// -// scenario("we will not delete narrative for one random transaction due to a missing token", API1_2, DeleteNarrative) { -// Given("We will not use an access token and will set a narrative first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1) -// When("the delete request is sent") -// val deleteReply = deleteNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the public narrative should not be null") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val narrativeAfterTheDelete : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// narrativeAfterTheDelete.narrative should not equal (null) -// } -// -// scenario("we will not delete the narrative for one random transaction because the user does not have enough privileges", API1_2, DeleteNarrative) { -// Given("We will use an access token and will set a narrative first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomNarrative = randomString(20) -// postNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomNarrative, user1) -// When("the delete request is sent") -// val deleteReply = deleteNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// And("the narrative should not be null") -// val getReply = getNarrativeForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val narrativeAfterTheDelete : TransactionNarrativeJSON = getReply.body.extract[TransactionNarrativeJSON] -// narrativeAfterTheDelete.narrative should not equal (null) -// } -// -// scenario("we will not delete the narrative for one random transaction because the transaction does not exist", API1_2, DeleteNarrative) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = Constant.SYSTEM_OWNER_VIEW_ID -// val randomNarrative = randomString(20) -// When("the delete request is sent") -// val deleteReply = deleteNarrativeForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We get the comments of one random transaction"){ -// scenario("we will get the comments of one random transaction", API1_2, GetComments) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// reply.body.extract[TransactionCommentsJSON] -// } -// -// scenario("we will not get the comments of one random transaction due to a missing token", API1_2, GetComments) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the comments of one random transaction because the user does not have enough privileges", API1_2, GetComments) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the comments of one random transaction because the view does not exist", API1_2, GetComments) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getCommentsForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the comments of one random transaction because the transaction does not exist", API1_2, GetComments) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getCommentsForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post a comment for one random transaction"){ -// scenario("we will post a comment for one random transaction", API1_2, PostComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[TransactionCommentJSON] -// And("the comment should be added") -// val getReply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theCommentsAfterThePost = getReply.body.extract[TransactionCommentsJSON].comments -// val theComment = theCommentsAfterThePost.find(_.value == randomComment.value) -// theComment.nonEmpty should equal (true) -// theComment.get.user should not equal (null) -// -// } -// -// scenario("we will not post a comment for one random transaction due to a missing token", API1_2, PostComment) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// When("the request is sent") -// val postReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the comment should not be added") -// val getReply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theCommentsAfterThePost = getReply.body.extract[TransactionCommentsJSON].comments -// val notFound = theCommentsAfterThePost.find(_.value == randomComment.value) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// -// scenario("we will not post a comment for one random transaction because the user does not have enough privileges", API1_2, PostComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// When("the request is sent") -// val postReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the comment should not be added") -// val getReply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theCommentsAfterThePost = getReply.body.extract[TransactionCommentsJSON].comments -// val notFound = theCommentsAfterThePost.find(_.value == randomComment.value) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post a comment for one random transaction because the view does not exist", API1_2, PostComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// When("the request is sent") -// val postReply = postCommentForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, randomComment, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the comment should not be added") -// val getReply = getCommentsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theCommentsAfterThePost = getReply.body.extract[TransactionCommentsJSON].comments -// val notFound = theCommentsAfterThePost.find(_.value == randomComment.value) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post a comment for one random transaction because the transaction does not exist", API1_2, PostComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// When("the request is sent") -// val postReply = postCommentForOneTransaction(bankId, bankAccount.id, view, randomString(5), randomComment, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete a comment for one random transaction"){ -// scenario("we will delete a comment for one random transaction", API1_2, DeleteComment) { -// Given("We will use an access token and will set a comment first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user1) -// val postedComment = postedReply.body.extract[TransactionCommentJSON] -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedComment.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// } -// -// scenario("we will not delete a comment for one random transaction due to a missing token", API1_2, DeleteComment) { -// Given("We will not use an access token and will set a comment first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user1) -// val postedComment = postedReply.body.extract[TransactionCommentJSON] -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedComment.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a comment for one random transaction because the user does not have enough privileges", API1_2, DeleteComment) { -// Given("We will use an access token and will set a comment first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user1) -// val postedComment = postedReply.body.extract[TransactionCommentJSON] -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedComment.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a comment for one random transaction because the user did not post the comment", API1_2, DeleteComment) { -// Given("We will use an access token and will set a comment first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = "public" -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user2) -// val postedComment = postedReply.body.extract[TransactionCommentJSON] -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedComment.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a comment for one random transaction because the comment does not exist", API1_2, DeleteComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a comment for one random transaction because the transaction does not exist", API1_2, DeleteComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user1) -// val postedComment = postedReply.body.extract[TransactionCommentJSON] -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, view, randomString(5), postedComment.id, user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a comment for one random transaction because the view does not exist", API1_2, DeleteComment) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomComment = PostTransactionCommentJSON(randomString(20)) -// val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user1) -// val postedComment = postedReply.body.extract[TransactionCommentJSON] -// When("the delete request is sent") -// val deleteReply = deleteCommentForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, postedComment.id, user1) -// Then("we should get a 404 code") -// deleteReply.code should equal (404) -// } -// } -// -// feature("We get the tags of one random transaction"){ -// scenario("we will get the tags of one random transaction", API1_2, GetTags) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// reply.body.extract[TransactionTagsJSON] -// } -// -// scenario("we will not get the tags of one random transaction due to a missing token", API1_2, GetTags) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the tags of one random transaction because the user does not have enough privileges", API1_2, GetTags) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the tags of one random transaction because the view does not exist", API1_2, GetTags) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTagsForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the tags of one random transaction because the transaction does not exist", API1_2, GetTags) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getTagsForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post a tag for one random transaction"){ -// scenario("we will post a tag for one random transaction", API1_2, PostTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[TransactionTagJSON] -// And("the tag should be added") -// val getReply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theTagsAfterThePost = getReply.body.extract[TransactionTagsJSON].tags -// val theTag = theTagsAfterThePost.find(_.value == randomTag.value) -// theTag.nonEmpty should equal (true) -// theTag.get.user should not equal (null) -// } -// -// scenario("we will not post a tag for one random transaction due to a missing token", API1_2, PostTag) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// When("the request is sent") -// val postReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the tag should not be added") -// val getReply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theTagsAfterThePost = getReply.body.extract[TransactionTagsJSON].tags -// val notFound = theTagsAfterThePost.find(_.value == randomTag.value) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post a tag for one random transaction because the user does not have enough privileges", API1_2, PostTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// When("the request is sent") -// val postReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the tag should not be added") -// val getReply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theTagsAfterThePost = getReply.body.extract[TransactionTagsJSON].tags -// val notFound = theTagsAfterThePost.find(_.value == randomTag.value) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post a tag for one random transaction because the view does not exist", API1_2, PostTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// When("the request is sent") -// val postReply = postTagForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, randomTag, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the tag should not be added") -// val getReply = getTagsForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theTagsAfterThePost = getReply.body.extract[TransactionTagsJSON].tags -// val notFound = theTagsAfterThePost.find(_.value == randomTag.value) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post a tag for one random transaction because the transaction does not exist", API1_2, PostTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// When("the request is sent") -// val postReply = postTagForOneTransaction(bankId, bankAccount.id, view, randomString(5), randomTag, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete a tag for one random transaction"){ -// scenario("we will delete a tag for one random transaction", API1_2, DeleteTag) { -// Given("We will use an access token and will set a tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user1) -// val postedTag = postedReply.body.extract[TransactionTagJSON] -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedTag.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// } -// -// scenario("we will not delete a tag for one random transaction due to a missing token", API1_2, DeleteTag) { -// Given("We will not use an access token and will set a tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user1) -// val postedTag = postedReply.body.extract[TransactionTagJSON] -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedTag.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a tag for one random transaction because the user does not have enough privileges", API1_2, DeleteTag) { -// Given("We will use an access token and will set a tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user1) -// val postedTag = postedReply.body.extract[TransactionTagJSON] -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedTag.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a tag for one random transaction because the user did not post the tag", API1_2, DeleteTag) { -// Given("We will use an access token and will set a tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = "public" -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user2) -// val postedTag = postedReply.body.extract[TransactionTagJSON] -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedTag.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a tag for one random transaction because the tag does not exist", API1_2, DeleteTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a tag for one random transaction because the transaction does not exist", API1_2, DeleteTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user1) -// val postedTag = postedReply.body.extract[TransactionTagJSON] -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, view, randomString(5), postedTag.id, user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete a tag for one random transaction because the view does not exist", API1_2, DeleteTag) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomTag = PostTransactionTagJSON(randomString(5)) -// val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user1) -// val postedTag = postedReply.body.extract[TransactionTagJSON] -// When("the delete request is sent") -// val deleteReply = deleteTagForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, postedTag.id, user1) -// Then("we should get a 404 code") -// deleteReply.code should equal (404) -// } -// } -// -// feature("We get the images of one random transaction"){ -// scenario("we will get the images of one random transaction", API1_2, GetImages) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// reply.body.extract[TransactionImagesJSON] -// } -// -// scenario("we will not get the images of one random transaction due to a missing token", API1_2, GetImages) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the images of one random transaction because the user does not have enough privileges", API1_2, GetImages) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the images of one random transaction because the view does not exist", API1_2, GetImages) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getImagesForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the images of one random transaction because the transaction does not exist", API1_2, GetImages) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getImagesForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post an image for one random transaction"){ -// scenario("we will post an image for one random transaction", API1_2, PostImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[TransactionImageJSON] -// And("the image should be added") -// val getReply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theImagesAfterThePost = getReply.body.extract[TransactionImagesJSON].images -// val theImage = theImagesAfterThePost.find(_.URL == randomImage.URL) -// theImage.nonEmpty should equal (true) -// theImage.get.user should not equal (null) -// } -// -// scenario("we will not post an image for one random transaction due to a missing token", API1_2, PostImage) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com/"+randomString(5)) -// When("the request is sent") -// val postReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image should not be added") -// val getReply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theImagesAfterThePost = getReply.body.extract[TransactionImagesJSON].images -// val notFound = theImagesAfterThePost.find(_.URL == randomImage.URL) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post an image for one random transaction because the user does not have enough privileges", API1_2, PostImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// When("the request is sent") -// val postReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image should not be added") -// val getReply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theImagesAfterThePost = getReply.body.extract[TransactionImagesJSON].images -// val notFound = theImagesAfterThePost.find(_.URL == randomImage.URL) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post an image for one random transaction because the view does not exist", API1_2, PostImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com/"+randomString(5)) -// When("the request is sent") -// val postReply = postImageForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, randomImage, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// And("the image should not be added") -// val getReply = getImagesForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// val theImagesAfterThePost = getReply.body.extract[TransactionImagesJSON].images -// val notFound = theImagesAfterThePost.find(_.URL == randomImage.URL) match { -// case None => true -// case Some(_) => false -// } -// notFound should equal (true) -// } -// -// scenario("we will not post an image for one random transaction because the transaction does not exist", API1_2, PostImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// When("the request is sent") -// val postReply = postImageForOneTransaction(bankId, bankAccount.id, view, randomString(5), randomImage, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete an image for one random transaction"){ -// scenario("we will delete an image for one random transaction", API1_2, DeleteImage) { -// Given("We will use an access token and will set an image first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// val postedImage = postedReply.body.extract[TransactionImageJSON] -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedImage.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// } -// -// scenario("we will not delete an image for one random transaction due to a missing token", API1_2, DeleteImage) { -// Given("We will not use an access token and will set an image first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// val postedImage = postedReply.body.extract[TransactionImageJSON] -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedImage.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete an image for one random transaction because the user does not have enough privileges", API1_2, DeleteImage) { -// Given("We will use an access token and will set an image first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// val postedImage = postedReply.body.extract[TransactionImageJSON] -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedImage.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete an image for one random transaction because the user did not post the image", API1_2, DeleteImage) { -// Given("We will use an access token and will set an image first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = "public" -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// val postedImage = postedReply.body.extract[TransactionImageJSON] -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, postedImage.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete an image for one random transaction because the image does not exist", API1_2, DeleteImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete an image for one random transaction because the transaction does not exist", API1_2, DeleteImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// val postedImage = postedReply.body.extract[TransactionImageJSON] -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, view, randomString(5), postedImage.id, user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete an image for one random transaction because the view does not exist", API1_2, DeleteImage) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com") -// val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1) -// val postedImage = postedReply.body.extract[TransactionImageJSON] -// When("the delete request is sent") -// val deleteReply = deleteImageForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, postedImage.id, user1) -// Then("we should get a 404 code") -// deleteReply.code should equal (404) -// } -// } -// -// feature("We get the where of one random transaction"){ -// scenario("we will get the where of one random transaction", API1_2, GetWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the request is sent") -// val reply = getWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// } -// -// scenario("we will not get the where of one random transaction due to a missing token", API1_2, GetWhere) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the request is sent") -// val reply = getWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the where of one random transaction because the user does not have enough privileges", API1_2, GetWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the request is sent") -// val reply = getWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the where of one random transaction because the view does not exist", API1_2, GetWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the request is sent") -// val reply = getWhereForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the where of one random transaction because the transaction does not exist", API1_2, GetWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getWhereForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We post the where for one random transaction"){ -// scenario("we will post the where for one random transaction", API1_2, PostWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// Then("we should get a 201 code") -// postReply.code should equal (201) -// postReply.body.extract[SuccessMessage] -// And("the where should be posted") -// val location = getWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1).body.extract[TransactionWhereJSON] -// randomLoc.latitude should equal (location.where.latitude) -// randomLoc.longitude should equal (location.where.longitude) -// location.where.user should not equal (null) -// } -// -// scenario("we will not post the where for one random transaction because the coordinates don't exist", API1_2, PostWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// var randomLoc = JSONFactory.createLocationPlainJSON(400,200) -// When("the request is sent") -// val postReply = postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the where for a random transaction due to a missing token", API1_2, PostWhere) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, None) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the where for a random transaction because the user does not have enough privileges", API1_2, PostWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user3) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the where for a random transaction because the view does not exist", API1_2, PostWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postWhereForOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, randomLoc, user1) -// Then("we should get a 404 code") -// postReply.code should equal (404) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not post the where for a random transaction because the transaction does not exist", API1_2, PostWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the request is sent") -// val postReply = postWhereForOneTransaction(bankId, bankAccount.id, view, randomString(5), randomLoc, user1) -// Then("we should get a 400 code") -// postReply.code should equal (400) -// And("we should get an error message") -// postReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We update the where for one random transaction"){ -// scenario("we will update the where for one random transaction", API1_2, PutWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val randomLoc = randomLocation -// val putReply = updateWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// Then("we should get a 200 code") -// putReply.code should equal (200) -// putReply.body.extract[SuccessMessage] -// And("the where should be changed") -// val location = getWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1).body.extract[TransactionWhereJSON] -// randomLoc.latitude should equal (location.where.latitude) -// randomLoc.longitude should equal (location.where.longitude) -// } -// -// scenario("we will not update the where for one random transaction because the coordinates don't exist", API1_2, PutWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// var randomLoc = JSONFactory.createLocationPlainJSON(400,200) -// When("the request is sent") -// val putReply = updateWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the where for a random transaction due to a missing token", API1_2, PutWhere) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// var randomLoc = randomLocation -// When("the request is sent") -// val putReply = updateWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, None) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the where for a random transaction because the user does not have enough privileges", API1_2, PutWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updateWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user3) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not update the where for a random transaction because the transaction does not exist", API1_2, PutWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the request is sent") -// val putReply = updateWhereForOneTransaction(bankId, bankAccount.id, view, randomString(5), randomLoc, user1) -// Then("we should get a 400 code") -// putReply.code should equal (400) -// And("we should get an error message") -// putReply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -// -// feature("We delete the where for one random transaction"){ -// scenario("we will delete the where for one random transaction", API1_2, DeleteWhere) { -// Given("We will use an access token and will set a where tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 204 code") -// deleteReply.code should equal (204) -// And("the where should be null") -// val locationAfterDelete = getWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user1).body.extract[TransactionWhereJSON] -// locationAfterDelete.where should equal (null) -// } -// -// scenario("we will not delete the where for a random transaction due to a missing token", API1_2, DeleteWhere) { -// Given("We will not use an access token and will set a where tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// // And("the where should not be null") -// } -// -// scenario("we will not delete the where for a random transaction because the user does not have enough privileges", API1_2, DeleteWhere) { -// Given("We will use an access token and will set a where tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// // And("the where should not be null") -// } -// -// scenario("we will not delete the where for one random transaction because the user did not post the geo tag", API1_2, DeleteWhere) { -// Given("We will use an access token and will set a where tag first") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = "public" -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// val randomLoc = randomLocation -// postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1) -// When("the delete request is sent") -// val deleteReply = deleteWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// -// scenario("we will not delete the where for a random transaction because the transaction does not exist", API1_2, DeleteWhere) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val randomLoc = randomLocation -// When("the delete request is sent") -// val deleteReply = deleteWhereForOneTransaction(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// deleteReply.code should equal (400) -// } -// } -// -// feature("We get the other bank account of a transaction "){ -// scenario("we will get the other bank account of a random transaction", API1_2, GetTransactionAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccountOfOneTransaction(bankId, bankAccount.id, view, transaction.id, user1) -// Then("we should get a 200 code") -// reply.code should equal (200) -// val accountJson = reply.body.extract[OtherAccountJSON] -// And("some fields should not be empty") -// accountJson.id.nonEmpty should equal (true) -// } -// -// scenario("we will not get the other bank account of a random transaction due to a missing token", API1_2, GetTransactionAccount) { -// Given("We will not use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccountOfOneTransaction(bankId, bankAccount.id, view, transaction.id, None) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get get the other bank account of a random transaction because the user does not have enough privileges", API1_2, GetTransactionAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccountOfOneTransaction(bankId, bankAccount.id, view, transaction.id, user3) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get the other bank account of a random transaction because the view does not exist", API1_2, GetTransactionAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// val transaction = randomTransaction(bankId, bankAccount.id, view) -// When("the request is sent") -// val reply = getTheOtherBankAccountOfOneTransaction(bankId, bankAccount.id, randomString(5), transaction.id, user1) -// Then("we should get a 404 code") -// reply.code should equal (404) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// -// scenario("we will not get get the other bank account of a random transaction because the transaction does not exist", API1_2, GetTransactionAccount) { -// Given("We will use an access token") -// val bankId = randomBank -// val bankAccount : AccountJSON = randomPrivateAccount(bankId) -// val view = randomViewPermalink(bankId, bankAccount) -// When("the request is sent") -// val reply = getTheOtherBankAccount(bankId, bankAccount.id, view, randomString(5), user1) -// Then("we should get a 400 code") -// reply.code should equal (400) -// And("we should get an error message") -// reply.body.extract[ErrorMessage].error.nonEmpty should equal (true) -// } -// } -//} diff --git a/obp-api/src/test/scala/code/api/v1_2_1/API1_2_1Test.scala b/obp-api/src/test/scala/code/api/v1_2_1/API1_2_1Test.scala index ebc971366..2b18e387d 100644 --- a/obp-api/src/test/scala/code/api/v1_2_1/API1_2_1Test.scala +++ b/obp-api/src/test/scala/code/api/v1_2_1/API1_2_1Test.scala @@ -48,25 +48,65 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat def v1_2_1Request = baseRequest / "obp" / "v1.2.1" val viewFields = List( - "can_see_transaction_this_bank_account","can_see_transaction_other_bank_account", - "can_see_transaction_metadata","can_see_transaction_label","can_see_transaction_amount", - "can_see_transaction_type","can_see_transaction_currency","can_see_transaction_start_date", - "can_see_transaction_finish_date","can_see_transaction_balance","can_see_comments", - "can_see_narrative","can_see_tags","can_see_images","can_see_bank_account_owners", - "can_see_bank_account_type","can_see_bank_account_balance","can_see_bank_account_currency", - "can_see_bank_account_label","can_see_bank_account_national_identifier", - "can_see_bank_account_swift_bic","can_see_bank_account_iban","can_see_bank_account_number", - "can_see_bank_account_bank_name","can_see_other_account_national_identifier", - "can_see_other_account_swift_bic","can_see_other_account_iban", - "can_see_other_account_bank_name","can_see_other_account_number", - "can_see_other_account_metadata","can_see_other_account_kind","can_see_more_info", - "can_see_url","can_see_image_url","can_see_open_corporates_url","can_see_corporate_location", - "can_see_physical_location","can_see_public_alias","can_see_private_alias","can_add_more_info", - "can_add_url","can_add_image_url","can_add_open_corporates_url","can_add_corporate_location", - "can_add_physical_location","can_add_public_alias","can_add_private_alias", - "can_delete_corporate_location","can_delete_physical_location","can_edit_narrative", - "can_add_comment","can_delete_comment","can_add_tag","can_delete_tag","can_add_image", - "can_delete_image","can_add_where_tag","can_see_where_tag","can_delete_where_tag" + CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, + CAN_SEE_TRANSACTION_METADATA, + CAN_SEE_TRANSACTION_DESCRIPTION, + CAN_SEE_TRANSACTION_AMOUNT, + CAN_SEE_TRANSACTION_TYPE, + CAN_SEE_TRANSACTION_CURRENCY, + CAN_SEE_TRANSACTION_START_DATE, + CAN_SEE_TRANSACTION_FINISH_DATE, + CAN_SEE_TRANSACTION_BALANCE, + CAN_SEE_COMMENTS, + CAN_SEE_OWNER_COMMENT, + CAN_SEE_TAGS, + CAN_SEE_IMAGES, + CAN_SEE_BANK_ACCOUNT_OWNERS, + CAN_SEE_BANK_ACCOUNT_TYPE, + CAN_SEE_BANK_ACCOUNT_BALANCE, + CAN_SEE_BANK_ACCOUNT_CURRENCY, + CAN_SEE_BANK_ACCOUNT_LABEL, + CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, + CAN_SEE_BANK_ACCOUNT_IBAN, + CAN_SEE_BANK_ACCOUNT_NUMBER, + CAN_SEE_BANK_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, + CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, + CAN_SEE_OTHER_ACCOUNT_IBAN, + CAN_SEE_OTHER_ACCOUNT_BANK_NAME, + CAN_SEE_OTHER_ACCOUNT_NUMBER, + CAN_SEE_OTHER_ACCOUNT_METADATA, + CAN_SEE_OTHER_ACCOUNT_KIND, + CAN_SEE_MORE_INFO, + CAN_SEE_URL, + CAN_SEE_IMAGE_URL, + CAN_SEE_OPEN_CORPORATES_URL, + CAN_SEE_CORPORATE_LOCATION, + CAN_SEE_PHYSICAL_LOCATION, + CAN_SEE_PUBLIC_ALIAS, + CAN_SEE_PRIVATE_ALIAS, + CAN_ADD_MORE_INFO, + CAN_ADD_URL, + CAN_ADD_IMAGE_URL, + CAN_ADD_OPEN_CORPORATES_URL, + CAN_ADD_CORPORATE_LOCATION, + CAN_ADD_PHYSICAL_LOCATION, + CAN_ADD_PUBLIC_ALIAS, + CAN_ADD_PRIVATE_ALIAS, + CAN_DELETE_CORPORATE_LOCATION, + CAN_DELETE_PHYSICAL_LOCATION, + CAN_EDIT_OWNER_COMMENT, + CAN_ADD_COMMENT, + CAN_DELETE_COMMENT, + CAN_ADD_TAG, + CAN_DELETE_TAG, + CAN_ADD_IMAGE, + CAN_DELETE_IMAGE, + CAN_ADD_WHERE_TAG, + CAN_SEE_WHERE_TAG, + CAN_DELETE_WHERE_TAG ) /************************* test tags ************************/