Skip to content

clean up otp service - #66

Merged
axymthr merged 1 commit into
developfrom
otp-service-clean-up
Aug 28, 2025
Merged

clean up otp service#66
axymthr merged 1 commit into
developfrom
otp-service-clean-up

Conversation

@anuragSharma1112

Copy link
Copy Markdown
Collaborator

Description

Refactored OtpService to follow Single Responsibility and maintain a minimal public API. Reduced the public methods from five to two:
generateOtp(Visit visit) → Handles OTP creation, persistence, and email delivery internally.
validateOtp(Visit visit, String otpCode) → Validates OTP and returns the verification result.
All other methods (sendOtp, canResendOtp, hasExceededOtpAttempts, etc.) are now private and used only as internal helpers. This simplifies the design, improves maintainability, and reduces confusion for other services like VisitService, which now only interacts through these two main methods.

Fixes # (issue)
NA

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Database change

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing (please describe)

Checklist:

  • I have created ADR (Architecture Decision Record) for this change, in case of architecture or tech stack changes.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes in other branches have been merged
  • I have updated the relevant application properties files (if needed)
  • I have updated any necessary database migrations (if needed)

Screenshots (for UX changes):

NA

Additional Notes:

NA

@anuragSharma1112

Copy link
Copy Markdown
Collaborator Author

Hi @axymthr sir, otp service is now cleaned as per the expectations, please review and merge.

@axymthr
axymthr merged commit 2268bba into develop Aug 28, 2025
4 checks passed
@axymthr
axymthr deleted the otp-service-clean-up branch August 28, 2025 14:43
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