@@ -566,6 +566,8 @@ describe('SDK Unit Tests:', function (done) {
566566 assert . equal ( envelopeId , docsList . envelopeId ) ;
567567 console . log ( 'EnvelopeDocumentsResult: ' + JSON . stringify ( docsList ) ) ;
568568 done ( ) ;
569+ } else {
570+ return done ( response ) ;
569571 }
570572 } ) ;
571573 } ) ;
@@ -710,6 +712,102 @@ describe('SDK Unit Tests:', function (done) {
710712 } ) ;
711713 } ) ;
712714
715+ it ( 'should listRecipients with list tabs attached' , function ( done ) {
716+ var fileBytes = null ;
717+ try {
718+ var fs = require ( 'fs' ) ;
719+ // read file from a local directory
720+ fileBytes = fs . readFileSync ( path . resolve ( __dirname , SignTest1File ) ) ;
721+ } catch ( ex ) {
722+ // handle error
723+ console . log ( 'Exception: ' + ex ) ;
724+ return done ( ex ) ;
725+ }
726+ var envDef = new docusign . EnvelopeDefinition ( ) ;
727+ envDef . emailSubject = 'Please Sign my Node SDK Envelope' ;
728+ envDef . emailBlurb = 'Hello, Please sign my Node SDK Envelope.' ;
729+
730+ var doc = new docusign . Document ( ) ;
731+
732+ var base64Doc = Buffer . from ( fileBytes ) . toString ( 'base64' ) ;
733+ doc . documentBase64 = base64Doc ;
734+ doc . name = '..TestFile.pdf' ;
735+ doc . documentId = '1' ;
736+
737+ var docs = [ ] ;
738+ docs . push ( doc ) ;
739+ envDef . documents = docs ;
740+
741+ var envelopesApi = new docusign . EnvelopesApi ( apiClient ) ;
742+ // call the listRecipients() API
743+
744+ try {
745+ // Add a recipient to sign the document
746+ var signer = new docusign . Signer ( ) ;
747+ signer . email = UserName ;
748+ signer . name = 'Pat Developer' ;
749+ signer . recipientId = '1' ;
750+
751+ var signHere = new docusign . SignHere ( ) ;
752+ signHere . documentId = '1' ;
753+ signHere . pageNumber = '1' ;
754+ signHere . recipientId = '1' ;
755+ signHere . xPosition = '100' ;
756+ signHere . yPosition = '100' ;
757+
758+ var listItem = new docusign . ListItem ( ) ;
759+ listItem . selected = 'true' ;
760+ listItem . name = 'listItemName' ;
761+ listItem . value = 'listItemvalue' ;
762+
763+ var list = new docusign . List ( ) ;
764+ list . documentId = '1' ;
765+ list . pageNumber = '1' ;
766+ list . recipientId = '1' ;
767+ list . xPosition = '100' ;
768+ list . yPosition = '100' ;
769+ list . listItems = [ ] ;
770+ list . listItems . push ( listItem ) ;
771+
772+ var listTabs = [ ] ;
773+ listTabs . push ( list ) ;
774+
775+ var tabs = new docusign . Tabs ( ) ;
776+ tabs . listTabs = listTabs ;
777+ signer . tabs = tabs ;
778+
779+ // Above causes issue
780+ envDef . recipients = new docusign . Recipients ( ) ;
781+ envDef . recipients . signers = [ ] ;
782+ envDef . recipients . signers . push ( signer ) ;
783+
784+ envelopesApi . createEnvelope ( accountId , { 'envelopeDefinition' : envDef } , function ( error , envelopeSummary ) {
785+ if ( error ) {
786+ console . log ( error ) ;
787+ return done ( error ) ;
788+ }
789+
790+ if ( envelopeSummary ) {
791+ console . log ( 'EnvelopeSummary: ' + JSON . stringify ( envelopeSummary ) ) ;
792+ envelopeId = envelopeSummary . envelopeId ;
793+ envelopesApi . listRecipients ( accountId , envelopeId , { includeTabs : 'true' } , function ( error , recips ) {
794+ if ( error ) {
795+ console . log ( 'Error: ' + error ) ;
796+ return done ( error ) ;
797+ }
798+
799+ if ( recips ) {
800+ console . log ( 'Recipients: ' + JSON . stringify ( recips ) ) ;
801+ assert . equal ( recips . signers [ 0 ] . tabs . hasOwnProperty ( 'listTabs' ) , true ) ;
802+ done ( ) ;
803+ }
804+ } ) ;
805+ }
806+ } ) ;
807+ } catch ( e ) {
808+ console . log ( e ) ;
809+ }
810+ } ) ;
713811 it ( 'getTemplate' , function ( done ) {
714812 var templatesApi = new docusign . TemplatesApi ( apiClient ) ;
715813 templatesApi . get ( accountId , TemplateId , null , function ( error , envelopeTemplate , response ) {
0 commit comments