Reputation: 122
I followed the code on docusigns website about voiding envelopes with Node.js. https://www.docusign.com/blog/dsdev-common-api-tasks-void-an-envelope
But for some reason when I run the code it says the promise resolved with no issues no messages but the envelope doesn't actually get voided.
let apiClient = new docusign.ApiClient();
apiClient.setBasePath(config.docusign.apiUrl);
apiClient.addDefaultHeader('Authorization', `Bearer ${accessToken}`);
let envelopesApi = new docusign.EnvelopesApi(apiClient);
let env = new docusign.Envelope();
env.status = 'voided';
env.voidedReason = 'Declined Offer';
return envelopesApi.update(config.docusign.accountID, envelopeId, env).then(() => {
return true
}).catch((e) => {
console.log(e)
})
The promise returns true but again doesn't actually void the envelope
Upvotes: 1
Views: 385
Reputation: 412
Thanks for reporting this. This is indeed an issue in our node sdk. The way to work around this bug is (ugly workaround, we will fix this bug soon):
let env = new docusign.Envelope();
env.status = 'voided';
env.voidedReason = 'Declined Offer';
const finalEnv = {envelope : env}
return envelopesApi.update('accountId', 'EnvId', finalEnv).then(() => {
console.log('Yes the thing was voided');
}).catch((e) => {
console.log(e)
})
The envelope body needs an "envelope" tag to work. We will work on address this issue. Thank you for bringing this to our attention.
Upvotes: 4
Reputation: 122
To fix this issue I ended up just doing a direct request to the docusign api with superagent instead of using the docusign-esign package that was suggested. I'm not sure if the esign is using the wrong request type.
request
.put(`${config.docusign.apiUrl}/v2.1/accounts/${config.docusign.accountID}/envelopes/${envelopeId}`)
.send({"status": "voided", "voidedReason": "The reason for voiding the envelope"})
.set('Authorization', `Bearer ${accessToken}`)
.end((err, res) => {
if(err){
console.log(`ERROR: ${err}`)
}
console.log(res);
});
Upvotes: 0