Table of Contents |
---|
Purpose
...
Table of Contents |
---|
Purpose
This method must be used to create new division in the system.
...
Page Properties | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||
|
Logic
General
Each legal entity can manage its own divisions:
...
Note: Calculate mountain group for each new Divisions based on division address
Confluence: ERD
Acceptance criteria:
Configured Public GET, POST, PATCH methods on GW
Successful response with correct authorization and appropriate scopes
401 error on invalid authorization
403 error on invalid scopes
Legal entity id is missing in request
Legal entity id is set as header by GW
Created divisions saved to DB
Mountain group calculated
...
Expand | ||
---|---|---|
| ||
|
Authorize
...
Verify the validity of access token
Check user scope (scope = 'division:write') in order to perform this action
...
|
Authorize
Verify the validity of access token
Check user scope (scope = 'division:write') in order to perform this action
in case error - generate 401 response
If BLOCK_UNVERIFIED_PARTY_USERS is true, then check party's data match following condition: verification_status != NOT_VERIFIED or (verification_status = NOT_VERIFIED and updated_at <= current_date - UNVERIFIED_PARTY_PERIOD_DAYS_ALLOWED):
in case not match - return 403 ("Access denied. Party is not verified")
Headers
Content-Type:application/json
Authorization:Bearer {{access_token}}
API-key:{{secret}}
...
Processing
Create new division
Parameter | Source |
---|---|
action | `PUT` |
id | |
external_id | $.external_id |
name | $.name |
type | $.type |
mountain_group | |
addresses | $.addresses |
phones | $.type, $.number |
inserted_at | :timestamp |
Updated_at | :timestamp |
legal_entity_id | take from token |
Location | $.latitude, $.longitude |
status | ACTIVE |
is_active | true |
working_hours | $.working_hours |
Additional
Add new mapping for "division_type" & Legal_entity_type
Check that prm.legal_entities.status = active or suspended and prm.legal_entities.is_active = true for legal entity to which division is added
Add new validation for verification of usage division_type in Legal_entity_type at Create_division process.
There is no other specific logic for new division types.
...