Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

Table of Contents

Table of Contents

Open questions

Business Questions

  1. Is there a business rule that demands that only verified phone numbers can be used in customer search?

Business Answers

Tech Questions

  1. Why do two different Interfaces for lookupByPhone records exist? (one in user-service and another in intl-packages)

  2. Does accessing user-service phone lookup records from intl-packages violate the current architecture?

  3. Since Admin App is not using Launch Darkly, does it have a strategy defined for Feature Toggles?

Tech Answers

...

This is legacy from US, and neither of them are used today, since sign up via phone is disabled in international.

...

Table of Contents

Table of Contents

...

Business problem

This feature aims to implement the option to search for customers by phone in RBI Admin tool. This was a business request from Iberia (

Jira Legacy
serverSystem

...

Jira
serverId255417eb-03fa-3e2f-a6ba-05d325fec50d
keyIREQ-961
), given that customer support doesn’t always have the user’s email when trying to find them.

Tech Discovery

Architecture AS-IS

Today, Admin Tool only has the option to search customers by email or Cognito ID. The search by email is exemplified by the following sequence diagram.

...

The most direct solution is using intl-packages, which already exposes a method to search users by phone number and DynamoDB queries for userLookupByPhone records associating phone numbers to Cognito IDs. However, there is a divergence between the records created using intl-packages and the ones created by user-service, as can be seen below:

intl-packages:

Code Block
languagejs
{
  pk: phoneNumber,
  pk2: cognitoId,
  sk: current/user-lookup-by-phone
  sk2: current/user-lookup-by-phone/{date} 
}

user-service:

Code Block
languagejs
{
  pk: phone#${phoneNumber},
  pk2: phone_user#${cognitoId},
  sk: v0_UserPhone,
  sk2: v0_UserPhoneUserPhoneLookUp,
}

The user-service record is created when a user verifies their phone number via SMS. As far as we can tell, no one is using intl-packages lookup records since its only reference is its own test.

...

Note

Orders made using Call Center won’t appear in the customer history, since they are registered under the Call Center operator account.

Proposed solution n. 1 - DEPRECATED

Add the option in intl-packagesto search users by phone number, and change user-service API to create/update lookupByPhoneNumber records whenever there are changes in the customer's phone number.

...

It’s important to notice that since lookupByPhoneNumber records haven’t been created for existing users, a script will have to be developed to scan all users in DynamoDB and create their associated lookup records.

Necessary changes - summary

  • User Service API: Adapt GET user endpoint to also search by phone number

  • User Service API: Adapt the create method in user service to create a lookupByPhoneNumber record if a phone number is informed

  • User Service API: Adapt update-user lambda to update or create a lookupByPhoneNumber record if the phone number changed

  • User Service API: Add a isPhoneNumberVerified field to lookupByPhoneNumber interface. This is important to avoid impacting https://rbictg.atlassian.net/wiki/spaces/EGMT/pages/4329078785/Solution+Phone+Number+Authentication+for+BK+SA#Customer-support-tool

  • User packages: Change getByPhoneNumber to use User Service API instead of directly accessing the database

  • Admin App Backend: Create a GraphQL query to request customers by phone number

  • Admin App Frontend: Add the option to search customers by phone using the new query

  • DynamoDB: Develop a migration script to create lookupByPhoneNumber for existing customers

Diagrams

Search customer by phone sequence diagram:

...

Necessary changes - details

intl-user-service

  1. Include the isVerified field in IUserLookupByPhone Interface: https://github.com/rbilabs/intl-user-service/blob/master/src/users/user-lookup-by-phone.repository.ts#L25-L30

Code Block
export interface IUserLookupByPhone {
  pk: string;
  pk2: string;
  sk: string;
  sk2: string;
  isVerified: boolean;
}
  1. Create lookupByPhoneNumber record after creating the user in dynamo inside the pre-signup lambda, but only if a phone number is informed: https://github.com/rbilabs/intl-user-service/blob/master/src/cognito-lambdas/pre-signup.service.ts#L135

  2. Update the lookupByPhoneNumber record if an user update is triggered and includes the phone number: https://github.com/rbilabs/intl-user-service/blob/master/src/users/update-comm-pref.service.ts#L150

  3. Adapt the get user endpoint to have an phoneNumber query field, that searches by phone: https://github.com/rbilabs/intl-user-service/blob/master/src/users/users.controller.ts#L124

intl-packages

...

intl-admin-app

  • Create a GraphQL query that uses the searchByPhone method exposed by intl-packages

  • Update the UI to display the search by phone number option

These main changes are implemented in this git branch: https://github.com/rbilabs/intl-admin-app/pull/242

However, Admin App currently doesn’t use Launch Darkly, which makes it harder to control the feature activation for different markets and makes it riskier. Possible alternatives are:

...

Pros

...

Cons

...

Add and configure Launch Darkly in Admin App

...

  • Easy and quick FT management

  • Adhere to the pattern used in many other RBI repositories

...

  • High effort

...

Implement FT using environment variables

...

  • Medium effort

...

  • FT management requires that a Developer updates the CircleCI configuration and redeploys the app

  • An excessive number of env vars might be necessary

...

Only display the search by phone option in Iberia market

...

  • Low effort

...

  • Activation in other markets will require code changes

  • Once activated in an environment, can only be deactivated via hotfix or waiting for the normal Lifecycle

...

We could take advantage from the development done for SA market in

Jira Legacy
serverSystem Jira
serverId255417eb-03fa-3e2f-a6ba-05d325fec50d
keyIPN-31
.

However, this would still require existing customer to update their phone number for the search to work. This problem could be solved if we automatically update the user’s phone number with purchases. This can be done every time or only if they haven’t registered a phone.

Info

PROS:

  • The operator of the Admin tool can search by phone.

  • Customers will be associated to a phone number.

  • There is reusage in case OTP Phone validation will be implemented

  • EDGE CASE: In case of incidences on mobile ordering purchases when a user already did previously a delivery purchase, the operator can find the user by phone

Note

CONS:

  • Only one customer can be associated to a phone number. If the user tries to order using an already registered number, an error will appear on the screen.

  • EDGE CASE: There will be a phone number that is not officially validated and it can generate cases where the operator will input a phone number that is not the one expected for the user

  • OPTIONAL: Require a script for legacy data migration to update user phone number in case it is mandatory for the search by phone of older users to work.

Rule on when and how to save the phone number need to be defined

Proposed solution n. 2 - APPROVED

Using the Call Center solution to search orders by delivery phone. The search will return a list of orders using the given phone number, and they might come from multiple customer. One solution is to present this list of customers for the support team to decide which one they want to use.

...

This solution has the added bonus that if a phone number is associated to several phone number, that is probably a possible sign of a problem or even fraud.

Info

PROS: The operator of the Admin tool can see all customers associated with a phone number.

Note

CONS:

  • The search might be slower.

  • Causes more friction from the user point of view.

  • Search will only work for delivery orders.

  • The phone number might no be verified.