Add audit methods

This commit is contained in:
k.struzhkin 2021-07-06 18:25:21 +03:00
parent ce1edf20c2
commit f76926d54e
64 changed files with 7692 additions and 0 deletions

60
.gitignore vendored Normal file
View File

@ -0,0 +1,60 @@
# Dir for API portal deploy
dist
out
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
node_modules
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
# CI
.wercker
# Generated
web_deploy/
# User-specific stuff:
.idea/
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git
branch = master

18
.redocly.yaml Normal file
View File

@ -0,0 +1,18 @@
# See https://docs.redoc.ly/cli/configuration/ for more information.
apiDefinitions:
core: "openapi/openapi.yaml"
lint:
plugins:
- './plugins/local.js'
extends:
- recommended
rules:
tag-description: off
preprocessors:
local/merge-schemas: on
referenceDocs:
showConsole: true
layout:
scope: section
routingStrategy: browser
htmlTemplate: ./web/index.html

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
* @rbkmoney/java-team

40
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,40 @@
#!groovy
// -*- mode: groovy -*-
build('swag-fraudbusters-management', 'docker-host') {
checkoutRepo()
loadBuildUtils()
def pipeDefault
def gitUtils
runStage('load pipeline') {
env.JENKINS_LIB = "build_utils/jenkins_lib"
pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy")
gitUtils = load("${env.JENKINS_LIB}/gitUtils.groovy")
}
pipeDefault() {
runStage('init') {
withGithubSshCredentials {
sh 'make wc_init'
}
}
runStage('build') {
sh 'make wc_build'
}
// Java
runStage('Build client & server') {
withCredentials([[$class: 'FileBinding', credentialsId: 'java-maven-settings.xml', variable: 'SETTINGS_XML']]) {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic/')) {
sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} java.swag.deploy_client'
sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} java.swag.deploy_server'
} else {
sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} java.swag.compile_client'
sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} java.swag.compile_server'
}
}
}
}
}

176
LICENSE Normal file
View File

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

113
Makefile Normal file
View File

@ -0,0 +1,113 @@
SUBMODULES = build_utils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
UTILS_PATH := build_utils
TEMPLATES_PATH := .
# Name of the service
SERVICE_NAME := swag-analytics
# Service image default tag
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
# The tag for service image to be pushed with
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
BUILD_IMAGE_TAG := bdc05544014b3475c8e0726d3b3d6fc81b09db96
CALL_ANYWHERE := \
all submodules init build java.compile java.deploy
CALL_W_CONTAINER := $(CALL_ANYWHERE)
all: compile
-include $(UTILS_PATH)/make_lib/utils_image.mk
-include $(UTILS_PATH)/make_lib/utils_container.mk
.PHONY: $(CALL_W_CONTAINER)
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
submodules: $(SUBTARGETS)
# NPM
init:
npm install
build:
npm run build
# Java
ifdef SETTINGS_XML
DOCKER_RUN_OPTS = -v $(SETTINGS_XML):$(SETTINGS_XML)
DOCKER_RUN_OPTS += -e SETTINGS_XML=$(SETTINGS_XML)
endif
ifdef LOCAL_BUILD
DOCKER_RUN_OPTS += -v $$HOME/.m2:/home/$(UNAME)/.m2:rw
endif
COMMIT_HASH := $(shell git --no-pager log -1 --pretty=format:"%h")
NUMBER_COMMITS := $(shell git rev-list --count HEAD)
JAVA_PKG_VERSION := 1.$(NUMBER_COMMITS)-$(COMMIT_HASH)
ifdef BRANCH_NAME
ifeq "$(findstring epic,$(BRANCH_NAME))" "epic"Invoice
JAVA_PKG_VERSION := $(JAVA_PKG_VERSION)-epic
endif
endif
MVN = mvn -s $(SETTINGS_XML) -Dcommit.number="$(NUMBER_COMMITS)"
java.swag.compile_client:
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
$(MVN) clean && \
$(MVN) compile -P="client"
java.swag.deploy_client:
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-client" && \
$(MVN) deploy -P="client"
java.swag.install_client:
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-client" && \
$(MVN) install -P="client"
java.swag.compile_server:
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
$(MVN) clean && \
$(MVN) compile -P="server"
java.swag.deploy_server:
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-server" && \
$(MVN) deploy -P="server"
java.swag.install_server:
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-server" && \
$(MVN) install -P="server"
java.compile: java.settings
$(MVN) compile
java.deploy: java.settings
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
$(MVN) deploy
java.install: java.settings
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
$(MVN) install
java.settings:
$(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1)

View File

@ -0,0 +1,15 @@
description: Переданы ошибочные данные
content:
application/json:
schema:
description: Ошибка в переданных данных
type: object
required:
- code
properties:
code:
type: string
enum:
- invalidRequest
message:
type: string

View File

@ -0,0 +1,11 @@
type: object
required:
- result
- count
properties:
count:
type: integer
result:
type: array
items:
$ref: '../../schemas/CommandAudit.yaml'

View File

@ -0,0 +1,6 @@
type: object
required:
- result
properties:
result:
$ref: '../../schemas/ArrayResult.yaml'

View File

@ -0,0 +1,3 @@
type: array
items:
type: string

View File

@ -0,0 +1,31 @@
description: Информацмя по банковской карте
required:
- cardToken
- lastDigits
- bin
properties:
bin:
description: bin карты
type: string
minLength: 3
maxLength: 20
lastDigits:
description: Последнии цифры карты
type: string
minLength: 3
maxLength: 20
binCountryCode:
description: 'Страна карты, alpha-3 код по стандарту [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)'
type: string
pattern: '^[A-Z]{3}$'
example: "RUS"
cardToken:
description: Токен идентифицирующий карту
type: string
minLength: 1
maxLength: 200
bankName:
description: Название банка
type: string
minLength: 1
maxLength: 200

View File

@ -0,0 +1,16 @@
description: Платежная информация
required:
- amount
- currency
properties:
amount:
description: Сумма платежа
type: integer
format: int64
currency:
description: >-
Валюта, символьный код согласно [ISO
4217](http://www.iso.org/iso/home/standards/currency_codes.htm).
type: string
pattern: '^[A-Z]{3}$'

View File

@ -0,0 +1,32 @@
description: Лог изменений в личном кабинете
required:
- cardToken
- lastDigits
- bin
properties:
commandType:
type: string
enum: ["CREATE", "DELETE"]
id:
type: integer
initiator:
type: string
insertTime:
type: string
format: date-time
object:
type: string
objectType:
type: string
enum": [
"template",
"reference",
"group_reference",
"group",
"p2p_group_reference",
"p2p_reference",
"black",
"white",
"grey",
"naming"
]

View File

@ -0,0 +1,12 @@
description: Информация о мерчанте
required:
- shopId
- partyId
properties:
shopId:
description: Идентификатор магазина
type: string
partyId:
description: Идентификатор пати
type: string

View File

@ -0,0 +1,25 @@
description: P2p контекст
required:
- cashInfo
- bankCard
- transferId
- identityId
properties:
payerInfo:
$ref: './UserInfo.yaml'
cashInfo:
$ref: './CashInfo.yaml'
sender:
$ref: './BankCard.yaml'
receiver:
$ref: './BankCard.yaml'
transferId:
description: Идентификатор перевода
type: string
identityId:
description: Идентификатор мерчанта
type: string
createdAt:
description: Дата и время создания
type: string
format: date-time

View File

@ -0,0 +1,6 @@
type: object
required:
- context
properties:
context:
$ref: './P2pContext.yaml'

View File

@ -0,0 +1,5 @@
type: string
enum:
- 'payment_resource'
- 'customer'
- 'recurrent'

View File

@ -0,0 +1,41 @@
description: Контекст платежа
required:
- cashInfo
- bankCard
- merchantInfo
- invoiceId
- paymentId
- payerType
properties:
payerInfo:
$ref: './UserInfo.yaml'
cashInfo:
$ref: './CashInfo.yaml'
bankCard:
$ref: './BankCard.yaml'
merchantInfo:
$ref: './MerchantInfo.yaml'
mobile:
description: Признак мобильного платежа
type: boolean
default: false
recurrent:
description: Признак рекурентного платежа
type: boolean
default: false
invoiceId:
description: Идентификатор счета
type: string
paymentId:
description: Идентификатор платежа
type: string
payerType:
description: Тип плательщика
$ref: './PayerType.yaml'
tokenMobileProvider:
description: Провайдер предоставляющий токен для мобильного платежа
type: string
createdAt:
description: Дата и время создания
type: string
format: date-time

View File

@ -0,0 +1,6 @@
type: object
required:
- context
properties:
context:
$ref: './PaymentContext.yaml'

View File

@ -0,0 +1,6 @@
type: string
enum:
- 'low'
- 'high'
- 'fatal'
default: 'high'

View File

@ -0,0 +1,8 @@
description: Информацмя о клиенте
properties:
ip:
type: string
email:
type: string
fingerprint:
type: string

18
openapi/docs/api.md Normal file
View File

@ -0,0 +1,18 @@
RBKmoney Fraudbusters proxy inspector API является интерфейсом для
сервиса поиска мошеннических операций.
Мы предоставляем REST API поверх HTTP-протокола, схема которого описывается в
соответствии со стандартом [OpenAPI 3][OAS3].
Коды возврата описываются соответствующими HTTP-статусами. Платформа принимает и
возвращает значения JSON в теле запросов и ответов.
[OAS3]: https://swagger.io/specification/
## Формат содержимого
Любой запрос к API должен выполняться в кодировке UTF-8 и с указанием
содержимого в формате JSON.
```
Content-Type: application/json; charset=utf-8
```

View File

@ -0,0 +1,34 @@
## Общие ошибки
Ошибки возникающие при попытках совершения недопустимых операций, операций с невалидными объектами или несуществующими ресурсами. Имеют следующий вид:
```json
{
"code": "string",
"message": "string"
}
```
В поле `message` содержится информация по произошедшей ошибке. Например:
```json
{
"code": "invalidRequest",
"message": "Property 'name' is required."
}
```
## Ошибки обработки запросов
В процессе обработки запросов силами нашей платформы могут происходить различные непредвиденные ситуации. Об их появлении платформа сигнализирует по протоколу HTTP соответствующими [статусами][5xx], обозначающими ошибки сервера.
| Код | Описание |
| ------- | ---------- |
| **500** | В процессе обработки платформой запроса возникла непредвиденная ситуация. При получении подобного кода ответа мы рекомендуем обратиться в техническую поддержку. |
| **503** | Платформа временно недоступна и не готова обслуживать данный запрос. Запрос гарантированно не выполнен, при получении подобного кода ответа попробуйте выполнить его позднее, когда доступность платформы будет восстановлена. |
| **504** | Платформа превысила допустимое время обработки запроса, результат запроса не определён. Попробуйте отправить запрос повторно или выяснить результат выполнения исходного запроса, если повторное исполнение запроса нежелательно. |
[5xx]: https://tools.ietf.org/html/rfc7231#section-6.6
Если вы получили ошибку, которой нет в данном описании, обратитесь в техническую поддержку.

136
openapi/openapi.yaml Normal file
View File

@ -0,0 +1,136 @@
openapi: 3.0.3
info:
version: 1.0.0
title: RBKmoney Fraudbusters Management API
description:
$ref: './docs/api.md'
termsOfService: 'https://rbk.money/'
contact:
name: RBKmoney Support Team
email: support@rbk.money
url: 'https://developer.rbk.money'
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
security:
- bearer: []
tags:
- name: error-codes
x-displayName: Коды ошибок
description:
$ref: './docs/error-codes.md'
- name: audit
x-displayName: Audit
- name: basic-error-controller
x-displayName: Basic Error Controller
- name: clickhouse-notificator-proxy-facade
x-displayName: Clickhouse Notificator Proxy Facade
- name: group-command-resource
x-displayName: Group Command Resource
- name: lists-resource
x-displayName: Lists Resource
- name: operation-handler
x-displayName: Operation Handler
- name: payment-emulate-resource
x-displayName: Payment Emulate Resource
- name: payment-group-query-resource
x-displayName: Payment Group Query Resource
- name: payment-load-data-resource
x-displayName: Payment Load Data Resource
- name: payment-template-command-resource
x-displayName: Payment Template Command Resource
- name: payment-template-query-resource
x-displayName: Payment Template Query Resource
- name: reference-query-resource
x-displayName: Reference Query Resource
paths:
# Audit
/audit/commandTypes:
$ref: ./paths/audit/getCommandTypes.yaml
/audit/filter:
$ref: ./paths/audit/filterLogs.yaml
/audit/objectTypes:
$ref: ./paths/audit/getObjectTypes.yaml
# Notifications
/notification:
$ref: ./paths/notification/createOrUpdateNotification.yaml
/notification/{name}:
$ref: ./paths/notification/removeByName.yaml
/notification/validate:
$ref: ./paths/notification/validateNotification.yaml
# Notifications channel
/notification/channel/{name}:
$ref: ./paths/notification/channel/createChannel.yaml
# Load data
/load-data/fraud:
$ref: ./paths/load-data/loadFraudTransactions.yaml
# Groups
/group:
$ref: ./paths/group/insertGroup.yaml
/group/{groupId}:
$ref: ./paths/group/removeGroupById.yaml
/group/filter:
$ref: ./paths/group/filterGroups.yaml
/group?groupId={id}:
$ref: ./paths/group/getGroupById.yaml
# Groups reference
/group/{id}/reference:
$ref: ./paths/group/reference/insertGroupReference.yaml
/group/{id}/reference/remove:
$ref: ./paths/group/reference/removeGroupReferenceById.yaml
/group/reference/filter:
$ref: ./paths/group/reference/filterGroupsReferences.yaml
/group/{groupId}/reference:
$ref: ./paths/group/reference/getGroupReferencesByGroupId.yaml
# Lists
/lists:
$ref: ./paths/lists/insertRowToList.yaml
/lists/{id}:
$ref: ./paths/lists/removeRowFromListById.yaml
/lists/availableListNames:
$ref: ./paths/lists/getAvailableListNames.yaml
/lists/filter:
$ref: ./paths/lists/filterLists.yaml
/lists/names:
$ref: ./paths/lists/getListNames.yaml
# Templates
/template:
$ref: ./paths/template/insertTemplate.yaml
/template/{id}:
$ref: ./paths/template/removeTemplateById.yaml
/template/filter:
$ref: ./paths/template/filterTemplates.yaml
/template/names:
$ref: ./paths/template/getTemplateNames.yaml
/template/validate:
$ref: ./paths/template/validateTemplate.yaml
# References
/reference:
$ref: ./paths/reference/insertReferences.yaml # /template/references
/reference/{id}:
$ref: ./paths/reference/removeReferences.yaml # /template/{templateId}/reference/{id}
/reference/filter:
$ref: ./paths/reference/filterReferences.yaml
# Default references
/reference/default:
$ref: ./paths/reference/default/insertDefaultReference.yaml # /template/{id}/default
/reference/default/{id}:
$ref: ./paths/reference/default/removeDefaultReference.yaml # /template/{id}/default
/reference/default/filter:
$ref: ./paths/reference/default/filterDefaultReferences.yaml
# Emulation
/emulation:
$ref: ./paths/emulation/getTemplatesFlowByPartyAndShop.yaml # /rules
servers:
- url: 'https://fb-management:8080/fb-management/v1'

View File

@ -0,0 +1,65 @@
get:
summary: Поиск логов аудита
operationId: filterLogs
tags:
- audit
required:
- commandTypes
parameters:
- name: commandTypes
type: array
in: query
items:
type: string
- name: objectTypes
type: array
in: query
items:
type: string
- name: from
type: string
in: query
- name: to
type: string
in: query
- name: lastId
type: string
in: query
- name: name
type: string
in: query
- name: searchValue
type: string
in: query
- name: sortBy
type: string
in: query
- name: sortFieldValue
type: string
in: query
- name: sortOrder
type: string
in: query
enum:
- ASC
- DESC
- DEFAULT
- name: size
type: int32
in: query
responses:
'201':
description: Audit logs
content:
application/json:
schema:
$ref: '../../components/responses/audit/FilterLogsResponse.yaml'
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found

View File

@ -0,0 +1,25 @@
get:
summary: Список команд
operationId: getCommandTypes
tags:
- audit
parameters:
- name: id
type: string
in: query
responses:
'201':
description: Command types list
content:
application/json:
schema:
$ref: '../../components/responses/audit/ListResponse.yaml'
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found

View File

@ -0,0 +1,25 @@
get:
summary: Список объектов
operationId: getObjectTypes
tags:
- audit
parameters:
- name: name
type: string
in: query
responses:
'201':
description: Object types list
content:
application/json:
schema:
$ref: '../../components/responses/audit/ListResponse.yaml'
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
delete:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
delete:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

View File

@ -0,0 +1,6 @@
post:
summary: Test
operationId: test
tags:
- test

6272
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "rbkmoney-fraudbusters-management-api",
"version": "1.0.0",
"dependencies": {
"@redocly/openapi-cli": "^1.0.0-beta.53",
"json-merge-patch": "^1.0.0",
"redoc-cli": "^0.9.8"
},
"private": true,
"scripts": {
"start": "openapi preview-docs",
"build": "openapi bundle -o web_deploy/openapi.yaml && openapi bundle -o web_deploy/openapi.json",
"validate": "openapi lint"
}
}

50
plugins/local.js Normal file
View File

@ -0,0 +1,50 @@
const jsonmergepatch = require('json-merge-patch');
module.exports = {
id: 'local',
preprocessors: {
oas3: {
'merge-schemas': MergeSchemas
}
}
};
function MergeSchemas() {
const trigger = 'x-mergeSchemas';
return {
Schema: {
leave(node, ctx) {
if (!node[trigger]) {
return;
}
var schemas = node[trigger];
if (!Array.isArray(schemas)) {
return ctx.report({
message: "Argument should be an array of schemas",
location: ctx.location.child(trigger)
});
}
let merged = null;
for (index = schemas.length - 1; index >= 0; --index) {
let schema = schemas[index];
if (typeof schema !== 'object') {
return ctx.report({
message: "Non-object value",
location: ctx.location.child(trigger).child(index)
});
}
if (schema.$ref && typeof schema.$ref === 'string') {
schema = ctx.resolve(schema).node;
}
merged = jsonmergepatch.apply(merged, schema);
console.log(merged);
};
Object.assign(node, merged);
delete node[trigger];
}
}
}
}

206
pom.xml Normal file
View File

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.rbkmoney</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>swag-fraudbusters-management</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Messages</name>
<description>Generates jar artifact containing compiled swagger classes based on generated swagger yaml files
</description>
<properties>
<default.package>com.rbkmoney.swag.fraudbusters.management</default.package>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-plugin-version>1.0.0</maven-plugin-version>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<slf4j-version>1.7.21</slf4j-version>
<junit-version>4.12</junit-version>
<servlet-api-version>2.5</servlet-api-version>
<jackson-version>2.11.2</jackson-version>
<spring-version>2.3.4.RELEASE</spring-version>
<javax-annotation-api-version>1.3.2</javax-annotation-api-version>
<jaxb-version>2.3.1</jaxb-version>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-version}</version>
<scope>provided</scope>
</dependency>
<!--Spring dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>${spring-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>${spring-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-api-version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>server</id>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>spring-server</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>web_deploy/openapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<apiPackage>${default.package}.api</apiPackage>
<modelPackage>${default.package}.model</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>client</id>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>remote</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>web_deploy/openapi.yaml</inputSpec>
<generatorName>java</generatorName>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<library>resttemplate</library>
<apiPackage>${default.package}.api</apiPackage>
<modelPackage>${default.package}.model</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

25
web/index.html Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>API Reference | ReDoc</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="favicon.png">
<!--
ReDoc uses font options from the parent element
So override default browser styles
-->
<style>
body {
margin: 0;
padding: 0;
}
</style>
{{{redocHead}}}
</head>
<body>
{{{redocHTML}}}
</body>
</html>