Challenge Overview
Welcome to Topcoder Member Service - New Endpoint to Update Email Address Code Challenge
In this challenge, we need your help to update existing Topcoder Member Service to extend a new endpoint that will allow user to modify their Email Address.
Read more details based on requirements below.
About current application:
- Existing Topcoder Services technologies using Java 8 with Maven 3, Docker and Docker Compose, DynamoDB, AWS, ElasticSearch
- Base Submission: https://github.com/appirio-tech/ap-member-microservice
- Github Self Registration for the repo: https://ragnar.topcoder.com/api/v1/github/teams/registration/9a476237-a754-4ef6-b4d7-dfd92e4e8e7b-1523461917737
- Make sure you install all required technologies as stated above.
- We need your submission updates follow existing procedure on existing Swagger, refer here: https://github.com/appirio-tech/ap-member-microservice/blob/dev/swagger.yaml
- You might need update the Swagger to use the new endpoints.
- Read and follow instructions mentioned in docs/LocalSetup.docx
- 2 commands to get the Topcoder Service server running:
-- Open command line terminal and go to ap-member-microservice/local directory
$ source env.sh
$ docker-compose -f local.yml up
-- Open command line terminal, in ap-member-microservice/service
$ mvn clean compile package
$ java -jar target/member-microservice-*.jar server src/main/resources/member-service.yaml
- Use Postman to verify the service connection.
- Update existing ap-member-microservice to capture challenge requirements below.
- Important: Frontend part based on this storyboard design not build yet. We need you focus to update the service endpoint to support the updated flow.
- The expected solution need give less effort when we link the updated service with the Frontend app.
Design Flow
Screenshot as Reference: https://marvelapp.com/c90c0ij/screen/40383219
- There will be a new button to Change Email Address on Member Profile new page
- Click Change Email button need load the hidden password field (https://marvelapp.com/c90c0ij/screen/40383218)
- User need filled Topcoder login password before he/she can send Verification Email
- Then server need send the verification to user new email.
- Pass data to existing Email Server. Need provide Email server info.
- Need able to capture status of verified or not verified email address.
- Important: We no need store the old email address. Ignore storyboard screen that displaying the Revert Old Email button.
Topcoder Member Service Endpoints Requirements
Notes:
- For the backend challenge, you’ll need to update the `PUT /members/{handle}` endpoint to accept the new email. If the new email is passed in the request body, the backend should send a verification email to the user
- Specifically you can find ‘updateMemberProfile’ service on existing ap-member-microservice
- Check the additional requirements need inserted into the existing route:
1). Update Email
2). Verify New Email
Email Server Configuration
POST :: https://api.topcoder-dev.com/v5/bus/events
Headers ::
authorization : Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJjb3BpbG90IiwiYWFhIiwidGVzdFJvbGUiLCJ0b255X3Rlc3RfMSIsIlRvcGNvZGVyIFVzZXIiLCJhc2RkIiwiYWRtaW5pc3RyYXRvciJdLCJpc3MiOiJodHRwczovL2FwaS50b3Bjb2Rlci1kZXYuY29tIiwiaGFuZGxlIjoibXR3b21leSIsInVzZXJJZCI6IjQwMDE2MzU2IiwiZW1haWwiOiJtdHdvbWV5QHRvcGNvZGVyLmNvbSIsImp0aSI6ImRhNGMyNTZjLTBjNmQtNDFiYy1hN2NjLTU2ZjE5OTBiMTViMCIsIm5hbWUiOiJtZXNzYWdlLXNlcnZpY2UiLCJpYXQiOjE1MjI2NjkzNDQsImV4cCI6MTUyNTI2MTM0NH0.igeBTF8hDJ8koAY2IwaUYVTPzpSKhwD1v1LtyYbtUg8
cache-control : no-cache
content-type : application/json
Body ::
{
"topic": "member.action.email.profile.emailchange.verification",
"originator": "tc-member-profile",
"timestamp": "2018-04-11T00:00:00",
"mime-type": "application/json",
"payload": {
"data": {
"subject": "Topcoder - Email Change Verification",
"userHandle": "Upbeat",
"verificationAgreeUrl": "https://www.google.co.in/search?q=agree",
"verificationDisagreeUrl": "https://www.google.co.in/search?q=disagree"
},
"recipients": [
"atif.siddiqui2@wipro.com",
"atif.siddiqui2@topcoder.com",
"lunarkid@copilots.topcoder.com",
],
"replyTo": ""
}
}
In the payload :
- topic - is declared in tc-email-service with in the template mapper
- originator - Will be our repository name, for now given "tc-member-profile"
- data - contains the substitutions that would be replaced in the email template created. In our template we added subject, userHandle, verificationAgreeUrl, and verificationDisagreeUrl
- recipients - this is where we will place the new email address
- FYI: This is the email that will be received by by the recipients: https://www.dropbox.com/s/7c1leg7ufmjpssh/Email-sample.png?dl=0
- The expected solution for email server url, authorization token, payload - data should be all configurable - minimal code modifications.
Request and Response
- Create/Update endpoint parameters will accept input as raw/JSON format.
- Exclude file upload endpoints which cannot work with application/json content type.
- Response should be in json format always.
- Display related error messages that will cover the failure tests.
- Create best practices for the json response.
Postman Client JSON
- Create OR Update postman collection json file listing all calls and sample data.
- Provide description for endpoints
- Submit a git patch that implement the tasks requirements.
- Updated Documentation (if Any)
- Verification document contains steps to verify your solution. (if Any)
- Updated Swagger file
- Challenge winner will be responsible to do pull request over a git patch
In this challenge, we need your help to update existing Topcoder Member Service to extend a new endpoint that will allow user to modify their Email Address.
Read more details based on requirements below.
About current application:
- Existing Topcoder Services technologies using Java 8 with Maven 3, Docker and Docker Compose, DynamoDB, AWS, ElasticSearch
- Base Submission: https://github.com/appirio-tech/ap-member-microservice
- Github Self Registration for the repo: https://ragnar.topcoder.com/api/v1/github/teams/registration/9a476237-a754-4ef6-b4d7-dfd92e4e8e7b-1523461917737
- Make sure you install all required technologies as stated above.
- We need your submission updates follow existing procedure on existing Swagger, refer here: https://github.com/appirio-tech/ap-member-microservice/blob/dev/swagger.yaml
- You might need update the Swagger to use the new endpoints.
- Read and follow instructions mentioned in docs/LocalSetup.docx
- 2 commands to get the Topcoder Service server running:
-- Open command line terminal and go to ap-member-microservice/local directory
$ source env.sh
$ docker-compose -f local.yml up
-- Open command line terminal, in ap-member-microservice/service
$ mvn clean compile package
$ java -jar target/member-microservice-*.jar server src/main/resources/member-service.yaml
- Use Postman to verify the service connection.
- Update existing ap-member-microservice to capture challenge requirements below.
- Important: Frontend part based on this storyboard design not build yet. We need you focus to update the service endpoint to support the updated flow.
- The expected solution need give less effort when we link the updated service with the Frontend app.
Design Flow
Screenshot as Reference: https://marvelapp.com/c90c0ij/screen/40383219
- There will be a new button to Change Email Address on Member Profile new page
- Click Change Email button need load the hidden password field (https://marvelapp.com/c90c0ij/screen/40383218)
- User need filled Topcoder login password before he/she can send Verification Email
- Then server need send the verification to user new email.
- Pass data to existing Email Server. Need provide Email server info.
- Need able to capture status of verified or not verified email address.
- Important: We no need store the old email address. Ignore storyboard screen that displaying the Revert Old Email button.
Topcoder Member Service Endpoints Requirements
Notes:
- For the backend challenge, you’ll need to update the `PUT /members/{handle}` endpoint to accept the new email. If the new email is passed in the request body, the backend should send a verification email to the user
- Specifically you can find ‘updateMemberProfile’ service on existing ap-member-microservice
- Check the additional requirements need inserted into the existing route:
1). Update Email
- Route : PUT /members/{handle}
- Input parameters :
- password
- Endpoint logic :
- validate input parameters
- validate the email address and password
- Check if is a user with email/password, if not, return error
- Replace the old email with new email address
- Send verification to user new email address
- Need call email server from here. Refer the details below
- The email template should be configurable
- The from email should be configurable
- Create some sample data
- Response should be json with ‘success’ : true value on success, or success : false with message field set for reason of failure.
- Please follow existing response like existing Swagger, refer here: https://github.com/appirio-tech/ap-member-microservice/blob/dev/swagger.yaml
2). Verify New Email
- Route : POST /members/{handle}/verify
- Input parameters :
- Input parameters are the query string parameters constructed in Update Email endpoint plus the new email.
- Endpoint logic :
- Check if is a user already verified the new email or not
- Need able to resend the verify link to user new email
- We need able to set expiration the verification token after a configurable time limit.
- If pass the expiration date need revert back to the old email address.
- Important: We also need create new "oldemailaddress" field on DynamoDB on the fly to capture the old email.
- Response should be json with ‘success’ : true value on success, or success : false with message field set for reason of failure.
- Please follow existing response like existing Swagger, refer here: https://github.com/appirio-tech/ap-member-microservice/blob/dev/swagger.yaml
Email Server Configuration
POST :: https://api.topcoder-dev.com/v5/bus/events
Headers ::
authorization : Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJjb3BpbG90IiwiYWFhIiwidGVzdFJvbGUiLCJ0b255X3Rlc3RfMSIsIlRvcGNvZGVyIFVzZXIiLCJhc2RkIiwiYWRtaW5pc3RyYXRvciJdLCJpc3MiOiJodHRwczovL2FwaS50b3Bjb2Rlci1kZXYuY29tIiwiaGFuZGxlIjoibXR3b21leSIsInVzZXJJZCI6IjQwMDE2MzU2IiwiZW1haWwiOiJtdHdvbWV5QHRvcGNvZGVyLmNvbSIsImp0aSI6ImRhNGMyNTZjLTBjNmQtNDFiYy1hN2NjLTU2ZjE5OTBiMTViMCIsIm5hbWUiOiJtZXNzYWdlLXNlcnZpY2UiLCJpYXQiOjE1MjI2NjkzNDQsImV4cCI6MTUyNTI2MTM0NH0.igeBTF8hDJ8koAY2IwaUYVTPzpSKhwD1v1LtyYbtUg8
cache-control : no-cache
content-type : application/json
Body ::
{
"topic": "member.action.email.profile.emailchange.verification",
"originator": "tc-member-profile",
"timestamp": "2018-04-11T00:00:00",
"mime-type": "application/json",
"payload": {
"data": {
"subject": "Topcoder - Email Change Verification",
"userHandle": "Upbeat",
"verificationAgreeUrl": "https://www.google.co.in/search?q=agree",
"verificationDisagreeUrl": "https://www.google.co.in/search?q=disagree"
},
"recipients": [
"atif.siddiqui2@wipro.com",
"atif.siddiqui2@topcoder.com",
"lunarkid@copilots.topcoder.com",
],
"replyTo": ""
}
}
In the payload :
- topic - is declared in tc-email-service with in the template mapper
- originator - Will be our repository name, for now given "tc-member-profile"
- data - contains the substitutions that would be replaced in the email template created. In our template we added subject, userHandle, verificationAgreeUrl, and verificationDisagreeUrl
- recipients - this is where we will place the new email address
- FYI: This is the email that will be received by by the recipients: https://www.dropbox.com/s/7c1leg7ufmjpssh/Email-sample.png?dl=0
- The expected solution for email server url, authorization token, payload - data should be all configurable - minimal code modifications.
Request and Response
- Create/Update endpoint parameters will accept input as raw/JSON format.
- Exclude file upload endpoints which cannot work with application/json content type.
- Response should be in json format always.
- Display related error messages that will cover the failure tests.
- Create best practices for the json response.
Postman Client JSON
- Create OR Update postman collection json file listing all calls and sample data.
- Provide description for endpoints
Final Submission Guidelines
Challenge Deliverables- Submit a git patch that implement the tasks requirements.
- Updated Documentation (if Any)
- Verification document contains steps to verify your solution. (if Any)
- Updated Swagger file
- Challenge winner will be responsible to do pull request over a git patch