Tech analysis - Backend services

Architecture AS-IS

OTP Sign In

 

Braze

 

Proposal

Solution 1 - Add isBlocked field in User DynamoDB item

Workflow:

Support agent blocks the user

Blocked user attempts login

User is blocked while logged in WL → Add getMe query when user goes to cart page

User is blocked while logged in WL → Validate blocked user on gateway

Task breakdown

Changes in intl-whitelabel-cms

  1. Create email template for blocked user notification

    1. Templates should use the Liquid syntax

  2. Create email template for unblocked user notification

    1. Templates should use the Liquid syntax

Changes in intl-notifications-service

  1. Create send block notification endpoint

    1. POST /api/v1/email/send-block

    2. Create block TemplateType

    3. Receive SendEmailRequestDto as payload

  2. Create send unblock notification endpoint

    1. POST /api/v1/email/send-unblock

    2. Create unblock TemplateType

    3. Receive SendEmailRequestDto as payload

 

Changes in intl-users-service

  1. Create block user endpoint

    1. Endpoint: POST /api/v1/users/block-user/{cognitoId}

    2. Add isBlocked field to user details base interface

      1. The field should be returned in GET user endpoint

    3. Use UpdateService to set is blocked to true

    4. user notification-service to send email

    5. remove user from braze campaings

  2. Create unblock user endpoint

    1. Endpoint: POST /api/v1/users/unblock-user/{cognitoId}

    2. Use UpdateService to set is blocked to false

    3. user notification-service to send email

    4. return user to braze campaings

  3. Prevent blocked users from signing in

    1. Create UserBlockedError apollo error

    2. Add isBlocked validation in the listed resolvers:

      • createOTP

      • createLoginOTP

      • signInJWT

      • socialLogin

    3. User not found validation for reference

Changes in intl-packages

  1. Add isBlocked to userDetails type

  2. Create method to block user

    1. Should use axios to trigger a request to user service

  3. Create method to unblock user

    1. Should use axios to trigger a request to user service

 

Changes in intl-whitelable-graphql

  1. Add isBlocked to userDetails type

Changes in intl-admin-app

Changes in intl-whitelable-app

Solution 2 - Disable user in cognito