|
18 | 18 | * @param {string} args.documentArgs.jobTitle |
19 | 19 | * @param {string} args.documentArgs.date |
20 | 20 | */ |
21 | | - const embedClickwrap = async (args) => { |
22 | | - // Step 3. Construct the request Body |
23 | | - const documentArgs = { |
24 | | - fullName: args.documentArgs.fullName, |
25 | | - email: args.documentArgs.email, |
26 | | - company: args.documentArgs.company, |
27 | | - jobTitle: args.documentArgs.jobTitle, |
28 | | - date: args.documentArgs.date, |
29 | | - }; |
30 | | - |
| 21 | + |
| 22 | + const embedClickwrap = async (args) => { |
| 23 | + |
| 24 | + const documentArgs = { |
| 25 | + fullName: args.documentArgs.fullName, |
| 26 | + email: args.documentArgs.email, |
| 27 | + company: args.documentArgs.company, |
| 28 | + jobTitle: args.documentArgs.jobTitle, |
| 29 | + date: args.documentArgs.date, |
| 30 | + }; |
| 31 | + |
31 | 32 | const userAgreement = new docusignClick.UserAgreementRequest.constructFromObject({ |
32 | | - clientUserId: documentArgs.email, |
33 | | - documentData: { |
34 | | - fullName: documentArgs.fullName, |
35 | | - email: documentArgs.email, |
36 | | - company: documentArgs.company, |
37 | | - title: documentArgs.jobTitle, |
38 | | - date: documentArgs.date, |
39 | | - }, |
40 | | - }); |
41 | | - |
42 | | - |
43 | | - // Step 4. Call the Click API |
44 | | - const dsApiClient = new docusignClick.ApiClient(); |
45 | | - dsApiClient.setBasePath(args.basePath); |
46 | | - dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken); |
47 | | - const accountApi = new docusignClick.AccountsApi(dsApiClient); |
48 | | - |
49 | | - // Embed the clickwrap |
50 | | - const result = await accountApi.createHasAgreed( |
51 | | - args.accountId, args.clickwrapId, { |
52 | | - userAgreementRequest: userAgreement |
53 | | - }); |
54 | | - console.log(`See the embedded clickwrap on this page:`); |
55 | | - return result; |
56 | | - |
57 | | - }; |
| 33 | + clientUserId: documentArgs.email, |
| 34 | + documentData: { |
| 35 | + fullName: documentArgs.fullName, |
| 36 | + email: documentArgs.email, |
| 37 | + company: documentArgs.company, |
| 38 | + title: documentArgs.jobTitle, |
| 39 | + date: documentArgs.date, |
| 40 | + }, |
| 41 | + // requireReacceptance: true, |
| 42 | + }); |
| 43 | + |
| 44 | + |
| 45 | + // Step 4. Call the Click API |
| 46 | + const dsApiClient = new docusignClick.ApiClient(); |
| 47 | + dsApiClient.setBasePath(args.basePath); |
| 48 | + dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken); |
| 49 | + const accountApi = new docusignClick.AccountsApi(dsApiClient); |
| 50 | + |
| 51 | + // Embed the clickwrap |
| 52 | + const result = await accountApi.createHasAgreed( |
| 53 | + args.accountId, args.clickwrapId, { |
| 54 | + userAgreementRequest: userAgreement |
| 55 | + }); |
| 56 | + console.log(`See the embedded clickwrap in the dialog box.`); |
| 57 | + return result; |
| 58 | + }; |
58 | 59 |
|
59 | 60 | const getActiveClickwraps = async (args) => { |
60 | 61 | // Call the Click API |
|
0 commit comments