мы разрабатываем вместе с библиотекой Java из REST API процедуру подписания нескольких документов, где позиция подписи устанавливается с помощью anchorString в signHereTabs для каждого подписавшего (anchorString - это строка, вставляемая в документ для подписи);поскольку у нас есть документы, размер которых превышает 25 МБ, мы используем то, что было сообщено в https://developers.docusign.com/esign-rest-api/guides/resource-limits, то есть мы создаем черновой конверт (статус = создан), а затем мы обновляем этот конверт документами;проблема в том, что когда мы устанавливаем конверт со статусом = отправлено, подписывающее лицо получает электронное письмо, открывает ссылку на DocuSign, но только первый документ разрешает доступ к anchorString.Есть ли какой-нибудь конкретный способ обновить список документов в черновом конверте?
Спасибо
...
// add a recipient to sign the document, identified by name and email we used above
int recipientId = 0;
List<Signer> signerList = new ArrayList<Signer>();
/* to fix the position where the signature has to be inserted */
int buyerIdx = 0;
int supplierIdx = 0;
for(DSSignerInfo signerInfo : signers) {
Tabs tabs = new Tabs();
Signer signer = new Signer();
signer.setEmail(signerInfo.getEmail());
signer.setName(signerInfo.getName());
signer.setRecipientId(String.valueOf(++recipientId));
signer.setRoutingOrder(String.valueOf(recipientId)); // sequential
signer.setRoleName("role unknown");
RecipientEmailNotification emailNotification = new RecipientEmailNotification();
emailNotification.setEmailBody("emailBody - "+signerInfo.getName());
emailNotification.setEmailSubject("emailSubject - "+signerInfo.getName());
emailNotification.setSupportedLanguage(signerInfo.getLanguage());
signer.setEmailNotification(emailNotification);
// create a signHere tab somewhere on the document for the signer to sign
// default unit of measurement is pixels, can be mms, cms, inches also
for(int documentId = 1; documentId <= documentFiles.size(); documentId++) {
SignHere signHere = new SignHere();
signHere.setDocumentId("" + documentId);
signHere.setPageNumber("1");
signHere.setRecipientId(String.valueOf(recipientId));
if(signerInfo.getRole().equalsIgnoreCase("buyer")) {
signHere.setAnchorString("BUYER_"+buyerIdx);
} else {
signHere.setAnchorString("SUPPLIER_"+supplierIdx);
}
signHere.setAnchorXOffset("10");
signHere.setAnchorYOffset("10");
tabs.addSignHereTabsItem(signHere);
}
signer.setTabs(tabs);
signerList.add(signer);
if(signerInfo.getRole().equalsIgnoreCase("buyer")) {
buyerIdx++;
} else {
supplierIdx++;
}
}
Recipients recipients = new Recipients();
recipients.setSigners(signerList);
envDef.setRecipients(recipients);
try {
String envelopeId = null;
EnvelopesApi envelopesApi = null;
// create a byte array that will hold our document bytes
int documentId = 1;
for(String documentFile : documentFiles) {
byte[] fileBytes = null;
try {
// read file
Path path = Paths.get(documentFile);
fileBytes = Files.readAllBytes(path);
} catch (IOException ioExcp) {
// handle error
System.out.println("Exception: " + ioExcp);
return null;
}
// add a document to the envelope
Document doc = new Document();
String base64Doc = Base64.getEncoder().encodeToString(fileBytes);
doc.setDocumentBase64(base64Doc);
String fileName = new File(documentFile).getName();
doc.setName(documentId+"_"+fileName);
doc.setFileExtension(fileName.lastIndexOf('.') > 0 ? fileName.substring(fileName.lastIndexOf('.') + 1) : "");
doc.setDocumentId("" + documentId++);
envDef.addDocumentsItem(doc);
if(envelopeId == null || envelopesApi == null) {
// To save as a draft set to "created" (for test purpose I create and envelope with only one file)
envDef.setStatus("created");
envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envDef);
envelopeId = envelopeSummary.getEnvelopeId();
} else {
// the files after the 1st are updated in the draft envelope
envDef.setRecipients(recipients);
List<Document> tmpDocumentList = new ArrayList<Document>();
doc.setApplyAnchorTabs("true");
tmpDocumentList.add(doc);
envDef.setDocuments(tmpDocumentList);
EnvelopeDocumentsResult envelopeDocumentsResult = envelopesApi.updateDocuments(accountId, envelopeId, envDef);
}
}
Envelope envelope = envelopesApi.getEnvelope(accountId, envelopeId);
envelope.setStatus("sent");
envelope.setPurgeState(null);
EnvelopesApi.UpdateOptions uo = envelopesApi. new UpdateOptions();
uo.setAdvancedUpdate("true");
EnvelopeUpdateSummary envelopeUpdateSummary = envelopesApi.update(accountId, envelopeId, envelope, uo);
documentId = 1;
for(String documentFile : documentFiles) {
Tabs tabs = envelopesApi.getDocumentTabs(accountId, envelopeId, ""+documentId++);
System.out.println("CARLO Tabs 3, documentId "+(documentId - 1)+": "+tabs);
}
Спасибо за ваш ответ.Более подробная информация: в конверте у нас более одного документа;размер каждого документа - менее 25 МБ;сумма размеров всех документов составляет более 25 МБ.Мы можем загружать документы в конверте со статусом «создано», но когда статус изменяется на «отправлено» и подписывающее лицо переходит на страницу подписи, подписывать эти документы не требуется;кажется, что signHereTabs не установлен в документах, добавленных, когда статус конверта «создан».
Если после установки статуса конверта = «отправлено», мы выполняем следующий код
documentId = 1;
for(String documentFile : documentFiles) {
Tabs tabs = envelopesApi.getDocumentTabs(accountId, envelopeId, ""+documentId++);
System.out.println("Tabs: documentId "+(documentId - 1)+": "+tabs);
}
мы получаем
Tabs: documentId 1: class Tabs {... signHereTabs: [class SignHere {anchorCaseSensitive: null anchorHor HorizontalAlignment: null anchorIgnoreIfNotPresent: null anchorMatchWholeWord: null anchorString :chorNOO: anchorOff: an: 10: 0: 0: 0: 0: 0: anignOff: an: 10: 0: 0conditionalParentLabel: ноль условноеParentValue: нольtabId: e484087c-70c2-431c-9825-47605e1f44c2 tabLabel: Sign Here tabOrder: null templateLocked: null templateRequired: null tooltip: null xPosition: 123 yPosition: 297}] ...} Tabs: documentId 2: class Tabs {...signHereTabs: [] ...}
, где documentId 1 был загружен, когда конверт был создан (status = "созданный"), а documentId 2 был загружен на втором шаге (оба documentId 1 и 2содержит строку anchorString: BUYER_0).