@@ -18,6 +18,7 @@ const sendEnvelopeForEmbeddedSigning = async (args) => {
1818 // args.accessToken
1919 // args.accountId
2020
21+ //ds-snippet-start:eSign41Step2
2122 let dsApiClient = new docusign . ApiClient ( ) ;
2223 dsApiClient . setBasePath ( args . basePath ) ;
2324 dsApiClient . addDefaultHeader ( "Authorization" , "Bearer " + args . accessToken ) ;
@@ -29,14 +30,14 @@ const sendEnvelopeForEmbeddedSigning = async (args) => {
2930 let workflowResults = await accountsApi . getAccountIdentityVerification (
3031 args . accountId
3132 ) ;
32-
33+
3334 // Find the workflow ID corresponding to the name "Phone Authentication"
3435 workflowResults . identityVerification . forEach ( workflow => {
3536 if ( workflow . defaultName === "SMS for access & signatures" ) {
3637 workflowId = workflow . workflowId
3738 }
3839 } ) ;
39- // Step 3 end
40+ //ds-snippet- end:eSign41Step2
4041
4142 if ( workflowId === null ) {
4243 throw new Error ( "IDENTITY_WORKFLOW_INVALID_ID" ) ;
@@ -47,20 +48,25 @@ const sendEnvelopeForEmbeddedSigning = async (args) => {
4748 let envelopesApi = new docusign . EnvelopesApi ( dsApiClient ) ,
4849 results = null ;
4950
50- // Step 1. Make the envelope request body
51+ // Make the envelope request body
52+ //ds-snippet-start:eSign41Step4
5153 let envelope = makeEnvelope ( args . envelopeArgs ) ;
5254
53- // Step 2. call Envelopes::create API method
55+ // call Envelopes::create API method
5456 // Exceptions will be caught by the calling function
5557 results = await envelopesApi . createEnvelope ( args . accountId , {
5658 envelopeDefinition : envelope ,
5759 } ) ;
5860
5961 let envelopeId = results . envelopeId ;
62+ //ds-snippet-end:eSign41Step4
6063 console . log ( `Envelope was created. EnvelopeId ${ envelopeId } ` ) ;
6164
62- // Step 3. create the recipient view, the embedded signing
65+ // create the recipient view, the embedded signing
66+ //ds-snippet-start:eSign41Step5
6367 let viewRequest = makeRecipientViewRequest ( args . envelopeArgs ) ;
68+
69+ //ds-snippet-end:eSign41Step5
6470 // Call the CreateRecipientView API
6571 // Exceptions will be caught by the calling function
6672 results = await envelopesApi . createRecipientView ( args . accountId , envelopeId , {
@@ -77,12 +83,13 @@ const sendEnvelopeForEmbeddedSigning = async (args) => {
7783 * @returns {Envelope } An envelope definition
7884 * @private
7985 */
86+ //ds-snippet-start:eSign41Step3
8087function makeEnvelope ( args ) {
8188 // Data for this method
8289 // args.signerEmail
8390 // args.signerName
8491 // args.signerClientId
85- // docFile
92+ // docFile
8693
8794 // document 1 (pdf) has tag /sn1/
8895 //
@@ -149,7 +156,9 @@ function makeEnvelope(args) {
149156
150157 return env ;
151158}
159+ //ds-snippet-end:eSign41Step3
152160
161+ //ds-snippet-start:eSign29Step5
153162function makeRecipientViewRequest ( args ) {
154163 // Data for this method
155164 // args.dsReturnUrl
@@ -192,5 +201,6 @@ function makeRecipientViewRequest(args) {
192201
193202 return viewRequest ;
194203}
204+ //ds-snippet-end:eSign29Step5
195205
196206module . exports = { sendEnvelopeForEmbeddedSigning } ;
0 commit comments