- This is a project intended for BCA Digital Technical Assessment
- Written in Python especially built on version 3.11.5
- It will run based on config located on
config,py
which currently only store API url - Functionalities:
- Calculate credit interactively using command line interface
- Alternatively, you can pass a text file to the program, and it will take the input from the file
- Load calculation from the API defined on the config
- This program can be run in several ways (Of course you can run it with a direct python run but it won't be
highlighted here)
- Running the executable
- Using make command
- Run it using Docker
- The program will calculate and run based on your input
- If you choose to run in
interactive
mode, your CLI will give you this prompt
Credit Simulator Enter Vehicle Type (Motor/Mobil): mobil Is the vehicle New or Bekas (Baru/Bekas): baru Enter Vehicle Year (4 digits): 2023 Enter Total Credit Amount (in Rupiah): 80000000 Enter Loan Tenure (1-6 years): 3 Enter Down Payment (in Rupiah): 65000000
- If you provide
(any_text).txt
as input. It will run based on what written there. Please follow this format ( alternatively I've provided example file, seeexample.txt
)
mobil baru 2022 75000000 2 35000000
- If you choose to run in
- Run the input and it will give a result like this
tahun 1 : Rp. 1,950,000.00/bulan, Suku Bunga : 8% tahun 2 : Rp. 2,107,950.00/bulan, Suku Bunga : 8.1% tahun 3 : Rp. 2,289,233.70/bulan, Suku Bunga : 8.6%
- After it finished the calculation of your input. This program also will load an existing calculation provided by the
API url in the config. If by default using this mock example
"http://www.mocky.io/v2/5d11a58d310000b23508cd62"
, it will give error like this cause it violates the new vehicle definition========== Load Existing Calculations from API Error: For New vehicle, the year must be in the current year or the previous one
- Make sure you have python installed on your machine. Since this built with version 3.11.5, it's recommended using the same version or higher
- Since we're using python, please also make sure you have pip installed 3Make sure you have Docker installed on your machine, only if you want to run it with Docker
- If you want to change the API Url redirection, please change
config.py
- Install required package using
pip
$ make prepare
- Running the test
$ make test
- Running test with coverage
$ make test-with-coverage
- Run the program. You can run the program using all these variations
- Executable script
- Default or Interactive mode
$ ./credit-simulator
- With File Input
$ python main.py example.txt
- Make command
- Default or Interactive mode
$ make run
- With File Input
$ make run --input_file=example.txt
- Docker (This is for default only as to provide)
- Build the image first
$ make build-docker
- Run the app
$ make run-docker
- Executable script
This project also using Github actions. So, to have this project connected to your repository, please provide two secrets in your action's settings
DOCKER_USERNAME = (your docker hub username)
DOCKER_PASSWORD = (your docker hub password or access token)