@@ -182,8 +182,6 @@ function makeEnvelope(args){
182182
183183 // add the documents
184184 let doc1 = new docusign . Document ( )
185- , doc2 = new docusign . Document ( )
186- , doc3 = new docusign . Document ( )
187185 , doc1b64 = Buffer . from ( document1 ( args ) ) . toString ( 'base64' )
188186 , doc2b64 = Buffer . from ( doc2DocxBytes ) . toString ( 'base64' )
189187 , doc3b64 = Buffer . from ( doc3PdfBytes ) . toString ( 'base64' )
@@ -193,20 +191,25 @@ function makeEnvelope(args){
193191 doc1 . name = 'Order acknowledgement' ; // can be different from actual file name
194192 doc1 . fileExtension = 'html' ; // Source data format. Signed docs are always pdf.
195193 doc1 . documentId = '1' ; // a label used to reference the doc
196- doc2 . documentBase64 = doc2b64 ;
197- doc2 . name = 'Battle Plan' ; // can be different from actual file name
198- doc2 . fileExtension = 'docx' ;
199- doc2 . documentId = '2' ;
200- doc3 . documentBase64 = doc3b64 ;
201- doc3 . name = 'Lorem Ipsum' ; // can be different from actual file name
202- doc3 . fileExtension = 'pdf' ;
203- doc3 . documentId = '3' ;
194+
195+ // Alternate pattern: using constructors for docs 2 and 3...
196+ let doc2 = new docusign . Document . constructFromObject ( {
197+ documentBase64 : doc2b64 ,
198+ name : 'Battle Plan' , // can be different from actual file name
199+ fileExtension : 'docx' ,
200+ documentId : '2' } ) ;
201+
202+ let doc3 = new docusign . Document . constructFromObject ( {
203+ documentBase64 : doc3b64 ,
204+ name : 'Lorem Ipsum' , // can be different from actual file name
205+ fileExtension : 'pdf' ,
206+ documentId : '3' } ) ;
204207
205208 // The order in the docs array determines the order in the envelope
206209 env . documents = [ doc1 , doc2 , doc3 ] ;
207210
208211 // create a signer recipient to sign the document, identified by name and email
209- // We're setting the parameters via the object creation
212+ // We're setting the parameters via the object constructor
210213 let signer1 = docusign . Signer . constructFromObject ( {
211214 email : args . signerEmail ,
212215 name : args . signerName ,
0 commit comments