Skip to content

Enhance fines management with points history and PDF receipt features - #83

Merged
vthish merged 52 commits into
mainfrom
development
Jun 27, 2026
Merged

vthish merged 52 commits into
mainfrom
development

Conversation

@vthish

@vthish vthish commented Jun 27, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several significant changes to the fines and licensing system, focusing on improved handling of fines, license status automation, and enhanced data relationships. The main themes are: stricter device login handling, improved fine issuance and payment logic, enhanced data modeling for officers and scans, and more robust automation around license activation and suspension.

Key changes include:

Fines and License Status Logic Improvements

  • Fine issuance now uses a scanToken (JWT) to securely associate fines with licenses, and introduces automatic handling of overdue fines and license activation/suspension based on point thresholds and court cases. Points now accumulate upwards, triggering suspensions and revocations at 24, 50, and 100 points respectively. [1] [2]
  • Fine payment logic is updated to prevent payments for already paid or overdue/court-case fines, and to only reactivate licenses when appropriate. Bulk payments follow similar rules and provide clear user feedback. [1] [2]
  • Added automation to reactivate suspended licenses when all fines are cleared or suspension periods expire. [1] [2] [3]

Data Model and Schema Enhancements

  • The Prisma schema adds new relationships: QR_Scan_History now references Traffic_Officer, and Temporary_License records the issuing officer. Traffic_Officer is related to both QR scans and temporary licenses. [1] [2] [3]
  • The Fine_Status enum introduces a new COURT_CASE status, and Driving_License points now start at 0 instead of 24, with a new suspended_Until field to track suspension periods. [1] [2]

Security and Authentication

  • Device login now returns a specific error structure when a device mismatch is detected, requiring OTP verification for new devices instead of a generic unauthorized error.
  • The AuthRequest interface and password change logic are simplified to use id instead of sub for user identification. [1] [2] [3]

API and Service Additions

  • New endpoints for traffic officers to retrieve their stats and fines.
  • The FinesService now injects JwtService for scan token verification and is registered in the module. [1] [2]

General Robustness

  • Error handling is standardized: NotFound and BadRequest exceptions are thrown without detailed messages for invalid operations (e.g., missing entities, invalid actions). [1] [2] [3] [4] [5]

These changes collectively make the fines and licensing system more secure, maintainable, and aligned with real-world business rules.


References:

vthish added 30 commits June 21, 2026 14:35
Update shema add the new attribute in  model license table to suspend…
Fix merge issues and add Git working app code
vthish added 22 commits June 24, 2026 22:28
Updated AuthRequest interface to use 'id' instead of 'sub' for user identification in password change methods.
- Replace static TweenAnimationBuilder dots with a repeating AnimationController
- Implement staggered phases (0.0, 0.33, 0.66) for wave-like pulsing effect
- Switch from SingleTickerProviderStateMixin to TickerProviderStateMixin to support multiple animation controllers
- Add import for dart:math for trigonometric pulse calculations
Features Added:

1. Points History Tab
   - Third tab in fines screen showing cumulative demerit points
   - Timeline view with individual fine points and running total
   - Displays fine ID, date, officer, and status for each entry
   - Color-coded items (orange for pending, green for paid)

2. PDF Receipt Download
   - Receipt button for each paid fine
   - Generates PDF with fine details, offenses, and payment info
   - Prints/downloads receipt using printing package
   - Professional receipt layout with Auto-Ledger branding

Dependencies Added:
   - pdf: ^3.10.4
   - printing: ^5.11.1
   - path_provider: ^2.1.2

Files Changed:
   - lib/screens/fines_screen.dart (points history + receipt button)
   - lib/services/pdf_service.dart (new file)
   - pubspec.yaml (dependencies)
Description:

- Add license dashboard with glass-morphism design
- Add fines screen with pending/paid tabs and points history
- Add profile screen with biometric toggle and password change
- Add biometric login with NIC auto-save
- Add PDF receipt download for paid fines
- Add device verification with OTP
- Build release APK with signing configuration
@vthish
vthish requested a review from Copilot June 27, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vthish
vthish merged commit 33ba05b into main Jun 27, 2026
1 check passed
vthish added a commit that referenced this pull request Jun 27, 2026
Enhance fines management with points history and PDF receipt features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants