/
[TECHDOC][MOBILE] NDR Based OTP

[TECHDOC][MOBILE] NDR Based OTP

 

Jira Ticket :

https://app.devrev.ai/shipsy/works/ISS-255559

 

Problem Statement :

OTP to be triggered based on selected undelivered reason . This is to be handled in App flow V2 config

Solution :

1. In App flow v2 ,

  • we receive App flow config , where on undelivered , the config with flow id : failure_config is used in transaction where we use step single_choice_reason .

  • This step has list of reason and branch step based on reason id .

  • Now each NDR will be mapped with list of steps ,

    • For NDR , with step OTP , if this feature is enabled , app will expect key : should_generate_otp

    • similar to shown in json below :

    • "branch_steps": { "NSR": [ { "action_id": "otp", "type": "otp_dialog", "control": { "visibility": "mandatory" }, "config": { "should_generate_otp": true }, "ui": { "pretty_name": "OTP" } } ], "INCORRECT ADDRESS": [ { "action_id": "otp", "type": "otp_dialog", "control": { "visibility": "optional" }, "config": { "should_generate_otp": false }, "ui": { "pretty_name": "OTP" } } ] },
    • In Above example ,

      • We will show a button to generate OTP in the OTP screen

2. UI / UX Actions

Send OTP

  • as mentioned above , button : Send OTP will be shown on UI based on above explained configs

  • On clicking Send OTP , it will call api : /api/RiderApp/validateOtpOnDelivery

  • request body will now contain : status where status will be attempted signifying undelivered flow .

  • This will trigger message to end customer.

  • Request Body now will look like :

  • @Serializable data class ResendDeliveryOtpRequest( @SerialName("reference_number") val referenceNumber: String, @SerialName("task_id") val taskId: String, @SerialName("status") val status: String )
  • On Response , we will handle success or failure , to intimate user about API status i.e., success or failure via Toast message.

  • use-case modified will be ResentOtpUseCase

ResendOtp

  • Same Request will go for every Resend / Send OTP click , no check based on should_generate_otp received in app flow v2 config.

 

Verify OTP

  • here if otp was generated , /api/RiderApp/validateOtpOnDelivery API will be called

  • Request JSON will look like :

  • { "status": "attempted", "task_id": "TASK789", "task_failure_reason_id": "REASON001", "otp": "123456" // entered by user }
  • Currently , there is no API called in app flow v2 for validating , it is matched with task.otp

  • So this flow will be executed when should_generate_otp is true.

  • UseCase modified : OtpUseCase

Rest flow will be same as existing.

 

Add label