Skip to content
Snippets Groups Projects
Commit 9c1df332 authored by Filip Piták's avatar Filip Piták
Browse files

Merge branch 'develop' into 'transaction-develop'

merge Develop into feature branch

See merge request xpitak/PA165-Banking-System!14
parents 57b6d4cb 9b13b20b
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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:
......
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"
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"
File deleted
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
#Generated by Maven
#Fri Apr 19 11:06:31 CEST 2024
artifactId=account-query-api
groupId=cz.muni.pa165.banking
version=1.0-SNAPSHOT
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
#Generated by Maven
#Fri Apr 19 11:06:31 CEST 2024
artifactId=transaction-api
groupId=cz.muni.pa165.banking
version=1.0-SNAPSHOT
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment