Files
Dalan/docs/zagros/KYC-steps/level-two/landline.md
2026-08-13 19:56:46 +03:30

2.7 KiB

KYC: landline

Sprint: 3

Outcome:

User should enter his number, after the validation app sends a call with an otp code, the user must enter the code to prove to us that he has access to the entered number.

Endpoints:

POST {$domain}/api/v2/barong/resource/phones

POST {$domain}/api/v2/barong/resource/phones/send_code

POST {$domain}/api/v2/barong/resource/phones/verify

File destination:

{$Dalan_Path}/app/api/v2/resource/phones.rb

Commits:

bd7f980596 695b0b56e2 6dd40a9c42 e04a58b012 36167eda10 2089690fe0 90cbc48649 17a5bce849 63722fe22a 63977c330d bff2746686 75490dcb22 f13ee3f4d5 2c05522f77 46c053b435 551e7cdba2 77d7b9a9b3 2da71b1097

What did we implement:

in access mobile told about KaveNegarService user entered landline number then system send call by kave negar with otp code user must enter send code to prove us that has access.

if user wants to enter new number:

1.if user have verified phone: response error

2.if user has pending number: update that number with new one

3.if user doesnt have number in our system: create new one

sequenceDiagram
    title: access landline
    User->>Ranj: enter landline number with +98
    Ranj-->>Dalan: post /phones params
    Dalan->>Ranj: 400, message: 'Required params are empty'
    Dalan->>Ranj: 401, message: 'Invalid bearer token'
    Dalan->>Ranj: 404, message: 'Record is not found'
    Dalan->>Ranj: 422, message: 'Validation errors'
    Dalan->>Ranj: 422, message: 'code_doesnt_expired'(there is an active process for addding new landline) and phone.exists(has verified number in system)
    Dalan->>Ranj: 200, message: 'New phone was added'
    note left of Dalan: if there is a pending number it will be replaced with new one
    Dalan->>KaveNegar: send call to User in case of success
    KaveNegar->>User: call with code
    Ranj->>User: show result
    note right of User: if didnt catch call 
    
    User->>Ranj: resend code
    Ranj->>Dalan: Post phones/send_code params
    Dalan->>Ranj: 400, message: 'Required params are empty'
    Dalan->>Ranj: 401, message: 'Invalid bearer token'
    Dalan->>Ranj: 404, message: 'Record is not found', 'phone.doesnt_exist'
    Dalan->>Ranj: 422, message: 'Validation errors'
    Dalan->>Ranj: 422, message: 'code_doesnt_expired' (expiration time doesnt finish)
    Dalan->>KaveNegar: send call to User in case of success
    KaveNegar->>User: call with code
    Ranj->>User: show result
    User->>Ranj:enter code
    Ranj->>Dalan: Post phones/verify params
    Dalan->>Ranj: 401, message: 'Invalid bearer token'
    Dalan->>Ranj: 404, message: 'Record is not found', 'phone.doesnt_exist', 'verification_invalid
    Dalan->>Ranj: 422, message: 'Validation errors'
    Dalan->>Ranj: success 2xx
    Ranj->>User: show result