Homework done in Java using Spring Boot and using PostgreSQL.
According to the layered architecture in the project, interfaces (abstract classes) and implemented classes (concrete classes) are used on both Service side.
Sample script file containing the data inserted into the PostgreSQL database have been added under the "resource" folder.
PostgreSQL connection information has been added as "application.properties" file under the name of "resource" folder.
The SMS API used was created by logging in from Twilio.
Below is the required dependency for Maven.
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio</artifactId>
<version>8.25.1</version>
</dependency>
Twilio generates a local but different number each time on the trial account in regions other than the USA and Canada. In trial mode, a message is sent to only one number.
The account information in the image above is kept in the file named "application.yml" under the resources folder.
IMPORTANT NOTE1: When the program is run, the user is created first. Then, a credit application is made with only the "user_account_id" of the registered user in the system.
IMPORTANT NOTE2: For security reasons, user numbers and ID numbers will be shared as fake numbers in the script file. But to send sms to the phone, a real number must be entered! In the screenshot, these parts are censored.
IMPORTANT NOTE3: The credit score, which is thought to have been written before, is calculated as follows in CreditScoreService:
// if age of user is equal to 20, so Credit Score is 20 x 25 = 500.
@Override
public int findCreditScore(Long userId)
{
return (Calendar.getInstance().get(Calendar.YEAR) -
Integer.parseInt(findByUserId(userId).getDateOfBirth().toString().substring(0,4))) * 25;
}
In short, the Credit Score is calculated to be 25 times the age.
Credit applications will now be made for existing users registered in the system.
- If the credit score is below 500, the user will be rejected. (Credit result: Rejection)
credit_application table
reference user_account table
- If the credit score is between 500 points and 1000 points and the monthly income is below 5000 TL, the loan application of the user is approved and a limit of 10.000 TL is assigned to the user. (Credit Result: Approval)
credit_application table
reference user_account table
- If the credit score is between 500 points and 1000 points and the monthly income is between 5000 TL and 10,000 TL, the credit application of the user is approved and a 20,000 TL limit is assigned to the user. (Credit Result: Approval)
credit_application table
reference user_account table
- If the credit score is between 500 points and 1000 points and the monthly income is over 10,000 TL, the user's credit application is approved and the user is assigned a limit of MONTHLY INCOME INFORMATION * CREDIT LIMIT MULTIPLIER / 2.
(Credit Result: Approval)
CREDIT LIMIT MULTIPLIER = 4
credit_application table
reference user_account table
- If the credit score is equal to or above 1000 points, the user is assigned a limit equal to MONTHLY INCOME * CREDIT LIMIT MULTIPLIER. (Credit Result: Approval)
CREDIT LIMIT MULTIPLIER = 4
credit_application table
reference user_account table