Class DocuSignClient

java.lang.Object
com.avoka.component.docusign.DocuSignClient

public class DocuSignClient 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:
3.6.0
  • Field Details

    • TAB_DATE_SIGNED

      public static final String TAB_DATE_SIGNED
      The DocuSign tab date signed: dateSignedTabs
      See Also:
    • TAB_FULL_NAME

      public static final String TAB_FULL_NAME
      The DocuSign tab full name: fullNameTabs
      See Also:
    • TAB_SIGN_HERE

      public static final String TAB_SIGN_HERE
      The DocuSign tab sign here: signHereTabs
      See Also:
    • TABS_ALL

      public static final String[] TABS_ALL
      The default DocuSign all tabs array.
  • Constructor Details

    • DocuSignClient

      public DocuSignClient(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 message
      emailSubject - the email subject
      documentFileName - the document filename
      documentContent - the document content of the pdf file
      recipientList - 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 message
      emailSubject - the email subject
      documentFileName - the document filename
      documentContent - the document content of the pdf file
      recipientList - the recipient list
      template - the velocity template used to create the envelope JSON body (optional)
      Returns:
      the Envelope ID
      Since:
      4.3.2
    • ping

      public String ping()
      Ping the DocuSign service to determine whether it is available.
      Returns:
      the authentication attempt response status
    • getEnvelopeStatusResponse

      public String getEnvelopeStatusResponse(String envelopeId) throws IOException, DocuSignException
      Return the DocuSign Envelope Status JSON response for the given DocuSign Envelope ID.
      Parameters:
      envelopeId - the DocuSign Envelope ID.
      Returns:
      Envelope Status JSON response
      Throws:
      IOException - if the DocuSign server could not be called
      DocuSignException - if an invalid response was returned
    • getEnvelopeStatus

      public String getEnvelopeStatus(String envelopeId) throws IOException, DocuSignException
      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 the DocuSign server could not be called
      DocuSignException - if an invalid response was returned
    • getEnvelopeRecipientStatus

      public String getEnvelopeRecipientStatus(String envelopeId) throws IOException, DocuSignException
      Return the Envelope recipient status for the given Envelope ID.
      Parameters:
      envelopeId - the DocuSign Envelope ID
      Returns:
      Envelope recipient status for the given Envelope ID
      Throws:
      IOException - if the DocuSign server could not be called
      DocuSignException - if an invalid response was returned
    • 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 ID
      voidReason - 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
    • toString

      public String toString()
      Return the string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the object