Skip to content

Commit cd7123d

Browse files
authored
adding step comments (#92)
1 parent 6558184 commit cd7123d

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

lib/eSignature/examples/setDocumentVisibility.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,26 @@ const docusign = require("docusign-esign");
2626
* @param {string} args.envelopeArgs.doc3File Path to the third document
2727
*/
2828
async function sendEnvelope(args) {
29+
// Step 2 start
2930
const dsApiClient = new docusign.ApiClient();
3031

3132
dsApiClient.setBasePath(args.basePath);
3233
dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken);
34+
// Step 2 end
3335

36+
// Step 4 start
3437
const envelopesApi = new docusign.EnvelopesApi(dsApiClient);
3538

36-
// Step 1. Make the envelope request body
39+
// Make the envelope request body
3740
const envelope = makeEnvelope(args.envelopeArgs);
3841

39-
// Step 2. call Envelopes::create API method
42+
// Call Envelopes::create API method
4043
// Exceptions will be caught by the calling function
4144
const results = await envelopesApi.createEnvelope(args.accountId, {
4245
envelopeDefinition: envelope,
4346
});
4447
const envelopeId = results.envelopeId;
48+
// Step 4 end
4549

4650
console.log(`Envelope was created. EnvelopeId ${envelopeId}`);
4751
return { envelopeId };
@@ -63,6 +67,7 @@ async function sendEnvelope(args) {
6367
* @returns {docusign.EnvelopeDefinition} An envelope definition
6468
* @private
6569
*/
70+
// Step 3 start
6671
function makeEnvelope(args) {
6772
/**
6873
* document 1 (html) has tag **signature_1**
@@ -233,5 +238,6 @@ function document1(args) {
233238
</html>
234239
`;
235240
}
241+
// Step 3 end
236242

237243
module.exports = { sendEnvelope };

lib/eSignature/examples/signingInPerson.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,35 @@ const docusign = require("docusign-esign");
2323
* @param {string} args.envelopeArgs.docFile Path to the document
2424
*/
2525
const sendEnvelopeForInPersonSigning = async (args) => {
26+
27+
// Step 3 start
2628
const dsApiClient = new docusign.ApiClient();
2729
dsApiClient.setBasePath(args.basePath);
2830
dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken);
2931
const envelopesApi = new docusign.EnvelopesApi(dsApiClient);
3032

31-
// Step 1. Make the envelope request body
33+
// Make the envelope request body
3234
const envelope = makeEnvelope(args.envelopeArgs);
3335

34-
// Step 2. call Envelopes::create API method
36+
// Call Envelopes::create API method
3537
// Exceptions will be caught by the calling function
3638
let results = await envelopesApi.createEnvelope(args.accountId, {
3739
envelopeDefinition: envelope,
3840
});
3941

4042
const envelopeId = results.envelopeId;
43+
// Step 3 end
4144
console.log(`Envelope was created. EnvelopeId ${envelopeId}`);
4245

43-
// Step 3. create the recipient view, the embedded signing
46+
// Create the recipient view, the embedded signing
47+
// Step 5 start
4448
const viewRequest = makeRecipientViewRequest(args.envelopeArgs);
4549
// Call the CreateRecipientView API
4650
// Exceptions will be caught by the calling function
4751
results = await envelopesApi.createRecipientView(args.accountId, envelopeId, {
4852
recipientViewRequest: viewRequest,
4953
});
54+
// Step 5 end
5055

5156
return { envelopeId: envelopeId, redirectUrl: results.url };
5257
};
@@ -62,6 +67,8 @@ const sendEnvelopeForInPersonSigning = async (args) => {
6267
* @returns {Envelope} An envelope definition
6368
* @private
6469
*/
70+
71+
// Step 2 start
6572
function makeEnvelope(args) {
6673
// document 1 (pdf) has tag /sn1/
6774
//
@@ -127,6 +134,8 @@ function makeEnvelope(args) {
127134
return env;
128135
}
129136

137+
// Step 2 end
138+
130139
/**
131140
* Creates recipient view definition
132141
* @function
@@ -138,6 +147,7 @@ function makeEnvelope(args) {
138147
* @returns {docusign.RecipientViewRequest} A recipient view definition
139148
* @private
140149
*/
150+
// Step 4 start
141151
function makeRecipientViewRequest(args) {
142152
let viewRequest = new docusign.RecipientViewRequest();
143153

@@ -172,5 +182,6 @@ function makeRecipientViewRequest(args) {
172182

173183
return viewRequest;
174184
}
185+
// Step 4 end
175186

176187
module.exports = { sendEnvelopeForInPersonSigning };

0 commit comments

Comments
 (0)