openapi: 3.0.3 info: title: Banking API description: |- Lucas Mathews - Fontys Student ID: 5023572 contact: email: 522499@student.fontys.nl version: 3.0.0 servers: - url: http://127.0.0.1:81 tags: - name: client description: Operations for Client Accounts - name: account description: Operations for Bank Accounts - name: transaction description: Operations for Transactions - name: auth description: Operations for Authentication - name: system description: Operations for System - name: admin description: Operations for Admin paths: /Client/Login: post: tags: - auth summary: Log in to the system description: Log in to the system operationId: manager.login parameters: - name: client_id in: query description: client_id required: true schema: type: string - name: password in: query description: Password required: true schema: type: string responses: '200': description: Successful operation '401': description: Invalid Client ID/password supplied /Client/Logout: post: tags: - auth summary: Log out from the system description: Log out from the system operationId: manager.logout responses: '200': description: Successful operation '404': description: Already logged out /Client/Status: get: tags: - auth summary: Get login status description: Get login status operationId: manager.status responses: '200': description: Logged in '400': description: Not logged in /Client/Password: put: tags: - auth summary: Change password description: Change password operationId: manager.change_password parameters: - name: client_id in: query description: ID of client to change password required: true schema: type: string - name: password in: query description: New password required: true schema: type: string - name: new_password in: query description: New password required: true schema: type: string - name: otp in: query description: OTP to verify required: true schema: type: integer format: int32 responses: '200': description: Password changed successfully '400': description: Old password incorrect '404': description: client_id not found /OTP/Generate: get: tags: - auth summary: Generate OTP description: Generate OTP operationId: manager.generate_otp parameters: - name: client_id in: query description: ID of client to generate OTP required: true schema: type: string responses: '200': description: OTP generated '401': description: Unauthorised '400': description: OTP not valid '404': description: client_id not found /Client/Client: put: tags: - client summary: Update an existing client description: Update an existing client Id operationId: manager.update_client parameters: - name: client_id in: query description: ID of client to update required: true schema: type: string - name: name in: query description: Client Name required: false schema: type: string - name: birthdate in: query description: Client Birthdate (dd-mm-yyyy) required: false schema: type: string - name: address in: query description: Client Address required: false schema: type: string - name: phone_number in: query description: Client Phone Number required: false schema: type: string - name: email in: query description: Client Email Address required: false schema: type: string - name: notes in: query description: Notes about client required: false schema: type: string responses: '200': description: Successful operation '400': description: Invalid Client ID supplied get: tags: - client summary: Get a client by ID description: Get a client by ID operationId: manager.get_client parameters: - name: client_id in: query description: ID of client to return required: true schema: type: string responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Client' '400': description: Invalid Client ID supplied '404': description: Client not found /Account: post: tags: - account summary: Add a new account description: Add a new account to the system operationId: manager.add_account parameters: - name: client_id in: query description: ID of client to add account to required: true schema: type: string - name: description in: query description: Account description required: true schema: type: string - name: account_type in: query description: Type of account required: true schema: type: string - name: notes in: query description: Notes about account required: false schema: type: string responses: '200': description: Successful operation '400': description: Invalid input '404': description: client_id not found put: tags: - account summary: Update an existing account description: Update an existing account operationId: manager.update_account parameters: - name: account_id in: query description: ID of account to update required: true schema: type: string - name: description in: query description: Account description required: false schema: type: string - name: account_type in: query description: Type of account required: false schema: type: string - name: notes in: query description: Notes about account required: false schema: type: string responses: '200': description: Successful operation '400': description: Invalid Account ID supplied get: tags: - account summary: Get an account by ID description: Get an account by ID operationId: manager.get_account parameters: - name: account_id in: query description: ID of account to return required: true schema: type: string responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Invalid Account ID supplied '404': description: Account not found /Transaction: get: tags: - transaction summary: Get a transaction by ID description: Get a transaction by ID operationId: manager.get_transaction parameters: - name: transaction_id in: query description: ID of transaction to return required: true schema: type: string responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Transaction' '400': description: Invalid Transaction ID supplied '404': description: Transaction not found post: tags: - transaction summary: Add a new transaction description: Add a new transaction to the system operationId: manager.add_transaction parameters: - name: amount in: query description: Amount of transaction required: true schema: type: integer format: int32 - name: account_id in: query description: Account number the money paid from required: true schema: type: string - name: recipient_account_id in: query description: Recipient account_id required: true schema: type: string - name: description in: query description: Description of transaction required: false schema: type: string responses: '200': description: Successful operation '400': description: Invalid input '401': description: Insufficient funds '404': description: account_id not Found /Transaction/History: get: tags: - transaction summary: Get transaction history description: Get transaction history operationId: manager.transaction_history parameters: - name: account_id in: query description: ID of account to return required: true schema: type: string responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Transaction' '400': description: Invalid input '404': description: No transactions found /Admin/Interest: post: tags: - admin summary: Apply interest description: Apply interest to account operationId: manager.apply_interest requestBody: description: Apply interest to account content: application/json: schema: $ref: '#/components/schemas/Account' required: true responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Invalid input '422': description: Validation exception put: tags: - admin summary: Apply fee description: Apply fee to account operationId: manager.apply_fee requestBody: description: Apply fee to account content: application/json: schema: $ref: '#/components/schemas/Account' required: true responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Invalid input '422': description: Validation exception /Admin/Clients: get: tags: - admin summary: Get all clients description: Get all clients operationId: manager.get_all_clients responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Client' '400': description: Invalid input '404': description: No clients found /Admin/Accounts: get: tags: - admin summary: Get all accounts description: Get all accounts operationId: manager.get_all_accounts responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Invalid input '404': description: No accounts found /Admin/Transactions: get: tags: - admin summary: Get all transactions description: Get all transactions operationId: manager.get_all_transactions responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Transaction' '400': description: Invalid input '404': description: No transactions found /System/Hash: get: tags: - system summary: Hash password description: Pass a string through the hashing algorithm operationId: manager.hash_password parameters: - name: password in: query description: Password to hash required: true schema: type: string responses: '200': description: Successful operation content: application/json: schema: type: string '400': description: Invalid input '401': description: Unauthorised /System/Timestamp: get: tags: - system summary: Get the timestamp description: Gets the date and time in the appropriate format operationId: manager.timestamp responses: '200': description: Successful operation content: application/json: schema: type: string '400': description: Invalid input '401': description: Unauthorised /Admin/Balance: get: tags: - admin summary: Test the balance of all accounts description: Tests the balance of all accounts and alerts of any discrepancies operationId: manager.test_account_balances responses: '200': description: Successful operation content: application/json: schema: type: string '401': description: Unauthorised /System/Initialise: get: tags: - system summary: Initialise the system description: Initialises the system with test data operationId: manager.initialise_database parameters: - name: password in: query description: Password to initialise the system required: true schema: type: string - name: email in: query description: Email to initialise the system required: true schema: type: string responses: '200': description: Successful operation '400': description: Database not empty, this function cannot be used /Admin/Promote: put: tags: - admin summary: Promote a client to administrator description: Promote a client to administrator operationId: manager.promote_to_admin parameters: - name: client_id in: query description: ID of client to promote required: true schema: type: string responses: '200': description: Successful operation '401': description: Unauthorised '404': description: Client not found /Admin/Demote: put: tags: - admin summary: Demote a client from administrator description: Demote a client from administrator operationId: manager.demote_from_admin parameters: - name: client_id in: query description: ID of client to demote required: true schema: type: string responses: '200': description: Successful operation '401': description: Unauthorised '404': description: Client not found /Admin/Client: post: tags: - admin summary: Add a new client description: Add a new client to the system operationId: manager.add_client parameters: - name: name in: query description: Client Name required: true schema: type: string - name: birthdate in: query description: Client Birthdate (dd-mm-yyyy) required: true schema: type: string - name: address in: query description: Client Address required: false schema: type: string - name: phone_number in: query description: Client Phone Number required: true schema: type: string - name: email in: query description: Client Email Address required: true schema: type: string - name: password in: query description: Client Password required: true schema: type: string - name: notes in: query description: Notes about client required: false schema: type: string responses: '200': description: "Client created" '400': description: Invalid input '422': description: Validation exception /Delete/Client: delete: tags: - admin summary: Delete a client by ID description: Delete a client by ID operationId: manager.delete_client parameters: - name: client_id in: query description: ID of client to delete required: true schema: type: string format: int32 responses: '200': description: Successful operation '400': description: Invalid Client ID supplied '404': description: Client not found /Delete/Account: delete: tags: - admin summary: Delete an account by ID description: Delete an account by ID operationId: manager.delete_account parameters: - name: account_id in: query description: ID of account to delete required: true schema: type: string format: int32 responses: '200': description: Successful operation '400': description: Invalid account_id supplied '404': description: Account not found components: schemas: Client: type: object properties: client_id: type: integer format: int32 name: type: string birthdate: type: string opening_timestamp: type: string address: type: string phone_number: type: string email: type: string password: type: string notes: type: string enabled: type: boolean administator: type: boolean example: client_id: 1 name: "Lucas Mathews" birthdate: "21-05-1980" opening_timestamp: "17-04-2022 16:21:12" address: "Rachelsmolen 1, 5612MA, Eindhoven" phone_number: "0612345678" email: "john.d@fontys.nl" password: "password" notes: "This is a test client" enabled: true administator: false Account: type: object properties: account_id: type: integer format: int32 client_id: type: string decription: type: string opening_timestamp: type: string account_type: type: string balance: type: number enabled: type: boolean notes: type: string transactons: type: array example: account_id: 1 client_id: 1 description: "Savings Account" opening_timestamp: "17-04-2022 16:21:12" account_type: "Rachelsmolen 1, 5612MA, Eindhoven" balance: 2314.23 enabled: true notes: "This is a savings account" Transaction: type: object properties: transaction_id: type: integer format: int32 transaction_type: type: string amount: type: integer format: int32 timestamp: type: string description: type: string account_to: type: string recipient_account_number: type: string example: transaction_id: 1 transaction_type: "Deposit" amount: 100.00 timestamp: "17-04-2022 16:21:12" description: "Deposit to Savings Account" account_id: "NL12ABNA0123456789" recipient_account_id: "NL12ABNA1234567890"