Table of Contents |
---|
Specification
Method The method is used to register new employee or to update an existing one. There is 2 are two different flows of registration depend depending on whether the employee has tax_id or doesn't have one.
...
Authorize user
Validate MIS API Key
Check MIS scopes employee_request:write in order to perform this action
In case error - generate 401 response
...
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
Check that DRFO in Certificate details exists and not empty
Check that DRFO in Certificate details is equal to DRFO of the user that creates employee_request in Party
Get party.tax_id using user_id from employee request payload
Compare DRFO in Certificate with party.tax_id
Convert DRFO and TAX_ID to uppercase
Compare DRFO and TAX_ID as Cyrillic letters
Convert DRFO to Cyrillic and compare as Cyrillic letters
In case validation fails - generate 422 error
...
Validate request using JSON schema
In case validation fails - generate 422 error
new_employee_request_schema.json
Validate request (Logic)
Check employee_type: Employee configurable validation rules and dictionaries
If employee_id is passed in the payload:
search employees by employee_id
if not found - return error 404
else check * employee_type and (* tax_id or passport_id)
If dosn't match, return error 409
If match, check that employee is active
for (employee_type = OWNER or PHARMACY_OWNER), status = APPROVED and is_active = false
for (employee_type not OWNER and not PHARMACY_OWNER), status = DISMISSED and is_active = true
if employee is active - create employee request
if employee is not active - return error 409
Check allowed employee types for legal_entity type: Legal_Entity_Type vs Employee_Type validation rules
if not found - return error 404
Validate legal entity type status for current legal entity: status should be active or suspended
Validate party
first_name, last_name, second_name have the same validation pattern - `^(?!.*[ЫЪЭЁыъэё@%&$^#])[А-ЯҐЇІЄа-яґїіє’\\'\\- ]+$`
if doesn't match, return error 422 "string does not match pattern ..."
validate birth_date
birth_date > 1900-01-01 and birth_date < current date
otherwise return error 422 "invalid birth_date value"
birth_date has validation pattern - `^(\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))?)?$`
if doesn't match, return error 422 "expected 'birth_date' to be a valid ISO 8601 date"
gender has one of the following values - "FEMALE", "MALE"
otherwise return error 422 "value is not allowed in enum"
validate tax_id
tax_id has validation pattern - `^([0-9]{9,10}|[А-ЯЁЇIЄҐ]{2}\\d{6})$`
if doesn't match, return error 422 "string does not match pattern ..."
email has validation pattern - `^[\\w!#$%&'*+/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}$`
if doesn't match, return error 422 "expected 'email' to be an email address"
validate documents
documents.type has one of the following values:
"BIRTH_CERTIFICATE"
"BIRTH_CERTIFICATE_FOREIGN"
Jira Legacy server System Jira serverId d9171809-9c5e-36f7-ab17-a56a875b6d19 key BAT-1392 "COMPLEMENTARY_PROTECTION_CERTIFICATE"
"NATIONAL_ID"
"PASSPORT"
"PERMANENT_RESIDENCE_PERMIT"
"REFUGEE_CERTIFICATE"
"TEMPORARY_CERTIFICATE"
"TEMPORARY_PASSPORT"
otherwise return error 422 "value is not allowed in enum"
documents.number has validation pattern according to documents.type
BIRTH_CERTIFICATE - `^((?![ЫЪЭЁыъэё@%&$^#`~:,.*|}{?!])[A-ZА-ЯҐЇІЄ0-9№\\/()-]){2,25}$`
COMPLEMENTARY_PROTECTION_CERTIFICATE - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
NATIONAL_ID - `^[0-9]{9}$`
PASSPORT - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
PERMANENT_RESIDENCE_PERMIT - `^(((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{4,6}|[0-9]{9}|((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{5}\\/[0-9]{5})$`
REFUGEE_CERTIFICATE - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
TEMPORARY_CERTIFICATE - `^(((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{4,6}|[0-9]{9}|((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{5}\\/[0-9]{5})$`
TEMPORARY_PASSPORT - `^((?![ЫЪЭЁыъэё@%&$^#`~:,.*|}{?!])[A-ZА-ЯҐЇІЄ0-9№\\/()-]){2,25}$`
validate documents.issued_at
documents.issued_at has validation pattern - `^(\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))?)?$`
if doesn't match, return error 422 "expected 'issued_at' to be a valid ISO 8601 date"
validate phones
phones.type has one of the following values - "LAND_LINE", "MOBILE"
otherwise return error 422 "value is not allowed in enum"
phones.number has validation pattern - `^\\+38[0-9]{10}$`
if doesn't match, return error 422 "string does not match pattern ..."
...