ЕСОЗ - публічна документація
RC_DMS passport data synchronization for Persons (DMS)
- 1 Purpose
- 2 Configuration
- 3 Data flow
- 3.1 Step description
- 3.1.1 Step 1. Get list of Persons
- 3.1.2 Step 1.1 Update Person
- 3.1.3 Step 2. Call CheckPassportDMSStatus
- 3.1.4 Step 3. Create or update dms_passport_data
- 3.1.5 Step 4. Update Person
- 3.1.6 Step 4.1. Update another Persons
- 3.1.7 Step 4.2. Update Party
- 3.1.8 Step 5. Update Person
- 3.1.9 Step 6. Technical error returned
- 3.1 Step description
Purpose
This job is designed for initial and further regular synchronization of Persons with the EIS MVS registry in order to check if their passport documents are invalid or not.
Configuration
Value | Description | Example |
---|---|---|
DMS_PERSON_SYNCHRONIZATION_SCHEDULE | Cron parameter, represents start time of the EIS MVS data synchronization among invalid passport documents |
|
DMS_PERSON_VALIDATION_PERIOD_DAYS | Represents period in days when the existing saved dms data should be validated in dms registry if it still valid. |
|
DMS_PASSPORT_PERSONS_SYNCHRONIZATION_BATCH_SIZE | Amount of persons processed by DMS passport data synchronization job at once |
|
Data flow
Scheduller starts according to DMS_PERSON_SYNCHRONIZATION_SCHEDULE cron parameter. It creates oban job that selects DMS_PASSPORT_PERSONS_SYNCHRONIZATION_BATCH_SIZE Persons that match to some filter parameters. For each the job receives Person’s passport data on input and returns the result of reconciliation with the EIS MVS registry to output (details in “Step description” section below):
if Passport is found - verification status is set to NOT_VERIFIED.
if Passport is not found for the person - verification status is set to VERIFIED.
If Passport is absent - the person receives VERIFICATION_NOT_NEEDED status.
If incorrect passport data - verification status is set to NOT_VERIFIED.
if technical error received - the verification status and reason doesn’t change. A dms data is not saved, Person is not updated;
Step description
Step 1. Get list of Persons
Get the list of active Persons (status=active, is_active=true) who meet the following criteria (using logical AND):
mpi.person_verifications.dms_passport_synced_at <= current_date - DMS_PERSON_VALIDATION_PERIOD_DAYS OR dms_passport_synced_at is null
exclude persons who has dms_passport_verification_status = IN_REVIEW, NOT_VERIFIED, VERIFICATION_NOT_NEEDED
Order selected records in descending way by:
dms_passport_verification_status = VERIFICATION_NEEDED and dms_passport_verification_reason = ONLINE_TRIGGERED or MANUAL (should be at the top of the list)
Update person_verifications record by person_id:
dms_passport_verification_status = IN_REVIEW
dms_passport_verification_reason = AUTO
Step 1.1 Update Person
Invoke the Step If person_verifications.dms_passport_verification_status still IN_REVIEW
Make data pre-estimation for a synchronization:
If a person has no passport document (
NATIONAL_ID
orPASSPORT
) at all, then update person_verifications record by person_id:dms_passport_data_id = null
dms_passport_data_status = null
dms_passport_synced_at = null
dms_passport_verification_status = VERIFICATION_NOT_NEEDED
dms_passport_verification_reason = AUTO_DATA_ABSENT
dms_passport_unverified_at = null
Check If the person matches both rules:
it has only one passport document:
NATIONAL_ID
orPASSPORT
passport number matches the regex for its type:
^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$
for thePASSPORT
^[0-9]{9}$
for theNATIONAL_ID
Else, update person_verifications record by person_id:
dms_passport_data_id = null
dms_passport_data_status = null
dms_passport_synced_at = null
dms_passport_verification_status = NOT_VERIFIED
dms_passport_verification_reason = AUTO_INCORRECT_DATA
dms_passport_unverified_at = current datetime
Step 2. Call CheckPassportDMSStatus
Call CheckPassportDMSStatus with third-party service RC_MVS Trembita methods_EN (DMS warranty) | CheckPassportStatus using the following request params:
If mpi.person_documents.type = NATIONAL_ID
pass_type = 0101
pas_number= mpi.persons_documents.number
If mpi.person_documents.type = PASSPORT
pass_type = 0101
pas_number = mpi.persons_documents.number (number as last six symbols)
pas_serial = mpi.persons_documents.number (serial as first two symbols)
Step 3. Create or update dms_passport_data
If Step 2 was successful and PasStatus
= 1 returned. Get a record from mimir.dms_passport_data table by pass_type, pas_serial, pas_number :
if not found - create a record.
if found - updated the record.
Step 4. Update Person
Invoke the Step If person_verifications.dms_passport_verification_status still IN_REVIEW (because if changed to VERIFICATION_NEEDED+ONLINE_TRIGGERED, then it means that person record has been changed while current sync with MVS performed)
After dms_passport_data record was stored in Step 3 - update persons record in MPI db:
Update person_verifications record by person_id:
dms_passport_data_id = mimir.dms_passport_data.id
dms_passport_data_status = 1
dms_passport_synced_at = date and time when synchronization has been performed (current datetime)
dms_passport_verification_status = NOT_VERIFIED
dms_passport_verification_reason = AUTO_NOT_VALID
dms_passport_unverified_at = current datetime
Step 4.1. Update another Persons
Invoke the Step If person_verifications.dms_passport_verification_status is not IN_REVIEW
If dms_passport_data has been changed at Step 3, then find another Persons with the same document_type (PASSPORT or NATIONAL_ID) and document number. If such was fount, set for them also:
dms_passport_data_id = mimir.dms_passport_data.id
dms_passport_data_status = 1
dms_passport_synced_at = date and time when synchronization has been performed (current datetime)
dms_passport_verification_status = NOT_VERIFIED
dms_passport_verification_reason = AUTO_NOT_VALID
dms_passport_unverified_at = current datetime
Step 4.2. Update Party
Invoke the Step if party_verifications.dms_passport_verification_status is not IN_REVIEW
If dms_passport_data has been changed at Step 3, then find Parties with the same document_type (PASSPORT or NATIONAL_ID) and document number. If such was fount, set for them also:
dms_passport_data_id = mimir.dms_passport_data.id
dms_passport_data_status = 1
dms_passport_synced_at = date and time when synchronization has been performed (current datetime)
dms_passport_verification_status = NOT_VERIFIED
dms_passport_verification_reason = AUTO_NOT_VALID
dms_passport_unverified_at = current datetime
Step 5. Update Person
Invoke the Step If person_verifications.dms_passport_verification_status still IN_REVIEW
If passport wasn’t fount (PasStatus
= 0) in the register at Step 2, then update person_verification for the person_id:
dms_passport_data_id = null
dms_passport_data_status = 0
dms_passport_synced_at = date and time when synchronization has been performed (current datetime)
dms_passport_verification_status = VERIFIED
dms_passport_verification_reason = AUTO_VALID
dms_passport_unverified_at = null
Step 6. Technical error returned
If technical error: PasStatus
= -2, -1, timeout, etc. returned in Step 2 - the Person is considered unprocessed.
If person_verifications.dms_passport_verification_status still IN_REVIEW:
rollback to previous dms_passport_verification_status and dms_passport_verification_reason (that were before IN_REVIEW, set in Step 2)
ЕСОЗ - публічна документація