-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject_Declaration.txt
More file actions
286 lines (151 loc) · 6.36 KB
/
Project_Declaration.txt
File metadata and controls
286 lines (151 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<!-- Step 1: Understanding the Entities and Requirements -->
From your description, we can identify several key entities or objects that the system needs to manage:
Member: Represents library users who are either members or admins.
Admin: A special type of member who can perform administrative tasks.
Fees: The fee structure (monthly, quarterly, yearly) that members can select.
Payment: A record of the member’s payment for their membership renewal.
Receipt: A generated receipt for payment confirmation.
<!-- We also have the following core features: -->
Membership Registration: Admin registers members, generates a member ID.
Fee Payment: Members can pay either through cash, Google Pay, or online.
Membership Renewal: Members can renew their membership after a period of 30 days, selecting the fee structure.
Payment History: Members can view their payment history, and admins can access all members' payment history.
<!-- Step 2: Identifying the Classes -->
Based on these requirements, we can identify the following classes:
User (Base class):
This is a common class for both Member and Admin. It will contain shared properties and methods like name, email, etc.
Member (Inherits from User):
Represents a library member.
Can see their payment history and renew membership.
Admin (Inherits from User):
Special type of member who can register new members, view all payment histories, and manage renewals.
FeeStructure:
Represents the fee structures (monthly, quarterly, yearly).
Can store fee details and the structure type.
Payment:
Represents payment transactions made by the members.
This would include payment details such as amount, date, payment method (cash, Google Pay, or online).
Receipt:
This will be generated after a payment is made to confirm the transaction.
<!-- Step 3: Defining Class Functions -->
Let’s break down the functions for each class based on the functionality required:
1. User Class (Base class):
Properties:
id
name
email
role (admin or member)
Methods:
login(): Authenticate the user (member/admin).
updateProfile(): Allows user to update personal details (like name or email).
getRole(): Returns the role of the user (admin or member).
2. Member Class (Inherits from User):
Properties:
membershipExpiryDate
feeStructure (could be a foreign key to the FeeStructure table)
Methods:
renewMembership(): Allows member to renew their membership based on selected fee structure.
getPaymentHistory(): Retrieve all past payments made by the member.
viewMembershipStatus(): Check current status of their membership (active/inactive).
getFeeStructure(): Get details of the selected fee structure (monthly, quarterly, yearly).
3. Admin Class (Inherits from User):
Properties:
adminLevel (e.g., super admin or regular admin).
Methods:
registerMember(): Registers new members.
collectFees(): Allows the admin to collect fees for a member (can be done manually or through an online method).
generateReceipt(): Generate and send receipts for fee payments.
viewAllMembers(): Admin can view a list of all members.
viewAllPayments(): Admin can view all members' payment history.
4. FeeStructure Class:
Properties:
id
feeType (monthly, quarterly, yearly)
amount
duration (30 days, 90 days, 365 days)
Methods:
getFeeDetails(): Retrieve details of the fee structure (amount, duration, etc.).
5. Payment Class:
Properties:
id
member_id (foreign key to Member)
amount
paymentMethod (cash, Google Pay, online)
paymentDate
Methods:
processPayment(): Processes the payment (validate amount, payment method).
getPaymentDetails(): Retrieve payment details for a member.
6. Receipt Class:
Properties:
id
payment_id (foreign key to Payment)
receiptDate
receiptAmount
Methods:
generateReceipt(): Generates a receipt for a given payment.
sendReceipt(): Sends the receipt to the member's email or shows it on the portal.
<!-- Step 4: Defining Database Tables -->
We need tables to store the data related to users, fees, payments, and receipts. Below are the potential tables:
1. Users Table:
columns:
id (Primary Key)
name
email
password (encrypted)
role (enum: member, admin)
created_at
updated_at
2. FeeStructures Table:
columns:
id (Primary Key)
feeType (enum: monthly, quarterly, yearly)
amount
duration (in days)
created_at
3. Payments Table:
columns:
id (Primary Key)
member_id (Foreign Key to Users)
amount
paymentMethod (enum: cash, google_pay, online)
paymentDate
status (pending, completed)
4. Receipts Table:
columns:
id (Primary Key)
payment_id (Foreign Key to Payments)
receiptDate
receiptAmount
created_at
5. Memberships Table (If you want to track membership status separately):
columns:
id (Primary Key)
member_id (Foreign Key to Users)
feeStructure_id (Foreign Key to FeeStructures)
membershipStartDate
membershipExpiryDate
status (active, expired)
<!-- Step 5: Example Flow -->
Admin Registers a Member: Admin fills in member details and selects a fee structure (monthly, quarterly, yearly). This creates a new User record and a Membership record in the database.
Member Pays Fees: The member makes a payment. The Payment record is created with the payment method and amount.
Admin Collects Payment: Admin can either manually process payment or use the system to mark payments as completed, generating receipts.
Member Views Payment History: The member can log in and view past payments using the getPaymentHistory() method.
Renewal: After 30 days, the member can choose to renew their membership. Admin or the member can update the Membership record with the new FeeStructure and the updated membershipExpiryDate.
Step 6: Basic Design Principles
Encapsulation: Use private methods and properties to protect sensitive data (e.g., passwords, payment details).
Inheritance: Reuse code (like login, profile management) by inheriting from a base User class for both Admin and Member.
Separation of Concerns: Make sure your models, views, and controllers are clearly separated. Use a controller to handle the logic, models for data handling, and views for displaying data.
Summary of Classes and Tables:
Classes:
User (base class)
Member (inherits from User)
Admin (inherits from User)
FeeStructure
Payment
Receipt
Database Tables:
users: Stores user data.
fee_structures: Stores different fee types.
payments: Tracks member payments.
receipts: Stores receipts generated for payments.
memberships: Tracks membership details.