Your information system should work with documents that consist of several primary attachments. If this is not the case, implement this support or refuse to approve documents in your information system. All document attachments are agreed (rejected/approved) at the same time.
To process incoming primary documents in the IS, you need to save the ID of the workflow stage from «Документ.Этап.Идентификатор» («Document.Stage.ID»). You can get it when you download the first or subsequent versions of the document. When performing actions on a document (for example, «Approval» or «Rejection»), you must pass the saved ID.
- If the EDI regulation provides for responses to notifications and they are not processed in a separate looped flow, perform processing of service steps for the document:
- Call «СБИС.СписокСлужебныхЭтапов» with the filter «НашаОрганизация» («OurOrganization») and «ИдентификаторДокумента»/«ИдентификаторРедакции» («DocumentID»/«EditionID»);
- If the response returns a non-empty list, process the list items. To do this, call «СБИС.ПодготовитьДействие» and «СБИС.ВыполнитьДействие».
- If your information system does not store or synchronize information about steps and actions for incoming documents, then sync the document state from «Документ.Состояние.Код» («Document.Condition.Code») before processing the document. To do this, read the document using the command «СБИС.ПрочитатьДокумент». Addressing is performed by the document ID («Документ.Идентификатор») or the edition ID («Документ.Редакция.Идентификатор»).
- Select the stage and action that will complete the selected approval stage: «Документ.Этап.Идентификатор» («Document.Stage.ID»), «Документ.Этап.Действие.Название» («Document.Stage.Action.Title»).
- Prepare document attachments. This can be done in Saby or in a third-party information system.
- Prepare xml document attachments using the «СБИС.ПодготовитьДействие» command. Be sure to send information about the stage, the stage action, the signatory, or the selected certificate. The server will generate response titles and service documents.
When approving a document with any number of attachments, the following is generated:
- response title for each attachment that requires a response title;
- one general document «Approval Notification».
- Sign the documents in Saby.
- To repeat the approval step for an incoming document, use the «СБИС.ПовторитьЭтап» command.
If a document with any number of attachments is rejected, a separate «Rejection Notification» document is generated for each attachment.
- Create an xml-representation of the response titles and other service documents yourself, or call «СБИС.ПодготовитьДействие» command. Enter information about the stage, the stage action, and the signatory. Using an HTTP GET request to the address in «Документ.Вложение.Файл.Ссылка» («Document.Investment.File.Link») upload the generated response titles and service attachments to your IS. Check and adjust them if necessary.
- Sign the documents in your system. If service attachments are generated in your IS:
- Call the «СБИС.ПодготовитьДействие» method. Online.saby.ru generates attachments and returns the list for signing.
- Extract the ID's of the generated attachments from «Документ.Вложение.Идентификатор» («Document.Attachment.ID») and use them when sending the «СБИС.ВыполнитьДействие» and upload attachments. Generated service attachments on online.saby.ru will be replaced by your own.
- Do not pass the «Вложение.СсылкаНаФайл» («Attachment.LinkToFile») and «Вложение.ДвоичныеДанные» («Attachment.BinaryData») for attachments that do not require replacement. If the link leads to the same attachment — it will be ignored. In all other cases, either a new version will be created for the signed attachment, or the unsigned attachment will be overwritten.
- To repeat the approval step for an incoming document, use the «СБИС.ПовторитьЭтап» command.
Attention!
When generating a notification of acceptance or rejection by yourself, use Moscow time. When writing to the server, the time in the body of the xml attachment is checked. If the time is less than the time when the document was actually created (received) on the server, an error will be generated, and the event will remain unprocessed.
The option without calling «СБИС.ПодготовитьДействие» is allowed (but not recommended). In this case, create the documents and signatures required by the Saby regulations (for local signing) or the certificate details (for server signing with an unqualified certificate). After that, send the generated data to the server using the command «СБИС.ВыполнитьДействие».
Example of document approval
Example of rejection of incoming document
Example of processing an incoming order with substitution of confirmation
License
The «Exchange with partners» and «Implementation of EDI» tariffs of «Electronic Document Flow» service.