Initial commit
This commit is contained in:
91
docs/zagros/KYC-steps/level-two/landline.md
Normal file
91
docs/zagros/KYC-steps/level-two/landline.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# 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
|
||||
|
||||
```mermaid
|
||||
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
|
||||
```
|
||||
42
docs/zagros/KYC-steps/level-two/mobile-ownership.md
Normal file
42
docs/zagros/KYC-steps/level-two/mobile-ownership.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# KYC: mobile ownership
|
||||
|
||||
### Outcome:
|
||||
we checking ownership of mobile.
|
||||
|
||||
### Implementation description:
|
||||
|
||||
#### Endpoints:
|
||||
PUT {$domain}/api/v2/barong/admin/profiles/label
|
||||
|
||||
#### File destination:
|
||||
- {$Dalan_Path}/app/workers/kyc/local/owner_mobile_worker.rb
|
||||
- {$Dalan_Path}/app/models/phone.rb
|
||||
- {$Dalan_Path}/app/services/kyc_service.rb
|
||||
- {$Dalan_Path}/app/api/v2/admin/profiles.rb
|
||||
- {$Dalan_Path}/app/services/jibit_service.rb
|
||||
|
||||
#### Commits:
|
||||
- 7f06a2e3
|
||||
- 816fb00e
|
||||
- 2c05522f
|
||||
- 90cbc486
|
||||
- 91e75604
|
||||
- bdfc578d
|
||||
|
||||
#### What did we implement:
|
||||
Ownership of mobile is done in background (worker) after last step (selfie confirmation).<br />
|
||||
The national code of verified profile with phone number , is sent to Jibit Service for matching.<br />
|
||||
The label key in the `labels` table is **owner_phone**
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
|
||||
Title: mobile ownership
|
||||
note over Admin,Dalan: admin user confirm users selfie
|
||||
Admin->>PUT Dalan:user_uid, label_key, label_value
|
||||
|
||||
note over Dalan,Jibit: Dalan send request to Jibbit service (as worker)
|
||||
Dalan->>Jibit:GET: natonal_code, phone_number
|
||||
Jibit->>Dalan:Response: matched, false or true
|
||||
Dalan->>Dalan: create ownership label with reject label or verified label
|
||||
```
|
||||
72
docs/zagros/KYC-steps/level-two/residence.md
Normal file
72
docs/zagros/KYC-steps/level-two/residence.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# KYC: Residence
|
||||
|
||||
###### Sprint: ?
|
||||
|
||||
### Outcome:
|
||||
|
||||
User can add address with complete information(city and province and etc..)
|
||||
|
||||
|
||||
#### Endpoints:
|
||||
|
||||
POST {$domain}/api/v2/barong/resource/profiles/address
|
||||
|
||||
#### File destination:
|
||||
|
||||
{$Dalan_Path}/app/api/v2/resource/profiles.rb
|
||||
|
||||
#### Commits:
|
||||
|
||||
f7820d8
|
||||
3e0fff4
|
||||
67c41b3
|
||||
f420fa4
|
||||
bff2746
|
||||
63977c3
|
||||
|
||||
#### What did we implement:
|
||||
|
||||
Opendax just implements address as a string but we need more information like city and province and document for residency.
|
||||
|
||||
So first of all we implemented city and province as below steps:
|
||||
|
||||
##### 1.create migrations:
|
||||
|
||||
20210420111532_create_provinces.rb → have just a name
|
||||
|
||||
20210420111629_create_cities.rb → have name and must connect to province(foreign key) references :province, foreign_key: true
|
||||
|
||||
|
||||
|
||||
##### 2.create models
|
||||
|
||||
Province model:
|
||||
|
||||
* Create validation for name: only allows letters, digits "-", "\'", and space. length: 1..255
|
||||
|
||||
* Mention to rails that this model has many cities
|
||||
|
||||
City model:
|
||||
* Mention to rails that this model belongs to province and this column is required.
|
||||
* Create validation for name: only allows letters, digits "-", "\'", and space. length: 1..255
|
||||
|
||||
we need seeds to fill city and province tables. So we used a JSON file from git and create a seed. data of the seed was put in config/seeds.yml file and the functions are in lib/barong/seed.rb.(seed_provinces and seed_cities) they check the existence of the data(city or province) then create it in db.
|
||||
|
||||
After these steps, we were ready to create a new API. we check the existence of the city and province that the user has been sent and create poa label. if user submitted another doc for poa and it has not been accepted, the new document will be replaced.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
title: residence
|
||||
User->>Ranj: residence information
|
||||
Ranj-->>Dalan: post /profiles/address params
|
||||
Dalan->>Ranj: 400, message: 'Required params are empty'
|
||||
Dalan->>Ranj: 401, message: 'Invalid bearer token'
|
||||
Dalan->>Ranj: 404, message: 'needed data doesnt exist'
|
||||
Dalan->>Ranj: 422, message: 'Validation errors',(address.already_exist,province_doesnt_exist)
|
||||
Dalan->>Ranj: 422, message: 'code_doesnt_expired'(there is an active process for addding new mobile)
|
||||
Dalan->>Ranj: 200, message: 'New phone was added'
|
||||
note left of Dalan: if there is a pending address it will be replaced with new one
|
||||
```
|
||||
|
||||
|
||||
|
||||
38
docs/zagros/KYC-steps/level-two/selfie.md
Normal file
38
docs/zagros/KYC-steps/level-two/selfie.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# KYC: Selfie
|
||||
###### Sprint: 3
|
||||
|
||||
### Outcome:
|
||||
Users can upload image for certification (the image includes selfie and signed text of the agreement )
|
||||
|
||||
|
||||
### Implementation description:
|
||||
|
||||
#### Endpoints:
|
||||
POST{$domain}/api/v2/barong/resource/profiles/selfie
|
||||
|
||||
#### File destination:
|
||||
{$Dalan_Path}/app/api/v2/resource/profiles.rb
|
||||
|
||||
#### Commits:
|
||||
ac083d21
|
||||
ea79c211
|
||||
|
||||
#### What did we implement:
|
||||
Users can upload images for the Selfie KYC step. In the first place that image is in a `pending` state.
|
||||
In the Admin panel, this image must be change state from `pending` to `confirm` or `reject`
|
||||
|
||||
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
|
||||
Title: KYC - Selfie
|
||||
|
||||
note over User,Ranj: **upload** must be valid format of image (jpg, jpeg, png)
|
||||
User->>Ranj: upload
|
||||
Ranj->>Dalan:Post: after client side checking
|
||||
Dalan->>Ranj:4xx if does not exist verified profile for the current user
|
||||
Dalan->>Ranj:4xx if before exist verified selfie image for the current user
|
||||
Dalan->>Ranj:2xx update (if exist unconfirmed ) or create new selfie
|
||||
Ranj->>User:notify user that password changed
|
||||
```
|
||||
Reference in New Issue
Block a user