简体   繁体   English

Docusign:Nodejs 创建信封,没有错误,但返回空 Object

[英]Docusign: Nodejs Create Envelope, No Error, But returns Empty Object

I have a fairly simple setup, wanted to create a simple envelope used the node-DocuSign-examples client.我有一个相当简单的设置,想使用 node-DocuSign-examples 客户端创建一个简单的信封。 https://github.com/docusign/code-examples-node https://github.com/docusign/code-examples-node

I am getting jwt token from the getToken method( Completed all the user consent issues.) But CreateEnvelope Api from Docusign API is returning exports {} as a response.我从 getToken 方法获得 jwt 令牌(已完成所有用户同意问题。)但来自 Docusign API 的 CreateEnvelope Api 正在返回exports {}作为响应。

Simple Function from node example:来自节点示例的简单 Function :

 eg001EmbeddedSigning.worker = async (args) => { let dsApiClient = new docusign.ApiClient(); dsApiClient.setBasePath(args.basePath); dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken); let envelopesApi = new docusign.EnvelopesApi(dsApiClient), results = null; // Step 1. Make the envelope request body let envelope = makeEnvelope(args.envelopeArgs) // Step 2. call Envelopes::create API method // Exceptions will be caught by the calling function results = await envelopesApi.createEnvelope(args.accountId, {envelopeDefinition: envelope}); let envelopeId = results.envelopeId; console.log(`Envelope was created. EnvelopeId ${envelopeId}`); // Step 3. create the recipient view, the Signing Ceremony results = await envelopesApi.createRecipientView(args.accountId, envelopeId); return ({envelopeId: envelopeId}) } function makeEnvelope(args){ let docPdfBytes; docPdfBytes = fs.readFileSync(path.resolve(demoDocsPath, pdf1File)); let env = new docusign.EnvelopeDefinition(); env.emailSubject = 'Please sign this document'; let doc1 = new docusign.Document(), doc1b64 = Buffer.from(docPdfBytes).toString('base64'); doc1.documentBase64 = doc1b64; doc1.name = 'Lorem Ipsum'; doc1.fileExtension = 'pdf'; doc1.documentId = '3'; env.documents = [doc1]; let signer1 = docusign.Signer.constructFromObject({ email: args.signerEmail, name: args.signerName, clientUserId: args.signerClientId, recipientId: 1 }); let signHere1 = docusign.SignHere.constructFromObject({ anchorString: '/sn1/', anchorYOffset: '10', anchorUnits: 'pixels', anchorXOffset: '20'}); let signer1Tabs = docusign.Tabs.constructFromObject({ signHereTabs: [signHere1]}); signer1.tabs = signer1Tabs; let recipients = docusign.Recipients.constructFromObject({ signers: [signer1]}); env.recipients = recipients; env.status = 'sent'; return env; }

I suggest that you first download and install the overall Node.js example and get it working.我建议您首先下载并安装整个Node.js 示例并让它工作。 Then compare it to your code to understand where the problem is.然后将其与您的代码进行比较以了解问题所在。

At first glance your code looks fine, so something more subtle is going on.乍一看,您的代码看起来不错,因此发生了一些更微妙的事情。

Also, when you requested consent for your integration key, did you request both the signature and impersonation scopes?此外,当您请求同意您的集成密钥时,您是否同时请求了signatureimpersonation范围?

Added添加

Anytime a document is not being displayed correctly, here are the steps to debug:任何时候文档无法正确显示,以下是调试步骤:

  1. Try using the DocuSign web tool to create an envelope that includes the suspect document.尝试使用 DocuSign web 工具创建包含可疑文档的信封。 If the envelope and document work correctly, then the problem is with your software application, not with the document itself.如果信封和文档正常工作,那么问题出在您的软件应用程序上,而不是文档本身。 In this case check that you're processing the PDF as a binary file.在这种情况下,请检查您是否将 PDF 作为二进制文件处理。
  2. If the document doesn't look right (or is blank) when you use the DocuSign web tool, then the document is at fault.如果您使用 DocuSign web 工具时文档看起来不正确(或为空白),则文档有问题。 If it is a PDF, try opening it with a PDF analysis tool and see if anything is funky.如果是 PDF,请尝试使用 PDF 分析工具打开它,看看是否有任何问题。 You can also try a less complicated document.您也可以尝试不太复杂的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM