@@ -8,6 +8,7 @@ const path = require('path')
88 , fs = require ( 'fs-extra' )
99 , docusign = require ( 'docusign-esign' )
1010 , validator = require ( 'validator' )
11+ , { promisify} = require ( 'util' ) // http://2ality.com/2017/05/util-promisify.html
1112 , dsConfig = require ( '../../ds_configuration.js' ) . config
1213 ;
1314
@@ -82,7 +83,6 @@ eg001EmbeddedSigning.createController = async (req, res) => {
8283 , dsAPIclient = req . dsAuthCodeGrant . getDSApi ( )
8384 , args = {
8485 dsAPIclient : dsAPIclient ,
85- makePromise : req . dsAuthCodeGrant . makePromise , // this is a function
8686 accountId : accountId ,
8787 envelopeArgs : envelopeArgs
8888 }
@@ -125,7 +125,7 @@ eg001EmbeddedSigning.createController = async (req, res) => {
125125// ***DS.worker.start ***DS.snippet.1.start
126126eg001EmbeddedSigning . worker = async ( args ) => {
127127 let envelopesApi = new docusign . EnvelopesApi ( args . dsAPIclient )
128- , createEnvelopeP = args . makePromise ( envelopesApi , ' createEnvelope' )
128+ , createEnvelopeP = promisify ( envelopesApi . createEnvelope ) . bind ( envelopesApi )
129129 , results = null
130130 ;
131131
@@ -141,7 +141,7 @@ eg001EmbeddedSigning.worker = async (args) => {
141141
142142 // Step 3. create the recipient view, the Signing Ceremony
143143 let viewRequest = makeRecipientViewRequest ( args . envelopeArgs )
144- , createRecipientViewP = args . makePromise ( envelopesApi , ' createRecipientView' )
144+ , createRecipientViewP = promisify ( envelopesApi . createRecipientView ) . bind ( envelopesApi )
145145 ;
146146
147147 // Call the CreateRecipientView API
0 commit comments