Package com.avoka.component.docusign
Class DocuSignClientV2
- java.lang.Object
-
- com.avoka.component.docusign.DocuSignClientV2
-
public class DocuSignClientV2 extends Object
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
Fields Modifier and Type Field Description static String
TAB_DATE_SIGNED
The DocuSign tab date signed: dateSignedTabsstatic String
TAB_FULL_NAME
The DocuSign tab full name: fullNameTabsstatic String
TAB_SIGN_HERE
The DocuSign tab sign here: signHereTabsstatic String[]
TABS_ALL
The default DocuSign all tabs array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createAndSendEnvelope(String emailBlurb, String emailSubject, String documentFileName, byte[] documentContent, List<DocuSignRecipient> recipientList)
Create and send a DocuSign Envelope.String
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.String
getCreateSendEnvelopeStatus()
Return the is send now status, by default send immediately.Map<String,Object>
getEnvelopeRecipientStatusJsonMap(String envelopeId)
Return the Envelope recipient status for the given Envelope ID.String
getEnvelopeStatus(String envelopeId)
Return the DocuSign Envelope Status for the given DocuSign Envelope ID.Map<String,Object>
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.htmMap<String,Object>
getEnvelopeStatusResponseJsonMap(String envelopeId)
Return the DocuSign Envelope Status JSON response as a jsonMap for the given DocuSign Envelope ID.String
getServerURL()
Return the DocuSign server URL.String[]
getTabsInUseArray()
Return the array of DocuSign tabs in use.boolean
isSendNow()
Return the is send now status, by default send immediately.String
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.String
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 Detail
-
TAB_DATE_SIGNED
public static final String TAB_DATE_SIGNED
The DocuSign tab date signed: dateSignedTabs- See Also:
- Constant Field Values
-
TAB_FULL_NAME
public static final String TAB_FULL_NAME
The DocuSign tab full name: fullNameTabs- See Also:
- Constant Field Values
-
TAB_SIGN_HERE
public static final String TAB_SIGN_HERE
The DocuSign tab sign here: signHereTabs- See Also:
- Constant Field Values
-
TABS_ALL
public static final String[] TABS_ALL
The default DocuSign all tabs array.
-
-
Constructor Detail
-
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 Detail
-
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
public String ping() throws IOException
Ping the DocuSign service to determine whether it is available.- Returns:
- the authentication attempt response status
- Throws:
IOException
- error with the DocuSign connection
-
getEnvelopeStatusResponseJsonMap
public Map<String,Object> getEnvelopeStatusResponseJsonMap(String envelopeId) throws IOException
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
public String getEnvelopeStatus(String envelopeId) throws IOException
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
public Map<String,Object> getEnvelopeRecipientStatusJsonMap(String envelopeId) throws IOException
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
public byte[] getCombinedDocument(String envelopeId) throws IOException
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
public boolean voidEnvelope(String envelopeId, String voidReason) throws IOException
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
public String 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
public String[] getTabsInUseArray()
Return the array of DocuSign tabs in use.- Returns:
- the array of DocuSign tabs in use
-
setTabsInUseArray
public void setTabsInUseArray(String[] tabsInUseArray)
Set the array of DocuSign tabs in use.- Parameters:
tabsInUseArray
- the array of DocuSign tabs to use
-
getServerURL
public String getServerURL()
Return the DocuSign server URL.- Returns:
- the DocuSign server URL
-
setServerURL
public void setServerURL(String serverURL)
Set the DocuSign server URL.- Parameters:
serverURL
- set the DocuSign server URL
-
-