- Goals
- To produce a re-scoped application within an accelerated timeframe which can offer pre-billing insights.
- Minimize friction for billing staff by circumventing the need to learn a new database system.
- Implement two key functions to aid the pre-billing process using data from the MemberCheck API.
- Current Progress
- Backend functions have been tested successfully.
- Frontend Command-Line Interface (CLI) is operational.
- Database implementation was abandoned in favor of continuing with .csv files.
- Caveats
- Use Case 3 may contain bugs due to lack of access to the API for testing.
- Use Case 4 remains unimplemented because data is parsed as List, and credential access to retrieve the data structure from the API endpoint is no longer available.
- Deliverables
- Design Documents related to future Spring-Boot integration have been uploaded to Lupl as of 31 October 2023.
- Technical Documentation for the re-scoped application/tool has been updated as of 03 November 2023 (see this document).
- Re-Scoped Application/Tool has been updated and shared with Ben Loh and Michael Lees of Rajah and Tann Technologies (RTTech) as of 03 November 2023 (refer to this repository).
Before running the tool, make sure you have the following requirements installed on your system:
-
Clone this Repository
- Click on the green button in the top right-hand corner called
code
and thendownload zip
. - You may also clone using HTTPS or SSH depending on your technical preference.
- Place the extracted zip somewhere in your directory where you will remember.
- For me, this is
D:\WS\VsCode\RTTbilling
.
- For me, this is
- Click on the green button in the top right-hand corner called
-
Visual Studio Code (VSCode):
- You can download and install VSCode from the official website: VSCode Download.
- Follow the installation instructions for your specific operating system.
-
Java:
- You'll need Java to run the application. Ensure that you have Java installed on your system.
- If not, you can download it from the official Oracle website: Java Downloads.
- Please download
JDK-17
. - Make sure to add Java to your system's PATH or classpath so that the application can locate it.
- Go to search and type in "Env" or "Environment Variables".
- Click on New under System Variables (NOT User Variables).
- Add CLASSPATH as the variable name and the path of files as the variable value.
- Click [OK] to confirm.
-
Maven:
- Maven is used for building and managing the project.
- You need to have Maven installed on your system. You can download Maven from the official website: Maven Download.
- Similar to Java, add Maven to your system's PATH or classpath for easy access.
- You can confirm whether this worked or not by opening
cmd.exe
and typingmvn -version
to check if it has been successfully added to path.- If installation is successful, your command-line output will look similar to the following:
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb...) ...
Follow these steps to install and run the AppAML application:
-
Rebuild the Project with Maven:
- Open the project in VScode.
- Click on the top toolbar/menu
Terminal > New Terminal
. - Verify that you are in the location where you have cloned the project during the Requirements stage above.
- VsCode should automatically change the directory for you.
- For me, this is
D:\WS\VsCode\RTTbilling
. It may differ for you.
- For me, this is
- If you are not in the correct directory, simply pass the command
cd ...
where...
is the location of the cloned project.- For example,
cd D:\WS\VsCode\RTTbilling
- For example,
- VsCode should automatically change the directory for you.
- Type
mvn clean install
and execute by pressing enter. - If successful, you should see something similar to the following output:
... [INFO] Installing D:\WS\VsCode\RTTbilling\target\AppAML-1.0-SNAPSHOT.jar to C:\Users\...\.m2\repository\org\example\AppAML\1.0-SNAPSHOT\AppAML-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.470 s [INFO] Finished at: 2023-11-03T12:36:26+08:00 [INFO] ------------------------------------------------------------------------
-
Running the Project:
- You can now run the project by pressing the play icon at the top right hand corner of the VsCode UI
Play > Run Java
orPlay > Debug Java
- This will bring you to the first screen in the Command Line (see below).
- You can now run the project by pressing the play icon at the top right hand corner of the VsCode UI
===Welcome===
This is a preliminary Command-Line Interface for the Pre-Billing Application. To Use, Please Enter Your API Key.
- Your API key can be obtained from the MemberCheck portal, under your profile.
- Depending on your Command-Line Interface, you might need to press CTRL+V or RIGHT-CLICK to paste your key in.
Enter your key:
- When retrieveing the API Key from the MemberCheck Portal:
- Firstly generate the key.
- Secondly, press 'save' under profile details.
- This is IMPORTANT as the API Key will NOT persist otherwise.
- The API Key entered into this tool has no Cloud interaction.
- As part of the Membercheck API documentation/requirement, the API key is included in every header which is posted to the various endpoints.
- To confirm/check that no sensitive endpoints (such as
POST
orDELETE
) are being used, please look in theApiService.java
file for the various endpoint methods.
- The API Key exists in volatile memory to reduce security breach vectors.
- It is NEVER written into persistent memory.
- This is to prevent mishandling or loss of API keys through on-premise computer breaches.
- Future implementation may require an additional security layer to encrypt the API Key (particularly for persistent DB storage).
- Implementation might need to be changed upon adoption of a web frameworks (see design documents in Lupl).
===Choose RTT Org Node===
In order to access billing data, the program will need guidance on which Org_Id is directly above the client organizations.
Please enter the number that corresponds to HOW FAR FROM THE ROOT the nearest RTT organization occupies above the client organizations. Here are some examples:
- RTT Org -> [0]
- Client1
- Client1
//[0] represents the root. Here, you would enter [0] since RTT Org is at the root AND closest to client-level.
- RTT Org -> [0]
- RTT SubOrg -> [1]
- Client1
- Client2
//[0] represents the root, and [1] represents 1 level away from root. Here, you would enter [1] since RTT SubOrg is 1 level away from the root AND is closest to client-level.
- RTT Org -> [0]
- RTT SubOrg -> [1]
- RTT Sub-SubOrg -> [2]
- Client1
- Client2
//[0] represents the root, and [2] represents 2 levels away from root. Here, you would enter [2] since RTT Sub-SubOrg is 2 levels away from the root AND is closest to client-level.
I will now print the tree so that you can choose which level to enter.
- Required for the program to correctly choose the Top-Level (TL) Organization IDs for the clients.
- Implementation will always return the first node at the selected level implemented.
- Based on current structure for
Retail
andWholesale
accounts, this will work - Will need to be updated in the future to parse a specific Org_Id if there are to be multiple RTT SubOrgs- for example something like this would not work with the current setup:
- RTT Org - RTT SubOrgA - Client1 - Client2 - RTT SubOrgB - Client3 - Client4
- Based on current structure for
===Main Menu===
To proceed, please type the number representing your choice and press enter.
[1] Review Organizational Tree (Top-Level Nodes, RTT Node)
[2] Get Quarterly Billing Statistics (Top-Level Nodes, Respective Scan Usage (Incl. Sub-Orgs))
[3] Get Contract Renewal Statistics (Top-Level Nodes, Respective Monitoring Scans which are CURRENTLY TURNED ON (Incl. Sub-Orgs)))
[99] Quit
Enter your choice:
- User will only be admitted to Main Menu once
Api Key
andRTT Org Node Selection
are complete. - This is because both fields are necessary in order to carry out each of the use cases.
- [1] returns user to update the
RTT Org Node Selection
in case they made any mistakes.
===Menu 2: Get Quarterly Billing Statistics (Top-Level Nodes, Respective Scan Usage (Incl. Sub-Orgs))===
If you wish to exit this menu and return to the main menu, please enter [99] twice.
Otherwise, to retrieve the quarterly billing statistics, follow these instructions:
- Check [config.yaml] in [src/main/resources] and ensure that the various start and end dates for each quarter are correct. Otherwise, data retrieval would not be over the correct period.
- First enter your desired YEAR (YYYY format), followed by your desired QUARTER (1-4)
Enter desired YEAR (YYYY format): 2023
Enter desired QUARTER (1-4): 1
- Enter the required year and quarter.
- Use
src/main/resources/config.yaml
to configure the start and end dates for each quarter.- This is left to the due diligence of the user.
- Outputs the billing details
- Prints to the Command Line
- Updates a file
src/main/resources/2_QuarterlyBilling/Output.csv
===Menu 3: Get Contract Renewal Statistics (Top-Level Nodes, Respective Monitoring Scans which are CURRENTLY TURNED ON (Incl. Sub-Orgs))===
BEFORE beginning, please check the following path:
src/main/resources/3_ContractRenewal/Input.csv
You must FIRST update this CSV file with all ongoing contracts for this function to work.
- The format is as follows: Org_Id, Contract Start Date and Contract End Date for this function to work.
- Contract Start Date and End Date MUST be in DD-MM-YYYY format.
The system will automatically filter out which contracts end in 2 months or less.
After entering the details following the format in the given file, you may proceed to do the following inputs:
[1] to receive the statistics.
[99] to return to the main menu.
- Configuring the
src/main/resources/3_ContractRenewal/Input.csv
is essential, as the program would have no context for the contract start/end dates otherwise. - The system will automatically filter out which contracts end in 2 months or less.
- Outputs the monitoring usage details where the status is turned ON:
- Prints to the Command Line
- Updates a file
src/main/resources/3_ContractRenewal/Output.csv
- Backend logic has already been written and works as of
31 October 2023
. - I am unable to implement the mapping logic because I no longer have access to the API as of
3 November 2023.
- Outputs the monitoring usage details where the monitoring scans' status is either turned ON or OFF.
- In essence, it goes through all scans and returns a list of the granular details of each scan (the individuals/corporations that each organization was scanning at the time).
- Logic can be found in
private static void menu4()
ofsrc\main\java\RTT\billing\CommandLineApp.java
.
- Original API calls were done in Python.
- Ported over to Java to facilitate easier Spring-Boot compatibility (Important for future implementation).
- Use
InputStream
methods as much as possible so that external.csv
and.yaml
files remain accessible after building.
- The
ApiService
class contains a field reference to aPoolingHttpClientConnectionManager
object. - This is done intentionally to re-use the Connection Manager as many times as possible.
- This significantly reduces the delay associated with re-creating and destroying the Connection Manager upon every HTTP call.
- For user experience and updating of yearly interquartile billing start/end dates.