Package com.avoka.component.docusign
Class DocuSignClientV2
java.lang.Object
com.avoka.component.docusign.DocuSignClientV2
Provides a DocuSign service client class.
See the DocuSign Developer Center for online resources.
Groovy Example
The example below illustrates how to create a DocuSignClient object using service parameters for configuration.
import com.avoka.component.docusign.* def username = serviceParameters["DocuSign Username"] def password = serviceParameters["DocuSign Password"] def integratorKey = serviceParameters["DocuSign Integrator Key"] def accountId = serviceParameters["DocuSign Account Id"] def serverUrl = serviceParameters["DocuSign Server URL"] // Create a DocuSign client def docuSignClient = new DocuSignClient(username, password, integratorKey, accountId, serverUrl)
The example below creates a DocuSign Envelope which will be sent.
// Determine the signing recipient list based on the submission XML data def recipientList = DocuSignUtils.getRecipientList(submissionXml) // Create DocuSign envelop and send notification signing request emails to the recipients envelopeId = docuSignClient.createAndSendEnvelope(serviceParameters["DocuSign Email Blurb"], serviceParameters["DocuSign Email Subject"], serviceParameters["DocuSign Document FileName"], receiptPDF, recipientList)
- Since:
- 4.3.4
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateAndSendEnvelope
(String emailBlurb, String emailSubject, String documentFileName, byte[] documentContent, List<DocuSignRecipient> recipientList) Create and send a DocuSign Envelope.createAndSendEnvelope
(String emailBlurb, String emailSubject, String documentFileName, byte[] documentContent, List<DocuSignRecipient> recipientList, String template) Create and send a DocuSign Envelope.byte[]
getCombinedDocument
(String envelopeId) Return the combined (signed) PDF document for the given Envelope ID.Return the is send now status, by default send immediately.getEnvelopeRecipientStatusJsonMap
(String envelopeId) Return the Envelope recipient status for the given Envelope ID.getEnvelopeStatus
(String envelopeId) Return the DocuSign Envelope Status for the given DocuSign Envelope ID.getEnvelopeStatusesJsonMap
(String statusQualifier, int lastNumberOfDays) Returns a JSON Map of for all envelopes that have Completed (Completed, Declined, Voided, Deleted) Please see the following Docusign API for format https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST API References/Get Envelope Status Changes.htmgetEnvelopeStatusResponseJsonMap
(String envelopeId) Return the DocuSign Envelope Status JSON response as a jsonMap for the given DocuSign Envelope ID.Return the DocuSign server URL.String[]
Return the array of DocuSign tabs in use.boolean
Return the is send now status, by default send immediately.ping()
Ping the DocuSign service to determine whether it is available.void
setSendNow
(boolean isSendNow) Set the the is send now status, by default send immediately.void
setServerURL
(String serverURL) Set the DocuSign server URL.void
setTabsInUseArray
(String[] tabsInUseArray) Set the array of DocuSign tabs in use.toString()
Return the string representation of the object.boolean
voidEnvelope
(String envelopeId, String voidReason) Void the DocuSign Envelope specified by the given Envelope ID.
-
Field Details
-
TAB_DATE_SIGNED
The DocuSign tab date signed: dateSignedTabs- See Also:
-
TAB_FULL_NAME
The DocuSign tab full name: fullNameTabs- See Also:
-
TAB_SIGN_HERE
The DocuSign tab sign here: signHereTabs- See Also:
-
TABS_ALL
The default DocuSign all tabs array.
-
-
Constructor Details
-
DocuSignClientV2
public DocuSignClientV2(String username, String password, String integratorKey, String accountId, String serverURL) Create a DocuSign client with the given username, password, integrator key and account ID.import com.avoka.component.docusign.* def username = serviceParameters["DocuSign Username"] def password = serviceParameters["DocuSign Password"] def integratorKey = serviceParameters["DocuSign Integrator Key"] def accountId = serviceParameters["DocuSign Account Id"] def serverUrl = serviceParameters["DocuSign Server URL"] def docuSignClient = new DocuSignClient(username, password, integratorKey, accountId, serverUrl)
- Parameters:
username
- the DocuSign login username (required)password
- the DocuSign login password (required)integratorKey
- the DocuSign integrator key (required)accountId
- the DocuSign account ID (required)serverURL
- the DocuSign server URL (required) Demo="https://demo.docusign.net/", PROD either "https://www.docusign.net/", "https://na2.docusign.net/", "https://eu1.docusign.net/"
-
-
Method Details
-
createAndSendEnvelope
public String createAndSendEnvelope(String emailBlurb, String emailSubject, String documentFileName, byte[] documentContent, List<DocuSignRecipient> recipientList) Create and send a DocuSign Envelope.Groovy Example
The example below creates a DocuSign Envelope which will be sent.
// Determine the signing recipient list based on the submission XML data def recipientList = DocuSignUtils.getRecipientList(submissionXml) // Create DocuSign envelop and send notification signing request emails to the recipients envelopeId = docuSignClient.createAndSendEnvelope(serviceParameters["DocuSign Email Blurb"], serviceParameters["DocuSign Email Subject"], serviceParameters["DocuSign Document FileName"], receiptPDF, recipientList)
- Parameters:
emailBlurb
- the email messageemailSubject
- the email subjectdocumentFileName
- the document filenamedocumentContent
- the document content of the pdf filerecipientList
- the recipient list- Returns:
- the Envelope ID
-
createAndSendEnvelope
public String createAndSendEnvelope(String emailBlurb, String emailSubject, String documentFileName, byte[] documentContent, List<DocuSignRecipient> recipientList, String template) Create and send a DocuSign Envelope.Groovy Example
The example below creates a DocuSign Envelope which will be sent.
// Determine the signing recipient list based on the submission XML data def recipientList = DocuSignUtils.getRecipientList(submissionXml) // Create DocuSign envelop and send notification signing request emails to the recipients envelopeId = docuSignClient.createAndSendEnvelope(serviceParameters["DocuSign Email Blurb"], serviceParameters["DocuSign Email Subject"], serviceParameters["DocuSign Document FileName"], receiptPDF, recipientList)
- Parameters:
emailBlurb
- the email messageemailSubject
- the email subjectdocumentFileName
- the document filenamedocumentContent
- the document content of the pdf filerecipientList
- the recipient listtemplate
- the velocity template used to create the envelope JSON body (optional)- Returns:
- the Envelope ID
-
ping
Ping the DocuSign service to determine whether it is available.- Returns:
- the authentication attempt response status
- Throws:
IOException
- error with the DocuSign connection
-
getEnvelopeStatusResponseJsonMap
Return the DocuSign Envelope Status JSON response as a jsonMap for the given DocuSign Envelope ID.- Parameters:
envelopeId
- the DocuSign Envelope ID.- Returns:
- the JSON response as a JsonSlurper Map.
- Throws:
IOException
- if the DocuSign server could not be called
-
getEnvelopeStatus
Return the DocuSign Envelope Status for the given DocuSign Envelope ID. The status values include [ "changed" | "created" | "sent" | "delivered" | "signed" | "voided" | "deleted" | "declined" | "timedout" | "completed" ]- Parameters:
envelopeId
- the DocuSign Envelope ID.- Returns:
- the DocuSign Envelope status
- Throws:
IOException
- if connectivity issue with the DocuSign server
-
getEnvelopeStatusesJsonMap
public Map<String,Object> getEnvelopeStatusesJsonMap(String statusQualifier, int lastNumberOfDays) throws IOException Returns a JSON Map of for all envelopes that have Completed (Completed, Declined, Voided, Deleted) Please see the following Docusign API for format https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST API References/Get Envelope Status Changes.htm- Parameters:
statusQualifier
- please refer tolastNumberOfDays
- will retrieve all transactions back to this date.- Returns:
- the JSON Map (produced by the JsonSlurper) for Get Envelope Status Changes JSON response.
- Throws:
IOException
- if connectivity issue with the DocuSign server
-
getEnvelopeRecipientStatusJsonMap
Return the Envelope recipient status for the given Envelope ID.- Parameters:
envelopeId
- the DocuSign Envelope ID- Returns:
- the Json Map produced by the JsonSlurper(JSON response string)
- Throws:
IOException
- if the DocuSign server could not be called- Since:
- 4.3.4
-
getCombinedDocument
Return the combined (signed) PDF document for the given Envelope ID.- Parameters:
envelopeId
- the DocuSign Envelope ID- Returns:
- the combined (signed) PDF document bytes
- Throws:
IOException
- if the DocuSign server could not be called
-
voidEnvelope
Void the DocuSign Envelope specified by the given Envelope ID.- Parameters:
envelopeId
- the DocuSign Envelope IDvoidReason
- the void reason- Returns:
- true if the DocuSign Envelope ID was successfully voided
- Throws:
IOException
- if the DocuSign server could not be called
-
getCreateSendEnvelopeStatus
Return the is send now status, by default send immediately.- Returns:
- the is send now status
-
isSendNow
public boolean isSendNow()Return the is send now status, by default send immediately.- Returns:
- the is send now status
-
setSendNow
public void setSendNow(boolean isSendNow) Set the the is send now status, by default send immediately.- Parameters:
isSendNow
- the is send now status
-
getTabsInUseArray
Return the array of DocuSign tabs in use.- Returns:
- the array of DocuSign tabs in use
-
setTabsInUseArray
Set the array of DocuSign tabs in use.- Parameters:
tabsInUseArray
- the array of DocuSign tabs to use
-
getServerURL
Return the DocuSign server URL.- Returns:
- the DocuSign server URL
-
setServerURL
Set the DocuSign server URL.- Parameters:
serverURL
- set the DocuSign server URL
-
toString
Return the string representation of the object.
-