OneCompiler

prompt 2

110

Payment Management System (PMS) using AI Code Assistant

Client: BSNL - Land Line Customer (Monthly Bill Payment)

Develop a Payment Management System (PMS) using Python Streamlit with a PostgreSQL database. The application should follow a structured folder hierarchy to ensure maintainability and prevent unnecessary Streamlit reruns.

šŸ“‚ Folder Structure:

── šŸ“‚ pages/ │ │── šŸ“„ main.py # Bill payment processing │ │── šŸ“„ receipt.py # Receipt generation │ │── šŸ“„ app.py # Main entry point (handles page navigation) │── šŸ“„ login.py #(entry page) Admin login handling

šŸ›  Functional Requirements

šŸ”¹ 1) login.py (Admin Login Page)

Purpose: Allows admins to log in. If authenticated, redirects to pages/main.py.

Database Table: check_admin

Table Columns:

username

password

enabled_or_not

date_of_creation_of_username

Implementation Considerations:

Uses session state to store login status and prevent unnecessary reruns.

Upon successful login, redirects to pages/main.py.

šŸ”¹ 2) pages/main.py (Bill Payment Portal)

Purpose: Handles bill payments for landline customers.

This page should take telephone number as input and retrieve all the details and display them . the below are the fields to be displayed.

Database Table: Customer_info

Table Columns:

Custemer_Name

Telephone_No

Telephone_Exchange

Monthly_Plan

Billed_Month

Amount_payable

Payment_method (Default: "Cash")

Payment_Status

paid_dt_time

Name_of_the_Accounts_Officer

**) this page contains a submit button where upon clicking the payment_status should be updated to "paid " and the name of the accounts officer is to be taken as text_input and the paid_dt_time has to be updated. Rest all are fetched from database. all this data should be passed to receipt page which gets redirected after clicking on submit

Implementation Considerations:

Uses session state to avoid unnecessary reruns.

Displays input fields for Account Number or Telephone Number.

Fetches customer details from the database.

Updates the Customer_info table upon submission.

Redirects to receipt.py after successful payment.

šŸ”¹ 3) pages/receipt.py (Receipt Generation)

Purpose: Generates a bill payment receipt after successful payment.

the details are to be obtained from main page

Receipt Format:

Customer_Name

Telephone Number

Plan

Billed Month

Amount Paid

Payment Method

Date_time

Account_Officer_details

Implementation Considerations:

Uses session state to retain payment details and prevent reruns.

Displays a formatted receipt after successful payment.

1). Login page for Admin to redirect to Main page after successful login:

              Login credential are be checked using Postgres database using a table "check_admin"

              check_admin table should contain the columns: username, password, enabled_or_not, date_of_creation_of_username



            2). Main page should contain:

            Heading of the page:     "BSNL Bill Payment Portal"

            Input boxes:      Account_number or Telephone_Number

            Once, either Account_number or Telephone_Number are submitted, the following data to be fetched from Cutomer_info table

            Custemer_Name:          To be fetched from database base(Cutomer_info table) on Account_number or Telephone_number

            Telephone_No: Telephone_Number

            Telephone_Exchange: Telephone Exchange

            Monthly_Plan:                  Current Plan is to be fetched from database (Cutomer_info table)

            Billed_Month:  To be fetched from database (Cutomer_info table)

            Amount_payable:          To be fetched from database (Cutomer_info table)

            Payment_method:         "Cash"

            Submit_button:               Submit

           

            Once Submitted, The data to be updated in the Cutomer_info table with payment completed successfully with a receipt.



            The Cutomer_info table should contain the following columns:

            Custemer_Name, Telephone_No, Telephone_Exchange, Monthly_Plan, Billed_Month, Amount_payable,  Payment_method, Payment_Status, paid_dt_time, Name_of_the_Accounts_Officer



            3). Receipt format:         Customer_Name, Telephone Number, Plan, Billed Month, Amount paid, Payment method, Date_time,

                                                            Account_Officer_details                                                                                               Do not give any other files, just give the three files and write the database configuraitons in those files itself and do no use sqlalchemy instead use   psycorpg2,