Automatically assign door codes to new members via external service#2105
Merged
Conversation
f62db17 to
7218e48
Compare
evanugarte
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a user pays for membership, their membership status is updated automatically, but their door code has to be manually assigned. This is a problem because most members pay almost exclusively for the door code so this should be automated.
Context
I created DCD, a simple microservice to maintain and distribute door codes given to SCE by the department. This engine makes sure that the door codes are distributed evenly; since there are more members than door codes, there are inevitably repeats, but the codes are repeated at an almost identical frequency.
Implementation
I modified the workflow for membership validation by having Clark query DCD for a new door code, then assigning that door code to the user when updating their membership status. This includes robust error handling for tracking when issues occur with querying DCD, and also made it so that the API call to DCD can be mocked, in case of a local setup where the developer does not have access to the production DCD server.
Testing
This was tested on a local setup with Clark running in dev mode and DCD running on localhost port 5999. Using a test account with access level
NON_MEMBER, verifying membership with a dummy payment record successfully updated the user's membership status toMEMBERand added a door code to the profile.Before Running
Ensure that you set the
DCD_URLfield inapi/config/config.jsonto be whatever the address of the DCD service is, so that Clark can correctly query for door codes.