ecos-edi API Requests
The ecos-edi microservice implements functionality from the enterprise-core service EcosEdiService.
When sending a request to send a package or documents, or to generate service documents, a record DAO with id edi-action is used.
To send a request via records, the mutate method must be used.
Request and response DTO:
public static class EdiActionRequest {
private String requestType;
private EdiProviderType providerType;
private ObjectData requestData;
}
public static class EdiActionResult {
private T data;
}
Where:
requestType - тип запроса, например “generatePrintForm“
providerType- тип провайдера, Контур, СБИС и т.д. для Диадока необходимо указывать “KONTUR“ (см. EdiProviderType enum).
requestData - request data; e.g. for print form generation, this is the document’s documentRef
Request example:
RecordAtts requestAtts = new RecordAtts();
requestAtts.setId("edi/edi-action@");
requestAtts.setAtt("requestType", "generatePrintForm");
requestAtts.setAtt("providerType","KONTUR");
requestAtts.setAtt("requestData", ObjectData.create().set("documentRef", RecordRef.valueOf("recordRef value")));
recordsService.mutate(requestAtts);
Various request types can be found in the EdiRequestRecords class of the ecos-edi microservice
Console request example:
var rec = Records.get('edi/edi-action@'); // важно @ в конце
rec.att("_self", {
"requestType":"generatePrintForm",
"providerType":"KONTUR",
"requestData": {"documentRef":"emodel/edi-document@5d518efd-cef1-4ebf-b518-62ff9a620c9e"}
});
var resp = await rec.save("?json");
List of currently supported requests:
Request |
Description |
Example |
|---|---|---|
isCounterpartyExists |
Request to check whether a connection with a counterparty exists for a specific organization.
requestData parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"isCounterpartyExists",
"providerType":"KONTUR",
"requestData": {
"clientBoxId":"1312313-131331-1231",
"inn":"12334561234",
"kpp":"123652323"
}
});
var resp = await rec.save("json");
|
aquireCounterparty |
Request to create a connection with a counterparty.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"aquireCounterparty",
"providerType":"KONTUR",
"requestData": {
"counterpartyRef":"emodel/counterparty@12311241-123123",
"clientBoxId":"123123-123123123-123213",
"invitationDocRef ":"emodel/invitationDoc@12311241-123123",
"comment": "commentText"
}
});
var resp = await rec.save("json");
|
breakWithCounterparty |
Request to disconnect from a counterparty
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"breakWithCounterparty",
"providerType":"KONTUR",
"requestData": {
"counterpartyRef":"emodel/counterparty@12311241-123123",
"clientBoxId":"123123-123123123-123213",
"comment": "commentText"
}
});
var resp = await rec.save("json");
|
sendPackageToCounterparty |
Sending an outgoing package to the provider.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendPackageToCounterparty",
"providerType":"KONTUR",
"requestData": {
"packageRef":"emodel/edi-package@12311241-123123",
"counterpartyRef":"emodel/counterparty@12311241-123123",
"counterpartyBoxId ":"234623478246824623442374",
"legalEntityRef":"emodel/legal-entity@12311241-123123",
"clientBoxId":"2342342342342342424324",
"fromDepartmentId ":"3434444444444434343434",
"toDepartmentId":"242423423424242424242",
"isInternal":false,
"needSentSignature":true,
"packageNumber":"22551515252",
"packageDate":"2023/09/08",
"packageComment":"Test comment",
"signerRef": "emodel/person@12311241-123123"
}
});
var resp = await rec.save("json");
|
signPackage |
Sending signed documents in a package to the provider.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"signPackage",
"providerType":"KONTUR",
"requestData": {
"packageRef ":"emodel/edi-package@12311241-123123"
}
});
rec.save("json");
|
pointwiseSync |
Point-to-point synchronization with the provider for a single package.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"pointwiseSync",
"providerType":"KONTUR",
"requestData": {
"clientBoxId":"12315116136163241231",
"systemPackageId":"1321312312312321312312"
}
});
rec.save("json");
|
signDocuments |
Sending document signatures to the provider.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"signDocuments",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
signDocumentsAndBuyerTitles |
Sending signatures for formal documents to the provider.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"signDocumentsAndBuyerTitles",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
],
"invoicesRefs":[
"emodel/edi-document@ref3",
"emodel/edi-document@ref4"
]
}
});
rec.save("json");
|
sendReconciliationActSigns |
Sending signatures for reconciliation acts.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendReconciliationActSigns",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
],
"signerRef":"emodel/person@ref-1",
"signerJobTitle":"Директор тест"
}
});
rec.save("json");
|
rejectPackage |
Sending a signed rejection of document signatures in a package.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"rejectPackage",
"providerType":"KONTUR",
"requestData": {
"packageRef ":"emodel/edi-package@12311241-123123"
}
});
rec.save("json");
|
rejectDocuments |
Sending a signed rejection of document signatures.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"rejectDocuments",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
sendReconciliationActRejects |
Sending signed signature rejections for reconciliation acts.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendReconciliationActRejects",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
acceptRevocationRequests |
Sending signed annulment requests for documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"acceptRevocationRequests",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
declineRevocationRequests |
Sending signed rejections of annulment requests for documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"declineRevocationRequests",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
sendRevocationRequests |
Sending signed annulment requests for documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendRevocationRequests",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
sendCorrectionRequests |
Sending signed correction requests for documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendCorrectionRequests",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
sendBuyerTitles |
Sending signed buyer titles for formal documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendBuyerTitles",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
rec.save("json");
|
generatePrintForm |
Generate a print form for a document; returns the print form content
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generatePrintForm",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1"
}
});
var res = rec.save("json");
|
generatePrintFormWithDetails |
Generate a print form for a document; returns the print form content plus additional parameters (document ID, print form generation status at the provider, possible errors)
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generatePrintFormWithDetails",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1"
}
});
var res = rec.save("json");
|
needUpdateMainContentByPrintForm |
Whether print form generation is required for the document
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"needUpdateMainContentByPrintForm",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1"
}
});
var res = rec.save("json");
|
generateRejectionXml |
Generate a signature rejection XML for a document.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateRejectionXml",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1",
"signerRef":"emodel/person@ref-1",
"comment":"Test comment"
}
});
var res = rec.save("json");
|
generateRejectionsXml |
Generate signature rejection XML for documents
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateRejectionsXml",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
],
"signerRef":"emodel/person@ref-1",
"comment":"Test comment"
}
});
var res = rec.save("json");
|
generateRevocationXml |
Generate an annulment request XML for a document
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateRevocationXml",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1",
"signerName":"admin",
"comment":"Test comment"
}
});
var res = rec.save("json");
|
generateRevocationsXml |
Generate annulment request XML for documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateRevocationsXml",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
],
"signerName":"admin",
"comment":"Test comment"
}
});
var res = rec.save("json");
|
generateInvoiceCorrectionRequestXml |
Generate a correction XML for a document.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateInvoiceCorrectionRequestXml",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1",
"signerName":"admin",
"comment":"Test comment"
}
});
var res = rec.save("json");
|
isNeedSignTitle |
Check whether a buyer title signature is required for the document
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"isNeedSignTitle",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1"
}
});
var res = rec.save("json");
|
generateBuyerTitle |
Generate a buyer title XML for a document
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateBuyerTitle",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1",
"signerName":"admin",
"factArrivalDate ":"2023/09/08",
"comment":"Test comment"
}
});
var res = rec.save("json");
|
generateReceiptXml |
Generate a receipt acknowledgment XML for a document
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateReceiptXml",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1",
"signerName":"admin",
"signerPosition":"DirectorTest"
}
});
var res = rec.save("json");
|
generateReceiptsXml |
Generate receipt acknowledgment XML for documents
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"generateReceiptsXml",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
],
"signerName":"admin",
"signerPosition":"DirectorTest"
}
});
var res = rec.save("json");
|
sendReceiptsXml |
Sending signed receipt acknowledgment XML for documents.
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendReceiptsXml",
"providerType":"KONTUR",
"requestData": {
"documentRefs":[
"emodel/edi-document@ref1",
"emodel/edi-document@ref2"
]
}
});
var res = rec.save("json");
|
sendReceiptXml |
Sending signed receipt acknowledgment XML for a document (to be optimized in the future)
Parameters:
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"sendReceiptXml",
"providerType":"KONTUR",
"requestData": {
"documentRef":"emodel/edi-document@ref1"
}
});
var res = rec.save("json");
|
addDocumentsToSystemPackage |
Adding a document to the edi-package system package.
The parameters include the ref of the system package and a list of documents to be added to that package.
If the package ref is not specified, a new EDI package will be created and the provided documents will be added to it.
Documents can be of the edi-document type and its subtypes, as well as any other type not related to EDI
If a document that is not of the edi-document type or its subtype is provided, a corresponding edi-document type document is created for each such document.
The edi-document is added to the package and can then be sent to the provider.
The edi-document and the added custom document are linked via the ediDoc:systemDocumentLink association
Parameters:
The response returns the recordRef of the package
|
var rec = Records.get('edi/edi-action@');
rec.att("_self", {
"requestType":"addDocumentsToSystemPackage",
"providerType":"KONTUR",
"requestData": {
"packageRef":"emodel/edi-package@packageId", //id системного пакета для добавления документов (может быть null, тогда будет создан новый пакет
"documentRefs":["emodel/doc-type@doc-id"] // список документов для добавления в системный edi пакет
}
});
var resp = await rec.save("json");
|