diff --git a/.gitignore b/.gitignore index fa82665234a6d857933233813edbd1d906b63cae..f511d17dce64d0d26fa28d577867b6161cab3c58 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ account-management/.idea/ account-query/.idea/ transaction-processor/.idea/ +infrastructure/.idea/ +m2m-banking-api/.idea/ ### Account management ### account-management/target/ @@ -21,4 +23,15 @@ account-query/!**/src/test/**/target/ transaction-processor/target/ transaction-processor/!.mvn/wrapper/maven-wrapper.jar transaction-processor/!**/src/main/**/target/ -transaction-processor/!**/src/test/**/target/ \ No newline at end of file +transaction-processor/!**/src/test/**/target/ + +### Infrastructure ### +infrastructure/target/ +infrastructure/!.mvn/wrapper/maven-wrapper.jar +infrastructure/!**/src/main/**/target/ +infrastructure/!**/src/test/**/target/ + +### API ### +m2m-banking-api/account-management-api/target +m2m-banking-api/account-query-api/target +m2m-banking-api/transaction-api/target diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2896443c3844d3bc74b080fb6b8af1ab17a121a..d8539270ba7dae603d99264715d4cb89ae3b2bec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,10 +19,6 @@ build: - mvn -f ./account-query clean install $MAVEN_CLI_OPTS - mvn -f ./account-management clean install $MAVEN_CLI_OPTS - mvn -f ./transaction-processor clean install $MAVEN_CLI_OPTS - artifacts: - expire_in: 10 min - paths: - - "*/target/*.jar" test: tags: diff --git a/build_artifacts.sh b/build_artifacts.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb5803b1e1d97d1424b24b46023658bdf9a02131 --- /dev/null +++ b/build_artifacts.sh @@ -0,0 +1,11 @@ +function install() { + mvn -f "./$1" clean install -Dmaven.test.skip=true +} + +echo "Building JAR artifacts" + +install "infrastructure" +install "m2m-banking-api" +install "account-management" +install "account-query" +install "transaction-processor" diff --git a/build_images.sh b/build_images.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea402d52f62b0625b88435f7d597d769aad55c7e --- /dev/null +++ b/build_images.sh @@ -0,0 +1,15 @@ +echo "Building JAR artifacts" + +./build_artifacts.sh > /dev/null 2>&1 + +function build() { + cd "$1" || exit + docker build -t "$1" . + cd .. +} + +echo "Building docker images" + +build "account-management" +build "account-query" +build "transaction-processor" diff --git a/m2m-banking-api/account-query-api/target/account-query-api-1.0-SNAPSHOT.jar b/m2m-banking-api/account-query-api/target/account-query-api-1.0-SNAPSHOT.jar deleted file mode 100644 index 87ec1c1c62a361fbce5fab9ef6c547ad43f9ff6c..0000000000000000000000000000000000000000 Binary files a/m2m-banking-api/account-query-api/target/account-query-api-1.0-SNAPSHOT.jar and /dev/null differ diff --git a/m2m-banking-api/account-query-api/target/classes/openapi.yaml b/m2m-banking-api/account-query-api/target/classes/openapi.yaml deleted file mode 100644 index 344ed566183609927723e57bc97646414b7b7065..0000000000000000000000000000000000000000 --- a/m2m-banking-api/account-query-api/target/classes/openapi.yaml +++ /dev/null @@ -1,260 +0,0 @@ -openapi: 3.0.1 -info: - title: Pa165 Project Banking Application Account Query - description: | - Hand-made OpenAPI document. - version: 1.0.0 -servers: - - url: "http://localhost:8080" -tags: - - name: CustomerService - description: Service to be used by customer of bank - - name: SystemService - description: Service to be used by other services of bank - - name: EmployeeService - description: Service to be used by employees of bank -components: - schemas: - TransactionType: - type: string - enum: [ WITHDRAW, DEPOSIT, CREDIT, CROSS_ACCOUNT_PAYMENT, REFUND ] - description: type of transaction - Transaction: - title: A transaction - description: A object representing one transaction - properties: - transactionType: - $ref: "#/components/schemas/TransactionType" - amount: - type: number - description: amount of money in transaction - example: 10 - date: - type: string - description: time when the transaction happened - format: date-time - processId: - type: string - format: uuid - description: id of transaction issued by transaction processor - - Balance: - title: A balance - description: Balance object keeping balance of ones account as well as all transactions that led to it. - required: - - id - properties: - id: - type: string - description: id of account with this balance - example: id1 - amount: - type: number - description: balance of account right now - example: 10 - transactions: - type: array - items: - $ref: '#/components/schemas/Transaction' - description: all transactions of this account in list - - TransactionStatistics: - title: statistics about one type of transaction - properties: - transactionType: - $ref: "#/components/schemas/TransactionType" - amountIn: - type: number - description: amount of money got by this type of transactions - example: 1002 - amountOut: - type: number - description: amount of money spent by this type of transactions - example: 1184 - timesIn: - type: number - description: number of times this type of transaction was used to get money - example: 12 - timesOut: - type: number - description: number of times this type of transaction was used to spend money - example: 13 - avgIn: - type: number - description: average amount of money regarding charging account - example: 120 - avgOut: - type: number - description: average amount of money regarding spending money - example: 14 - - TransactionsReport: - title: statistical report about one account - properties: - totalAmount: - $ref: '#/components/schemas/TransactionStatistics' - depositAmount: - $ref: '#/components/schemas/TransactionStatistics' - withdrawalAmount: - $ref: '#/components/schemas/TransactionStatistics' - crossAccountAmount: - $ref: '#/components/schemas/TransactionStatistics' - creditAmount: - $ref: '#/components/schemas/TransactionStatistics' - -paths: - /balance/new: - post: - tags: - - SystemService - summary: creates a balance - operationId: createBalance - parameters: - - { name: id, in: query, required: true, schema: { type: string }, description: "id of account" } - responses: - "201": - description: OK - - /balance: - delete: - tags: - - SystemService - summary: deletes a balance - operationId: deleteBalance - parameters: - - { name: id, in: query, required: true, schema: { type: string }, description: "id of account" } - responses: - "200": - description: OK - - /balance/add: - post: - tags: - - SystemService - summary: adds transaction to existing balance - operationId: addTransactionToBalance - parameters: - - { name: id, in: query, required: true, schema: { type: string }, description: "id of account" } - - { name: amount, in: query, required: true, schema: { type: number }, description: "amount of money in transaction" } - - { name: processId, in: query, required: true, schema: { type: string, format: uuid }, description: "id of process which this transaction is part of" } - - { name: type, in: query, required: true, schema: { $ref: "#/components/schemas/TransactionType" }, description: "type of transaction" } - responses: - "200": - description: OK - "400": - description: NOK - content: - application/json: - schema: - type: string - description: reason of failure - - /balance/status: - get: - tags: - - CustomerService - - SystemService - summary: returns account balance status - operationId: getBalance - parameters: - - { name: id, in: query, required: true, schema: { type: string }, description: "id of account" } - responses: - "200": - description: OK - content: - application/json: - schema: - type: number - description: accounts balance - "400": - description: NOK - content: - application/json: - schema: - type: string - description: reason of failure - - /balance/transactions: - get: - tags: - - CustomerService - - SystemService - summary: returns transactions of specific account for specific time interval - operationId: getTransactions - parameters: - - { name: id, in: query, required: true, schema: { type: string }, description: "id of account" } - - { name: beginning, in: query, required: true, schema: { type: string, format: date }, description: "date from which onwards the transactions happened" } - - { name: end, in: query, required: true, schema: { type: string, format: date }, description: "date before which wanted transactions happened" } - - { name: minAmount, in: query, required: false, schema: { type: number }, description: "minimal amount of money included in transaction to be reported" } - - { name: maxAmount, in: query, required: false, schema: { type: number }, description: "maximal amount of money included in transaction to be reported" } - - { name: type, in: query, required: false, schema: { $ref: "#/components/schemas/TransactionType" }, description: "type of transactiops to be included in returned ones" } - responses: - "200": - description: OK - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Transaction" - "400": - description: NOK - content: - application/json: - schema: - type: string - description: reason of failure - - /balance/alltransactions: - get: - tags: - - EmployeeService - summary: returns all transactions for specific time interval - operationId: getAllTransactions - parameters: - - { name: beginning, in: query, required: true, schema: { type: string, format: date }, description: "date from which onwards the transactions happened" } - - { name: end, in: query, required: true, schema: { type: string, format: date }, description: "date before which wanted transactions happened" } - - { name: minAmount, in: query, required: false, schema: { type: number }, description: "minimal amount of money included in transaction to be reported" } - - { name: maxAmount, in: query, required: false, schema: { type: number }, description: "maximal amount of money included in transaction to be reported" } - - { name: type, in: query, required: false, schema: { $ref: "#/components/schemas/TransactionType" }, description: "type of transactiops to be included in returned ones" } - responses: - "200": - description: OK - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Transaction" - "400": - description: NOK - content: - application/json: - schema: - type: string - description: reason of failure - - /balance/account/report: - get: - tags: - - EmployeeService - summary: creates a report of spending statistics for one user - operationId: createReport - parameters: - - { name: id, in: query, required: true, schema: { type: string }, description: "id of account" } - - { name: beginning, in: query, required: true, schema: { type: string, format: date }, description: "date from which onwards the transactions wanted in report happened" } - - { name: end, in: query, required: true, schema: { type: string, format: date }, description: "date before which wanted transactions wanted in report happened" } - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionsReport' - "400": - description: NOK - content: - application/json: - schema: - type: string - description: reason of failure diff --git a/m2m-banking-api/account-query-api/target/maven-archiver/pom.properties b/m2m-banking-api/account-query-api/target/maven-archiver/pom.properties deleted file mode 100644 index f6e39b77869d7f19c89051e645c7a47587163517..0000000000000000000000000000000000000000 --- a/m2m-banking-api/account-query-api/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Fri Apr 19 11:06:31 CEST 2024 -artifactId=account-query-api -groupId=cz.muni.pa165.banking -version=1.0-SNAPSHOT diff --git a/m2m-banking-api/transaction-api/target/classes/openapi.yaml b/m2m-banking-api/transaction-api/target/classes/openapi.yaml deleted file mode 100644 index f28a6e3fd226e1b5f1816b898d9eae49707dc6c4..0000000000000000000000000000000000000000 --- a/m2m-banking-api/transaction-api/target/classes/openapi.yaml +++ /dev/null @@ -1,159 +0,0 @@ -openapi: 3.0.1 -info: - title: Transaction Processor API - description: Public API of Online Banking System - Transaction Processor - version: 1.0.0 -servers: - - url: "localhost:8081" -tags: - - name: Transaction - description: API for transaction requests - - name: ProcessorApi - description: API for administration of transaction processes - -paths: - /transaction/v1/process: - put: - tags: - - Transaction - operationId: create-transaction-process - summary: Create a new request for a transaction to be processed - description: | - Method starts a new process for processing a transaction request defined by the input. - After a process is created successfully, it is being handled asynchronous. Method replies with a JSON object - containing a unique identifier of the created process, status and a message explaining the status. - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionDto' - responses: - '201': - description: Process created, sent unique identifier assigned to new process. - content: - application/json: - schema: - $ref: '#/components/schemas/ProcessDto' - - /transaction/v1/status: - get: - tags: - - Transaction - operationId: status - summary: Get information about a existing transaction process - description: | - Method finds an existing process for a transaction request, returning all information about it's state - and further information regarding errors. - parameters: - - in: header - name: x-process-uuid - schema: - type: string - format: uuid - required: true - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ProcessDetailDto' - '404': - description: Resource or process by UUID not found - - /transaction/v1/revert: - post: - tags: - - Transaction - operationId: revert-transaction-process - summary: Revert a transaction - description: | - Method finds an existing process for a transaction request, which has been executed successfully, and reverts - the changes done - parameters: - - in: header - name: x-process-uuid - schema: - type: string - format: uuid - required: true - responses: - '200': - description: Process found and created new process reverting changes in accounts - content: - application/json: - schema: - $ref: '#/components/schemas/ProcessDto' - '400': - description: Process found by UUID but not in expected state (PROCESSED) - '404': - description: Resource or process by UUID not found - -components: - schemas: - TransactionTypeDto: - type: string - enum: - - WITHDRAW - - DEPOSIT - - CROSS_ACCOUNT - - SCHEDULED - description: Enumaration defining a type for a transaction. Each type may have different certain implementations and validations. - - AccountDto: - type: object - properties: - accountNumber: - type: string - description: Account number - - MoneyDto: - type: object - properties: - amount: - type: number - currency: - type: string - description: Currency code, short abbreviation of 3 characters such as 'EUR' or 'CZK'. - - TransactionDto: - type: object - properties: - source: - $ref: '#/components/schemas/AccountDto' - target: - $ref: '#/components/schemas/AccountDto' - type: - $ref: '#/components/schemas/TransactionTypeDto' - amount: - $ref: '#/components/schemas/MoneyDto' - detail: - type: string - description: Message or detail for transaction, holding user specified information - - StatusDto: - type: string - enum: - - CREATED - - PENDING - - PROCESSED - - FAILED - - ProcessDto: - type: object - properties: - identifier: - type: string - format: uuid - status: - $ref: '#/components/schemas/StatusDto' - info: - type: string - description: Message detail regarding process status, e.g. reason of failure or result of process. - - ProcessDetailDto: - allOf: - - $ref: '#/components/schemas/ProcessDto' - - $ref: '#/components/schemas/TransactionDto' - \ No newline at end of file diff --git a/m2m-banking-api/transaction-api/target/maven-archiver/pom.properties b/m2m-banking-api/transaction-api/target/maven-archiver/pom.properties deleted file mode 100644 index 2c726c8c8d0207eea0ac8150385b8fe3486e85dd..0000000000000000000000000000000000000000 --- a/m2m-banking-api/transaction-api/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Fri Apr 19 11:06:31 CEST 2024 -artifactId=transaction-api -groupId=cz.muni.pa165.banking -version=1.0-SNAPSHOT diff --git a/m2m-banking-api/transaction-api/target/transaction-api-1.0-SNAPSHOT.jar b/m2m-banking-api/transaction-api/target/transaction-api-1.0-SNAPSHOT.jar deleted file mode 100644 index 3c5388127cf62ddc9b8f0a54a63f92c1ea60d4d2..0000000000000000000000000000000000000000 Binary files a/m2m-banking-api/transaction-api/target/transaction-api-1.0-SNAPSHOT.jar and /dev/null differ