Skip to content

Commit 549498e

Browse files
DEVDOCS-10448 codeDepot tags
1 parent 995671c commit 549498e

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/eSignature/examples/embeddedSigningCFR.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
8087
function 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
153162
function 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

196206
module.exports = { sendEnvelopeForEmbeddedSigning };

0 commit comments

Comments
 (0)