ЕСОЗ - публічна документація

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Method is used to register new employee or to update an existing one. There is 2 different flows of registration depend on whether the employee has tax_id or doesn't have.

Authorize user

  1. Validate MIS API Key

    • Check MIS scopes employee_request:write in order to perform this action

      1. In case error - generate 401 response

Digital signature

Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature and returns result.
See service specification

Validate DRFO

  1. Check that DRFO in Certificate details exists and not empty

  2. Check that DRFO in Certificate details is equal to DRFO of the user that creates employee_request in Party

    1. Get party.tax_id using user_id in declaration payload

    2. Compare DRFO in Certificate with party.tax_id

      1. Convert DRFO and TAX_ID to uppercase

      2. Compare DRFO and TAX_ID as Cyrillic letters

      3. Convert DRFO to Cyrillic and compare as Cyrillic letters

    3. In case validation fails - generate 422 error

Latin to Cyrillic mapping using legal table 

Validate request (JSON schema)

  1. Validate request using JSON schema

    1. In case validation fails - generate 422 error

  2. Validate $.party.documents.[].number according to regexp and document type:

    1. PASSPORT - ^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$

    2. NATIONAL_ID - ^[0-9]{9}$

    3. COMPLEMENTARY_PROTECTION_CERTIFICATE - ^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$

    4. REFUGEE_CERTIFICATE - ^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$

    5. TEMPORARY_CERTIFICATE - ^(((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{4,6}|[0-9]{9}|((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{5}\\/[0-9]{5})$

    6. TEMPORARY_PASSPORT - ^((?![ЫЪЭЁыъэё@%&$^#`~:,.*|}{?!])[A-ZА-ЯҐЇІЄ0-9№\\/()-]){2,25}$

      1. in case of error - return 422 ('string does not match pattern') with the corresponding regexp

Validate request (Logic)

  1. Check employee_type: Employee configurable validation rules and dictionaries

  2. If employee_id is passed in the payload:

    1. search employees by employee_id

      1. if not found - return error 404

    2. check that employee_type not in (OWNER, PHARMACY_OWNER)

      1. in case of error - return 409 “Forbidden to create <employee_type>“

    3. check employee_type and tax_id (or passport_id, if no_tax_id: true)

      1. If dosn't match, return error 409 “<field> doesn't match"

    4. check that employee is active (status = APPROVED and is_active = true)

      1. in case of error - return 409 “employee is <status>“

  3. Check allowed employee types for legal_entity type: Legal_Entity_Type vs Employee_Type validation rules

    1. if not found - return error 404

  4. Validate legal entity type status for current legal entity: status should be active or suspended

  5. Check that documents.[x].type contain values from IDENTITY_DOCUMENT_TYPES EMPLOYEE_IDENTITY_DOCUMENT_TYPES chart parameter

    • in case of error - return 422 (“Submitted document type is not allowed“)

  6. Check that document types NATIONAL_ID and PASSPORT both do not exist in request

    • in case of error - return 422 ('Employee can have only one of following document types [\"PASSPORT\", \"NATIONAL_ID\"]')

Alternative notation 2 of validation :

 Click here to expand...
if (employee_id is passed in the payload) {
	result=search employees by employee_id;
	if (result == false) {
		return error 404 }
	else { 
		result=check * employee_type and * tax_id
		if (result == false) {
			return error 409}
		else {
			if (employee is active) {
				if (employee_type = OWNER || employee_type = PHARMACY_OWNER) {
					set status = APPROVED
					set is_active = false}
				if (employee_type not OWNER && employee_type not PHARMACY_OWNER) {
					set status = DISMISSED
					set is_active = true}
				if (employee is active) {
					create employee request }
				else {
					return error 409 }
					}
				}
			}
		}
	}
}	

result=search employee_type_legal_entity_type_links by employee_type+legal_entity_type
if (result == false) {
		return error 404 }

Save signed declaration to media storage

  1. Get url for declaration upload.
    Use Request a Secret WS

Parameter

Source

action

'GET'

bucket

'EMPLOYEE_REQUESTS'

resource_id

: EMPLOYEE_REQUEST_ID

resource_name

: signed_employee_request

  1. Upload signed declaration to media storage

Create employee request

Create employee request in IL_DB table - employee_request.

  1. generate GUID and writte in id column

  2. write JSON object with employee request details

Send activation link on email

  1. Generate activation link, which contains Employee request GUID

  2. Send activation URL on user email

    1. invoke service - Send message
      See service specification 

  • No labels