├── .github ├── dependabot.yml └── workflows │ ├── maven-publish.yml │ └── qodana_code_quality.yml ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── Dockerfile ├── Dockerfile-Jenkins-Maven ├── Jenkinsfile ├── README.md ├── img ├── dashboard1.png ├── dashboard2.png ├── deposit.png ├── login.png └── signup.png ├── logs └── browserstack-plugin.log ├── mvnw ├── mvnw.cmd ├── pom.xml ├── qodana.yaml └── src ├── main ├── java │ └── com │ │ └── hendisantika │ │ └── onlinebanking │ │ ├── OnlineBankingApplication.java │ │ ├── config │ │ ├── RequestFilter.java │ │ └── SecurityConfig.java │ │ ├── controller │ │ ├── AccountController.java │ │ ├── AppointmentController.java │ │ ├── HomeController.java │ │ ├── TransferController.java │ │ └── UserController.java │ │ ├── entity │ │ ├── Appointment.java │ │ ├── PrimaryAccount.java │ │ ├── PrimaryTransaction.java │ │ ├── Recipient.java │ │ ├── SavingsAccount.java │ │ ├── SavingsTransaction.java │ │ └── User.java │ │ ├── repository │ │ ├── AppointmentDao.java │ │ ├── PrimaryAccountDao.java │ │ ├── PrimaryTransactionDao.java │ │ ├── RecipientDao.java │ │ ├── RoleDao.java │ │ ├── SavingsAccountDao.java │ │ ├── SavingsTransactionDao.java │ │ └── UserDao.java │ │ ├── resource │ │ ├── AppointmentResource.java │ │ └── UserResource.java │ │ ├── security │ │ ├── Authority.java │ │ ├── Role.java │ │ └── UserRole.java │ │ └── service │ │ ├── AccountService.java │ │ ├── AppointmentService.java │ │ ├── TransactionService.java │ │ ├── UserService.java │ │ └── UserServiceImpl │ │ ├── AccountServiceImpl.java │ │ ├── AppointmentServiceImpl.java │ │ ├── TransactionServiceImpl.java │ │ ├── UserSecurityService.java │ │ ├── UserSecurityServiceImpl.java │ │ └── UserServiceImpl.java └── resources │ ├── application.properties │ ├── db │ └── migration │ │ ├── V1__20200405_Init_Primary_Account_Tables_Data.sql │ │ ├── V2__20200405_Init_Savings_Account_Tables_Data.sql │ │ ├── V3__20200405_Init_User_Tables_Data.sql │ │ ├── V4__20190307_Init_Appointment_Tables_Data.sql │ │ ├── V5__20200405_Init_Primary_Transaction_Tables_Data.sql │ │ ├── V6__20200405_Init_Recipient_Tables_Data.sql │ │ ├── V7__20200405_Init_Role_Tables_Data.sql │ │ ├── V8__20200405_Init_Savings_Transaction_Tables_Data.sql │ │ └── V9__20200405_Init_User_Role_Tables_Data.sql │ ├── sql │ ├── V1__20190307_Create_Tables_Online_Banking.sql │ └── V2__20190307_Init_Data_Online_Banking.sql │ ├── static │ ├── css │ │ ├── bootstrap-datetimepicker.css │ │ ├── bootstrap-datetimepicker.min.css │ │ ├── bootstrap.css │ │ ├── bootstrap.min.css │ │ ├── dataTables.bootstrap.min.css │ │ ├── dataTables.jqueryui.min.css │ │ ├── dataTables.uikit.min.css │ │ ├── jquery.dataTables.min.css │ │ ├── jquery.dataTables_themeroller.css │ │ └── main.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── images │ │ ├── banner.png │ │ ├── banner2.png │ │ └── bg.png │ └── js │ │ ├── bootbox.min.js │ │ ├── bootstrap-datetimepicker.min.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── dataTables.bootstrap.min.js │ │ ├── dataTables.jqueryui.min.js │ │ ├── dataTables.uikit.min.js │ │ ├── jquery.dataTables.min.js │ │ ├── jquery.easing.min.js │ │ ├── jquery.js │ │ └── main.js │ └── templates │ ├── appointment.html │ ├── betweenAccounts.html │ ├── common │ ├── header.html │ └── index.html │ ├── deposit.html │ ├── index.html │ ├── primaryAccount.html │ ├── profile.html │ ├── recipient.html │ ├── savingsAccount.html │ ├── signup.html │ ├── toSomeoneElse.html │ ├── userFront.html │ └── withdraw.html └── test └── java └── com └── hendisantika └── onlinebanking └── OnlineBankingApplicationTests.java /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: maven 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: '05:00' 8 | timezone: Asia/Jakarta 9 | open-pull-requests-limit: 10 10 | - package-ecosystem: "github-actions" 11 | directory: "/" 12 | schedule: 13 | interval: "daily" 14 | -------------------------------------------------------------------------------- /.github/workflows/maven-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created 2 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path 3 | 4 | name: Maven Package 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: read 16 | packages: write 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Set up JDK 21 21 | uses: actions/setup-java@v4 22 | with: 23 | java-version: '21' 24 | distribution: 'temurin' 25 | server-id: github # Value of the distributionManagement/repository/id field of the pom.xml 26 | settings-path: ${{ github.workspace }} # location for the settings.xml file 27 | 28 | - name: Setup Testcontainers Cloud Client 29 | uses: atomicjar/testcontainers-cloud-setup-action@v1 30 | env: 31 | TC_CLOUD_TOKEN: ${{ secrets.TC_CLOUD_TOKEN }} 32 | TC_CLOUD_LOGS_TRACE: true 33 | 34 | - name: Build with Maven 35 | run: mvn -B package --file pom.xml 36 | -------------------------------------------------------------------------------- /.github/workflows/qodana_code_quality.yml: -------------------------------------------------------------------------------- 1 | name: Qodana 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | push: 6 | branches: # Specify your branches here 7 | - main # The 'main' branch 8 | - 'releases/*' # The release branches 9 | 10 | jobs: 11 | qodana: 12 | runs-on: ubuntu-latest 13 | permissions: 14 | contents: write 15 | pull-requests: write 16 | checks: write 17 | steps: 18 | - uses: actions/checkout@v4 19 | with: 20 | ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit 21 | fetch-depth: 0 # a full history is required for pull request analysis 22 | - name: 'Qodana Scan' 23 | uses: JetBrains/qodana-action@v2025.1 24 | with: 25 | pr-mode: false 26 | env: 27 | QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_1948115938 }} 28 | QODANA_ENDPOINT: 'https://qodana.cloud' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | #FROM openjdk 2 | FROM maven 3 | MAINTAINER "hendisantika@yahoo.co.id" 4 | 5 | ## Install maven 6 | #RUN apt-get update 7 | #RUN apt-get install -y maven 8 | 9 | WORKDIR /code 10 | 11 | # Prepare by downloading dependencies 12 | ADD pom.xml /code/pom.xml 13 | #RUN ["mvn", "dependency:resolve"] 14 | # RUN ["mvn", "verify"] 15 | 16 | # Adding source, compile and package into a fat jar 17 | ADD src /code/src 18 | RUN ["mvn", "package", "-DskipTests"] 19 | 20 | EXPOSE 8080 21 | CMD ["java", "-jar", "target/online-bank-0.0.1-SNAPSHOT.jar"] -------------------------------------------------------------------------------- /Dockerfile-Jenkins-Maven: -------------------------------------------------------------------------------- 1 | FROM jenkins/jenkins 2 | # if we want to install via apt 3 | USER root 4 | RUN apt-get update && apt-get install -y maven && (curl -sSL https://get.docker.com/ | sh) 5 | # drop back to the regular jenkins user - good practice 6 | USER jenkins -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | parameters { 4 | string(name: 'MYSQL_ROOT_PASSWORD', defaultValue: 'root', description: 'MySQL password') 5 | } 6 | stages { 7 | stage ("Initialize Jenkins Env") { 8 | steps { 9 | sh ''' 10 | echo "PATH = ${PATH}" 11 | echo "M2_HOME = ${M2_HOME}" 12 | ''' 13 | } 14 | } 15 | stage('Download Code') { 16 | steps { 17 | echo 'checking out' 18 | checkout scm 19 | } 20 | } 21 | stage('Execute Tests'){ 22 | steps { 23 | echo 'Testing' 24 | sh 'mvn test' 25 | } 26 | } 27 | stage('Build Application'){ 28 | steps { 29 | echo 'Building...' 30 | sh 'mvn clean install -Dmaven.test.skip=true' 31 | } 32 | } 33 | stage('Build Docker Image') { 34 | steps { 35 | echo 'Building Docker image' 36 | sh 'docker build -t hendisantika/online-banking:1 .' 37 | } 38 | } 39 | stage('Create Database') { 40 | steps { 41 | echo 'Running Database Image' 42 | // sh 'docker kill bankmysql 2> /dev/null' 43 | // sh 'docker kill cloudbank 2> /dev/null' 44 | // sh 'docker rm bankmysql 2> /dev/null' 45 | // sh 'docker rm cloudbank 2> /dev/null' 46 | sh 'docker stop bankmysql || true && docker rm bankmysql || true' 47 | sh 'docker run --detach --name=bankmysql --env="MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" -p 3306:3306 mysql' 48 | sh 'sleep 20' 49 | // sh 'docker exec -i bankmysql mysql -uroot -proot < sql_dump/onlinebanking.sql' 50 | sh 'docker exec -i bankmysql mysql -uroot -p${MYSQL_ROOT_PASSWORD} < sql_dump/onlinebanking.sql' 51 | } 52 | } 53 | stage('Deploy and Run') { 54 | steps { 55 | echo 'Running Application' 56 | sh 'docker stop cloudbank || true && docker rm cloudbank || true' 57 | sh 'docker run --detach --name=cloudbank -p 8888:8888 --link bankmysql:localhost -t hendisantika/online-banking:1' 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Online-banking-angular-springboot-mysql 2 | 3 | Online-Bank-Simulator 4 | 5 | Spring Boot/Spring Data/Spring Security/Hibernate/MySQL/REST 6 | 7 | The project simulates online banking system. It allows to register/login, deposit/withdraw money from accounts, add/edit recipients, transfer money between accounts and recipients, view transactions, make appointments. 8 | 9 | There are two roles user and admin. 10 | 11 | ## Thing to run the application 12 | 13 | __Clone the repository__ 14 | ``` 15 | git clone https://github.com/hendisantika/Online-banking-angular-springboot-mysql 16 | ``` 17 | 18 | __Go the folder__ 19 | ``` 20 | Online-banking-angular-springboot-mysql 21 | ``` 22 | 23 | __Set Your MySQL username & password in application.properties__ 24 | 25 | [application.properties](../../blob/master/src/main/resources/application.properties) 26 | 27 | __Run the application__ 28 | ``` 29 | mvn clean spring-boot:run 30 | ``` 31 | 32 | ## Screen shot 33 | 34 | ### Sign Up Page 35 | 36 | ![Sign Up Page](img/signup.png "Sign Up Page") 37 | 38 | ### Sign In Page 39 | 40 | ![Sign Up](img/login.png "Login Page") 41 | 42 | ### Dashboard Page 43 | 44 | ![Dashboard page](img/dashboard1.png "Dashboard Page") 45 | 46 | ### Deposit Page 47 | 48 | ![Deposit Page](img/deposit.png "Deposit Page") 49 | 50 | ### Dashboard Page 51 | ![Dashboard page](img/dashboard2.png "Dashboard Page") 52 | 53 | ## Spring Boot/Spring Data/Spring Security/Hibernate/MySQL/REST 54 | 55 | The project simulates online banking system. It allows to register/login, deposit/withdraw money from accounts, add/edit recipients, 56 | transfer money between accounts and recipients, view transactions, make appointments. 57 | 58 | There are two roles user and admin. 59 | 60 | The admin has there own frontend implemented in Angular2, which communicates with backend through REST services. 61 | 62 | ## Deployment Steps on Docker: 63 | ###### Download application 64 | ``` 65 | git clone https://github.com/hendisantika/online-banking.git 66 | ``` 67 | ###### Start MySQL Docker Container 68 | ``` 69 | docker run --detach --name=bankmysql --env="MYSQL_ROOT_PASSWORD=root" -p 3306:3306 mysql:8 70 | ``` 71 | ###### Run Docker image of the application 72 | ``` 73 | docker run --detach -p 8888:8888 --link bankmysql:localhost -t hendisantika/online-banking:latest 74 | ``` 75 | Access the application by clicking the URL "[http://localhost:8080!](http://localhost:8080)" 76 | 77 | ## Deployment Steps without Docker: 78 | ###### Build application 79 | ``` 80 | mvn clean build 81 | ``` 82 | ###### DB Setup 83 | * Start [MySQL server!](https://dev.mysql.com/downloads/mysql/) 84 | * Use [MySQLWorkbench!](https://www.mysql.com/products/workbench/) 85 | 86 | ###### Run application 87 | ``` 88 | java -jar target/online-banking-0.0.1-SNAPSHOT.jar 89 | ``` 90 | 91 | ## Things to know: 92 | ###### Build Docker image for the application 93 | ``` 94 | docker build -t hendisantika/online-banking:latest . 95 | ``` 96 | ###### Create Jenkins image that has Maven 97 | ``` 98 | sudo chmod 777 /var/run/docker.sock && \ 99 | mkdir -p /jenkins_bkp/jenkins_home && \ 100 | chmod -R 777 /jenkins_bkp && \ 101 | git clone https://github.com/hendisantika/online-banking.git && \ 102 | cd online-bank && \ 103 | git checkout master && \ 104 | cp Dockerfile-Jenkins-Maven ../Dockerfile && \ 105 | cd .. && \ 106 | docker build -t hendisantika/jenkins-maven-docker:v0.1 . 107 | ``` 108 | ###### Start Jenkins Server on Docker 109 | ``` 110 | docker run --detach -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) -p 9080:8080 -p 50000:50000 -v /jenkins_bkp/jenkins_home:/var/jenkins_home hendisantika/jenkins-maven-docker:v0.1 111 | ``` 112 | ###### Setup "online-banking" project in Jenkins: 113 | * Login to Jenkins and setup a pipeline project with source code from [Link to OnlineBank GIT repo!](https://github.com/hendisantika/online-banking.git) 114 | * Run the job to build and deploy the application 115 | 116 | ###### Debug H2 DB while testing 117 | * Set a debug point in any test step and check the URL "http://localhost:8080/console" while testing 118 | 119 | -------------------------------------------------------------------------------- /img/dashboard1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/img/dashboard1.png -------------------------------------------------------------------------------- /img/dashboard2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/img/dashboard2.png -------------------------------------------------------------------------------- /img/deposit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/img/deposit.png -------------------------------------------------------------------------------- /img/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/img/login.png -------------------------------------------------------------------------------- /img/signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/img/signup.png -------------------------------------------------------------------------------- /logs/browserstack-plugin.log: -------------------------------------------------------------------------------- 1 | 07:28:06.558 [ApplicationImpl pooled thread 116] INFO c.b.l.BrowserStackRunExtension - spring boot 2 | 07:28:06.559 [ApplicationImpl pooled thread 116] INFO com.browserstack.utils.Helpers - null 3 | 07:32:10.651 [ApplicationImpl pooled thread 127] INFO c.b.l.BrowserStackRunExtension - spring boot 4 | 07:32:10.652 [ApplicationImpl pooled thread 127] INFO com.browserstack.utils.Helpers - null 5 | 07:36:08.620 [ApplicationImpl pooled thread 128] INFO c.b.l.BrowserStackRunExtension - spring boot 6 | 07:36:08.620 [ApplicationImpl pooled thread 128] INFO com.browserstack.utils.Helpers - null 7 | 07:36:21.484 [ApplicationImpl pooled thread 136] INFO c.b.l.BrowserStackRunExtension - spring boot 8 | 07:36:21.484 [ApplicationImpl pooled thread 136] INFO com.browserstack.utils.Helpers - null 9 | 07:44:39.947 [ApplicationImpl pooled thread 144] INFO c.b.l.BrowserStackRunExtension - spring boot 10 | 07:44:39.947 [ApplicationImpl pooled thread 144] INFO com.browserstack.utils.Helpers - null 11 | 07:55:03.158 [ApplicationImpl pooled thread 162] INFO c.b.l.BrowserStackRunExtension - spring boot 12 | 07:55:03.158 [ApplicationImpl pooled thread 162] INFO com.browserstack.utils.Helpers - null 13 | 08:13:42.215 [ApplicationImpl pooled thread 184] INFO c.b.l.BrowserStackRunExtension - spring boot 14 | 08:13:42.216 [ApplicationImpl pooled thread 184] INFO com.browserstack.utils.Helpers - null 15 | 08:15:47.478 [ApplicationImpl pooled thread 190] INFO c.b.l.BrowserStackRunExtension - spring boot 16 | 08:15:47.478 [ApplicationImpl pooled thread 190] INFO com.browserstack.utils.Helpers - null 17 | 08:15:53.427 [ApplicationImpl pooled thread 193] INFO c.b.l.BrowserStackRunExtension - spring boot 18 | 08:15:53.427 [ApplicationImpl pooled thread 193] INFO com.browserstack.utils.Helpers - null 19 | 08:17:46.687 [ApplicationImpl pooled thread 198] INFO c.b.l.BrowserStackRunExtension - spring boot 20 | 08:17:46.688 [ApplicationImpl pooled thread 198] INFO com.browserstack.utils.Helpers - null 21 | 08:26:06.124 [ApplicationImpl pooled thread 211] INFO c.b.l.BrowserStackRunExtension - spring boot 22 | 08:26:06.124 [ApplicationImpl pooled thread 211] INFO com.browserstack.utils.Helpers - null 23 | 08:29:13.758 [ApplicationImpl pooled thread 215] INFO c.b.l.BrowserStackRunExtension - spring boot 24 | 08:29:13.758 [ApplicationImpl pooled thread 215] INFO com.browserstack.utils.Helpers - null 25 | 08:37:06.728 [ApplicationImpl pooled thread 226] INFO c.b.l.BrowserStackRunExtension - spring boot 26 | 08:37:06.729 [ApplicationImpl pooled thread 226] INFO com.browserstack.utils.Helpers - null 27 | 08:39:12.996 [ApplicationImpl pooled thread 227] INFO c.b.l.BrowserStackRunExtension - spring boot 28 | 08:39:12.996 [ApplicationImpl pooled thread 227] INFO com.browserstack.utils.Helpers - null 29 | 10:41:47.673 [ApplicationImpl pooled thread 7] INFO c.b.l.BrowserStackRunExtension - spring boot 30 | 10:41:47.674 [ApplicationImpl pooled thread 7] INFO com.browserstack.utils.Helpers - null 31 | 10:57:59.687 [ApplicationImpl pooled thread 31] INFO c.b.l.BrowserStackRunExtension - spring boot 32 | 10:57:59.687 [ApplicationImpl pooled thread 31] INFO com.browserstack.utils.Helpers - null 33 | 10:58:57.400 [ApplicationImpl pooled thread 33] INFO c.b.l.BrowserStackRunExtension - spring boot 34 | 10:58:57.400 [ApplicationImpl pooled thread 33] INFO com.browserstack.utils.Helpers - null 35 | 10:59:37.531 [ApplicationImpl pooled thread 37] INFO c.b.l.BrowserStackRunExtension - spring boot 36 | 10:59:37.531 [ApplicationImpl pooled thread 37] INFO com.browserstack.utils.Helpers - null 37 | 11:01:49.112 [ApplicationImpl pooled thread 45] INFO c.b.l.BrowserStackRunExtension - spring boot 38 | 11:01:49.112 [ApplicationImpl pooled thread 45] INFO com.browserstack.utils.Helpers - null 39 | 11:03:54.927 [ApplicationImpl pooled thread 45] INFO c.b.l.BrowserStackRunExtension - spring boot 40 | 11:03:54.927 [ApplicationImpl pooled thread 45] INFO com.browserstack.utils.Helpers - null 41 | 07:50:43.860 [ApplicationImpl pooled thread 85] INFO c.b.l.BrowserStackRunExtension - maven 42 | 07:50:43.860 [ApplicationImpl pooled thread 85] INFO com.browserstack.utils.Helpers - null 43 | 07:50:55.763 [ApplicationImpl pooled thread 82] INFO c.b.l.BrowserStackRunExtension - spring boot 44 | 07:50:55.764 [ApplicationImpl pooled thread 82] INFO com.browserstack.utils.Helpers - null 45 | 07:51:36.072 [ApplicationImpl pooled thread 82] INFO c.b.l.BrowserStackRunExtension - spring boot 46 | 07:51:36.072 [ApplicationImpl pooled thread 82] INFO com.browserstack.utils.Helpers - null 47 | 07:51:46.420 [ApplicationImpl pooled thread 72] INFO c.b.l.BrowserStackRunExtension - maven 48 | 07:51:46.420 [ApplicationImpl pooled thread 72] INFO com.browserstack.utils.Helpers - null 49 | 07:52:03.885 [ApplicationImpl pooled thread 92] INFO c.b.l.BrowserStackRunExtension - maven 50 | 07:52:03.885 [ApplicationImpl pooled thread 92] INFO com.browserstack.utils.Helpers - null 51 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.hendisantika 7 | online-banking 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | online-banking 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 3.5.0 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 21 25 | 1.21.1 26 | 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-web 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-thymeleaf 41 | 42 | 43 | 44 | org.springframework.boot 45 | spring-boot-starter-jdbc 46 | 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-data-jpa 51 | 52 | 53 | 54 | com.mysql 55 | mysql-connector-j 56 | 57 | 58 | 59 | org.springframework.boot 60 | spring-boot-starter-security 61 | 62 | 63 | org.flywaydb 64 | flyway-mysql 65 | 66 | 67 | org.projectlombok 68 | lombok 69 | 70 | 71 | org.springframework.boot 72 | spring-boot-starter-test 73 | test 74 | 75 | 76 | org.testcontainers 77 | junit-jupiter 78 | test 79 | 80 | 81 | org.testcontainers 82 | mysql 83 | test 84 | 85 | 86 | 87 | 88 | 89 | 90 | org.testcontainers 91 | testcontainers-bom 92 | ${testcontainers.version} 93 | pom 94 | import 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | org.springframework.boot 103 | spring-boot-maven-plugin 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /qodana.yaml: -------------------------------------------------------------------------------- 1 | version: "1.0" 2 | linter: jetbrains/qodana-jvm-community:2024.3 3 | profile: 4 | name: qodana.recommended 5 | include: 6 | - name: CheckDependencyLicenses -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/OnlineBankingApplication.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | 7 | @SpringBootApplication 8 | public class OnlineBankingApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(OnlineBankingApplication.class, args); 12 | } 13 | 14 | // @Bean 15 | // public BCryptPasswordEncoder passwordEncoder() { 16 | // return new BCryptPasswordEncoder(12, new SecureRandom(SALT.getBytes())); 17 | // } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/config/RequestFilter.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.config; 2 | 3 | import jakarta.servlet.Filter; 4 | import jakarta.servlet.FilterChain; 5 | import jakarta.servlet.FilterConfig; 6 | import jakarta.servlet.ServletRequest; 7 | import jakarta.servlet.ServletResponse; 8 | import jakarta.servlet.http.HttpServletRequest; 9 | import jakarta.servlet.http.HttpServletResponse; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.springframework.core.Ordered; 12 | import org.springframework.core.annotation.Order; 13 | import org.springframework.stereotype.Component; 14 | 15 | /** 16 | * Created by IntelliJ IDEA. 17 | * Project : online-banking 18 | * User: hendisantika 19 | * Email: hendisantika@gmail.com 20 | * Telegram : @hendisantika34 21 | * Date: 04/09/18 22 | * Time: 06.27 23 | * To change this template use File | Settings | File Templates. 24 | */ 25 | @Slf4j 26 | @Component 27 | @Order(Ordered.HIGHEST_PRECEDENCE) 28 | public class RequestFilter implements Filter { 29 | 30 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) { 31 | HttpServletResponse response = (HttpServletResponse) res; 32 | HttpServletRequest request = (HttpServletRequest) req; 33 | 34 | response.setHeader("Access-Control-Allow-Origin", "http://localhost:4200"); 35 | response.setHeader("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, DELETE"); 36 | response.setHeader("Access-Control-Allow-Headers", "x-requested-with"); 37 | response.setHeader("Access-Control-Max-Age", "3600"); 38 | response.setHeader("Access-Control-Allow-Credentials", "true"); 39 | 40 | if (!(request.getMethod().equalsIgnoreCase("OPTIONS"))) { 41 | try { 42 | chain.doFilter(req, res); 43 | } catch (Exception e) { 44 | e.printStackTrace(); 45 | } 46 | } else { 47 | log.info("Pre-flight"); 48 | response.setHeader("Access-Control-Allow-Methods", "POST,GET,DELETE"); 49 | response.setHeader("Access-Control-Max-Age", "3600"); 50 | response.setHeader("Access-Control-Allow-Headers", "authorization, content-type," + 51 | "access-control-request-headers,access-control-request-method,accept,origin,authorization,x-requested-with"); 52 | response.setStatus(HttpServletResponse.SC_OK); 53 | } 54 | 55 | } 56 | 57 | public void init(FilterConfig filterConfig) { 58 | } 59 | 60 | public void destroy() { 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.config; 2 | 3 | import com.hendisantika.onlinebanking.repository.UserDao; 4 | import com.hendisantika.onlinebanking.service.UserServiceImpl.UserSecurityServiceImpl; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.security.authentication.dao.DaoAuthenticationProvider; 8 | import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; 9 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 11 | import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; 12 | import org.springframework.security.core.userdetails.UserDetailsService; 13 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 14 | import org.springframework.security.web.SecurityFilterChain; 15 | import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 16 | 17 | import java.security.SecureRandom; 18 | 19 | /** 20 | * Created by IntelliJ IDEA. 21 | * Project : online-banking 22 | * User: hendisantika 23 | * Email: hendisantika@gmail.com 24 | * Telegram : @hendisantika34 25 | * Date: 04/09/18 26 | * Time: 06.29 27 | * To change this template use File | Settings | File Templates. 28 | */ 29 | @Configuration 30 | @EnableWebSecurity 31 | @EnableMethodSecurity 32 | public class SecurityConfig { 33 | 34 | private static final String SALT = "salt"; // Salt should be protected carefully 35 | private static final String[] PUBLIC_MATCHERS = { 36 | "/webjars/**", 37 | "/css/**", 38 | "/js/**", 39 | "/images/**", 40 | "/", 41 | "/about/**", 42 | "/contact/**", 43 | "/error/**", 44 | "/console/**", 45 | "/signup" 46 | }; 47 | 48 | private final UserDao userRepository; 49 | 50 | public SecurityConfig(UserDao userRepository) { 51 | this.userRepository = userRepository; 52 | } 53 | 54 | // @Bean(BeanIds.AUTHENTICATION_MANAGER) 55 | // public AuthenticationManager authenticationManagerBean() throws Exception { 56 | // return authenticationManagerBean(); 57 | // } 58 | 59 | @Bean 60 | public BCryptPasswordEncoder passwordEncoder() { 61 | return new BCryptPasswordEncoder(12, new SecureRandom(SALT.getBytes())); 62 | } 63 | 64 | @Bean 65 | public SecurityFilterChain configure(HttpSecurity http, UserDetailsService userDetailsServiceBean) throws Exception { 66 | http 67 | .authorizeHttpRequests(authz -> authz 68 | .requestMatchers(PUBLIC_MATCHERS).permitAll() 69 | .anyRequest().authenticated() 70 | ); 71 | 72 | http 73 | .csrf(AbstractHttpConfigurer::disable) 74 | .cors().disable() 75 | .formLogin(formLogin -> formLogin 76 | .loginPage("/index").permitAll() 77 | .defaultSuccessUrl("/userFront", true) 78 | .failureUrl("/index?error") 79 | ) 80 | .logout(logout -> logout 81 | .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 82 | .logoutSuccessUrl("/index?logout") 83 | .deleteCookies("remember-me").permitAll() 84 | .logoutSuccessUrl("/login?logout") 85 | ) 86 | .rememberMe().userDetailsService(userDetailsServiceBean); 87 | return http.build(); 88 | } 89 | 90 | // @Autowired 91 | // public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { 92 | // auth.userDetailsService(userSecurityService).passwordEncoder(passwordEncoder()); 93 | // auth.userDetailsService(userSecurityService).passwordEncoder(passwordEncoder); 94 | // } 95 | 96 | @Bean 97 | public DaoAuthenticationProvider authenticationProvider() { 98 | DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider(); 99 | 100 | authProvider.setUserDetailsService(userDetailsServiceBean()); 101 | authProvider.setPasswordEncoder(passwordEncoder()); 102 | 103 | return authProvider; 104 | } 105 | 106 | @Bean 107 | public UserDetailsService userDetailsServiceBean() { 108 | return new UserSecurityServiceImpl(userRepository); 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.controller; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.PrimaryTransaction; 5 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 6 | import com.hendisantika.onlinebanking.entity.SavingsTransaction; 7 | import com.hendisantika.onlinebanking.entity.User; 8 | import com.hendisantika.onlinebanking.service.AccountService; 9 | import com.hendisantika.onlinebanking.service.TransactionService; 10 | import com.hendisantika.onlinebanking.service.UserService; 11 | import lombok.RequiredArgsConstructor; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.ui.Model; 14 | import org.springframework.web.bind.annotation.ModelAttribute; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | 18 | import java.security.Principal; 19 | import java.util.List; 20 | 21 | /** 22 | * Created by IntelliJ IDEA. 23 | * Project : online-banking 24 | * User: hendisantika 25 | * Email: hendisantika@gmail.com 26 | * Telegram : @hendisantika34 27 | * Date: 04/09/18 28 | * Time: 06.32 29 | * To change this template use File | Settings | File Templates. 30 | */ 31 | @Controller 32 | @RequestMapping("/account") 33 | @RequiredArgsConstructor 34 | public class AccountController { 35 | 36 | private final UserService userService; 37 | 38 | private final AccountService accountService; 39 | 40 | private final TransactionService transactionService; 41 | 42 | @RequestMapping("/primaryAccount") 43 | public String primaryAccount(Model model, Principal principal) { 44 | List primaryTransactionList = transactionService.findPrimaryTransactionList(principal.getName()); 45 | 46 | User user = userService.findByUsername(principal.getName()); 47 | PrimaryAccount primaryAccount = user.getPrimaryAccount(); 48 | 49 | model.addAttribute("primaryAccount", primaryAccount); 50 | model.addAttribute("primaryTransactionList", primaryTransactionList); 51 | 52 | return "primaryAccount"; 53 | } 54 | 55 | @RequestMapping("/savingsAccount") 56 | public String savingsAccount(Model model, Principal principal) { 57 | List savingsTransactionList = transactionService.findSavingsTransactionList(principal.getName()); 58 | User user = userService.findByUsername(principal.getName()); 59 | SavingsAccount savingsAccount = user.getSavingsAccount(); 60 | 61 | model.addAttribute("savingsAccount", savingsAccount); 62 | model.addAttribute("savingsTransactionList", savingsTransactionList); 63 | 64 | return "savingsAccount"; 65 | } 66 | 67 | @RequestMapping(value = "/deposit", method = RequestMethod.GET) 68 | public String deposit(Model model) { 69 | model.addAttribute("accountType", ""); 70 | model.addAttribute("amount", ""); 71 | 72 | return "deposit"; 73 | } 74 | 75 | @RequestMapping(value = "/deposit", method = RequestMethod.POST) 76 | public String depositPOST(@ModelAttribute("amount") String amount, @ModelAttribute("accountType") String accountType, Principal principal) { 77 | accountService.deposit(accountType, Double.parseDouble(amount), principal); 78 | 79 | return "redirect:/userFront"; 80 | } 81 | 82 | @RequestMapping(value = "/withdraw", method = RequestMethod.GET) 83 | public String withdraw(Model model) { 84 | model.addAttribute("accountType", ""); 85 | model.addAttribute("amount", ""); 86 | 87 | return "withdraw"; 88 | } 89 | 90 | @RequestMapping(value = "/withdraw", method = RequestMethod.POST) 91 | public String withdrawPOST(@ModelAttribute("amount") String amount, @ModelAttribute("accountType") String accountType, Principal principal) { 92 | accountService.withdraw(accountType, Double.parseDouble(amount), principal); 93 | 94 | return "redirect:/userFront"; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/controller/AppointmentController.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.controller; 2 | 3 | import com.hendisantika.onlinebanking.entity.Appointment; 4 | import com.hendisantika.onlinebanking.entity.User; 5 | import com.hendisantika.onlinebanking.service.AppointmentService; 6 | import com.hendisantika.onlinebanking.service.UserService; 7 | import lombok.RequiredArgsConstructor; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.ModelAttribute; 12 | import org.springframework.web.bind.annotation.PostMapping; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | 15 | import java.security.Principal; 16 | import java.text.ParseException; 17 | import java.text.SimpleDateFormat; 18 | import java.util.Date; 19 | 20 | /** 21 | * Created by IntelliJ IDEA. 22 | * Project : online-banking 23 | * User: hendisantika 24 | * Email: hendisantika@gmail.com 25 | * Telegram : @hendisantika34 26 | * Date: 04/09/18 27 | * Time: 06.35 28 | * To change this template use File | Settings | File Templates. 29 | */ 30 | @Controller 31 | @RequestMapping("/appointment") 32 | @RequiredArgsConstructor 33 | public class AppointmentController { 34 | 35 | private final AppointmentService appointmentService; 36 | 37 | private final UserService userService; 38 | 39 | @GetMapping(value = "/create") 40 | public String createAppointment(Model model) { 41 | Appointment appointment = new Appointment(); 42 | model.addAttribute("appointment", appointment); 43 | model.addAttribute("dateString", ""); 44 | 45 | return "appointment"; 46 | } 47 | 48 | @PostMapping(value = "/create") 49 | public String createAppointmentPost(@ModelAttribute("appointment") Appointment appointment, @ModelAttribute("dateString") String date, Model model, Principal principal) throws ParseException { 50 | 51 | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 52 | Date d1 = format1.parse(date); 53 | appointment.setDate(d1); 54 | 55 | User user = userService.findByUsername(principal.getName()); 56 | appointment.setUser(user); 57 | 58 | appointmentService.createAppointment(appointment); 59 | 60 | return "redirect:/userFront"; 61 | } 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.controller; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 5 | import com.hendisantika.onlinebanking.entity.User; 6 | import com.hendisantika.onlinebanking.repository.RoleDao; 7 | import com.hendisantika.onlinebanking.security.UserRole; 8 | import com.hendisantika.onlinebanking.service.UserService; 9 | import lombok.RequiredArgsConstructor; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.ModelAttribute; 14 | import org.springframework.web.bind.annotation.PostMapping; 15 | 16 | import java.security.Principal; 17 | import java.util.HashSet; 18 | import java.util.Set; 19 | 20 | /** 21 | * Created by IntelliJ IDEA. 22 | * Project : online-banking 23 | * User: hendisantika 24 | * Email: hendisantika@gmail.com 25 | * Telegram : @hendisantika34 26 | * Date: 04/09/18 27 | * Time: 06.34 28 | * To change this template use File | Settings | File Templates. 29 | */ 30 | @Controller 31 | @RequiredArgsConstructor 32 | public class HomeController { 33 | 34 | private final UserService userService; 35 | 36 | private final RoleDao roleDao; 37 | 38 | @GetMapping("/") 39 | public String home() { 40 | return "redirect:/index"; 41 | } 42 | 43 | @GetMapping("/index") 44 | public String index() { 45 | return "index"; 46 | } 47 | 48 | @GetMapping("/signup") 49 | public String signup(Model model) { 50 | User user = new User(); 51 | 52 | model.addAttribute("user", user); 53 | 54 | return "signup"; 55 | } 56 | 57 | @PostMapping("/signup") 58 | public String signupPost(@ModelAttribute("user") User user, Model model) { 59 | 60 | if (userService.checkUserExists(user.getUsername(), user.getEmail())) { 61 | 62 | if (userService.checkEmailExists(user.getEmail())) { 63 | model.addAttribute("emailExists", true); 64 | } 65 | 66 | if (userService.checkUsernameExists(user.getUsername())) { 67 | model.addAttribute("usernameExists", true); 68 | } 69 | 70 | return "signup"; 71 | } else { 72 | Set userRoles = new HashSet<>(); 73 | userRoles.add(new UserRole(user, roleDao.findByName("ROLE_USER"))); 74 | 75 | userService.createUser(user, userRoles); 76 | 77 | return "redirect:/"; 78 | } 79 | } 80 | 81 | @GetMapping("/userFront") 82 | public String userFront(Principal principal, Model model) { 83 | User user = userService.findByUsername(principal.getName()); 84 | PrimaryAccount primaryAccount = user.getPrimaryAccount(); 85 | SavingsAccount savingsAccount = user.getSavingsAccount(); 86 | 87 | model.addAttribute("primaryAccount", primaryAccount); 88 | model.addAttribute("savingsAccount", savingsAccount); 89 | 90 | return "userFront"; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/controller/TransferController.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.controller; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.Recipient; 5 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 6 | import com.hendisantika.onlinebanking.entity.User; 7 | import com.hendisantika.onlinebanking.service.TransactionService; 8 | import com.hendisantika.onlinebanking.service.UserService; 9 | import lombok.RequiredArgsConstructor; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.transaction.annotation.Transactional; 12 | import org.springframework.ui.Model; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.ModelAttribute; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RequestParam; 18 | 19 | import java.security.Principal; 20 | import java.util.List; 21 | 22 | /** 23 | * Created by IntelliJ IDEA. 24 | * Project : online-banking 25 | * User: hendisantika 26 | * Email: hendisantika@gmail.com 27 | * Telegram : @hendisantika34 28 | * Date: 04/09/18 29 | * Time: 06.37 30 | * To change this template use File | Settings | File Templates. 31 | */ 32 | @Controller 33 | @RequestMapping("/transfer") 34 | @RequiredArgsConstructor 35 | public class TransferController { 36 | 37 | private final TransactionService transactionService; 38 | 39 | private final UserService userService; 40 | 41 | @GetMapping(value = "/betweenAccounts") 42 | public String betweenAccounts(Model model) { 43 | model.addAttribute("transferFrom", ""); 44 | model.addAttribute("transferTo", ""); 45 | model.addAttribute("amount", ""); 46 | 47 | return "betweenAccounts"; 48 | } 49 | 50 | @PostMapping(value = "/betweenAccounts") 51 | public String betweenAccountsPost( 52 | @ModelAttribute("transferFrom") String transferFrom, 53 | @ModelAttribute("transferTo") String transferTo, 54 | @ModelAttribute("amount") String amount, 55 | Principal principal 56 | ) throws Exception { 57 | User user = userService.findByUsername(principal.getName()); 58 | PrimaryAccount primaryAccount = user.getPrimaryAccount(); 59 | SavingsAccount savingsAccount = user.getSavingsAccount(); 60 | transactionService.betweenAccountsTransfer(transferFrom, transferTo, amount, primaryAccount, savingsAccount); 61 | 62 | return "redirect:/userFront"; 63 | } 64 | 65 | @GetMapping(value = "/recipient") 66 | public String recipient(Model model, Principal principal) { 67 | List recipientList = transactionService.findRecipientList(principal); 68 | 69 | Recipient recipient = new Recipient(); 70 | 71 | model.addAttribute("recipientList", recipientList); 72 | model.addAttribute("recipient", recipient); 73 | 74 | return "recipient"; 75 | } 76 | 77 | @PostMapping(value = "/recipient/save") 78 | public String recipientPost(@ModelAttribute("recipient") Recipient recipient, Principal principal) { 79 | 80 | User user = userService.findByUsername(principal.getName()); 81 | recipient.setUser(user); 82 | transactionService.saveRecipient(recipient); 83 | 84 | return "redirect:/transfer/recipient"; 85 | } 86 | 87 | @GetMapping(value = "/recipient/edit") 88 | public String recipientEdit(@RequestParam(value = "recipientName") String recipientName, Model model, Principal principal) { 89 | 90 | Recipient recipient = transactionService.findRecipientByName(recipientName); 91 | List recipientList = transactionService.findRecipientList(principal); 92 | 93 | model.addAttribute("recipientList", recipientList); 94 | model.addAttribute("recipient", recipient); 95 | 96 | return "recipient"; 97 | } 98 | 99 | @GetMapping(value = "/recipient/delete") 100 | @Transactional 101 | public String recipientDelete(@RequestParam(value = "recipientName") String recipientName, Model model, Principal principal) { 102 | 103 | transactionService.deleteRecipientByName(recipientName); 104 | 105 | List recipientList = transactionService.findRecipientList(principal); 106 | 107 | Recipient recipient = new Recipient(); 108 | model.addAttribute("recipient", recipient); 109 | model.addAttribute("recipientList", recipientList); 110 | 111 | 112 | return "recipient"; 113 | } 114 | 115 | @GetMapping(value = "/toSomeoneElse") 116 | public String toSomeoneElse(Model model, Principal principal) { 117 | List recipientList = transactionService.findRecipientList(principal); 118 | 119 | model.addAttribute("recipientList", recipientList); 120 | model.addAttribute("accountType", ""); 121 | 122 | return "toSomeoneElse"; 123 | } 124 | 125 | @PostMapping(value = "/toSomeoneElse") 126 | public String toSomeoneElsePost(@ModelAttribute("recipientName") String recipientName, @ModelAttribute("accountType") String accountType, @ModelAttribute("amount") String amount, Principal principal) { 127 | User user = userService.findByUsername(principal.getName()); 128 | Recipient recipient = transactionService.findRecipientByName(recipientName); 129 | transactionService.toSomeoneElseTransfer(recipient, accountType, amount, user.getPrimaryAccount(), user.getSavingsAccount()); 130 | 131 | return "redirect:/userFront"; 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.controller; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import com.hendisantika.onlinebanking.service.UserService; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.Model; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.ModelAttribute; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | 13 | import java.security.Principal; 14 | 15 | /** 16 | * Created by IntelliJ IDEA. 17 | * Project : online-banking 18 | * User: hendisantika 19 | * Email: hendisantika@gmail.com 20 | * Telegram : @hendisantika34 21 | * Date: 04/09/18 22 | * Time: 06.38 23 | * To change this template use File | Settings | File Templates. 24 | */ 25 | @Controller 26 | @RequestMapping("/user") 27 | @RequiredArgsConstructor 28 | public class UserController { 29 | 30 | private final UserService userService; 31 | 32 | @GetMapping("/profile") 33 | public String profile(Principal principal, Model model) { 34 | User user = userService.findByUsername(principal.getName()); 35 | model.addAttribute("user", user); 36 | return "profile"; 37 | } 38 | 39 | @PostMapping("/profile") 40 | public String profilePost(@ModelAttribute("user") User newUser, Model model) { 41 | User user = userService.findByUsername(newUser.getUsername()); 42 | user.setUsername(newUser.getUsername()); 43 | user.setFirstName(newUser.getFirstName()); 44 | user.setLastName(newUser.getLastName()); 45 | user.setEmail(newUser.getEmail()); 46 | user.setPhone(newUser.getPhone()); 47 | 48 | model.addAttribute("user", user); 49 | 50 | userService.saveUser(user); 51 | 52 | return "profile"; 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/Appointment.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import jakarta.persistence.JoinColumn; 8 | import jakarta.persistence.ManyToOne; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * Created by IntelliJ IDEA. 14 | * Project : online-banking 15 | * User: hendisantika 16 | * Email: hendisantika@gmail.com 17 | * Telegram : @hendisantika34 18 | * Date: 07/08/18 19 | * Time: 06.46 20 | * To change this template use File | Settings | File Templates. 21 | */ 22 | @Entity 23 | public class Appointment { 24 | 25 | @Id 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | private Long id; 28 | private Date date; 29 | private String location; 30 | private String description; 31 | private boolean confirmed; 32 | 33 | @ManyToOne 34 | @JoinColumn(name = "user_id") 35 | private User user; 36 | 37 | public Long getId() { 38 | return id; 39 | } 40 | 41 | public void setId(Long id) { 42 | this.id = id; 43 | } 44 | 45 | public Date getDate() { 46 | return date; 47 | } 48 | 49 | public void setDate(Date date) { 50 | this.date = date; 51 | } 52 | 53 | public String getLocation() { 54 | return location; 55 | } 56 | 57 | public void setLocation(String location) { 58 | this.location = location; 59 | } 60 | 61 | public String getDescription() { 62 | return description; 63 | } 64 | 65 | public void setDescription(String description) { 66 | this.description = description; 67 | } 68 | 69 | public User getUser() { 70 | return user; 71 | } 72 | 73 | public void setUser(User user) { 74 | this.user = user; 75 | } 76 | 77 | public boolean isConfirmed() { 78 | return confirmed; 79 | } 80 | 81 | public void setConfirmed(boolean confirmed) { 82 | this.confirmed = confirmed; 83 | } 84 | 85 | @Override 86 | public String toString() { 87 | return "Appointment{" + 88 | "id=" + id + 89 | ", date=" + date + 90 | ", location='" + location + '\'' + 91 | ", description='" + description + '\'' + 92 | ", user=" + user + 93 | '}'; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/PrimaryAccount.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import jakarta.persistence.CascadeType; 5 | import jakarta.persistence.Entity; 6 | import jakarta.persistence.FetchType; 7 | import jakarta.persistence.GeneratedValue; 8 | import jakarta.persistence.GenerationType; 9 | import jakarta.persistence.Id; 10 | import jakarta.persistence.OneToMany; 11 | 12 | import java.math.BigDecimal; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by IntelliJ IDEA. 17 | * Project : online-banking 18 | * User: hendisantika 19 | * Email: hendisantika@gmail.com 20 | * Telegram : @hendisantika34 21 | * Date: 07/08/18 22 | * Time: 06.49 23 | * To change this template use File | Settings | File Templates. 24 | */ 25 | @Entity 26 | public class PrimaryAccount { 27 | 28 | @Id 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) 30 | private Long id; 31 | private int accountNumber; 32 | private BigDecimal accountBalance; 33 | 34 | @OneToMany(mappedBy = "primaryAccount", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 35 | @JsonIgnore 36 | private List primaryTransactionList; 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public int getAccountNumber() { 47 | return accountNumber; 48 | } 49 | 50 | public void setAccountNumber(int accountNumber) { 51 | this.accountNumber = accountNumber; 52 | } 53 | 54 | public BigDecimal getAccountBalance() { 55 | return accountBalance; 56 | } 57 | 58 | public void setAccountBalance(BigDecimal accountBalance) { 59 | this.accountBalance = accountBalance; 60 | } 61 | 62 | public List getPrimaryTransactionList() { 63 | return primaryTransactionList; 64 | } 65 | 66 | public void setPrimaryTransactionList(List primaryTransactionList) { 67 | this.primaryTransactionList = primaryTransactionList; 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/PrimaryTransaction.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import jakarta.persistence.JoinColumn; 8 | import jakarta.persistence.ManyToOne; 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * Project : online-banking 16 | * User: hendisantika 17 | * Email: hendisantika@gmail.com 18 | * Telegram : @hendisantika34 19 | * Date: 07/08/18 20 | * Time: 06.49 21 | * To change this template use File | Settings | File Templates. 22 | */ 23 | @Entity 24 | public class PrimaryTransaction { 25 | 26 | @Id 27 | @GeneratedValue(strategy = GenerationType.IDENTITY) 28 | private Long id; 29 | private Date date; 30 | private String description; 31 | private String type; 32 | private String status; 33 | private double amount; 34 | private BigDecimal availableBalance; 35 | @ManyToOne 36 | @JoinColumn(name = "primary_account_id") 37 | private PrimaryAccount primaryAccount; 38 | 39 | 40 | public PrimaryTransaction() { 41 | } 42 | 43 | public PrimaryTransaction(Date date, String description, String type, String status, double amount, BigDecimal availableBalance, PrimaryAccount primaryAccount) { 44 | this.date = date; 45 | this.description = description; 46 | this.type = type; 47 | this.status = status; 48 | this.amount = amount; 49 | this.availableBalance = availableBalance; 50 | this.primaryAccount = primaryAccount; 51 | } 52 | 53 | public Long getId() { 54 | return id; 55 | } 56 | 57 | public void setId(Long id) { 58 | this.id = id; 59 | } 60 | 61 | public Date getDate() { 62 | return date; 63 | } 64 | 65 | public void setDate(Date date) { 66 | this.date = date; 67 | } 68 | 69 | public String getDescription() { 70 | return description; 71 | } 72 | 73 | public void setDescription(String description) { 74 | this.description = description; 75 | } 76 | 77 | public String getType() { 78 | return type; 79 | } 80 | 81 | public void setType(String type) { 82 | this.type = type; 83 | } 84 | 85 | public String getStatus() { 86 | return status; 87 | } 88 | 89 | public void setStatus(String status) { 90 | this.status = status; 91 | } 92 | 93 | public double getAmount() { 94 | return amount; 95 | } 96 | 97 | public void setAmount(double amount) { 98 | this.amount = amount; 99 | } 100 | 101 | public BigDecimal getAvailableBalance() { 102 | return availableBalance; 103 | } 104 | 105 | public void setAvailableBalance(BigDecimal availableBalance) { 106 | this.availableBalance = availableBalance; 107 | } 108 | 109 | public PrimaryAccount getPrimaryAccount() { 110 | return primaryAccount; 111 | } 112 | 113 | public void setPrimaryAccount(PrimaryAccount primaryAccount) { 114 | this.primaryAccount = primaryAccount; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/Recipient.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.JoinColumn; 9 | import jakarta.persistence.ManyToOne; 10 | 11 | /** 12 | * Created by IntelliJ IDEA. 13 | * Project : online-banking 14 | * User: hendisantika 15 | * Email: hendisantika@gmail.com 16 | * Telegram : @hendisantika34 17 | * Date: 07/08/18 18 | * Time: 06.54 19 | * To change this template use File | Settings | File Templates. 20 | */ 21 | @Entity 22 | public class Recipient { 23 | 24 | @Id 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) 26 | private Long id; 27 | private String name; 28 | private String email; 29 | private String phone; 30 | private String accountNumber; 31 | private String description; 32 | 33 | @ManyToOne 34 | @JoinColumn(name = "user_id") 35 | @JsonIgnore 36 | private User user; 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | 54 | public String getEmail() { 55 | return email; 56 | } 57 | 58 | public void setEmail(String email) { 59 | this.email = email; 60 | } 61 | 62 | public String getPhone() { 63 | return phone; 64 | } 65 | 66 | public void setPhone(String phone) { 67 | this.phone = phone; 68 | } 69 | 70 | public String getAccountNumber() { 71 | return accountNumber; 72 | } 73 | 74 | public void setAccountNumber(String accountNumber) { 75 | this.accountNumber = accountNumber; 76 | } 77 | 78 | public User getUser() { 79 | return user; 80 | } 81 | 82 | public void setUser(User user) { 83 | this.user = user; 84 | } 85 | 86 | public String getDescription() { 87 | return description; 88 | } 89 | 90 | public void setDescription(String description) { 91 | this.description = description; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/SavingsAccount.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import jakarta.persistence.CascadeType; 5 | import jakarta.persistence.Entity; 6 | import jakarta.persistence.FetchType; 7 | import jakarta.persistence.GeneratedValue; 8 | import jakarta.persistence.GenerationType; 9 | import jakarta.persistence.Id; 10 | import jakarta.persistence.OneToMany; 11 | 12 | import java.math.BigDecimal; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by IntelliJ IDEA. 17 | * Project : online-banking 18 | * User: hendisantika 19 | * Email: hendisantika@gmail.com 20 | * Telegram : @hendisantika34 21 | * Date: 07/08/18 22 | * Time: 06.51 23 | * To change this template use File | Settings | File Templates. 24 | */ 25 | @Entity 26 | public class SavingsAccount { 27 | 28 | @Id 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) 30 | private Long id; 31 | private int accountNumber; 32 | private BigDecimal accountBalance; 33 | 34 | @OneToMany(mappedBy = "savingsAccount", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 35 | @JsonIgnore 36 | private List savingsTransactionList; 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public int getAccountNumber() { 47 | return accountNumber; 48 | } 49 | 50 | public void setAccountNumber(int accountNumber) { 51 | this.accountNumber = accountNumber; 52 | } 53 | 54 | public BigDecimal getAccountBalance() { 55 | return accountBalance; 56 | } 57 | 58 | public void setAccountBalance(BigDecimal accountBalance) { 59 | this.accountBalance = accountBalance; 60 | } 61 | 62 | public List getSavingsTransactionList() { 63 | return savingsTransactionList; 64 | } 65 | 66 | public void setSavingsTransactionList(List savingsTransactionList) { 67 | this.savingsTransactionList = savingsTransactionList; 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/SavingsTransaction.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import jakarta.persistence.JoinColumn; 8 | import jakarta.persistence.ManyToOne; 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * Project : online-banking 16 | * User: hendisantika 17 | * Email: hendisantika@gmail.com 18 | * Telegram : @hendisantika34 19 | * Date: 07/08/18 20 | * Time: 06.52 21 | * To change this template use File | Settings | File Templates. 22 | */ 23 | @Entity 24 | public class SavingsTransaction { 25 | 26 | @Id 27 | @GeneratedValue(strategy = GenerationType.IDENTITY) 28 | private Long id; 29 | private Date date; 30 | private String description; 31 | private String type; 32 | private String status; 33 | private double amount; 34 | private BigDecimal availableBalance; 35 | 36 | @ManyToOne 37 | @JoinColumn(name = "savings_account_id") 38 | private SavingsAccount savingsAccount; 39 | 40 | public SavingsTransaction() { 41 | } 42 | 43 | public SavingsTransaction(Date date, String description, String type, String status, double amount, BigDecimal availableBalance, SavingsAccount savingsAccount) { 44 | this.date = date; 45 | this.description = description; 46 | this.type = type; 47 | this.status = status; 48 | this.amount = amount; 49 | this.availableBalance = availableBalance; 50 | this.savingsAccount = savingsAccount; 51 | } 52 | 53 | public Long getId() { 54 | return id; 55 | } 56 | 57 | public void setId(Long id) { 58 | this.id = id; 59 | } 60 | 61 | public Date getDate() { 62 | return date; 63 | } 64 | 65 | public void setDate(Date date) { 66 | this.date = date; 67 | } 68 | 69 | public String getDescription() { 70 | return description; 71 | } 72 | 73 | public void setDescription(String description) { 74 | this.description = description; 75 | } 76 | 77 | public String getType() { 78 | return type; 79 | } 80 | 81 | public void setType(String type) { 82 | this.type = type; 83 | } 84 | 85 | public String getStatus() { 86 | return status; 87 | } 88 | 89 | public void setStatus(String status) { 90 | this.status = status; 91 | } 92 | 93 | public double getAmount() { 94 | return amount; 95 | } 96 | 97 | public void setAmount(double amount) { 98 | this.amount = amount; 99 | } 100 | 101 | public BigDecimal getAvailableBalance() { 102 | return availableBalance; 103 | } 104 | 105 | public void setAvailableBalance(BigDecimal availableBalance) { 106 | this.availableBalance = availableBalance; 107 | } 108 | 109 | public SavingsAccount getSavingsAccount() { 110 | return savingsAccount; 111 | } 112 | 113 | public void setSavingsAccount(SavingsAccount savingsAccount) { 114 | this.savingsAccount = savingsAccount; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.hendisantika.onlinebanking.security.Authority; 5 | import com.hendisantika.onlinebanking.security.UserRole; 6 | import jakarta.persistence.CascadeType; 7 | import jakarta.persistence.Column; 8 | import jakarta.persistence.Entity; 9 | import jakarta.persistence.FetchType; 10 | import jakarta.persistence.GeneratedValue; 11 | import jakarta.persistence.GenerationType; 12 | import jakarta.persistence.Id; 13 | import jakarta.persistence.OneToMany; 14 | import jakarta.persistence.OneToOne; 15 | import org.springframework.security.core.GrantedAuthority; 16 | import org.springframework.security.core.userdetails.UserDetails; 17 | 18 | import java.util.Collection; 19 | import java.util.HashSet; 20 | import java.util.List; 21 | import java.util.Set; 22 | 23 | /** 24 | * Created by IntelliJ IDEA. 25 | * Project : online-banking 26 | * User: hendisantika 27 | * Email: hendisantika@gmail.com 28 | * Telegram : @hendisantika34 29 | * Date: 07/08/18 30 | * Time: 06.47 31 | * To change this template use File | Settings | File Templates. 32 | */ 33 | @Entity 34 | public class User implements UserDetails { 35 | 36 | @Id 37 | @GeneratedValue(strategy = GenerationType.IDENTITY) 38 | @Column(name = "userId", nullable = false, updatable = false) 39 | private Long userId; 40 | private String username; 41 | private String password; 42 | private String firstName; 43 | private String lastName; 44 | 45 | @Column(name = "email", nullable = false, unique = true) 46 | private String email; 47 | private String phone; 48 | 49 | private boolean enabled = true; 50 | 51 | @OneToOne 52 | private PrimaryAccount primaryAccount; 53 | 54 | @OneToOne 55 | private SavingsAccount savingsAccount; 56 | 57 | @OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 58 | @JsonIgnore 59 | private List appointmentList; 60 | 61 | @OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 62 | private List recipientList; 63 | 64 | @OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.EAGER) 65 | @JsonIgnore 66 | private Set userRoles = new HashSet<>(); 67 | 68 | public Set getUserRoles() { 69 | return userRoles; 70 | } 71 | 72 | public void setUserRoles(Set userRoles) { 73 | this.userRoles = userRoles; 74 | } 75 | 76 | public Long getUserId() { 77 | return userId; 78 | } 79 | 80 | public void setUserId(Long userId) { 81 | this.userId = userId; 82 | } 83 | 84 | public String getUsername() { 85 | return username; 86 | } 87 | 88 | public void setUsername(String username) { 89 | this.username = username; 90 | } 91 | 92 | public String getFirstName() { 93 | return firstName; 94 | } 95 | 96 | public void setFirstName(String firstName) { 97 | this.firstName = firstName; 98 | } 99 | 100 | public String getLastName() { 101 | return lastName; 102 | } 103 | 104 | public void setLastName(String lastName) { 105 | this.lastName = lastName; 106 | } 107 | 108 | public String getEmail() { 109 | return email; 110 | } 111 | 112 | public void setEmail(String email) { 113 | this.email = email; 114 | } 115 | 116 | public String getPhone() { 117 | return phone; 118 | } 119 | 120 | public void setPhone(String phone) { 121 | this.phone = phone; 122 | } 123 | 124 | public List getAppointmentList() { 125 | return appointmentList; 126 | } 127 | 128 | public void setAppointmentList(List appointmentList) { 129 | this.appointmentList = appointmentList; 130 | } 131 | 132 | public List getRecipientList() { 133 | return recipientList; 134 | } 135 | 136 | public void setRecipientList(List recipientList) { 137 | this.recipientList = recipientList; 138 | } 139 | 140 | public String getPassword() { 141 | return password; 142 | } 143 | 144 | public void setPassword(String password) { 145 | this.password = password; 146 | } 147 | 148 | public PrimaryAccount getPrimaryAccount() { 149 | return primaryAccount; 150 | } 151 | 152 | public void setPrimaryAccount(PrimaryAccount primaryAccount) { 153 | this.primaryAccount = primaryAccount; 154 | } 155 | 156 | public SavingsAccount getSavingsAccount() { 157 | return savingsAccount; 158 | } 159 | 160 | public void setSavingsAccount(SavingsAccount savingsAccount) { 161 | this.savingsAccount = savingsAccount; 162 | } 163 | 164 | @Override 165 | public String toString() { 166 | return "User{" + 167 | "userId=" + userId + 168 | ", username='" + username + '\'' + 169 | ", password='" + password + '\'' + 170 | ", firstName='" + firstName + '\'' + 171 | ", lastName='" + lastName + '\'' + 172 | ", email='" + email + '\'' + 173 | ", phone='" + phone + '\'' + 174 | ", appointmentList=" + appointmentList + 175 | ", recipientList=" + recipientList + 176 | ", userRoles=" + userRoles + 177 | '}'; 178 | } 179 | 180 | @Override 181 | public Collection getAuthorities() { 182 | Set authorities = new HashSet<>(); 183 | userRoles.forEach(ur -> authorities.add(new Authority(ur.getRole().getName()))); 184 | return authorities; 185 | } 186 | 187 | @Override 188 | public boolean isAccountNonExpired() { 189 | // TODO Auto-generated method stub 190 | return true; 191 | } 192 | 193 | @Override 194 | public boolean isAccountNonLocked() { 195 | // TODO Auto-generated method stub 196 | return true; 197 | } 198 | 199 | @Override 200 | public boolean isCredentialsNonExpired() { 201 | // TODO Auto-generated method stub 202 | return true; 203 | } 204 | 205 | @Override 206 | public boolean isEnabled() { 207 | return enabled; 208 | } 209 | 210 | public void setEnabled(boolean enabled) { 211 | this.enabled = enabled; 212 | } 213 | 214 | 215 | } 216 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/AppointmentDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.Appointment; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * Project : online-banking 11 | * User: hendisantika 12 | * Email: hendisantika@gmail.com 13 | * Telegram : @hendisantika34 14 | * Date: 08/08/18 15 | * Time: 06.03 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public interface AppointmentDao extends CrudRepository { 19 | 20 | List findAll(); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/PrimaryAccountDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | /** 7 | * Created by IntelliJ IDEA. 8 | * Project : online-banking 9 | * User: hendisantika 10 | * Email: hendisantika@gmail.com 11 | * Telegram : @hendisantika34 12 | * Date: 08/08/18 13 | * Time: 06.04 14 | * To change this template use File | Settings | File Templates. 15 | */ 16 | public interface PrimaryAccountDao extends CrudRepository { 17 | 18 | PrimaryAccount findByAccountNumber(int accountNumber); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/PrimaryTransactionDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryTransaction; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * Project : online-banking 11 | * User: hendisantika 12 | * Email: hendisantika@gmail.com 13 | * Telegram : @hendisantika34 14 | * Date: 08/08/18 15 | * Time: 06.05 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public interface PrimaryTransactionDao extends CrudRepository { 19 | 20 | List findAll(); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/RecipientDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.Recipient; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * Project : online-banking 11 | * User: hendisantika 12 | * Email: hendisantika@gmail.com 13 | * Telegram : @hendisantika34 14 | * Date: 08/08/18 15 | * Time: 06.06 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public interface RecipientDao extends CrudRepository { 19 | 20 | List findAll(); 21 | 22 | Recipient findByName(String recipientName); 23 | 24 | void deleteByName(String recipientName); 25 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/RoleDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.security.Role; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | /** 7 | * Created by IntelliJ IDEA. 8 | * Project : online-banking 9 | * User: hendisantika 10 | * Email: hendisantika@gmail.com 11 | * Telegram : @hendisantika34 12 | * Date: 08/08/18 13 | * Time: 06.06 14 | * To change this template use File | Settings | File Templates. 15 | */ 16 | public interface RoleDao extends CrudRepository { 17 | 18 | Role findByName(String name); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/SavingsAccountDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | /** 7 | * Created by IntelliJ IDEA. 8 | * Project : online-banking 9 | * User: hendisantika 10 | * Email: hendisantika@gmail.com 11 | * Telegram : @hendisantika34 12 | * Date: 08/08/18 13 | * Time: 06.07 14 | * To change this template use File | Settings | File Templates. 15 | */ 16 | public interface SavingsAccountDao extends CrudRepository { 17 | 18 | SavingsAccount findByAccountNumber(int accountNumber); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/SavingsTransactionDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.SavingsTransaction; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * Project : online-banking 11 | * User: hendisantika 12 | * Email: hendisantika@gmail.com 13 | * Telegram : @hendisantika34 14 | * Date: 08/08/18 15 | * Time: 06.08 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public interface SavingsTransactionDao extends CrudRepository { 19 | 20 | List findAll(); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/repository/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.repository; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * Project : online-banking 11 | * User: hendisantika 12 | * Email: hendisantika@gmail.com 13 | * Telegram : @hendisantika34 14 | * Date: 08/08/18 15 | * Time: 06.08 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public interface UserDao extends CrudRepository { 19 | 20 | User findByUsername(String username); 21 | 22 | User findByEmail(String email); 23 | 24 | List findAll(); 25 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/resource/AppointmentResource.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.resource; 2 | 3 | import com.hendisantika.onlinebanking.entity.Appointment; 4 | import com.hendisantika.onlinebanking.service.AppointmentService; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.security.access.prepost.PreAuthorize; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * Project : online-banking 16 | * User: hendisantika 17 | * Email: hendisantika@gmail.com 18 | * Telegram : @hendisantika34 19 | * Date: 09/08/18 20 | * Time: 04.31 21 | * To change this template use File | Settings | File Templates. 22 | */ 23 | @RestController 24 | @RequestMapping("/api/appointment") 25 | @PreAuthorize("hasRole('ADMIN')") 26 | @RequiredArgsConstructor 27 | public class AppointmentResource { 28 | 29 | private final AppointmentService appointmentService; 30 | 31 | @RequestMapping("/all") 32 | public List findAppointmentList() { 33 | return appointmentService.findAll(); 34 | } 35 | 36 | @RequestMapping("/{id}/confirm") 37 | public void confirmAppointment(@PathVariable("id") Long id) { 38 | appointmentService.confirmAppointment(id); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/resource/UserResource.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.resource; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryTransaction; 4 | import com.hendisantika.onlinebanking.entity.SavingsTransaction; 5 | import com.hendisantika.onlinebanking.entity.User; 6 | import com.hendisantika.onlinebanking.service.TransactionService; 7 | import com.hendisantika.onlinebanking.service.UserService; 8 | import lombok.RequiredArgsConstructor; 9 | import org.springframework.security.access.prepost.PreAuthorize; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * Created by IntelliJ IDEA. 20 | * Project : online-banking 21 | * User: hendisantika 22 | * Email: hendisantika@gmail.com 23 | * Telegram : @hendisantika34 24 | * Date: 04/09/18 25 | * Time: 06.39 26 | * To change this template use File | Settings | File Templates. 27 | */ 28 | @RestController 29 | @RequestMapping("/api") 30 | @PreAuthorize("hasRole('ADMIN')") 31 | @RequiredArgsConstructor 32 | public class UserResource { 33 | 34 | private final UserService userService; 35 | 36 | private final TransactionService transactionService; 37 | 38 | @RequestMapping(value = "/user/all", method = RequestMethod.GET) 39 | public List userList() { 40 | return userService.findUserList(); 41 | } 42 | 43 | @RequestMapping(value = "/user/primary/transaction", method = RequestMethod.GET) 44 | public List getPrimaryTransactionList(@RequestParam("username") String username) { 45 | return transactionService.findPrimaryTransactionList(username); 46 | } 47 | 48 | @RequestMapping(value = "/user/savings/transaction", method = RequestMethod.GET) 49 | public List getSavingsTransactionList(@RequestParam("username") String username) { 50 | return transactionService.findSavingsTransactionList(username); 51 | } 52 | 53 | @RequestMapping("/user/{username}/enable") 54 | public void enableUser(@PathVariable("username") String username) { 55 | userService.enableUser(username); 56 | } 57 | 58 | @RequestMapping("/user/{username}/disable") 59 | public void diableUser(@PathVariable("username") String username) { 60 | userService.disableUser(username); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/security/Authority.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.security; 2 | 3 | import org.springframework.security.core.GrantedAuthority; 4 | 5 | /** 6 | * Created by IntelliJ IDEA. 7 | * Project : online-banking 8 | * User: hendisantika 9 | * Email: hendisantika@gmail.com 10 | * Telegram : @hendisantika34 11 | * Date: 06/08/18 12 | * Time: 20.47 13 | * To change this template use File | Settings | File Templates. 14 | */ 15 | public class Authority implements GrantedAuthority { 16 | 17 | private final String authority; 18 | 19 | public Authority(String authority) { 20 | this.authority = authority; 21 | } 22 | 23 | @Override 24 | public String getAuthority() { 25 | return authority; 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/security/Role.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.security; 2 | 3 | import jakarta.persistence.CascadeType; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.Id; 7 | import jakarta.persistence.OneToMany; 8 | 9 | import java.util.HashSet; 10 | import java.util.Set; 11 | 12 | /** 13 | * Created by IntelliJ IDEA. 14 | * Project : online-banking 15 | * User: hendisantika 16 | * Email: hendisantika@gmail.com 17 | * Telegram : @hendisantika34 18 | * Date: 06/08/18 19 | * Time: 20.45 20 | * To change this template use File | Settings | File Templates. 21 | */ 22 | @Entity 23 | public class Role { 24 | 25 | @Id 26 | private int roleId; 27 | 28 | private String name; 29 | 30 | @OneToMany(mappedBy = "role", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 31 | private Set userRoles = new HashSet<>(); 32 | 33 | public Role() { 34 | 35 | } 36 | 37 | public int getRoleId() { 38 | return roleId; 39 | } 40 | 41 | public void setRoleId(int roleId) { 42 | this.roleId = roleId; 43 | } 44 | 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | 53 | public Set getUserRoles() { 54 | return userRoles; 55 | } 56 | 57 | public void setUserRoles(Set userRoles) { 58 | this.userRoles = userRoles; 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/security/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.security; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.JoinColumn; 10 | import jakarta.persistence.ManyToOne; 11 | import jakarta.persistence.Table; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * Project : online-banking 16 | * User: hendisantika 17 | * Email: hendisantika@gmail.com 18 | * Telegram : @hendisantika34 19 | * Date: 06/08/18 20 | * Time: 20.44 21 | * To change this template use File | Settings | File Templates. 22 | */ 23 | @Entity 24 | @Table(name = "user_role") 25 | public class UserRole { 26 | 27 | @Id 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) 29 | private long userRoleId; 30 | 31 | @ManyToOne(fetch = FetchType.EAGER) 32 | @JoinColumn(name = "user_id") 33 | private User user; 34 | 35 | @ManyToOne(fetch = FetchType.EAGER) 36 | @JoinColumn(name = "role_id") 37 | private Role role; 38 | 39 | 40 | public UserRole(User user, Role role) { 41 | this.user = user; 42 | this.role = role; 43 | } 44 | 45 | public UserRole() { 46 | } 47 | 48 | public long getUserRoleId() { 49 | return userRoleId; 50 | } 51 | 52 | public void setUserRoleId(long userRoleId) { 53 | this.userRoleId = userRoleId; 54 | } 55 | 56 | public User getUser() { 57 | return user; 58 | } 59 | 60 | public void setUser(User user) { 61 | this.user = user; 62 | } 63 | 64 | public Role getRole() { 65 | return role; 66 | } 67 | 68 | public void setRole(Role role) { 69 | this.role = role; 70 | } 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/AccountService.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 5 | 6 | import java.security.Principal; 7 | 8 | /** 9 | * Created by IntelliJ IDEA. 10 | * Project : online-banking 11 | * User: hendisantika 12 | * Email: hendisantika@gmail.com 13 | * Telegram : @hendisantika34 14 | * Date: 09/08/18 15 | * Time: 04.32 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | //@Service("accountService") 19 | public interface AccountService { 20 | 21 | PrimaryAccount createPrimaryAccount(); 22 | 23 | SavingsAccount createSavingsAccount(); 24 | 25 | void deposit(String accountType, double amount, Principal principal); 26 | 27 | void withdraw(String accountType, double amount, Principal principal); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/AppointmentService.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service; 2 | 3 | import com.hendisantika.onlinebanking.entity.Appointment; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by IntelliJ IDEA. 9 | * Project : online-banking 10 | * User: hendisantika 11 | * Email: hendisantika@gmail.com 12 | * Telegram : @hendisantika34 13 | * Date: 09/08/18 14 | * Time: 04.33 15 | * To change this template use File | Settings | File Templates. 16 | */ 17 | public interface AppointmentService { 18 | 19 | Appointment createAppointment(Appointment appointment); 20 | 21 | List findAll(); 22 | 23 | Appointment findAppointment(Long id); 24 | 25 | void confirmAppointment(Long id); 26 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/TransactionService.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.PrimaryTransaction; 5 | import com.hendisantika.onlinebanking.entity.Recipient; 6 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 7 | import com.hendisantika.onlinebanking.entity.SavingsTransaction; 8 | 9 | import java.security.Principal; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by IntelliJ IDEA. 14 | * Project : online-banking 15 | * User: hendisantika 16 | * Email: hendisantika@gmail.com 17 | * Telegram : @hendisantika34 18 | * Date: 09/08/18 19 | * Time: 04.34 20 | * To change this template use File | Settings | File Templates. 21 | */ 22 | public interface TransactionService { 23 | 24 | List findPrimaryTransactionList(String username); 25 | 26 | List findSavingsTransactionList(String username); 27 | 28 | void savePrimaryDepositTransaction(PrimaryTransaction primaryTransaction); 29 | 30 | void saveSavingsDepositTransaction(SavingsTransaction savingsTransaction); 31 | 32 | void savePrimaryWithdrawTransaction(PrimaryTransaction primaryTransaction); 33 | 34 | void saveSavingsWithdrawTransaction(SavingsTransaction savingsTransaction); 35 | 36 | void betweenAccountsTransfer(String transferFrom, String transferTo, String amount, PrimaryAccount primaryAccount, SavingsAccount savingsAccount) throws Exception; 37 | 38 | List findRecipientList(Principal principal); 39 | 40 | Recipient saveRecipient(Recipient recipient); 41 | 42 | Recipient findRecipientByName(String recipientName); 43 | 44 | void deleteRecipientByName(String recipientName); 45 | 46 | void toSomeoneElseTransfer(Recipient recipient, String accountType, String amount, PrimaryAccount primaryAccount, SavingsAccount savingsAccount); 47 | } -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import com.hendisantika.onlinebanking.security.UserRole; 5 | 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | /** 10 | * Created by IntelliJ IDEA. 11 | * Project : online-banking 12 | * User: hendisantika 13 | * Email: hendisantika@gmail.com 14 | * Telegram : @hendisantika34 15 | * Date: 09/08/18 16 | * Time: 04.34 17 | * To change this template use File | Settings | File Templates. 18 | */ 19 | //@Service("userDetailsService") 20 | public interface UserService { 21 | 22 | User findByUsername(String username); 23 | 24 | User findByEmail(String email); 25 | 26 | boolean checkUserExists(String username, String email); 27 | 28 | boolean checkUsernameExists(String username); 29 | 30 | boolean checkEmailExists(String email); 31 | 32 | void save(User user); 33 | 34 | User createUser(User user, Set userRoles); 35 | 36 | User saveUser(User user); 37 | 38 | List findUserList(); 39 | 40 | void enableUser(String username); 41 | 42 | void disableUser(String username); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserServiceImpl/AccountServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service.UserServiceImpl; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.PrimaryTransaction; 5 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 6 | import com.hendisantika.onlinebanking.entity.SavingsTransaction; 7 | import com.hendisantika.onlinebanking.entity.User; 8 | import com.hendisantika.onlinebanking.repository.PrimaryAccountDao; 9 | import com.hendisantika.onlinebanking.repository.SavingsAccountDao; 10 | import com.hendisantika.onlinebanking.repository.UserDao; 11 | import com.hendisantika.onlinebanking.service.AccountService; 12 | import com.hendisantika.onlinebanking.service.TransactionService; 13 | import com.hendisantika.onlinebanking.service.UserService; 14 | import lombok.RequiredArgsConstructor; 15 | import org.springframework.stereotype.Service; 16 | 17 | import java.math.BigDecimal; 18 | import java.security.Principal; 19 | import java.util.Date; 20 | 21 | /** 22 | * Created by IntelliJ IDEA. 23 | * Project : online-banking 24 | * User: hendisantika 25 | * Email: hendisantika@gmail.com 26 | * Telegram : @hendisantika34 27 | * Date: 09/08/18 28 | * Time: 04.36 29 | * To change this template use File | Settings | File Templates. 30 | */ 31 | @Service 32 | @RequiredArgsConstructor 33 | public class AccountServiceImpl implements AccountService { 34 | 35 | private static int nextAccountNumber = 11223101; 36 | 37 | private final PrimaryAccountDao primaryAccountDao; 38 | 39 | private final SavingsAccountDao savingsAccountDao; 40 | 41 | private final UserDao userDao; 42 | 43 | private final TransactionService transactionService; 44 | 45 | public PrimaryAccount createPrimaryAccount() { 46 | PrimaryAccount primaryAccount = new PrimaryAccount(); 47 | primaryAccount.setAccountBalance(new BigDecimal("0.0")); 48 | primaryAccount.setAccountNumber(accountGen()); 49 | 50 | primaryAccountDao.save(primaryAccount); 51 | 52 | return primaryAccountDao.findByAccountNumber(primaryAccount.getAccountNumber()); 53 | } 54 | 55 | public SavingsAccount createSavingsAccount() { 56 | SavingsAccount savingsAccount = new SavingsAccount(); 57 | savingsAccount.setAccountBalance(new BigDecimal("0.0")); 58 | savingsAccount.setAccountNumber(accountGen()); 59 | 60 | savingsAccountDao.save(savingsAccount); 61 | 62 | return savingsAccountDao.findByAccountNumber(savingsAccount.getAccountNumber()); 63 | } 64 | 65 | public void deposit(String accountType, double amount, Principal principal) { 66 | User user = userDao.findByUsername(principal.getName()); 67 | 68 | if (accountType.equalsIgnoreCase("Primary")) { 69 | PrimaryAccount primaryAccount = user.getPrimaryAccount(); 70 | primaryAccount.setAccountBalance(primaryAccount.getAccountBalance().add(new BigDecimal(amount))); 71 | primaryAccountDao.save(primaryAccount); 72 | 73 | Date date = new Date(); 74 | 75 | PrimaryTransaction primaryTransaction = new PrimaryTransaction(date, "Deposit to Primary Account", "Account", "Finished", amount, primaryAccount.getAccountBalance(), primaryAccount); 76 | transactionService.savePrimaryDepositTransaction(primaryTransaction); 77 | 78 | } else if (accountType.equalsIgnoreCase("Savings")) { 79 | SavingsAccount savingsAccount = user.getSavingsAccount(); 80 | savingsAccount.setAccountBalance(savingsAccount.getAccountBalance().add(new BigDecimal(amount))); 81 | savingsAccountDao.save(savingsAccount); 82 | 83 | Date date = new Date(); 84 | SavingsTransaction savingsTransaction = new SavingsTransaction(date, "Deposit to savings Account", "Account", "Finished", amount, savingsAccount.getAccountBalance(), savingsAccount); 85 | transactionService.saveSavingsDepositTransaction(savingsTransaction); 86 | } 87 | } 88 | 89 | public void withdraw(String accountType, double amount, Principal principal) { 90 | User user = userDao.findByUsername(principal.getName()); 91 | 92 | if (accountType.equalsIgnoreCase("Primary")) { 93 | PrimaryAccount primaryAccount = user.getPrimaryAccount(); 94 | primaryAccount.setAccountBalance(primaryAccount.getAccountBalance().subtract(new BigDecimal(amount))); 95 | primaryAccountDao.save(primaryAccount); 96 | 97 | Date date = new Date(); 98 | 99 | PrimaryTransaction primaryTransaction = new PrimaryTransaction(date, "Withdraw from Primary Account", "Account", "Finished", amount, primaryAccount.getAccountBalance(), primaryAccount); 100 | transactionService.savePrimaryWithdrawTransaction(primaryTransaction); 101 | } else if (accountType.equalsIgnoreCase("Savings")) { 102 | SavingsAccount savingsAccount = user.getSavingsAccount(); 103 | savingsAccount.setAccountBalance(savingsAccount.getAccountBalance().subtract(new BigDecimal(amount))); 104 | savingsAccountDao.save(savingsAccount); 105 | 106 | Date date = new Date(); 107 | SavingsTransaction savingsTransaction = new SavingsTransaction(date, "Withdraw from savings Account", "Account", "Finished", amount, savingsAccount.getAccountBalance(), savingsAccount); 108 | transactionService.saveSavingsWithdrawTransaction(savingsTransaction); 109 | } 110 | } 111 | 112 | private int accountGen() { 113 | return ++nextAccountNumber; 114 | } 115 | 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserServiceImpl/AppointmentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service.UserServiceImpl; 2 | 3 | import com.hendisantika.onlinebanking.entity.Appointment; 4 | import com.hendisantika.onlinebanking.repository.AppointmentDao; 5 | import com.hendisantika.onlinebanking.service.AppointmentService; 6 | import lombok.RequiredArgsConstructor; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by IntelliJ IDEA. 13 | * Project : online-banking 14 | * User: hendisantika 15 | * Email: hendisantika@gmail.com 16 | * Telegram : @hendisantika34 17 | * Date: 09/08/18 18 | * Time: 04.38 19 | * To change this template use File | Settings | File Templates. 20 | */ 21 | @Service 22 | @RequiredArgsConstructor 23 | public class AppointmentServiceImpl implements AppointmentService { 24 | 25 | private final AppointmentDao appointmentDao; 26 | 27 | public Appointment createAppointment(Appointment appointment) { 28 | return appointmentDao.save(appointment); 29 | } 30 | 31 | public List findAll() { 32 | return appointmentDao.findAll(); 33 | } 34 | 35 | public Appointment findAppointment(Long id) { 36 | return appointmentDao.findById(id).get(); 37 | } 38 | 39 | public void confirmAppointment(Long id) { 40 | Appointment appointment = findAppointment(id); 41 | appointment.setConfirmed(true); 42 | appointmentDao.save(appointment); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserServiceImpl/TransactionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service.UserServiceImpl; 2 | 3 | import com.hendisantika.onlinebanking.entity.PrimaryAccount; 4 | import com.hendisantika.onlinebanking.entity.PrimaryTransaction; 5 | import com.hendisantika.onlinebanking.entity.Recipient; 6 | import com.hendisantika.onlinebanking.entity.SavingsAccount; 7 | import com.hendisantika.onlinebanking.entity.SavingsTransaction; 8 | import com.hendisantika.onlinebanking.entity.User; 9 | import com.hendisantika.onlinebanking.repository.*; 10 | import com.hendisantika.onlinebanking.service.TransactionService; 11 | import lombok.RequiredArgsConstructor; 12 | import org.springframework.beans.factory.annotation.Qualifier; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.math.BigDecimal; 16 | import java.security.Principal; 17 | import java.util.Date; 18 | import java.util.List; 19 | import java.util.stream.Collectors; 20 | 21 | /** 22 | * Created by IntelliJ IDEA. 23 | * Project : online-banking 24 | * User: hendisantika 25 | * Email: hendisantika@gmail.com 26 | * Telegram : @hendisantika34 27 | * Date: 10/08/18 28 | * Time: 06.21 29 | * To change this template use File | Settings | File Templates. 30 | */ 31 | @Service 32 | @RequiredArgsConstructor 33 | public class TransactionServiceImpl implements TransactionService { 34 | 35 | private final UserDao userDao; 36 | 37 | private final PrimaryTransactionDao primaryTransactionDao; 38 | 39 | private final SavingsTransactionDao savingsTransactionDao; 40 | 41 | private final PrimaryAccountDao primaryAccountDao; 42 | 43 | private final SavingsAccountDao savingsAccountDao; 44 | 45 | private final RecipientDao recipientDao; 46 | 47 | 48 | public List findPrimaryTransactionList(String username) { 49 | User user = userDao.findByUsername(username); 50 | List primaryTransactionList = user.getPrimaryAccount().getPrimaryTransactionList(); 51 | 52 | return primaryTransactionList; 53 | } 54 | 55 | public List findSavingsTransactionList(String username) { 56 | User user = userDao.findByUsername(username); 57 | List savingsTransactionList = user.getSavingsAccount().getSavingsTransactionList(); 58 | 59 | return savingsTransactionList; 60 | } 61 | 62 | public void savePrimaryDepositTransaction(PrimaryTransaction primaryTransaction) { 63 | primaryTransactionDao.save(primaryTransaction); 64 | } 65 | 66 | public void saveSavingsDepositTransaction(SavingsTransaction savingsTransaction) { 67 | savingsTransactionDao.save(savingsTransaction); 68 | } 69 | 70 | public void savePrimaryWithdrawTransaction(PrimaryTransaction primaryTransaction) { 71 | primaryTransactionDao.save(primaryTransaction); 72 | } 73 | 74 | public void saveSavingsWithdrawTransaction(SavingsTransaction savingsTransaction) { 75 | savingsTransactionDao.save(savingsTransaction); 76 | } 77 | 78 | public void betweenAccountsTransfer(String transferFrom, String transferTo, String amount, PrimaryAccount primaryAccount, SavingsAccount savingsAccount) throws Exception { 79 | if (transferFrom.equalsIgnoreCase("Primary") && transferTo.equalsIgnoreCase("Savings")) { 80 | primaryAccount.setAccountBalance(primaryAccount.getAccountBalance().subtract(new BigDecimal(amount))); 81 | savingsAccount.setAccountBalance(savingsAccount.getAccountBalance().add(new BigDecimal(amount))); 82 | primaryAccountDao.save(primaryAccount); 83 | savingsAccountDao.save(savingsAccount); 84 | 85 | Date date = new Date(); 86 | 87 | PrimaryTransaction primaryTransaction = new PrimaryTransaction(date, "Between account transfer from " + transferFrom + " to " + transferTo, "Account", "Finished", Double.parseDouble(amount), primaryAccount.getAccountBalance(), primaryAccount); 88 | primaryTransactionDao.save(primaryTransaction); 89 | } else if (transferFrom.equalsIgnoreCase("Savings") && transferTo.equalsIgnoreCase("Primary")) { 90 | primaryAccount.setAccountBalance(primaryAccount.getAccountBalance().add(new BigDecimal(amount))); 91 | savingsAccount.setAccountBalance(savingsAccount.getAccountBalance().subtract(new BigDecimal(amount))); 92 | primaryAccountDao.save(primaryAccount); 93 | savingsAccountDao.save(savingsAccount); 94 | 95 | Date date = new Date(); 96 | 97 | SavingsTransaction savingsTransaction = new SavingsTransaction(date, "Between account transfer from " + transferFrom + " to " + transferTo, "Transfer", "Finished", Double.parseDouble(amount), savingsAccount.getAccountBalance(), savingsAccount); 98 | savingsTransactionDao.save(savingsTransaction); 99 | } else { 100 | throw new Exception("Invalid Transfer"); 101 | } 102 | } 103 | 104 | public List findRecipientList(Principal principal) { 105 | String username = principal.getName(); 106 | List recipientList = recipientDao.findAll().stream() 107 | .filter(recipient -> username.equals(recipient.getUser().getUsername())) 108 | .collect(Collectors.toList()); 109 | 110 | return recipientList; 111 | } 112 | 113 | public Recipient saveRecipient(Recipient recipient) { 114 | return recipientDao.save(recipient); 115 | } 116 | 117 | public Recipient findRecipientByName(String recipientName) { 118 | return recipientDao.findByName(recipientName); 119 | } 120 | 121 | public void deleteRecipientByName(String recipientName) { 122 | recipientDao.deleteByName(recipientName); 123 | } 124 | 125 | public void toSomeoneElseTransfer(Recipient recipient, String accountType, String amount, PrimaryAccount primaryAccount, SavingsAccount savingsAccount) { 126 | if (accountType.equalsIgnoreCase("Primary")) { 127 | primaryAccount.setAccountBalance(primaryAccount.getAccountBalance().subtract(new BigDecimal(amount))); 128 | primaryAccountDao.save(primaryAccount); 129 | 130 | Date date = new Date(); 131 | 132 | PrimaryTransaction primaryTransaction = new PrimaryTransaction(date, "Transfer to recipient " + recipient.getName(), "Transfer", "Finished", Double.parseDouble(amount), primaryAccount.getAccountBalance(), primaryAccount); 133 | primaryTransactionDao.save(primaryTransaction); 134 | } else if (accountType.equalsIgnoreCase("Savings")) { 135 | savingsAccount.setAccountBalance(savingsAccount.getAccountBalance().subtract(new BigDecimal(amount))); 136 | savingsAccountDao.save(savingsAccount); 137 | 138 | Date date = new Date(); 139 | 140 | SavingsTransaction savingsTransaction = new SavingsTransaction(date, "Transfer to recipient " + recipient.getName(), "Transfer", "Finished", Double.parseDouble(amount), savingsAccount.getAccountBalance(), savingsAccount); 141 | savingsTransactionDao.save(savingsTransaction); 142 | } 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserServiceImpl/UserSecurityService.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service.UserServiceImpl; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import com.hendisantika.onlinebanking.repository.UserDao; 5 | import lombok.RequiredArgsConstructor; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.security.core.userdetails.UserDetails; 9 | import org.springframework.security.core.userdetails.UserDetailsService; 10 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 11 | import org.springframework.stereotype.Service; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * Project : online-banking 16 | * User: hendisantika 17 | * Email: hendisantika@gmail.com 18 | * Telegram : @hendisantika34 19 | * Date: 04/09/18 20 | * Time: 06.30 21 | * To change this template use File | Settings | File Templates. 22 | */ 23 | @Service 24 | @RequiredArgsConstructor 25 | public class UserSecurityService implements UserDetailsService { 26 | 27 | private static final Logger LOG = LoggerFactory.getLogger(UserSecurityService.class); 28 | 29 | private final UserDao userDao; 30 | 31 | @Override 32 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 33 | User user = userDao.findByUsername(username); 34 | if (null == user) { 35 | LOG.warn("Username {} not found", username); 36 | throw new UsernameNotFoundException("Username " + username + " not found"); 37 | } 38 | return user; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserServiceImpl/UserSecurityServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service.UserServiceImpl; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import com.hendisantika.onlinebanking.repository.UserDao; 5 | import lombok.RequiredArgsConstructor; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.security.core.userdetails.UserDetails; 9 | import org.springframework.security.core.userdetails.UserDetailsService; 10 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 11 | import org.springframework.stereotype.Service; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * Project : online-banking 16 | * User: hendisantika 17 | * Email: hendisantika@gmail.com 18 | * Telegram : @hendisantika34 19 | * Date: 10/08/18 20 | * Time: 06.22 21 | * To change this template use File | Settings | File Templates. 22 | */ 23 | @Service 24 | @RequiredArgsConstructor 25 | public class UserSecurityServiceImpl implements UserDetailsService { 26 | 27 | private static final Logger LOG = LoggerFactory.getLogger(UserSecurityServiceImpl.class); 28 | 29 | private final UserDao userDao; 30 | 31 | @Override 32 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 33 | User user = userDao.findByUsername(username); 34 | if (null == user) { 35 | LOG.warn("Username {} not found", username); 36 | throw new UsernameNotFoundException("Username " + username + " not found"); 37 | } 38 | return user; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/hendisantika/onlinebanking/service/UserServiceImpl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hendisantika.onlinebanking.service.UserServiceImpl; 2 | 3 | import com.hendisantika.onlinebanking.entity.User; 4 | import com.hendisantika.onlinebanking.repository.RoleDao; 5 | import com.hendisantika.onlinebanking.repository.UserDao; 6 | import com.hendisantika.onlinebanking.security.UserRole; 7 | import com.hendisantika.onlinebanking.service.AccountService; 8 | import com.hendisantika.onlinebanking.service.UserService; 9 | import lombok.RequiredArgsConstructor; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.springframework.security.crypto.password.PasswordEncoder; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.util.List; 16 | import java.util.Set; 17 | 18 | 19 | /** 20 | * Created by IntelliJ IDEA. 21 | * Project : online-banking 22 | * User: hendisantika 23 | * Email: hendisantika@gmail.com 24 | * Telegram : @hendisantika34 25 | * Date: 10/08/18 26 | * Time: 06.23 27 | * To change this template use File | Settings | File Templates. 28 | */ 29 | @Slf4j 30 | @Service 31 | @Transactional 32 | @RequiredArgsConstructor 33 | public class UserServiceImpl implements UserService { 34 | private static final String SALT = "salt"; // Salt should be protected carefully 35 | 36 | private final UserDao userDao; 37 | 38 | private final RoleDao roleDao; 39 | 40 | // private final BCryptPasswordEncoder passwordEncoder; 41 | private final PasswordEncoder passwordEncoder; 42 | 43 | //@Qualifier("accountService") 44 | private final AccountService accountService; 45 | 46 | // @Bean 47 | // public BCryptPasswordEncoder passwordEncoder() { 48 | // return new BCryptPasswordEncoder(12, new SecureRandom(SALT.getBytes())); 49 | // } 50 | 51 | public void save(User user) { 52 | userDao.save(user); 53 | } 54 | 55 | public User findByUsername(String username) { 56 | return userDao.findByUsername(username); 57 | } 58 | 59 | public User findByEmail(String email) { 60 | return userDao.findByEmail(email); 61 | } 62 | 63 | 64 | public User createUser(User user, Set userRoles) { 65 | User localUser = userDao.findByUsername(user.getUsername()); 66 | 67 | if (localUser != null) { 68 | log.info("User with username {} already exist. Nothing will be done. ", user.getUsername()); 69 | } else { 70 | String encryptedPassword = passwordEncoder.encode(user.getPassword()); 71 | user.setPassword(encryptedPassword); 72 | 73 | for (UserRole ur : userRoles) { 74 | roleDao.save(ur.getRole()); 75 | } 76 | 77 | user.getUserRoles().addAll(userRoles); 78 | 79 | user.setPrimaryAccount(accountService.createPrimaryAccount()); 80 | user.setSavingsAccount(accountService.createSavingsAccount()); 81 | 82 | localUser = userDao.save(user); 83 | } 84 | 85 | return localUser; 86 | } 87 | 88 | public boolean checkUserExists(String username, String email) { 89 | return checkUsernameExists(username) || checkEmailExists(username); 90 | } 91 | 92 | public boolean checkUsernameExists(String username) { 93 | return null != findByUsername(username); 94 | 95 | } 96 | 97 | public boolean checkEmailExists(String email) { 98 | return null != findByEmail(email); 99 | 100 | } 101 | 102 | public User saveUser(User user) { 103 | return userDao.save(user); 104 | } 105 | 106 | public List findUserList() { 107 | return userDao.findAll(); 108 | } 109 | 110 | public void enableUser(String username) { 111 | User user = findByUsername(username); 112 | user.setEnabled(true); 113 | userDao.save(user); 114 | } 115 | 116 | public void disableUser(String username) { 117 | User user = findByUsername(username); 118 | user.setEnabled(false); 119 | log.info("user status : {}", user.isEnabled()); 120 | userDao.save(user); 121 | log.info(username, "{}, is disabled."); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # =============================== 2 | # = DATA SOURCE 3 | # =============================== 4 | # Set here configurations for the database connection 5 | spring.datasource.url=jdbc:mysql://localhost:3306/onlinebanking2?createDatabaseIfNotExist=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Jakarta&useSSL=false&allowPublicKeyRetrieval=true 6 | # Username and secret 7 | spring.datasource.username=root 8 | spring.datasource.password=root 9 | # Keep the connection alive if idle for a long time (needed in production) 10 | spring.datasource.testWhileIdle=true 11 | spring.datasource.validationQuery=SELECT 1 12 | # =============================== 13 | # = JPA / HIBERNATE 14 | # =============================== 15 | # Use spring.jpa.properties.* for Hibernate native properties (the prefix is 16 | # stripped before adding them to the entity manager). 17 | # Show or not log for each sql query 18 | spring.jpa.show-sql=true 19 | spring.jpa.properties.hibernate.format_sql=true 20 | # Hibernate ddl auto (create, create-drop, update): with "update" the database 21 | # schema will be automatically updated accordingly to java entities found in 22 | # the project 23 | spring.jpa.hibernate.ddl-auto=validate 24 | # Allows Hibernate to generate SQL optimized for a particular DBMS 25 | #spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect 26 | spring.jpa.properties.hibernate.id.new_generator_mappings=false 27 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1__20200405_Init_Primary_Account_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- CREATE DATABASE IF NOT EXISTS onlinebanking 2 | -- USE onlinebanking; 3 | -- 4 | -- Table structure for table `primary_account` 5 | -- 6 | 7 | DROP TABLE IF EXISTS primary_account; 8 | CREATE TABLE primary_account 9 | ( 10 | id bigint(20) NOT NULL AUTO_INCREMENT, 11 | account_balance decimal(19, 2) DEFAULT NULL, 12 | account_number int(11) NOT NULL, 13 | PRIMARY KEY (id) 14 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 15 | 16 | -- 17 | -- Dumping data for table primary_account 18 | -- 19 | 20 | LOCK TABLES primary_account WRITE; 21 | INSERT INTO primary_account 22 | VALUES (1, 1700.00, 11223146), 23 | (2, 0.00, 11223150); 24 | UNLOCK TABLES; -------------------------------------------------------------------------------- /src/main/resources/db/migration/V2__20200405_Init_Savings_Account_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table savings_account 3 | -- 4 | 5 | DROP TABLE IF EXISTS savings_account; 6 | CREATE TABLE savings_account 7 | ( 8 | id bigint(20) NOT NULL AUTO_INCREMENT, 9 | account_balance decimal(19, 2) DEFAULT NULL, 10 | account_number int(11) NOT NULL, 11 | PRIMARY KEY (id) 12 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 13 | 14 | -- 15 | -- Dumping data for table savings_account 16 | -- 17 | 18 | LOCK TABLES savings_account WRITE; 19 | INSERT INTO savings_account 20 | VALUES (1, 4250.00, 11223147), 21 | (2, 0.00, 11223151); 22 | UNLOCK TABLES; 23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V3__20200405_Init_User_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table user 3 | -- 4 | 5 | DROP TABLE IF EXISTS user; 6 | CREATE TABLE user 7 | ( 8 | user_id bigint(20) NOT NULL AUTO_INCREMENT, 9 | email varchar(255) NOT NULL, 10 | enabled bit(1) NOT NULL, 11 | first_name varchar(255) DEFAULT NULL, 12 | last_name varchar(255) DEFAULT NULL, 13 | password varchar(255) DEFAULT NULL, 14 | phone varchar(255) DEFAULT NULL, 15 | username varchar(255) DEFAULT NULL, 16 | primary_account_id bigint(20) DEFAULT NULL, 17 | savings_account_id bigint(20) DEFAULT NULL, 18 | PRIMARY KEY (user_id), 19 | UNIQUE KEY UK_ob8kqyqqgmefl0aco34akdtpe (email), 20 | KEY FKbj0uoj9i40dory8w4t5ojyb9n(primary_account_id), 21 | KEY FKihums7d3g5cv9ehminfs1539e(savings_account_id), 22 | CONSTRAINT FKbj0uoj9i40dory8w4t5ojyb9n FOREIGN KEY (primary_account_id) REFERENCES primary_account (id), 23 | CONSTRAINT FKihums7d3g5cv9ehminfs1539e FOREIGN KEY (savings_account_id) REFERENCES savings_account (id) 24 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 25 | 26 | -- 27 | -- Dumping data for table user 28 | -- 29 | 30 | LOCK TABLES USER WRITE; 31 | INSERT INTO user 32 | VALUES (1, 'uzumaki_naruto@konohagakure.co.jp', '', 'Uzumaki', 'Naruto', 33 | '$2a$12$DWCryEwHwbTYCegib92tk.VST.GG1i2WAqfaSwyMdxX0cl0eBeSve', '5551112345', 'User', 1, 1), 34 | (2, 'uchiha_sasuke@konohagakure.co.jp', '', 'Uchiha', 'Sasuke', 35 | '$2a$12$hZR7pcSf0JU/OTXR3TOyuu8r6C6n.JZE8Ei47E4LZs1t0Aq1AO6oC', 36 | '1111111111', 'Admin', 2, 2); 37 | UNLOCK TABLES; 38 | 39 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V4__20190307_Init_Appointment_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- CREATE DATABASE IF NOT EXISTS onlinebanking 2 | -- USE onlinebanking; 3 | -- 4 | -- Table structure for table appointment 5 | -- 6 | 7 | DROP TABLE IF EXISTS appointment; 8 | CREATE TABLE appointment 9 | ( 10 | id bigint(20) NOT NULL AUTO_INCREMENT, 11 | confirmed bit(1) NOT NULL, 12 | date datetime DEFAULT NULL, 13 | description varchar(255) DEFAULT NULL, 14 | location varchar(255) DEFAULT NULL, 15 | user_id bigint(20) DEFAULT NULL, 16 | PRIMARY KEY (id), 17 | INDEX appointment_id_idx(user_id) 18 | ) ENGINE = InnoDB 19 | AUTO_INCREMENT = 4 20 | DEFAULT CHARSET = utf8; 21 | 22 | ALTER TABLE appointment 23 | ADD CONSTRAINT user_id 24 | FOREIGN KEY (user_id) REFERENCES user (user_id) 25 | ON UPDATE CASCADE ON DELETE CASCADE; 26 | 27 | -- 28 | -- Dumping data for table appointment 29 | -- 30 | 31 | LOCK TABLES appointment WRITE; 32 | INSERT INTO appointment 33 | VALUES (1, '', '2017-01-25 14:01:00', 'Want to see someone', 'Indonesia', 1), 34 | (2, '\0', '2017-01-30 15:01:00', 'Take credit', 'Indonesia', 1), 35 | (3, '', '2017-02-16 15:02:00', 'Consultation', 'Indonesia', 1); 36 | UNLOCK TABLES; -------------------------------------------------------------------------------- /src/main/resources/db/migration/V5__20200405_Init_Primary_Transaction_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table primary_transaction 3 | -- 4 | 5 | DROP TABLE IF EXISTS primary_transaction; 6 | CREATE TABLE primary_transaction 7 | ( 8 | id bigint(20) NOT NULL AUTO_INCREMENT, 9 | amount double NOT NULL, 10 | available_balance decimal(19, 2) DEFAULT NULL, 11 | date datetime DEFAULT NULL, 12 | description varchar(255) DEFAULT NULL, 13 | status varchar(255) DEFAULT NULL, 14 | type varchar(255) DEFAULT NULL, 15 | primary_account_id bigint(20) DEFAULT NULL, 16 | PRIMARY KEY (id), 17 | KEY FK643wtfdx6y0e093wlc09csehn(primary_account_id), 18 | CONSTRAINT FK643wtfdx6y0e093wlc09csehn FOREIGN KEY (primary_account_id) REFERENCES primary_account (id) 19 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; 20 | 21 | -- 22 | -- Dumping data for table primary_transaction 23 | -- 24 | 25 | LOCK TABLES primary_transaction WRITE; 26 | INSERT INTO primary_transaction 27 | VALUES (1, 5000, 5000.00, '2017-01-13 00:57:16', 'Deposit to Primary Account', 'Finished', 'Account', 1), 28 | (2, 1500, 3500.00, '2017-01-13 00:57:31', 'Withdraw from Primary Account', 'Finished', 'Account', 1), 29 | (3, 1300, 2200.00, '2017-01-13 00:58:03', 'Between account transfer from Primary to Savings', 'Finished', 30 | 'Account', 1), 31 | (4, 500, 1700.00, '2017-01-13 00:59:08', 'Transfer to recipient Mr. Tomson', 'Finished', 'Transfer', 1), 32 | (5, 1500, 3200.00, '2017-01-13 01:11:38', 'Deposit to Primary Account', 'Finished', 'Account', 1), 33 | (6, 400, 2800.00, '2017-01-13 01:11:46', 'Withdraw from Primary Account', 'Finished', 'Account', 1), 34 | (7, 2300, 2000.00, '2017-01-13 01:13:48', 'Between account transfer from Primary to Savings', 'Finished', 35 | 'Account', 1), 36 | (8, 300, 1700.00, '2017-01-13 01:14:14', 'Transfer to recipient TaxSystem', 'Finished', 'Transfer', 1); 37 | UNLOCK TABLES; -------------------------------------------------------------------------------- /src/main/resources/db/migration/V6__20200405_Init_Recipient_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table recipient 3 | -- 4 | 5 | DROP TABLE IF EXISTS recipient; 6 | CREATE TABLE recipient 7 | ( 8 | id bigint(20) NOT NULL AUTO_INCREMENT, 9 | account_number varchar(255) DEFAULT NULL, 10 | description varchar(255) DEFAULT NULL, 11 | email varchar(255) DEFAULT NULL, 12 | name varchar(255) DEFAULT NULL, 13 | phone varchar(255) DEFAULT NULL, 14 | user_id bigint(20) DEFAULT NULL, 15 | PRIMARY KEY (id), 16 | KEY FK3041ks22uyyuuw441k5671ah9(user_id), 17 | CONSTRAINT FK3041ks22uyyuuw441k5671ah9 FOREIGN KEY (user_id) REFERENCES user (user_id) 18 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 19 | 20 | -- 21 | -- Dumping data for table recipient 22 | -- 23 | 24 | LOCK TABLES recipient WRITE; 25 | INSERT INTO recipient 26 | VALUES (1, '213425635454', 'Rent payment', 'tomson@gmail.com', 'Mr. Tomson', '1112223333', 1), 27 | (2, '453452341324', 'Gym payment', 'fitness@gmail.com', 'LtdFitness', '323245345', 1), 28 | (3, '5465464234542', 'Tax payment 20%', 'taxes@mail.fi', 'TaxSystem', '34254353', 1); 29 | UNLOCK TABLES; 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V7__20200405_Init_Role_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table role 3 | -- 4 | 5 | DROP TABLE IF EXISTS role; 6 | CREATE TABLE role 7 | ( 8 | role_id int(11) NOT NULL, 9 | name varchar(255) DEFAULT NULL, 10 | PRIMARY KEY (role_id) 11 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 12 | 13 | -- 14 | -- Dumping data for table role 15 | -- 16 | 17 | LOCK TABLES ROLE WRITE; 18 | INSERT INTO role 19 | VALUES (0, 'ROLE_USER'), 20 | (1, 'ROLE_ADMIN'); 21 | UNLOCK TABLES; 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V8__20200405_Init_Savings_Transaction_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table savings_transaction 3 | -- 4 | 5 | DROP TABLE IF EXISTS savings_transaction; 6 | CREATE TABLE savings_transaction 7 | ( 8 | id bigint(20) NOT NULL AUTO_INCREMENT, 9 | amount double NOT NULL, 10 | available_balance decimal(19, 2) DEFAULT NULL, 11 | date datetime DEFAULT NULL, 12 | description varchar(255) DEFAULT NULL, 13 | status varchar(255) DEFAULT NULL, 14 | type varchar(255) DEFAULT NULL, 15 | savings_account_id bigint(20) DEFAULT NULL, 16 | PRIMARY KEY (id), 17 | KEY FK4bt1l2090882974glyn79q2s9(savings_account_id), 18 | CONSTRAINT FK4bt1l2090882974glyn79q2s9 FOREIGN KEY (savings_account_id) REFERENCES savings_account (id) 19 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; 20 | 21 | -- 22 | -- Dumping data for table savings_transaction 23 | -- 24 | 25 | LOCK TABLES savings_transaction WRITE; 26 | INSERT INTO savings_transaction 27 | VALUES (1, 1000, 1000.00, '2017-01-13 00:57:40', 'Deposit to savings Account', 'Finished', 'Account', 1), 28 | (2, 150, 2150.00, '2017-01-13 01:11:15', 'Withdraw from savings Account', 'Finished', 'Account', 1), 29 | (3, 400, 1750.00, '2017-01-13 01:11:23', 'Withdraw from savings Account', 'Finished', 'Account', 1), 30 | (4, 2000, 3750.00, '2017-01-13 01:11:30', 'Deposit to savings Account', 'Finished', 'Account', 1), 31 | (5, 1500, 2250.00, '2017-01-13 01:13:38', 'Between account transfer from Savings to Primary', 'Finished', 32 | 'Transfer', 1), 33 | (6, 300, 4250.00, '2017-01-13 01:14:02', 'Transfer to recipient LtdFitness', 'Finished', 'Transfer', 1); 34 | UNLOCK TABLES; 35 | 36 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V9__20200405_Init_User_Role_Tables_Data.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Table structure for table user_role 3 | -- 4 | 5 | DROP TABLE IF EXISTS user_role; 6 | CREATE TABLE user_role 7 | ( 8 | user_role_id bigint(20) NOT NULL AUTO_INCREMENT, 9 | role_id int(11) DEFAULT NULL, 10 | user_id bigint(20) DEFAULT NULL, 11 | PRIMARY KEY (user_role_id), 12 | KEY FKa68196081fvovjhkek5m97n3y(role_id), 13 | KEY FK859n2jvi8ivhui0rl0esws6o(user_id), 14 | CONSTRAINT FK859n2jvi8ivhui0rl0esws6o FOREIGN KEY (user_id) REFERENCES user (user_id), 15 | CONSTRAINT FKa68196081fvovjhkek5m97n3y FOREIGN KEY (role_id) REFERENCES role (role_id) 16 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 17 | 18 | -- 19 | -- Dumping data for table user_role 20 | -- 21 | 22 | LOCK TABLES user_role WRITE; 23 | INSERT INTO user_role 24 | VALUES (1, 0, 1), 25 | (2, 1, 2); 26 | UNLOCK TABLES; -------------------------------------------------------------------------------- /src/main/resources/sql/V1__20190307_Create_Tables_Online_Banking.sql: -------------------------------------------------------------------------------- 1 | -- CREATE DATABASE IF NOT EXISTS `onlinebanking`; 2 | -- USE `onlinebanking`; 3 | -- 4 | -- Table structure for table `appointment` 5 | -- 6 | DROP TABLE IF EXISTS `appointment`; 7 | CREATE TABLE `appointment` ( 8 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 9 | `confirmed` bit(1) NOT NULL, 10 | `date` datetime DEFAULT NULL, 11 | `description` varchar(255) DEFAULT NULL, 12 | `location` varchar(255) DEFAULT NULL, 13 | `user_id` bigint(20) DEFAULT NULL, 14 | PRIMARY KEY (`id`), 15 | KEY `FKa8m1smlfsc8kkjn2t6wpdmysk` (`user_id`), 16 | CONSTRAINT `FKa8m1smlfsc8kkjn2t6wpdmysk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) 17 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 18 | 19 | -- 20 | -- Table structure for table `primary_account` 21 | -- 22 | 23 | DROP TABLE IF EXISTS `primary_account`; 24 | CREATE TABLE `primary_account` ( 25 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 26 | `account_balance` decimal(19,2) DEFAULT NULL, 27 | `account_number` int(11) NOT NULL, 28 | PRIMARY KEY (`id`) 29 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 30 | 31 | -- 32 | -- Table structure for table `primary_transaction` 33 | -- 34 | 35 | DROP TABLE IF EXISTS `primary_transaction`; 36 | /*!40101 SET @saved_cs_client = @@character_set_client */; 37 | /*!40101 SET character_set_client = utf8 */; 38 | CREATE TABLE `primary_transaction` ( 39 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 40 | `amount` double NOT NULL, 41 | `available_balance` decimal(19,2) DEFAULT NULL, 42 | `date` datetime DEFAULT NULL, 43 | `description` varchar(255) DEFAULT NULL, 44 | `status` varchar(255) DEFAULT NULL, 45 | `type` varchar(255) DEFAULT NULL, 46 | `primary_account_id` bigint(20) DEFAULT NULL, 47 | PRIMARY KEY (`id`), 48 | KEY `FK643wtfdx6y0e093wlc09csehn` (`primary_account_id`), 49 | CONSTRAINT `FK643wtfdx6y0e093wlc09csehn` FOREIGN KEY (`primary_account_id`) REFERENCES `primary_account` (`id`) 50 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; 51 | 52 | -- 53 | -- Table structure for table `recipient` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `recipient`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!40101 SET character_set_client = utf8 */; 59 | CREATE TABLE `recipient` ( 60 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 61 | `account_number` varchar(255) DEFAULT NULL, 62 | `description` varchar(255) DEFAULT NULL, 63 | `email` varchar(255) DEFAULT NULL, 64 | `name` varchar(255) DEFAULT NULL, 65 | `phone` varchar(255) DEFAULT NULL, 66 | `user_id` bigint(20) DEFAULT NULL, 67 | PRIMARY KEY (`id`), 68 | KEY `FK3041ks22uyyuuw441k5671ah9` (`user_id`), 69 | CONSTRAINT `FK3041ks22uyyuuw441k5671ah9` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) 70 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 71 | 72 | -- 73 | -- Table structure for table `role` 74 | -- 75 | 76 | DROP TABLE IF EXISTS `role`; 77 | CREATE TABLE `role` ( 78 | `role_id` int(11) NOT NULL, 79 | `name` varchar(255) DEFAULT NULL, 80 | PRIMARY KEY (`role_id`) 81 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 82 | 83 | -- 84 | -- Table structure for table `savings_account` 85 | -- 86 | 87 | DROP TABLE IF EXISTS `savings_account`; 88 | CREATE TABLE `savings_account` ( 89 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 90 | `account_balance` decimal(19,2) DEFAULT NULL, 91 | `account_number` int(11) NOT NULL, 92 | PRIMARY KEY (`id`) 93 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 94 | -- 95 | -- Table structure for table `savings_transaction` 96 | -- 97 | 98 | DROP TABLE IF EXISTS `savings_transaction`; 99 | CREATE TABLE `savings_transaction` ( 100 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 101 | `amount` double NOT NULL, 102 | `available_balance` decimal(19,2) DEFAULT NULL, 103 | `date` datetime DEFAULT NULL, 104 | `description` varchar(255) DEFAULT NULL, 105 | `status` varchar(255) DEFAULT NULL, 106 | `type` varchar(255) DEFAULT NULL, 107 | `savings_account_id` bigint(20) DEFAULT NULL, 108 | PRIMARY KEY (`id`), 109 | KEY `FK4bt1l2090882974glyn79q2s9` (`savings_account_id`), 110 | CONSTRAINT `FK4bt1l2090882974glyn79q2s9` FOREIGN KEY (`savings_account_id`) REFERENCES `savings_account` (`id`) 111 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; 112 | -- 113 | -- Table structure for table `user` 114 | -- 115 | 116 | DROP TABLE IF EXISTS `user`; 117 | CREATE TABLE `user` ( 118 | `user_id` bigint(20) NOT NULL AUTO_INCREMENT, 119 | `email` varchar(255) NOT NULL, 120 | `enabled` bit(1) NOT NULL, 121 | `first_name` varchar(255) DEFAULT NULL, 122 | `last_name` varchar(255) DEFAULT NULL, 123 | `password` varchar(255) DEFAULT NULL, 124 | `phone` varchar(255) DEFAULT NULL, 125 | `username` varchar(255) DEFAULT NULL, 126 | `primary_account_id` bigint(20) DEFAULT NULL, 127 | `savings_account_id` bigint(20) DEFAULT NULL, 128 | PRIMARY KEY (`user_id`), 129 | UNIQUE KEY `UK_ob8kqyqqgmefl0aco34akdtpe` (`email`), 130 | KEY `FKbj0uoj9i40dory8w4t5ojyb9n` (`primary_account_id`), 131 | KEY `FKihums7d3g5cv9ehminfs1539e` (`savings_account_id`), 132 | CONSTRAINT `FKbj0uoj9i40dory8w4t5ojyb9n` FOREIGN KEY (`primary_account_id`) REFERENCES `primary_account` (`id`), 133 | CONSTRAINT `FKihums7d3g5cv9ehminfs1539e` FOREIGN KEY (`savings_account_id`) REFERENCES `savings_account` (`id`) 134 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 135 | 136 | -- 137 | -- Table structure for table `user_role` 138 | -- 139 | 140 | DROP TABLE IF EXISTS `user_role`; 141 | CREATE TABLE `user_role` ( 142 | `user_role_id` bigint(20) NOT NULL AUTO_INCREMENT, 143 | `role_id` int(11) DEFAULT NULL, 144 | `user_id` bigint(20) DEFAULT NULL, 145 | PRIMARY KEY (`user_role_id`), 146 | KEY `FKa68196081fvovjhkek5m97n3y` (`role_id`), 147 | KEY `FK859n2jvi8ivhui0rl0esws6o` (`user_id`), 148 | CONSTRAINT `FK859n2jvi8ivhui0rl0esws6o` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`), 149 | CONSTRAINT `FKa68196081fvovjhkek5m97n3y` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) 150 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; 151 | -------------------------------------------------------------------------------- /src/main/resources/sql/V2__20190307_Init_Data_Online_Banking.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Dumping data for table `appointment` 3 | -- 4 | 5 | INSERT INTO `appointment` VALUES 6 | (1,'','2019-01-25 14:01:00','Want to see someone','Jakarta',1), 7 | (2,'\0','2019-01-30 15:01:00','Take credit','Bandung',1), 8 | (3,'','2019-02-16 15:02:00','Consultation','Cimahi',1); 9 | /*!40000 ALTER TABLE `appointment` ENABLE KEYS */; 10 | UNLOCK TABLES; 11 | 12 | 13 | -- 14 | -- Dumping data for table `primary_account` 15 | -- 16 | 17 | LOCK TABLES `primary_account` WRITE; 18 | /*!40000 ALTER TABLE `primary_account` DISABLE KEYS */; 19 | INSERT INTO `primary_account` VALUES (1,1700.00,11223146),(2,0.00,11223150); 20 | /*!40000 ALTER TABLE `primary_account` ENABLE KEYS */; 21 | UNLOCK TABLES; 22 | 23 | 24 | -- 25 | -- Dumping data for table `primary_transaction` 26 | -- 27 | 28 | LOCK TABLES `primary_transaction` WRITE; 29 | /*!40000 ALTER TABLE `primary_transaction` DISABLE KEYS */; 30 | INSERT INTO `primary_transaction` VALUES (1,5000,5000.00,'2019-01-13 00:57:16','Deposit to Primary Account','Finished','Account',1), 31 | (2,1500,3500.00,'2019-01-13 00:57:31','Withdraw from Primary Account','Finished','Account',1), 32 | (3,1300,2200.00,'2019-01-13 00:58:03','Between account transfer from Primary to Savings','Finished','Account',1), 33 | (4,500,1700.00,'2019-01-13 00:59:08','Transfer to recipient Mr. Tomson','Finished','Transfer',1), 34 | (5,1500,3200.00,'2019-01-13 01:11:38','Deposit to Primary Account','Finished','Account',1), 35 | (6,400,2800.00,'2019-01-13 01:11:46','Withdraw from Primary Account','Finished','Account',1), 36 | (7,2300,2000.00,'2019-01-13 01:13:48','Between account transfer from Primary to Savings','Finished','Account',1), 37 | (8,300,1700.00,'2019-01-13 01:14:14','Transfer to recipient TaxSystem','Finished','Transfer',1); 38 | /*!40000 ALTER TABLE `primary_transaction` ENABLE KEYS */; 39 | UNLOCK TABLES; 40 | 41 | -- 42 | -- Dumping data for table `recipient` 43 | -- 44 | 45 | LOCK TABLES `recipient` WRITE; 46 | /*!40000 ALTER TABLE `recipient` DISABLE KEYS */; 47 | INSERT INTO `recipient` VALUES 48 | (1,'213425635454','Rent payment','tomson@gmail.com','Mr. Tomson','1112223333',1), 49 | (2,'453452341324','Gym payment','fitness@gmail.com','LtdFitness','323245345',1), 50 | (3,'5465464234542','Tax payment 20%','taxes@mail.fi','TaxSystem','34254353',1); 51 | /*!40000 ALTER TABLE `recipient` ENABLE KEYS */; 52 | UNLOCK TABLES; 53 | -- 54 | -- Dumping data for table `role` 55 | -- 56 | 57 | LOCK TABLES `role` WRITE; 58 | /*!40000 ALTER TABLE `role` DISABLE KEYS */; 59 | INSERT INTO `role` VALUES (0,'ROLE_USER'),(1,'ROLE_ADMIN'); 60 | /*!40000 ALTER TABLE `role` ENABLE KEYS */; 61 | UNLOCK TABLES; 62 | 63 | -- 64 | -- Dumping data for table `savings_account` 65 | -- 66 | 67 | LOCK TABLES `savings_account` WRITE; 68 | /*!40000 ALTER TABLE `savings_account` DISABLE KEYS */; 69 | INSERT INTO `savings_account` VALUES (1,4250.00,11223147),(2,0.00,11223151); 70 | /*!40000 ALTER TABLE `savings_account` ENABLE KEYS */; 71 | UNLOCK TABLES; 72 | -- 73 | -- Dumping data for table `savings_transaction` 74 | -- 75 | 76 | LOCK TABLES `savings_transaction` WRITE; 77 | /*!40000 ALTER TABLE `savings_transaction` DISABLE KEYS */; 78 | INSERT INTO `savings_transaction` VALUES 79 | (1,1000,1000.00,'2019-01-13 00:57:40','Deposit to savings Account','Finished','Account',1), 80 | (2,150,2150.00,'2019-01-13 01:11:15','Withdraw from savings Account','Finished','Account',1), 81 | (3,400,1750.00,'2019-01-13 01:11:23','Withdraw from savings Account','Finished','Account',1), 82 | (4,2000,3750.00,'2019-01-13 01:11:30','Deposit to savings Account','Finished','Account',1), 83 | (5,1500,2250.00,'2019-01-13 01:13:38','Between account transfer from Savings to Primary','Finished','Transfer',1), 84 | (6,300,4250.00,'2019-01-13 01:14:02','Transfer to recipient LtdFitness','Finished','Transfer',1); 85 | /*!40000 ALTER TABLE `savings_transaction` ENABLE KEYS */; 86 | UNLOCK TABLES; 87 | -- 88 | -- Dumping data for table `user` 89 | -- 90 | 91 | LOCK TABLES `user` WRITE; 92 | /*!40000 ALTER TABLE `user` DISABLE KEYS */; 93 | INSERT INTO `user` VALUES (1,'user@gmail.com','','User','Online','$2a$12$DWCryEwHwbTYCegib92tk.VST.GG1i2WAqfaSwyMdxX0cl0eBeSve','5551112345','User',1,1), 94 | (2,'admin@gmail.com','','Admin','Online','$2a$12$hZR7pcSf0JU/OTXR3TOyuu8r6C6n.JZE8Ei47E4LZs1t0Aq1AO6oC','1111111111','Admin',2,2); 95 | /*!40000 ALTER TABLE `user` ENABLE KEYS */; 96 | UNLOCK TABLES; 97 | 98 | -- 99 | -- Dumping data for table `user_role` 100 | -- 101 | 102 | LOCK TABLES `user_role` WRITE; 103 | INSERT INTO `user_role` VALUES (1,0,1),(2,1,2); 104 | UNLOCK TABLES; -------------------------------------------------------------------------------- /src/main/resources/static/css/dataTables.bootstrap.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} 2 | -------------------------------------------------------------------------------- /src/main/resources/static/css/dataTables.uikit.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.row.uk-grid.dt-merge-grid{margin-top:5px}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th,table.dataTable thead>tr>td{position:relative}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th.sorting:after,table.dataTable thead>tr>th.sorting_asc:after,table.dataTable thead>tr>th.sorting_desc:after,table.dataTable thead>tr>td.sorting:after,table.dataTable thead>tr>td.sorting_asc:after,table.dataTable thead>tr>td.sorting_desc:after{position:absolute;top:7px;right:8px;display:block;font-family:'FontAwesome'}table.dataTable thead>tr>th.sorting:after,table.dataTable thead>tr>td.sorting:after{content:"\f0dc";color:#ddd;font-size:0.8em;padding-top:0.12em}table.dataTable thead>tr>th.sorting_asc:after,table.dataTable thead>tr>td.sorting_asc:after{content:"\f0de"}table.dataTable thead>tr>th.sorting_desc:after,table.dataTable thead>tr>td.sorting_desc:after{content:"\f0dd"}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.uk-table-condensed>thead>tr>th{padding-right:20px}table.dataTable.uk-table-condensed .sorting:after,table.dataTable.uk-table-condensed .sorting_asc:after,table.dataTable.uk-table-condensed .sorting_desc:after{top:6px;right:6px} 2 | -------------------------------------------------------------------------------- /src/main/resources/static/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: transparent; 3 | } 4 | 5 | html { 6 | background: url("/images/bg.png") no-repeat center center fixed; 7 | -webkit-background-size: cover; 8 | -moz-background-size: cover; 9 | -o-background-size: cover; 10 | background-size: cover; 11 | } 12 | 13 | img { 14 | display: block; 15 | margin-left: auto; 16 | margin-right: auto; 17 | } 18 | 19 | .form-basic { 20 | max-width: 640px; 21 | margin: 0 auto; 22 | padding: 55px; 23 | box-sizing: border-box; 24 | background-color: #ffffff; 25 | box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); 26 | font: bold 14px sans-serif; 27 | text-align: center; 28 | } 29 | 30 | .form-basic .form-row { 31 | text-align: left; 32 | margin-bottom: 22px; 33 | } 34 | 35 | .form-basic .form-title-row { 36 | text-align: center; 37 | margin-bottom: 55px; 38 | } 39 | 40 | /* The form title */ 41 | .form-basic h1 { 42 | display: inline-block; 43 | box-sizing: border-box; 44 | color: #4c565e; 45 | font-size: 24px; 46 | padding: 0 10px 15px; 47 | border-bottom: 2px solid #6caee0; 48 | margin: 0; 49 | } 50 | 51 | .form-basic .form-row > label span { 52 | display: inline-block; 53 | box-sizing: border-box; 54 | color: #5F5F5F; 55 | width: 180px; 56 | text-align: right; 57 | vertical-align: top; 58 | padding: 12px 25px; 59 | } 60 | 61 | .form-basic input { 62 | color: #5f5f5f; 63 | box-sizing: border-box; 64 | width: 240px; 65 | box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.08); 66 | padding: 12px; 67 | border: 1px solid #dbdbdb; 68 | } 69 | 70 | .form-basic input[type=radio], .form-basic input[type=checkbox] { 71 | box-shadow: none; 72 | width: auto; 73 | } 74 | 75 | .form-basic input[type=checkbox] { 76 | margin-top: 13px; 77 | } 78 | 79 | .form-basic select { 80 | background-color: #ffffff; 81 | color: #5f5f5f; 82 | box-sizing: border-box; 83 | max-width: 240px; 84 | box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.08); 85 | padding: 12px 8px; 86 | border: 1px solid #dbdbdb; 87 | } 88 | 89 | .form-basic textarea { 90 | color: #5f5f5f; 91 | box-sizing: border-box; 92 | width: 240px; 93 | height: 80px; 94 | box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.08); 95 | font: normal 13px sans-serif; 96 | padding: 12px; 97 | border: 1px solid #dbdbdb; 98 | resize: vertical; 99 | } 100 | 101 | .form-basic .form-radio-buttons { 102 | display: inline-block; 103 | vertical-align: top; 104 | } 105 | 106 | .form-basic .form-radio-buttons > div { 107 | margin-top: 10px; 108 | } 109 | 110 | .form-basic .form-radio-buttons label span { 111 | margin-left: 8px; 112 | color: #5f5f5f; 113 | font-weight: normal; 114 | } 115 | 116 | .form-basic .form-radio-buttons input { 117 | width: auto; 118 | } 119 | 120 | .form-basic button { 121 | display: block; 122 | border-radius: 2px; 123 | background-color: #6caee0; 124 | color: #ffffff; 125 | font-weight: bold; 126 | box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.08); 127 | padding: 14px 22px; 128 | border: 0; 129 | margin: 40px 183px 0; 130 | } 131 | 132 | /* Making the form responsive. Remove this media query 133 | if you don't need the form to work on mobile devices. */ 134 | @media ( max-width: 600px) { 135 | .form-basic { 136 | padding: 30px; 137 | max-width: 480px; 138 | } 139 | 140 | .form-basic .form-row { 141 | max-width: 300px; 142 | margin: 25px auto; 143 | text-align: left; 144 | } 145 | 146 | .form-basic .form-title-row { 147 | margin-bottom: 50px; 148 | } 149 | 150 | .form-basic .form-row > label span { 151 | display: block; 152 | text-align: left; 153 | padding: 0 0 15px; 154 | } 155 | 156 | .form-basic select { 157 | width: 240px; 158 | } 159 | 160 | .form-basic input[type=checkbox] { 161 | margin-top: 0; 162 | } 163 | 164 | .form-basic .form-radio-buttons > div { 165 | margin: 0 0 10px; 166 | } 167 | 168 | .form-basic button { 169 | margin: 0; 170 | } 171 | } 172 | 173 | .main { 174 | margin-top: 70px; 175 | } 176 | 177 | .main-center { 178 | margin-top: 30px; 179 | margin: 0 auto; 180 | max-width: 330px; 181 | padding: 40px 40px; 182 | } 183 | 184 | .responstable { 185 | margin: 1em 0; 186 | width: 100%; 187 | overflow: hidden; 188 | background: #FFF; 189 | color: #024457; 190 | border-radius: 10px; 191 | border: 1px solid #167F92; 192 | } 193 | 194 | .responstable tr { 195 | border: 1px solid #D9E4E6; 196 | } 197 | 198 | .responstable tr:nth-child(odd) { 199 | background-color: #EAF3F3; 200 | } 201 | 202 | .responstable th { 203 | display: none; 204 | border: 1px solid #FFF; 205 | background-color: #167F92; 206 | color: #FFF; 207 | padding: 1em; 208 | } 209 | 210 | .responstable th:first-child { 211 | display: table-cell; 212 | text-align: center; 213 | } 214 | 215 | .responstable th:nth-child(2) { 216 | display: table-cell; 217 | } 218 | 219 | .responstable th:nth-child(2) span { 220 | display: none; 221 | } 222 | 223 | .responstable th:nth-child(2):after { 224 | content: attr(data-th); 225 | } 226 | 227 | @media ( min-width: 480px) { 228 | .responstable th:nth-child(2) span { 229 | display: block; 230 | } 231 | 232 | .responstable th:nth-child(2):after { 233 | display: none; 234 | } 235 | } 236 | 237 | .responstable td { 238 | display: block; 239 | word-wrap: break-word; 240 | max-width: 7em; 241 | } 242 | 243 | .responstable td:first-child { 244 | display: table-cell; 245 | text-align: center; 246 | border-right: 1px solid #D9E4E6; 247 | } 248 | 249 | @media ( min-width: 480px) { 250 | .responstable td { 251 | border: 1px solid #D9E4E6; 252 | } 253 | } 254 | 255 | .responstable th, .responstable td { 256 | text-align: left; 257 | margin: .5em 1em; 258 | } 259 | 260 | @media ( min-width: 480px) { 261 | .responstable th, .responstable td { 262 | display: table-cell; 263 | padding: 1em; 264 | } 265 | } 266 | 267 | body { 268 | padding: 0 2em; 269 | font-family: Arial, sans-serif; 270 | color: #024457; 271 | /*background: #f2f2f2;*/ 272 | } 273 | 274 | h1 { 275 | font-family: Verdana; 276 | font-weight: normal; 277 | /*color: #024457;*/ 278 | } 279 | 280 | h1 span { 281 | color: #167F92; 282 | } 283 | 284 | .box { 285 | border: 2px solid red; 286 | } 287 | 288 | hr { 289 | -moz-border-bottom-colors: none; 290 | -moz-border-image: none; 291 | -moz-border-left-colors: none; 292 | -moz-border-right-colors: none; 293 | -moz-border-top-colors: none; 294 | border-color: #EEEEEE -moz-use-text-color #FFFFFF; 295 | border-style: solid none; 296 | border-width: 1px 0; 297 | margin: 18px 0; 298 | border: 0; 299 | height: 1px; 300 | background: #333; 301 | background-image: linear-gradient(to right, #ccc, #333, #ccc); 302 | } -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/images/banner.png -------------------------------------------------------------------------------- /src/main/resources/static/images/banner2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/images/banner2.png -------------------------------------------------------------------------------- /src/main/resources/static/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendisantika/Online-banking-angular-springboot-mysql/f50dfb47f04e8f8540c0f89696bc55234013504e/src/main/resources/static/images/bg.png -------------------------------------------------------------------------------- /src/main/resources/static/js/dataTables.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 3 integration 3 | ©2011-2015 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b,a,d){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"});b.extend(f.ext.classes, 6 | {sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm",sProcessing:"dataTables_processing panel panel-default"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,m,j,n){var o=new f.Api(a),s=a.oClasses,k=a.oLanguage.oPaginate,t=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault();!b(a.currentTarget).hasClass("disabled")&&o.page()!=a.data.action&&o.page(a.data.action).draw("page")}; 7 | l=0;for(h=f.length;l",{"class":s.sPageButton+" "+g,id:0===r&&"string"===typeof c?a.sTableId+"_"+c:null}).append(b("",{href:"#", 8 | "aria-controls":a.sTableId,"aria-label":t[c],"data-dt-idx":p,tabindex:a.iTabIndex}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(u){}q(b(h).empty().html('