Skip to content

paigesrossi/code-examples-java

 
 

Repository files navigation

Java Launcher Code Examples

Github repo: code-examples-java

Introduction

This repo is a Java Spring Boot application that demonstrates:

  1. Embedded Signing Ceremony. Source. This example sends an envelope, and then uses an embedded signing ceremony for the first signer. With embedded signing, the DocuSign signing ceremony is initiated from your website.

  2. Send an envelope with a remote (email) signer and cc recipient. Source. The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents.

  3. List envelopes in the user's account. Source.

  4. Get an envelope's basic information. Source. The example lists the basic information about an envelope, including its overall status.

  5. List an envelope's recipients and their current status. Source.

  6. List an envelope's documents. Source.

  7. Download an envelope's documents. The example can download individual documents, the documents concatenated together, or a zip file of the documents. Source.

  8. Programmatically create a template. Source.

  9. Send an envelope using a template. Source.

  10. Send an envelope and upload its documents with multipart binary transfer. Source. Binary transfer is 33% more efficient than using Base64 encoding.

  11. Embedded sending. Source.

  12. Embedded DocuSign web tool (NDSE). Source.

  13. Embedded Signing Ceremony from a template with an added document. Source. This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite Templates feature.

  14. Payments example: an order form, with online payment by credit card. Source.

  15. Get the envelope tab data. Retrieve the tab (field) values for all of the envelope's recipients. Source.

  16. Set envelope tab values. The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs are set to be read-only, others can be updated by the recipient. The example also stores metadata with the envelope. Source.

  17. Set template tab values. The example creates an envelope using a template and sets the initial values for its tabs (fields). The example also stores metadata with the envelope. Source.

  18. Get the envelope custom field data (metadata). The example retrieves the custom metadata (custom data fields) stored with the envelope. Source.

  19. Requiring an Access Code for a Recipient Source. This example sends and envelope that requires an access-code for the purpose of multi-factor authentication.

  20. Requiring SMS authentication for a recipient Source. This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.

  21. Requiring Phone authentication for a recipient Source. This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.

  22. Requiring Knowledge-Based Authentication (KBA) for a Recipient Source. This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.

  23. Requiring ID Verification (IDV) for a recipient Source. This example sends and envelope that requires the recipient to upload a government issued id.
    Creating a permission profile Source. This code example demonstrates how to create a user group's permission profile using the Create Profile method.

  24. Setting a permission profile Source. This code example demonstrates how to set a user group's permission profile using the Update Group method. You must have already created permissions profile and group of users.

  25. Updating individual permission settings Source. This code example demonstrates how to update individual settings for a specific permission profile using the Update Permission Profile method. You must have already created permissions profile and group of users.

  26. Deleting a permission profile Source. This code example demonstrates how to an account's permission profile using the Delete AccountPermissionProfiles method.

  27. Creating a brand Source. This example creates brand profile for an account using the Create Brand method.

  28. Applying a brand to an envelope Source. This code example demonstrates how to apply a brand you've created to an envelope using the Create Envelope method. First, creates the envelope and then applies brand to it. Anchor text (AutoPlace) is used to position the signing fields in the documents.

  29. Applying a brand to a template Source. This code example demonstrates how to apply a brand you've created to a template using using the Create Envelope method. You must have at least one created template and brand.

  30. Bulk sending envelopes to multiple recipients Source. This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send.

Included OAuth grant types:

  • Authentication with Docusign via Authorization Code Grant flow . When the token expires, the user is asked to re-authenticate. The refresh token is not used in this example.

  • Authentication with DocuSign via the JSON Web Token (JWT) Grant. When the token expires, it updates automatically.

Installation

Prerequisites

  1. A DocuSign Developer Sandbox account (email and password) on demo.docusign.net. Create a free account.

  2. A DocuSign Integration Key (a client ID) that is configured to use the OAuth Authorization Code flow. You will need the Integration Key itself, and its secret. To use JSON Web token, you will need the Integration Key itself, the RSA Secret Key and an API user ID for the user you are impersonating.

    If you use this example on your own workstation, the Integration key must include following Redirect URIs:

    If you will not be running the example on your own workstation, use the appropriate DNS name and port instead of localhost:8080. An example Redirect URI: http://myserver.it.mycompany.com/login

  3. Java 11.

  4. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same.

  5. Maven

Short installation instructions

  • Download or clone this repository.
  • The project includes a Maven pom file.
  • Configure the project by overriding necessary properties from the src\main\resources\application.example.json and saving this file as application.json file. Don't add this file into the Git index..
  • Add VM argument -Dspring.profiles.active=dev to your IDE
  • Note that IntelliJ Community Edition does not directly support Spring Boot applications.

Build and run

Examples are built as a dedicated application with embedded TomCat server. Build:

$ cd code-examples-java
$ mvn package

Run:

$ cd target
$ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war

IntelliJ Ultimate installation

See the IntelliJ Ultimate instructions.

Configure the example

Configure the example via the properties file: code-examples-java/src/main/resources/application-dev.properties.

Add the client id, secret, signer name and email to the file. Also add the URL that the application will use (the DS_APP_URL setting). By default, this is http://localhost:8080

You must also add a Redirect URI to the client id's settings in DocuSign. The Redirect URIs are /login&type=acg and /login&type=jwt appended to the DS_APP_URL setting. Eg http://localhost:8080/login&type=acg

Payments code example

To use the payments example, create a test payments gateway for your developer sandbox account.

See the PAYMENTS_INSTALLATION.md file for instructions.

Then add the payment gateway account id to the application.properties file.

Using the examples with other authentication flows

The examples in this repository can also be used with the JWT OAuth flow. See the Authentication guide for information on choosing the right authentication flow for your application.

License and additional information

License

This repository uses the MIT License. See the LICENSE file for more information.

Pull Requests

Pull requests are welcomed. Pull requests will only be considered if their content uses the MIT License.

About

DocuSign Java Code Examples and Launcher

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 94.7%
  • JavaScript 1.9%
  • FreeMarker 1.8%
  • Other 1.6%