+
+
+
+
+ Java Launcher
+ ${launcherTexts.getHomePageText()}
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+ Documentation on using OAuth Authorization Code Grant from a Java application.
+
+
+
+
+
+
+
+
+
${statusCFR}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${group.getName()}
+
+
+
+
+
+
+ ${example.getExampleDescription()}
+
+
+
+
+
+ ${launcherTexts.getAPIMethodUsed()}
+
+
+ ${launcherTexts.getAPIMethodUsedPlural()}
+
+
+
+
+
+ ${link.getPathName()}
+
+
+
+
+ .
+
+
+ and
+
+
+ ,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp
index 9f1609f7..d976fcff 100644
--- a/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp
+++ b/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp
@@ -7,11 +7,47 @@
-
-
${done.json}
-
+
+
+
+
+
+
+ ${formattedJson}
+
+
+
+
+
${done.json}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
Continue
+
+
+ ${launcherTexts.getContinueButton()}
+
+
+ ${launcherTexts.getContinueButton()}
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp
index d5b5edd7..238602e2 100644
--- a/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp
+++ b/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp
@@ -23,6 +23,6 @@
-
Continue
+
${launcherTexts.getContinueButton()}
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp
new file mode 100644
index 00000000..1357b250
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp
@@ -0,0 +1,8 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
${done.name}
+
${done.message}
+
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp
deleted file mode 100644
index 1a689fbe..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp
+++ /dev/null
@@ -1,40 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
1. Embedded Signing Ceremony
-
This example sends an envelope, and then uses an embedded signing ceremony for the first signer.
-
Embedded signing provides a smoother user experience for the signer: the DocuSign signing ceremony is initiated from
- your website.
-
- Documentation about this example.
-
-
-
-
API methods used:
- Envelopes::create
- and
- EnvelopeViews::createRecipient.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp
deleted file mode 100644
index 6958c6f3..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
2. Send an envelope with a remote (email) signer and cc recipient
-
The envelope includes a pdf, Word, and HTML document. Anchor text
- (AutoPlace)
- is used to position the signing fields in the documents.
-
-
This is a general example of creating and sending an envelope (a signing request) to multiple recipients,
- with multiple documents, and with signature fields for the documents.
-
- Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp
deleted file mode 100644
index e8dfd42d..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp
+++ /dev/null
@@ -1,25 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
3. List envelopes in the user's account
-
List the envelopes created in the last 30 days.
-
This example demonstrates how to query DocuSign about envelopes sent by the current user.
-
- Documentation about this example.
-
-
-
-
API method used:
- Envelopes::listStatusChanges.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp
deleted file mode 100644
index 051abe61..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp
+++ /dev/null
@@ -1,48 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
4. Get an envelope's basic information and status
-
List the basic information about an envelope, including its overall status.
- Additional API/SDK methods may be used to get additional information about the
- envelope, its documents, recipients, etc.
-
-
This example demonstrates how to obtain the latest information about
- an envelope from DocuSign. Often an alternative is to use Connect
- to enable DocuSign to proactively send your application updates when the
- status of an envelope changes.
-
-
-
- Documentation about this example.
-
-
-
-
API method used:
- Envelopes::get.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- The envelope you created via example 2 will be queried.
-
-
-
-
- Problem: please first create an envelope using example 2.
- Thank you.
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp
deleted file mode 100644
index f0cff895..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp
+++ /dev/null
@@ -1,40 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
5. List an envelope's recipients and their status
-
List the envelope's recipients, including their current status.
-
-
- Documentation about this example.
-
-
-
-
API method used:
- EnvelopeRecipients::list.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- The envelope you created via example 2 will be queried.
-
-
-
-
- Problem: please first create an envelope using example 2.
- Thank you.
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp
deleted file mode 100644
index a0341084..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp
+++ /dev/null
@@ -1,43 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
6. List an envelope's documents
-
List the envelope's documents. A Certificate of Completion document
- is also associated with every envelope.
-
-
-
This method is often used to dynamically create a list of an envelope's documents
- in preparation for enabling your user to download one or more of the documents.
-
- Documentation about this example.
-
-
-
-
API method used:
- EnvelopeDocuments::list.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- The envelope you created via example 2 will be queried.
-
-
-
-
- Problem: please first create an envelope using example 2.
- Thank you.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp
deleted file mode 100644
index 89eed27e..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp
+++ /dev/null
@@ -1,71 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
7. Download a document from an envelope
-
An envelope's documents can be downloaded one by one or as a complete set.
-
Document download options:
-
- - Combined: a PDF with the combined content of all documents and the
- certificate
-
- - Zip Archive: a ZIP archive that contains all of the PDF documents,
- the certificate, and any .WAV files used for voice authentication.
-
- - The envelope's individual documents
- - The envelope's Certificate of Completion
-
-
- Documentation about this example.
-
-
-
-
API method used:
- EnvelopeDocuments::get.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- Problem: please first create an envelope using example 2.
- You will then need to use example 6 to create the list of documents.
- Thank you.
-
-
-
-
- Problem: please first create a list of the envelope's documents using
- example 6.
- Thank you.
-
-
-
-
- Please choose a document.
- The document list is from your results for example 6.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp
deleted file mode 100644
index fd249303..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp
+++ /dev/null
@@ -1,34 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
8. Create a template
-
Create a template with two roles, signer and cc.
- The template includes three documents.
-
-
-
Templates are usually created using the DocuSign web tool. This example creates
- a template that will later be used by other examples in this launcher.
-
-
This example first lists the user's templates and only creates a new template if one does not already exist in your
- account.
-
-
- Documentation about this example.
-
-
-
-
API methods used:
- Templates::list,
- Templates::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp
deleted file mode 100644
index 227dfc8b..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp
+++ /dev/null
@@ -1,79 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
9. Send an envelope using a template
-
The envelope is defined by the template.
- The signer and cc recipient name and email are used to fill in the template's roles.
-
-
This example demonstrates a common pattern for DocuSign integrations: envelopes will
- be sent programmatically, based on a template. If the template definition needs to be
- updated, the DocuSign web tool can be used to easily update the template, thus
- avoiding the need to make software changes.
-
-
-
- Documentation about this example.
-
-
-
-
API method used:
- Envelopes::create.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- The template you created via example 8 will be used.
-
-
-
-
- Problem: please first create the template using example 8.
- Thank you.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp
deleted file mode 100644
index 008fd01c..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
10. Send an envelope using binary document transfer
-
The envelope includes a pdf, Word, and HTML document.
-
Multipart data transfer is used to send the documents in binary format to DocuSign.
- Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes.
-
-
-
Since binary transfer is not yet supported by the SDK, this example uses the API directly and
- demonstrates how to do so.
-
- Documentation about this example.
-
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp
deleted file mode 100644
index c67e4034..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp
+++ /dev/null
@@ -1,66 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
11. Embedded Sending
-
An envelope will be created in draft mode. Your browser will then be redirected to
- the DocuSign web tool where the envelope can be (optionally) updated and then sent.
-
The envelope includes a pdf, Word, and HTML document. Anchor text
- (AutoPlace)
- is used to position the signing fields in the documents.
-
DocuSign recommends that you enhance your application as needed to avoid the need
- for the embedded sender view.
-
-
For example, if the sender view is used to optionally
- add additional documents to the envelope, enhance your app to provide the
- needed feature (see example 13 for adding additional documents programmatically).
-
-
- Documentation about this example.
-
-
-
-
API methods used:
- Envelopes::create and
- EnvelopeViews::createSender.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp
deleted file mode 100644
index 97134c97..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp
+++ /dev/null
@@ -1,47 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
12. Embedded DocuSign web tool
-
Redirect the user to the DocuSign web tool.
-
Use this API call to open the DocuSign web tool, the NDSE (New DocuSign Signing Experience),
- with the user already logged in.
-
The starting view can be either an envelope's documents or the web tool's front page.
-
The user does not necessarily return from the NDSE, so using this API call is often a final
- step for your application.
- Or you can open the NDSE in a new tab for the user.
-
-
-
- Documentation about this example.
-
-
-
-
API method used:
- EnvelopeViews::createConsole.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
- Optional: to use the Envelope's document view please first create an envelope using
- example 2.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp
deleted file mode 100644
index 3739cb36..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp
+++ /dev/null
@@ -1,116 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
13. Embedded Signing Ceremony from a template with an added document
-
- 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.
- In this example, the additional document is an HTML document that
- includes order details with information from the form below.
- This example then enables you to sign the envelope using embedded signing.
- Embedded signing provides a smoother user experience for a signer who is
- already logged into your web application since the DocuSign
- signing ceremony is initiated from your website.
-
-
-
- Documentation about this example.
-
-
-
-
API methods used:
- Envelopes::create
- and
- EnvelopeViews::createRecipient.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
- The template you created via example 8 will be used.
-
-
-
-
- Problem: please first create the template using example 8.
- Thank you.
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp
deleted file mode 100644
index 37e49588..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp
+++ /dev/null
@@ -1,64 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
14. Send an envelope with an order form, including a payment field.
-
-
Note: This example will only work if the sender's DocuSign account
- is set up with a DocuSign payment gateway. Since the Payment Gateway ID
- is set in the configuration file, you will need to run your
- own instance of this project to set it.
-
-
-
Anchor strings
- (AutoPlace)
- are used to position the fields in the documents.
-
-
-
-Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
-
- Problem: please set the DS_PAYMENT_GATEWAY_ID value in the configuration file.
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp
deleted file mode 100644
index 7f451ab3..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp
+++ /dev/null
@@ -1,51 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
15. Get the tab data from an envelope.
-
-
Get the tab (field) values from an envelope for all of the envelope's recipients.
-
-
- This method is used to read the updated tab values from
- the envelope. The method can be used after the envelope is complete or while it is
- still in progress.
-
-
-
-
-
-Documentation about this example.
-
-
-
- API method used:
- EnvelopeFormData::get.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
- The last envelope you created with this example launcher will be queried.
- Recommendation: use example 9, then this example, since example 9 includes many tabs of different types.
-
-
-
-
-
- Problem: please first create an envelope using example 9.
- Thank you.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp
deleted file mode 100644
index aaa47d98..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp
+++ /dev/null
@@ -1,56 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
16. Set tab values for an envelope.
-
-
- This example creates an example with both read-only tabs (fields) and tabs that can
- be updated by the recipient.
-
-
The example also sets custom metadata in the envelope via the envelope custom fields feature.
-
-
-
-
-Documentation about this example.
-
-
-
- API method used:
- EnvelopeFormData::get.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp
deleted file mode 100644
index 50aeba3f..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp
+++ /dev/null
@@ -1,64 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
-
17. Set template tab values
-
- This example sets the value of a template's tabs. It includes setting
- radio button and checkbox tabs.
-
-
The example also sets custom metadata in the envelope via the envelope custom fields feature.
-
-
- Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- The template you created via example 8 will be used.
-
-
-
-
- Problem: please first create the template using example 8.
- Thank you.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp
deleted file mode 100644
index 0a90c072..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
18. Get the custom field data for an envelope
-
- Get the data values associated with the envelope itself. The custom data fields enable you to
- add additional meta-data to the envelope. The custom data fields can be set by the Sender
- via the DocuSign web tool, or can be set programmatically. The data can be included in the
- envelope's certificate of completion.
-
-
-
- This method is used to read the custom field values from
- an envelope.
-
-
-
- Documentation about this example.
-
-
-
-
- API method used:
- EnvelopeCustomFields::list.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
- The last envelope you created with this example launcher will be queried.
- Recommendation: use example 9, then this example, since example 9 includes many tabs of different types.
-
-
-
-
- Problem: please first create an envelope using example 9.
- Thank you.
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp
deleted file mode 100644
index e0955e80..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp
+++ /dev/null
@@ -1,51 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
19. Send an envelope with a recipient using Access Code Authentication.
-
-
- The envelope includes a pdf document. Anchor text
- (AutoPlace)
- is used to position the signing fields in the documents.
-
-
- This is a general example of creating and sending an envelope (a signing request) using An Access Code for Recipient Authentication.
-
-
-
-Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp
deleted file mode 100644
index c0daa432..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp
+++ /dev/null
@@ -1,36 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
20. Send an envelope with a recipient using SMS Authentication.
-
-
- Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp
deleted file mode 100644
index 85007e4d..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp
+++ /dev/null
@@ -1,36 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
21. Send an envelope with a recipient using Phone Authentication.
-
-
- Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp
deleted file mode 100644
index 667e08c9..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp
+++ /dev/null
@@ -1,36 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
22. Send an envelope with a recipient using Knowledge-Based Authentication.
-
-
- Documentation about this example.
-
-
-
API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp
deleted file mode 100644
index cc628383..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp
+++ /dev/null
@@ -1,45 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
23. Requiring Id Verification for a Recipient
-
-
- The envelope includes a pdf document. Anchor text
- (AutoPlace)
- is used to position the signing fields in the documents.
-
-
- This is a general example of creating and sending an envelope (a signing request) using ID Verification for Recipient Authentication.
-
-
-
- Documentation about this example.
-
-
-
- API method used:
- Envelopes::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp
deleted file mode 100644
index dbd066d9..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp
+++ /dev/null
@@ -1,34 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
24. ${title}.
-
-
-Permission profiles are collections of account settings that determine the behavior and actions
-available to the user groups to which they're applied. This code example demonstrates how to
-create a permission profile with the eSignature REST API.
-
-
-
- Documentation about this example.
-
-
-
API method used:
- AccountPermissionProfiles::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp
deleted file mode 100644
index e71c0566..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp
+++ /dev/null
@@ -1,66 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
26. ${title}.
-
-
-This code example demonstrates how to edit individual permission settings on a permissions profile
-with the eSignature REST API.
-
-
-
- Documentation about this example.
-
-
-
API method used:
- AccountPermissionProfiles::update.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg027.jsp
deleted file mode 100644
index c427e350..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg027.jsp
+++ /dev/null
@@ -1,39 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
27. ${title}.
-
-
- Permission profiles are collections of account settings that determine the behavior and actions
- available to the user groups to which they're applied. This code example demonstrates how to
- delete a permission profile with the eSignature REST API.
-
-
-
- Documentation about this example.
-
-
-
API method used:
- AccountPermissionProfiles::update.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg028.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg028.jsp
deleted file mode 100644
index 131aed33..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg028.jsp
+++ /dev/null
@@ -1,50 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
28. Creating a brand.
-
-
- The brand includes a Brand Name Configure Brands.
-
-
- DocuSign enables you to customize the eSignature sending and signing experience with your own
- branding elements-logo, colors, and more-stored as a collection of settings called a brand in
- your DocuSign account. This code example demonstrates how to create a brand with the
- eSignature REST API that you subsequently apply to a DocuSign envelope.
-
-
-
- Documentation about this example.
-
-
-
API method used:
- AccountBrands::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg029.jsp
deleted file mode 100644
index 00924592..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg029.jsp
+++ /dev/null
@@ -1,74 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
-
-
-
29. Applying a brand to an envelope
-
- The envelope includes a pdf document. Anchor text (AutoPlace)
- is used to position the signing fields in the documents.
-
-
- DocuSign enables you to customize the eSignature sending and signing experience with your own
- branding elements-logo, colors, and more-stored as a collection of settings called a brand in
- your DocuSign account. This code example demonstrates how to create a brand with the eSignature
- REST API that you subsequently apply to a DocuSign envelope.
-
-
-
- Documentation about
- this example.
-
-
-
-
-
- API method used: Envelopes::create.
-
-
- View source file ${sourceFile}
- on GitHub.
-
-
-
-
-
-
-
- Problem: please first create the brand(s) using example 24.
Thank you.
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg030.jsp
deleted file mode 100644
index 8f816b41..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg030.jsp
+++ /dev/null
@@ -1,102 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
-
-
-
30. Applying a brand to a template
-
This code example demonstrates how to apply a brand to an template.
-
- The envelope is defined by the template. The signer and cc recipient
- name and email are used to fill in the template's roles.
-
-
-
- This example demonstrates a common pattern for DocuSign integrations: envelopes will be sent
- programmatically, based on a template. If the template definition needs to be updated, the
- DocuSign web tool can be used to easily update the template, thus avoiding the need to make
- software changes.
-
-
-
- Documentation about this example.
-
-
-
-
-
- API method used: Envelopes::create.
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
- The template you created via example 8 and brands created via
- example 24 will be used.
-
-
-
-
- Problem: please create the template using example 8.
-
-
- Problem: please create the brand using example 24.
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg031.jsp
deleted file mode 100644
index 654ef489..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg031.jsp
+++ /dev/null
@@ -1,87 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
31. ${title}.
-
-
- This code example demonstrates how to send envelopes in bulk to multiple recipients with the
- eSignature API. To accomplish the task, you will first create a bulk send recipients list,
- and then create an envelope. From there, you will combine the envelope and bulk list to
- initiate bulk send. Method BulkSend::createBulkSendList creates a bulk send list that you can
- use to send an envelope to up to 1,000 recipients at once.
-
-
-
- Documentation about this example.
-
-
-
API methods used:
- EnvelopeRecipients::create,
- Envelopes::create,
- BulkEnvelopes::get,
- EnvelopeCustomFields::create,
- BulkSend::createBulkSendList
- EnvelopeRecipients::create.
-
-
-
- View source file ${sourceFile} on GitHub.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/index.jsp
deleted file mode 100644
index a99c03c3..00000000
--- a/src/main/webapp/WEB-INF/templates/views/pages/index.jsp
+++ /dev/null
@@ -1,252 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-
-
-
-
-
Welcome!
-
Welcome to the DocuSign Java Example Launcher
- using OAuth2.
-
-
-
-
-
Welcome
-
This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign eSignature REST API.
-
- Documentation on using OAuth Authorization Code Grant from a Java application.
-
-
-
Basic Examples
-
-
-
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.
-
-
API methods used:
- Envelopes::create and
- EnvelopeViews::createRecipient.
-
-
-
-
The envelope includes a pdf, Word, and HTML document. Anchor text
- (AutoPlace)
- is used to position the signing fields in the documents.
-
-
API method used:
- Envelopes::create.
-
-
-
-
List the envelopes created in the last 30 days.
-
-
API method used:
- Envelopes::listStatusChanges.
-
-
-
-
List the basic information about an envelope, including its overall status.
- Additional API/SDK methods may be used to get additional information about the
- envelope, its documents, recipients, etc.
-
-
API method used:
- Envelopes::get.
-
-
-
-
List the envelope's recipients, including their current status.
-
-
API method used:
- EnvelopeRecipients::list.
-
-
-
-
List the envelope's documents. A Certificate of Completion document
- is also associated with every envelope.
-
-
API method used:
- EnvelopeDocuments::list.
-
-
-
-
An envelope's documents can be downloaded one by one or as a complete set.
-
-
API method used:
- EnvelopeDocuments::get.
-
-
-
-
Create a template with two roles, signer and cc.
-
API methods used:
- Templates::list,
- Templates::create.
-
-
-
-
The envelope is defined by the template.
- The signer and cc recipient name and email are used to fill in the template's roles.
-
API method used:
- Envelopes::create.
-
-
-
-
The envelope includes a pdf, Word, and HTML document.
-
Multipart data transfer is used to send the documents in binary format to DocuSign.
- Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes.
- Binary transfer is not yet supported by the SDK.
-
-
API method used:
- Envelopes::create.
-
-
-
-
An envelope will be created in draft mode. The DocuSign
- web tool (NDSE) will then be shown, enabling further updates
- to the envelope before it is sent.
-
-
API methods used:
- Envelopes::create,
- EnvelopeViews::createSender.
-
-
-
Redirect the user to the DocuSign web tool.
-
API method used:
- EnvelopeViews::createConsole.
-
-
-
-
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.
-
API methods used:
- Envelopes::create and
- EnvelopeViews::createRecipient.
-
-
-
-
Anchor text
- (AutoPlace)
- is used to position the fields in the documents.
-
-
API method used:
- Envelopes::create.
-
-
-
-
-
Tabs Examples
-
-
This example retrieves the tab (field) values from an envelope.
-
- API method used:
- EnvelopeFormData::get.
-
-
-
-
This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.
-
- API method used:
- Envelopes::create and
- EnvelopeViews::createRecipient.
-
-
-
-
This example sets the tab (field) values for a template being used by an envelope.
-
- API method used:
- Envelopes::create and
- EnvelopeViews::createRecipient.
-
-
-
-
This example lists the envelope's custom metadata field values.
-
- API method used:
- EnvelopeCustomFields::list.
-
-
-
-
-
This example sends and envelope that requires an access-code for the purpose of multi-factor authentication.
-
API method used:
- Envelopes::create.
-
-
-
-
This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.
-
API method used:
- Envelopes::create.
-
-
-
-
This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.
-
API method used:
- Envelopes::create.
-
-
-
-
This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.
-
API method used:
- Envelopes::create.
-
-
-
-
Submit an envelope that requires verification of a government issued identity.
-
- API method used:
- Envelopes::create.
-
-
-
24. Creating a Permission Profile
-
- Coming Soon
-
-
-
-
This example allows you to set a permission profile on an existing user group.
-
API method used:
- Groups::update.
-
-
-
26. Modify a Permission Profile
-
- Coming Soon
-
-
-
-
This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.
-
API method used:
- AccountPermissionProfiles::create.
-
-
-
-
This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.
-
API method used:
- AccountBrands::create.
-
-
-
-
This example will show you how to create an envelope using any of the created brands on your account.
-
API method used:
- Envelopes::create.
-
-
-
-
This example will show you how to create an envelope using a brand
-
API method used:
- Envelopes::create.
-
-
-
31. Bulk sending envelopes to multiple recipients
-
- Coming Soon
-
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp b/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp
new file mode 100644
index 00000000..158ef8ff
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp
@@ -0,0 +1,30 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+ ${launcherTexts.getAPIMethodUsed()}
+
+
+ ${launcherTexts.getAPIMethodUsedPlural()}
+
+
+
+
+ ${link.getPathName()}
+
+
+
+ .
+
+
+ and
+
+
+ ,
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp
new file mode 100644
index 00000000..3c554970
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp
@@ -0,0 +1,21 @@
+<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
+
+
+
1. ${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ Documentation about this example.
+
+
+
+
+
+ ${viewSourceFile}
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp
new file mode 100644
index 00000000..990a6fd9
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp
@@ -0,0 +1,49 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
2. ${example.getExampleName()}
+
${example.getExampleDescription()}
+
+
+ ${viewSourceFile}
+
+
+
+ ${example.getForms().get(formNumber).getFormName()}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp
new file mode 100644
index 00000000..7c855526
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp
@@ -0,0 +1,32 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+
+ ${viewSourceFile}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp
new file mode 100644
index 00000000..06f60a40
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp
@@ -0,0 +1,52 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
+ ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText()}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp
new file mode 100644
index 00000000..e043d89c
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp
@@ -0,0 +1,41 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
+ ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp
new file mode 100644
index 00000000..0d74b7b7
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp
@@ -0,0 +1,65 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp
new file mode 100644
index 00000000..0217f06c
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp
@@ -0,0 +1,46 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp
new file mode 100644
index 00000000..64086a46
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp
@@ -0,0 +1,81 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+ ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)}
+
+
+
+
+
+
+
+
+
+ ${example.getRedirectsToOtherCodeExamples().get(redirectNoDocumentsNumber).getRedirectText().replaceFirst("\\{0}", redirectToForthCodeExample)}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp
new file mode 100644
index 00000000..5ba4a75f
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp
@@ -0,0 +1,31 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp
new file mode 100644
index 00000000..dd253d60
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp
@@ -0,0 +1,54 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp
new file mode 100644
index 00000000..00794187
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp
@@ -0,0 +1,56 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+
+
+
+
${example.getExampleName()}
+
${example.getExampleDescription()}
+
+ ${viewSourceFile}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp b/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp
index bbe98422..2ed8a460 100644
--- a/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp
+++ b/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp
@@ -18,10 +18,19 @@
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous">
-
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp
index 349c038b..829489e0 100644
--- a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp
+++ b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp
@@ -7,7 +7,7 @@
-
+
${title}
@@ -20,7 +20,7 @@
-
-
-
-
-
- DocuSign Account: ${locals.session.accountName}.
-
-
-
-
Working...
@@ -77,6 +69,15 @@
- Continue
+ ${launcherTexts.getContinueButton()}
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/tests/Click/ActivateClickwrapTest.java b/src/test/java/tests/Click/ActivateClickwrapTest.java
new file mode 100644
index 00000000..473c58d1
--- /dev/null
+++ b/src/test/java/tests/Click/ActivateClickwrapTest.java
@@ -0,0 +1,56 @@
+package tests.Click;
+
+import com.docusign.click.api.AccountsApi;
+import com.docusign.click.client.ApiClient;
+import com.docusign.click.client.ApiException;
+import com.docusign.click.model.ClickwrapVersionSummaryResponse;
+import com.docusign.controller.click.services.ActivateClickwrapService;
+import com.docusign.core.model.ApiType;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+
+public final class ActivateClickwrapTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String basePathAddition = "/clickapi";
+
+ private final ApiClient apiClient;
+
+ private final AccountsApi accountsApi;
+
+ private final TestConfig testConfig;
+
+ public ActivateClickwrapTest() throws IOException, ApiException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.CLICK);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.accountsApi = new AccountsApi(apiClient);
+ CreateClickwrapTest createClickwrapTest = new CreateClickwrapTest();
+ createClickwrapTest.CreateClickwrap_CorrectInputValues_ReturnsClickwrapVersionSummaryResponse();
+ }
+
+ @Test
+ public void ActivateClickwrap_CorrectInputValues_ReturnsClickwrapVersionSummaryResponse() throws ApiException {
+ // Arrange
+ var statusActive = "active";
+
+ // Act
+ ClickwrapVersionSummaryResponse clickwrapVersionSummaryResponse = ActivateClickwrapService.activateClickwrap(
+ this.accountsApi,
+ testConfig.getAccountId(),
+ testConfig.getInactiveClickwrap().getClickwrapId(),
+ testConfig.getInactiveClickwrap().getVersionNumber()
+ );
+
+ // Assert
+ Assert.assertNotNull(clickwrapVersionSummaryResponse);
+ Assert.assertEquals(statusActive, clickwrapVersionSummaryResponse.getStatus());
+ }
+}
diff --git a/src/test/java/tests/Click/CreateClickwrapTest.java b/src/test/java/tests/Click/CreateClickwrapTest.java
new file mode 100644
index 00000000..af41e678
--- /dev/null
+++ b/src/test/java/tests/Click/CreateClickwrapTest.java
@@ -0,0 +1,112 @@
+package tests.Click;
+
+import com.docusign.click.api.AccountsApi;
+import com.docusign.click.client.ApiClient;
+import com.docusign.click.client.ApiException;
+import com.docusign.click.model.ClickwrapRequest;
+import com.docusign.click.model.ClickwrapVersionSummaryResponse;
+import com.docusign.click.model.DisplaySettings;
+import com.docusign.click.model.Document;
+import com.docusign.controller.click.examples.ClickwrapHelper;
+import com.docusign.controller.click.services.CreateClickwrapService;
+import com.docusign.core.model.ApiType;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.Random;
+
+public final class CreateClickwrapTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf";
+
+ private static final Integer DOCUMENT_ORDER = 0;
+
+ private static final String DOCUMENT_NAME = "Terms of Service";
+
+ private static final String basePathAddition = "/clickapi";
+
+ private final ApiClient apiClient;
+
+ private final AccountsApi accountsApi;
+
+ private final TestConfig testConfig;
+
+ public CreateClickwrapTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.CLICK);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.accountsApi = new AccountsApi(apiClient);
+ }
+
+ @Test
+ public void CreateClickwrapRequest_CorrectInputValues_ReturnsClickwrapRequest() throws IOException {
+ // Arrange
+ String clickwrapName = "Clickwrap name";
+ String displayName = "Terms of Service";
+ String consentButtonText = "I Agree";
+ String format = "modal";
+ String documentDisplay = "document";
+
+ Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER);
+ DisplaySettings displaySettings = new DisplaySettings()
+ .displayName(displayName)
+ .consentButtonText(consentButtonText)
+ .downloadable(true)
+ .format(format)
+ .mustRead(true)
+ .requireAccept(true)
+ .documentDisplay(documentDisplay);
+
+ ClickwrapRequest expectedClickwrapRequest = new ClickwrapRequest()
+ .addDocumentsItem(document)
+ .clickwrapName(clickwrapName)
+ .requireReacceptance(true)
+ .displaySettings(displaySettings);
+
+ // Act
+ ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest(
+ clickwrapName,
+ DOCUMENT_FILE_NAME,
+ DOCUMENT_NAME,
+ DOCUMENT_ORDER);
+
+ // Assert
+ Assert.assertNotNull(clickwrapRequest);
+ Assert.assertEquals(expectedClickwrapRequest, clickwrapRequest);
+ }
+
+ @Test
+ public void CreateClickwrap_CorrectInputValues_ReturnsClickwrapVersionSummaryResponse() throws ApiException, IOException {
+ // Arrange
+ byte[] byteArray = new byte[8];
+ new Random().nextBytes(byteArray);
+ String clickwrapName = new String(byteArray, StandardCharsets.UTF_8);
+
+ ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest(
+ clickwrapName,
+ DOCUMENT_FILE_NAME,
+ DOCUMENT_NAME,
+ DOCUMENT_ORDER);
+
+ // Act
+ ClickwrapVersionSummaryResponse clickwrapVersionSummaryResponse = CreateClickwrapService.createClickwrap(
+ this.accountsApi,
+ testConfig.getAccountId(),
+ clickwrapRequest);
+
+ testConfig.setInactiveClickwrap(clickwrapVersionSummaryResponse);
+
+ // Assert
+ Assert.assertNotNull(clickwrapVersionSummaryResponse);
+ Assert.assertEquals(clickwrapName, clickwrapVersionSummaryResponse.getClickwrapName());
+ }
+}
diff --git a/src/test/java/tests/common/JWTLoginMethodTest.java b/src/test/java/tests/common/JWTLoginMethodTest.java
new file mode 100644
index 00000000..92dcdde6
--- /dev/null
+++ b/src/test/java/tests/common/JWTLoginMethodTest.java
@@ -0,0 +1,73 @@
+package tests.common;
+
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.client.auth.OAuth;
+import org.junit.Assert;
+
+import java.awt.*;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+
+public final class JWTLoginMethodTest {
+
+ private static final String RedirectUrl = "https://developers.docusign.com/platform/auth/consent";
+
+ private static final String CONSENT_REQUIRED_MESSAGE = "Consent required, please provide consent in browser window and then run this app again.";
+
+ private static final String CONSENT_REQUIRED_KEYWORD = "consent_required";
+
+ public static void RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType apiType) throws IOException {
+ TestConfig testConfig = TestConfig.getInstance();
+
+ try {
+ ApiClient apiClient = new ApiClient(testConfig.getHost());
+ List scopes = Arrays.asList(apiType.getScopes());
+
+ byte[] privateKeyBytes = Files.exists(Path.of(testConfig.getPrivateKeyPath())) ?
+ Files.readAllBytes(Paths.get(testConfig.getPrivateKeyPath()))
+ : testConfig.getPrivateKey().getBytes();
+
+ OAuth.OAuthToken oAuthToken = apiClient.requestJWTUserToken(
+ testConfig.getClientId(),
+ testConfig.getImpersonatedUserId(),
+ scopes,
+ privateKeyBytes,
+ 3600);
+ String accessToken = oAuthToken.getAccessToken();
+ OAuth.UserInfo userInfo = apiClient.getUserInfo(accessToken);
+ String accountId = userInfo.getAccounts().get(0).getAccountId();
+
+ Assert.assertNotNull(accessToken);
+ Assert.assertNotNull(accountId);
+ testConfig.setAccessToken(accessToken);
+ testConfig.setAccountId(accountId);
+ } catch (ApiException exp) {
+ if (exp.getMessage().contains(CONSENT_REQUIRED_KEYWORD)) {
+ try {
+ String scopes = "impersonation%20";
+ for (String scope : apiType.getScopes()) {
+ scopes += scope + "%20";
+ }
+ System.out.println(CONSENT_REQUIRED_MESSAGE);
+ Desktop.getDesktop().browse(new URI(
+ "https://account-d.docusign.com/oauth/auth?response_type=code&scope="
+ + scopes
+ + "&client_id="
+ + testConfig.getClientId()
+ + "&redirect_uri="
+ + JWTLoginMethodTest.RedirectUrl));
+ } catch (Exception e) {
+ System.out.print("Error!!! ");
+ System.out.print(e.getMessage());
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/java/tests/common/TestConfig.java b/src/test/java/tests/common/TestConfig.java
new file mode 100644
index 00000000..562722ed
--- /dev/null
+++ b/src/test/java/tests/common/TestConfig.java
@@ -0,0 +1,112 @@
+package tests.common;
+
+import com.docusign.click.model.ClickwrapVersionSummaryResponse;
+import com.docusign.esign.model.Brand;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import lombok.Getter;
+import lombok.Setter;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+@Getter
+@Setter
+public class TestConfig {
+ private static TestConfig single_instance = null;
+
+ public String PathToDocuments;
+
+ private String ClientId;
+
+ private String Host;
+
+ private String AccountId;
+
+ private String SignerEmail;
+
+ private String SignerName;
+
+ private String ImpersonatedUserId;
+
+ private String OAuthBasePath;
+
+ private String PrivateKeyPath;
+
+ private String PrivateKey;
+
+ private String AccessToken;
+
+ private String BasePath;
+
+ private String BatchId;
+
+ private String TemplateId;
+
+ private ClickwrapVersionSummaryResponse inactiveClickwrap;
+
+ private Brand brand;
+
+ public TestConfig() throws IOException {
+ PathToDocuments = System.getProperty("user.dir") + "//src//main//resources//";
+ Host = "https://demo.docusign.net";
+ OAuthBasePath = "account-d.docusign.com";
+ PrivateKeyPath = PathToDocuments + "private.key";
+ BasePath = "https://demo.docusign.net";
+
+ try {
+ var isFilePresentInTheRepository = Files.exists(Path.of(PathToDocuments + "application.json"));
+
+ if (isFilePresentInTheRepository) {
+ String source = new String(Files.readAllBytes(Paths.get(PathToDocuments + "application.json")));
+
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+
+ JsonObject originalJsonValue = gson.fromJson(source, JsonObject.class);
+ JsonObject jwtConfigurationValues = originalJsonValue
+ .getAsJsonObject("spring")
+ .getAsJsonObject("security")
+ .getAsJsonObject("oauth2")
+ .getAsJsonObject("client")
+ .getAsJsonObject("registration")
+ .getAsJsonObject("jwt")
+ .getAsJsonObject();
+
+ Object impersonatedUserId = jwtConfigurationValues.get("impersonated-user-guid").toString();
+ Object clientId = jwtConfigurationValues.get("client-id").toString();
+ Object signerEmail = new JSONObject(source).get("DS_SIGNER_EMAIL");
+ Object signerName = new JSONObject(source).get("DS_SIGNER_NAME");
+
+ if (impersonatedUserId == null || clientId == null || signerEmail == null || signerName == null) {
+ throw new JSONException("The wrong format of the application.json file.");
+ }
+
+ ImpersonatedUserId = impersonatedUserId.toString().replace("\"", "");
+ ClientId = clientId.toString().replace("\"", "");
+ SignerEmail = signerEmail.toString();
+ SignerName = signerName.toString();
+ } else {
+ ImpersonatedUserId = System.getenv("IMPERSONATED_USER_ID");
+ ClientId = System.getenv("CLIENT_ID");
+ SignerEmail = System.getenv("SIGNER_EMAIL");
+ SignerName = System.getenv("SIGNER_NAME");
+ PrivateKey = System.getenv("PRIVATE_KEY");
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static TestConfig getInstance() throws IOException {
+ if (single_instance == null) {
+ single_instance = new TestConfig();
+ }
+
+ return single_instance;
+ }
+}
diff --git a/src/test/java/tests/eSignature/AddDocToTemplateTest.java b/src/test/java/tests/eSignature/AddDocToTemplateTest.java
new file mode 100644
index 00000000..9866c0fa
--- /dev/null
+++ b/src/test/java/tests/eSignature/AddDocToTemplateTest.java
@@ -0,0 +1,228 @@
+package tests.eSignature;
+
+import com.docusign.common.WorkArguments;
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.AddDocToTemplateService;
+import com.docusign.core.common.DocumentType;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.EnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Collections;
+
+public final class AddDocToTemplateTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl";
+
+ private static final String HTML_DOCUMENT_NAME = "Appendix 1--Sales order";
+
+ private static final int ANCHOR_OFFSET_Y = 10;
+
+ private static final int ANCHOR_OFFSET_X = 20;
+
+ private static final String basePathAddition = "/restapi";
+
+ private final String SIGNER_CLIENT_ID = "1000";
+
+ private final String RedirectUrl = "https://developers.docusign.com/platform/auth/consent";
+
+ private final ApiClient apiClient;
+
+ private final EnvelopesApi envelopesApi;
+
+ private final TestConfig testConfig;
+
+ public AddDocToTemplateTest() throws IOException, ApiException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.envelopesApi = new EnvelopesApi(apiClient);
+
+ CreateNewTemplateTest createNewTemplateTest = new CreateNewTemplateTest();
+ createNewTemplateTest.CreateTemplate_CorrectInputValues_TemplateSummary();
+ }
+
+ @Test
+ public void AddDocumentToTemplate_CorrectInputValues_ViewUrl() throws ApiException, IOException {
+ // Arrange
+ String ccEmail = "cc@gmail.com";
+ String ccName = "cc";
+ String item = "kiwi";
+ String quantity = "1";
+
+ WorkArguments args = new WorkArguments();
+ args.setSignerEmail(testConfig.getSignerEmail());
+ args.setSignerName(testConfig.getSignerName());
+ args.setCcEmail(ccEmail);
+ args.setCcName(ccName);
+ args.setItem(item);
+ args.setQuantity(quantity);
+
+ // Act
+ ViewUrl embeddedEnvelope = AddDocToTemplateService.addDocumentToTemplate(
+ envelopesApi,
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ ccEmail,
+ ccName,
+ testConfig.getTemplateId(),
+ testConfig.getAccountId(),
+ RedirectUrl,
+ RedirectUrl,
+ args
+ );
+
+ // Assert
+ Assert.assertNotNull(embeddedEnvelope);
+ }
+
+ @Test
+ public void MakeRecipientViewRequest_CorrectInputValues_RecipientViewRequest() {
+ // Arrange
+ String pingFrequency = "600";
+ String authenticationMethod = "none";
+
+ RecipientViewRequest expectedViewRequest = new RecipientViewRequest();
+ expectedViewRequest.setReturnUrl(RedirectUrl);
+ expectedViewRequest.setAuthenticationMethod(authenticationMethod);
+ expectedViewRequest.setEmail(testConfig.getSignerEmail());
+ expectedViewRequest.setUserName(testConfig.getSignerName());
+ expectedViewRequest.setClientUserId(SIGNER_CLIENT_ID);
+ expectedViewRequest.setPingFrequency(pingFrequency);
+ expectedViewRequest.setPingUrl(RedirectUrl);
+
+ // Act
+ RecipientViewRequest recipientViewRequest = AddDocToTemplateService.makeRecipientViewRequest(
+ RedirectUrl,
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ RedirectUrl
+ );
+
+ // Assert
+ Assert.assertNotNull(recipientViewRequest);
+ Assert.assertEquals(expectedViewRequest, recipientViewRequest);
+ }
+
+ @Test
+ public void MakeEnvelope_CorrectInputValues_EnvelopeDefinition() throws IOException {
+ // Arrange
+ String ccEmail = "cc@gmail.com";
+ String ccName = "cc";
+ String item = "kiwi";
+ String defaultIdOne = "1";
+ String defaultIdTwo = "2";
+ String anchorString = "**signature_1**";
+
+ WorkArguments args = new WorkArguments();
+ args.setSignerEmail(testConfig.getSignerEmail());
+ args.setSignerName(testConfig.getSignerName());
+ args.setCcEmail(ccEmail);
+ args.setCcName(ccName);
+ args.setItem(item);
+ args.setQuantity(defaultIdOne);
+
+ CarbonCopy cc = new CarbonCopy();
+ cc.setEmail(ccEmail);
+ cc.setName(ccName);
+ cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME);
+ cc.setRecipientId(defaultIdTwo);
+
+ CompositeTemplate compositeTemplate = new CompositeTemplate();
+ compositeTemplate.setCompositeTemplateId(defaultIdOne);
+ ServerTemplate serverTemplates = new ServerTemplate();
+ serverTemplates.setSequence(defaultIdOne);
+ serverTemplates.setTemplateId(testConfig.getTemplateId());
+ compositeTemplate.setServerTemplates(Collections.singletonList(serverTemplates));
+
+ InlineTemplate inlineTemplate = new InlineTemplate();
+ inlineTemplate.setSequence(defaultIdTwo);
+ inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(
+ AddDocToTemplateService.createSigner(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID
+ ),
+ cc));
+ compositeTemplate.setInlineTemplates(Collections.singletonList(inlineTemplate));
+
+ Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab(
+ anchorString,
+ ANCHOR_OFFSET_Y,
+ ANCHOR_OFFSET_X);
+ Signer signer1AddedDoc = AddDocToTemplateService.createSigner(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID
+ );
+ signer1AddedDoc.setTabs(signer1Tabs);
+
+ byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)
+ .getBytes(StandardCharsets.UTF_8);
+
+ CompositeTemplate compTemplate2 = new CompositeTemplate();
+ compTemplate2.setCompositeTemplateId(defaultIdTwo);
+ InlineTemplate inlineTemplate2 = new InlineTemplate();
+ inlineTemplate2.setSequence(defaultIdOne);
+ inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc));
+ compTemplate2.setInlineTemplates(Collections.singletonList(inlineTemplate2));
+ compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME,
+ DocumentType.HTML.getDefaultFileExtention(), defaultIdOne));
+
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition();
+ expectedEnvelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT);
+ expectedEnvelopeDefinition.setCompositeTemplates(Arrays.asList(compositeTemplate, compTemplate2));
+
+ // Act
+ EnvelopeDefinition envelopeDefinition = AddDocToTemplateService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ ccEmail,
+ ccName,
+ testConfig.getTemplateId(),
+ args
+ );
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void CreateSigner_CorrectInputValues_Signer() {
+ // Arrange
+ String recipientId = "1";
+ Signer expectedSigner = new Signer();
+ expectedSigner.setEmail(testConfig.getSignerEmail());
+ expectedSigner.setName(testConfig.getSignerName());
+ expectedSigner.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME);
+ expectedSigner.setRecipientId(recipientId);
+ expectedSigner.setClientUserId(SIGNER_CLIENT_ID);
+
+ // Act
+ Signer signer = AddDocToTemplateService.createSigner(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID
+ );
+
+ // Assert
+ Assert.assertNotNull(signer);
+ Assert.assertEquals(expectedSigner, signer);
+ }
+}
diff --git a/src/test/java/tests/eSignature/ApplyBrandToEnvelopeTest.java b/src/test/java/tests/eSignature/ApplyBrandToEnvelopeTest.java
new file mode 100644
index 00000000..bc26ba64
--- /dev/null
+++ b/src/test/java/tests/eSignature/ApplyBrandToEnvelopeTest.java
@@ -0,0 +1,120 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.ApplyBrandToEnvelopeService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.AccountsApi;
+import com.docusign.esign.api.EnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+public final class ApplyBrandToEnvelopeTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf";
+
+ private static final String DOCUMENT_NAME = "EG025 Lorem Ipsum";
+
+ private static final int ANCHOR_OFFSET_Y = 10;
+
+ private static final int ANCHOR_OFFSET_X = 20;
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final AccountsApi accountsApi;
+
+ private final EnvelopesApi envelopesApi;
+
+ private final TestConfig testConfig;
+
+ public ApplyBrandToEnvelopeTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+
+ this.accountsApi = new AccountsApi(apiClient);
+ this.envelopesApi = new EnvelopesApi(apiClient);
+ }
+
+ @Test
+ public void GetBrands_CorrectInputValues_ReturnsBrandsResponse() throws ApiException {
+ // Act
+ BrandsResponse brand = ApplyBrandToEnvelopeService.getBrands(
+ this.accountsApi,
+ testConfig.getAccountId());
+
+ testConfig.setBrand(brand.getBrands().stream().findFirst().get());
+
+ // Assert
+ Assert.assertNotNull(brand);
+ Assert.assertNotNull(brand.getBrands());
+ }
+
+ @Test
+ public void MakeEnvelope_CorrectInputValues_ReturnsEnvelopeDefinition() throws IOException {
+ // Arrange
+ String defaultID = "1";
+ String emailSubject = "EG029. Please Sign";
+ String anchorString = "/sn1/";
+ Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, defaultID);
+
+ Tabs tabs = EnvelopeHelpers.createSingleSignerTab(anchorString, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X);
+ Signer signer = new Signer()
+ .email(testConfig.getSignerEmail())
+ .name(testConfig.getSignerName())
+ .recipientId(defaultID)
+ .routingOrder(defaultID)
+ .tabs(tabs);
+
+ Recipients recipients = new Recipients();
+ recipients.setSigners(Collections.singletonList(signer));
+
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition()
+ .emailSubject(emailSubject)
+ .documents(List.of(document))
+ .recipients(recipients)
+ .brandId(testConfig.getBrand().getBrandId())
+ .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT);
+ // Act
+ EnvelopeDefinition envelopeDefinition = ApplyBrandToEnvelopeService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ testConfig.getBrand().getBrandId());
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void ApplyBrandToEnvelope_CorrectInputValues_ReturnsEnvelopeSummary() throws ApiException, IOException {
+ // Arrange
+ EnvelopeDefinition envelopeDefinition = ApplyBrandToEnvelopeService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ testConfig.getBrand().getBrandId());
+
+ // Act
+ EnvelopeSummary envelopeSummary = ApplyBrandToEnvelopeService.applyBrandToEnvelope(
+ this.envelopesApi,
+ testConfig.getAccountId(),
+ envelopeDefinition);
+
+ // Assert
+ Assert.assertNotNull(envelopeSummary);
+ }
+}
diff --git a/src/test/java/tests/eSignature/BulkSendEnvelopesTest.java b/src/test/java/tests/eSignature/BulkSendEnvelopesTest.java
new file mode 100644
index 00000000..151f2200
--- /dev/null
+++ b/src/test/java/tests/eSignature/BulkSendEnvelopesTest.java
@@ -0,0 +1,294 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.examples.DsModelUtils;
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.BulkSendEnvelopesService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.BulkEnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+public final class BulkSendEnvelopesTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final long BULK_REQUEST_DELAY = 15L;
+
+ private static final String BULK_SIGNER_EMAIL_PLACEHOLDER = "MultiBulkRecipients-%s@docusign.com";
+
+ private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s";
+
+ private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf";
+
+ private static final String DOCUMENT_NAME = "Lorem Ipsum";
+
+ private static final int ANCHOR_OFFSET_Y = -5;
+
+ private static final int ANCHOR_OFFSET_X = 15;
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final BulkEnvelopesApi bulkEnvelopesApi;
+
+ private final TestConfig testConfig;
+
+ public BulkSendEnvelopesTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+
+ this.bulkEnvelopesApi = new BulkEnvelopesApi(apiClient);
+ }
+
+ @Test
+ public void CreateCCPlaceholder_CorrectInputValues_ReturnsCarbonCopy() {
+ // Arrange
+ String roleName = "cc";
+ String routingOrder = "1";
+ String recipientId = "1";
+ CarbonCopy expectedCarbonCopy = new CarbonCopy()
+ .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName))
+ .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName))
+ .roleName(roleName)
+ .note("")
+ .routingOrder(routingOrder)
+ .status(EnvelopeHelpers.SIGNER_STATUS_CREATED)
+ .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL)
+ .recipientId(recipientId)
+ .recipientType(roleName);
+
+ // Act
+ CarbonCopy carbonCopy = BulkSendEnvelopesService.createCCPlaceholder(
+ roleName,
+ recipientId,
+ routingOrder);
+
+ // Assert
+ Assert.assertNotNull(carbonCopy);
+ Assert.assertEquals(expectedCarbonCopy, carbonCopy);
+ }
+
+ @Test
+ public void CreateSignerPlaceholder_CorrectInputValues_ReturnsSigner() {
+ // Arrange
+ String roleName = "signer";
+ String routingOrder = "1";
+ String recipientId = "1";
+ String anchorString = "/sn1/";
+ Signer expectedSigner = new Signer()
+ .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName))
+ .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName))
+ .roleName(roleName)
+ .note("")
+ .routingOrder(routingOrder)
+ .status(EnvelopeHelpers.SIGNER_STATUS_CREATED)
+ .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL)
+ .recipientId(recipientId)
+ .recipientType(roleName)
+ .tabs(EnvelopeHelpers.createSingleSignerTab(anchorString, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X));
+
+ // Act
+ Signer signer = BulkSendEnvelopesService.createSignerPlaceholder(
+ roleName,
+ recipientId,
+ routingOrder);
+
+ // Assert
+ Assert.assertNotNull(signer);
+ Assert.assertEquals(expectedSigner, signer);
+ }
+
+ @Test
+ public void CreateRecipients_CorrectInputValues_ReturnsRecipients() {
+ // Arrange
+ String defaultId = "1";
+ String defaultIdTwo = "2";
+ Signer signer = BulkSendEnvelopesService.createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, defaultId, defaultId);
+ CarbonCopy carbonCopy = BulkSendEnvelopesService.createCCPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, defaultIdTwo, defaultIdTwo);
+ Recipients expectedRecipients = new Recipients()
+ .signers(List.of(signer))
+ .carbonCopies(List.of(carbonCopy));
+
+ // Act
+ Recipients recipients = BulkSendEnvelopesService.createRecipients();
+
+ // Assert
+ Assert.assertNotNull(recipients);
+ Assert.assertEquals(expectedRecipients, recipients);
+ }
+
+ @Test
+ public void CreateCustomFields_CorrectInputValues_ReturnsCustomFields() {
+ // Arrange
+ String bulkListId = "1";
+ String mailingListId = "mailingListId";
+ TextCustomField textCustomField = new TextCustomField()
+ .name(mailingListId)
+ .required(DsModelUtils.FALSE)
+ .show(DsModelUtils.FALSE)
+ .value(bulkListId);
+
+ CustomFields expectedCustomFields = new CustomFields()
+ .listCustomFields(Collections.emptyList())
+ .textCustomFields(List.of(textCustomField));
+
+ // Act
+ CustomFields customFields = BulkSendEnvelopesService.createCustomFields(bulkListId);
+
+ // Assert
+ Assert.assertNotNull(customFields);
+ Assert.assertEquals(expectedCustomFields, customFields);
+ }
+
+ @Test
+ public void MakeEnvelope_CorrectInputValues_ReturnsEnvelopeDefinition() throws IOException {
+ // Arrange
+ String docId = "1";
+ String emailSubject = "EG031 Please sign";
+ Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, docId);
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition()
+ .documents(List.of(document))
+ .envelopeIdStamping(DsModelUtils.TRUE)
+ .emailSubject(emailSubject)
+ .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED)
+ .recipients(BulkSendEnvelopesService.createRecipients());
+
+ // Act
+ EnvelopeDefinition envelopeDefinition = BulkSendEnvelopesService.makeEnvelope();
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void CreateBulkSending_CorrectInputValues_ReturnsBulkSendingCopy() {
+ // Arrange
+ String ccName = "CC";
+ String ccEmail = "cc@gmail.com";
+
+ BulkSendingCopyRecipient recipient1 = new BulkSendingCopyRecipient()
+ .name(testConfig.getSignerName())
+ .email(testConfig.getSignerEmail())
+ .tabs(Collections.emptyList())
+ .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME);
+
+ BulkSendingCopyRecipient recipient2 = new BulkSendingCopyRecipient()
+ .name(ccName)
+ .email(ccEmail)
+ .tabs(Collections.emptyList())
+ .roleName(EnvelopeHelpers.CC_ROLE_NAME);
+
+ BulkSendingCopy expectedBulkSendingCopy = new BulkSendingCopy()
+ .recipients(List.of(recipient1, recipient2))
+ .customFields(Collections.emptyList());
+
+ // Act
+ BulkSendingCopy bulkSendingCopy = BulkSendEnvelopesService.createBulkSending(
+ testConfig.getSignerName(),
+ testConfig.getSignerEmail(),
+ ccName,
+ ccEmail
+ );
+
+ // Assert
+ Assert.assertNotNull(bulkSendingCopy);
+ Assert.assertEquals(expectedBulkSendingCopy, bulkSendingCopy);
+ }
+
+ @Test
+ public void GetSendingList_CorrectInputValues_ReturnsBulkSendingList() {
+ // Arrange
+ String ccName = "CC";
+ String ccEmail = "cc@gmail.com";
+ String cc2Name = "CC 2";
+ String cc2Email = "cc2@gmail.com";
+ String signer2Name = "Signer 2";
+ String signer2Email = "signer2@gmail.com";
+ String fileName = "sample.csv";
+
+ List copies = List.of(
+ BulkSendEnvelopesService.createBulkSending(testConfig.getSignerName(), testConfig.getSignerEmail(), ccName, ccEmail),
+ BulkSendEnvelopesService.createBulkSending(signer2Name, signer2Email, cc2Name, cc2Email)
+ );
+ BulkSendingList expectedBulkSendingList = new BulkSendingList()
+ .name(fileName)
+ .bulkCopies(copies);
+
+ // Act
+ BulkSendingList bulkSendingList = BulkSendEnvelopesService.getSendingList(
+ testConfig.getSignerName(),
+ testConfig.getSignerEmail(),
+ ccName,
+ ccEmail,
+ signer2Name,
+ signer2Email,
+ cc2Name,
+ cc2Email
+ );
+
+ // Assert
+ Assert.assertNotNull(bulkSendingList);
+ Assert.assertEquals(expectedBulkSendingList, bulkSendingList);
+ }
+
+ @Test
+ public void BulkSendEnvelopes_CorrectInputValues_ReturnsString() throws ApiException, IOException {
+ // Arrange
+ String ccName = "CC";
+ String ccEmail = "cc@gmail.com";
+ String cc2Name = "CC 2";
+ String cc2Email = "cc2@gmail.com";
+ String signer2Name = "Signer 2";
+ String signer2Email = "signer2@gmail.com";
+
+ // Act
+ String batchId = BulkSendEnvelopesService.bulkSendEnvelopes(
+ this.bulkEnvelopesApi,
+ this.apiClient,
+ testConfig.getSignerName(),
+ testConfig.getSignerEmail(),
+ ccName,
+ ccEmail,
+ signer2Name,
+ signer2Email,
+ cc2Name,
+ cc2Email,
+ testConfig.getAccountId()
+ );
+ testConfig.setBatchId(batchId);
+
+ // Assert
+ Assert.assertNotNull(batchId);
+ }
+
+ @Test
+ public void GetBulkSendBatchStatus_CorrectInputValues_ReturnsBulkSendBatchStatus() throws ApiException, IOException, InterruptedException {
+ // Arrange
+ BulkSendEnvelopes_CorrectInputValues_ReturnsString();
+
+ // Act
+ BulkSendBatchStatus bulkSendBatchStatus = BulkSendEnvelopesService.getBulkSendBatchStatus(
+ this.bulkEnvelopesApi,
+ testConfig.getAccountId(),
+ testConfig.getBatchId(),
+ BULK_REQUEST_DELAY
+ );
+
+ // Assert
+ Assert.assertNotNull(bulkSendBatchStatus);
+ }
+}
diff --git a/src/test/java/tests/eSignature/CreateBrandTest.java b/src/test/java/tests/eSignature/CreateBrandTest.java
new file mode 100644
index 00000000..bff20e03
--- /dev/null
+++ b/src/test/java/tests/eSignature/CreateBrandTest.java
@@ -0,0 +1,59 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.services.CreateBrandService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.AccountsApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.BrandsResponse;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.Random;
+
+public final class CreateBrandTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final AccountsApi accountsApi;
+
+ private final TestConfig testConfig;
+
+ public CreateBrandTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.accountsApi = new AccountsApi(apiClient);
+ }
+
+ @Test
+ public void CreateBrand_CorrectInputValues_ReturnsBrandsResponse() throws ApiException {
+ // Arrange
+ byte[] array = new byte[8];
+ new Random().nextBytes(array);
+ var brandName = new String(array, StandardCharsets.UTF_8);
+ var defaultBrandLanguage = "en";
+
+ // Act
+ BrandsResponse brand = CreateBrandService.createBrand(
+ this.accountsApi,
+ brandName,
+ defaultBrandLanguage,
+ testConfig.getAccountId());
+
+ // Assert
+ Assert.assertNotNull(brand);
+ Assert.assertNotNull(brand.getBrands());
+ }
+}
diff --git a/src/test/java/tests/eSignature/CreateNewTemplateTest.java b/src/test/java/tests/eSignature/CreateNewTemplateTest.java
new file mode 100644
index 00000000..c7f96cb7
--- /dev/null
+++ b/src/test/java/tests/eSignature/CreateNewTemplateTest.java
@@ -0,0 +1,331 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.CreateTemplateService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.EnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Locale;
+
+public final class CreateNewTemplateTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String TEMPLATE_NAME = "Example Signer and CC template v2";
+
+ private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_fields.pdf";
+
+ private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum";
+
+ private static final String DOCUMENT_ID = "1";
+
+ private static final String PAGE_NUMBER = "1";
+
+ private static final String FALSE = "false";
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final EnvelopesApi envelopesApi;
+
+ private final TestConfig testConfig;
+
+ public CreateNewTemplateTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.envelopesApi = new EnvelopesApi(apiClient);
+ }
+
+ @Test
+ public void SearchTemplatesByName_CorrectInputValues_EnvelopeTemplateResults() throws ApiException {
+ // Act
+ EnvelopeTemplateResults envelopeTemplateResults = CreateTemplateService.searchTemplatesByName(
+ apiClient,
+ testConfig.getAccountId(),
+ TEMPLATE_NAME);
+
+ // Assert
+ Assert.assertNotNull(envelopeTemplateResults);
+ Assert.assertTrue(Integer.parseInt(envelopeTemplateResults.getResultSetSize()) > 0);
+
+ EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0);
+ testConfig.setTemplateId(template.getTemplateId());
+ }
+
+ @Test
+ public void CreateTemplate_CorrectInputValues_TemplateSummary() throws IOException, ApiException {
+ // Arrange
+ EnvelopeTemplate envelopeTemplate = CreateTemplateService.makeTemplate(TEMPLATE_NAME);
+
+ // Act
+ TemplateSummary template = CreateTemplateService.createTemplate(
+ apiClient,
+ testConfig.getAccountId(),
+ envelopeTemplate
+ );
+
+ // Assert
+ Assert.assertNotNull(template);
+ Assert.assertNotNull(template.getTemplateId());
+
+ testConfig.setTemplateId(template.getTemplateId());
+ }
+
+ @Test
+ public void MakeRecipientViewRequest_CorrectInputValues_RecipientViewRequest() throws ApiException {
+ // Act
+ EnvelopeTemplateResults envelopeTemplateResults = CreateTemplateService.searchTemplatesByName(
+ apiClient,
+ testConfig.getAccountId(),
+ TEMPLATE_NAME);
+
+ // Assert
+ Assert.assertNotNull(envelopeTemplateResults);
+ Assert.assertTrue(Integer.parseInt(envelopeTemplateResults.getResultSetSize()) > 0);
+
+ EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0);
+ testConfig.setTemplateId(template.getTemplateId());
+ }
+
+ @Test
+ public void MakeTemplate_CorrectInputValues_EnvelopeTemplate() throws IOException {
+ // Assert
+ String defaultIdOne = "1";
+ Document doc = EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, defaultIdOne);
+ String emailSubject = "Please sign this document";
+ String description = "Example template created via the API";
+ String falseString = "false";
+ String textXPosition = "153";
+ String checkboxXPosition = "75";
+ String defaultIdTwo = "2";
+
+ Tabs signerTabs = new Tabs();
+ signerTabs.setCheckboxTabs(Arrays.asList(
+ CreateTemplateService.createCheckbox("ckAuthorization", checkboxXPosition, "417"),
+ CreateTemplateService.createCheckbox("ckAuthentication", checkboxXPosition, "447"),
+ CreateTemplateService.createCheckbox("ckAgreement", checkboxXPosition, "478"),
+ CreateTemplateService.createCheckbox("ckAcknowledgement", checkboxXPosition, "508")));
+
+ signerTabs.setListTabs(Collections.singletonList(CreateTemplateService.createList()));
+ signerTabs.setRadioGroupTabs(Collections.singletonList(CreateTemplateService.createRadioGroup()));
+ signerTabs.setSignHereTabs(Collections.singletonList(CreateTemplateService.createSignHere()));
+ signerTabs.textTabs(java.util.List.of(
+ CreateTemplateService.createText("text", textXPosition, "230")
+ ));
+ signerTabs.numericalTabs(java.util.List.of(
+ CreateTemplateService.createNumerical("numericalCurrency", textXPosition, "260")
+ ));
+
+ Signer signer = new Signer();
+ signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME);
+ signer.setRecipientId(defaultIdOne);
+ signer.setRoutingOrder(defaultIdOne);
+ signer.setTabs(signerTabs);
+
+ CarbonCopy cc = new CarbonCopy();
+ cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME);
+ cc.setRoutingOrder(defaultIdTwo);
+ cc.setRecipientId(defaultIdTwo);
+
+ EnvelopeTemplate expectedEnvelopeTemplate = new EnvelopeTemplate();
+ expectedEnvelopeTemplate.setDocuments(Collections.singletonList(doc));
+ expectedEnvelopeTemplate.setEmailSubject(emailSubject);
+ expectedEnvelopeTemplate.setName(TEMPLATE_NAME);
+ expectedEnvelopeTemplate.setDescription(description);
+ expectedEnvelopeTemplate.setShared(falseString);
+ expectedEnvelopeTemplate.setRecipients(EnvelopeHelpers.createRecipients(signer, cc));
+ expectedEnvelopeTemplate.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED);
+
+ // Act
+ EnvelopeTemplate envelopeTemplate = CreateTemplateService.makeTemplate(TEMPLATE_NAME);
+
+ // Assert
+ Assert.assertNotNull(envelopeTemplate);
+ Assert.assertEquals(expectedEnvelopeTemplate, envelopeTemplate);
+ }
+
+ @Test
+ public void CreateList_CorrectInputValues_List() {
+ // Arrange
+ List expectedList = new List();
+ expectedList.setDocumentId(DOCUMENT_ID);
+ expectedList.setPageNumber(PAGE_NUMBER);
+ expectedList.setXPosition("142");
+ expectedList.setYPosition("291");
+ expectedList.setFont("helvetica");
+ expectedList.setFontSize("size14");
+ expectedList.setTabLabel("list");
+ expectedList.setRequired(FALSE);
+ expectedList.setListItems(Arrays.asList(
+ CreateTemplateService.createListItem("Red"),
+ CreateTemplateService.createListItem("Orange"),
+ CreateTemplateService.createListItem("Yellow"),
+ CreateTemplateService.createListItem("Green"),
+ CreateTemplateService.createListItem("Blue"),
+ CreateTemplateService.createListItem("Indigo"),
+ CreateTemplateService.createListItem("Violet")
+ ));
+
+ // Act
+ List list = CreateTemplateService.createList();
+
+ // Assert
+ Assert.assertNotNull(list);
+ Assert.assertEquals(expectedList, list);
+ }
+
+ @Test
+ public void CreateListItem_CorrectInputValues_ListItem() {
+ // Arrange
+ String color = "blue";
+
+ ListItem expectedListItem = new ListItem();
+ expectedListItem.setText(color);
+ expectedListItem.setValue(color.toLowerCase(Locale.ENGLISH));
+
+ // Act
+ ListItem listItem = CreateTemplateService.createListItem(color);
+
+ // Assert
+ Assert.assertNotNull(listItem);
+ Assert.assertEquals(expectedListItem, listItem);
+ }
+
+ @Test
+ public void CreateRadioGroup_CorrectInputValues_RadioGroup() {
+ // Arrange
+ String white = "white";
+ String red = "red";
+ String blue = "blue";
+ String blueXPosition = "220";
+ String redXPosition = "74";
+ String whiteXPosition = "142";
+ String groupName = "radio1";
+
+ RadioGroup expectedRadioGroup = new RadioGroup();
+ expectedRadioGroup.setDocumentId(DOCUMENT_ID);
+ expectedRadioGroup.setGroupName(groupName);
+
+ expectedRadioGroup.setRadios(Arrays.asList(
+ CreateTemplateService.createRadio(white, whiteXPosition),
+ CreateTemplateService.createRadio(red, redXPosition),
+ CreateTemplateService.createRadio(blue, blueXPosition)
+ ));
+
+ // Act
+ RadioGroup radioGroup = CreateTemplateService.createRadioGroup();
+
+ // Assert
+ Assert.assertNotNull(radioGroup);
+ Assert.assertEquals(expectedRadioGroup, radioGroup);
+ }
+
+ @Test
+ public void CreateRadio_CorrectInputValues_Radio() {
+ // Arrange
+ String value = "blue";
+ String xPosition = "111";
+ String yPosition = "384";
+
+ Radio expectedRadio = new Radio();
+ expectedRadio.setPageNumber(PAGE_NUMBER);
+ expectedRadio.setValue(value);
+ expectedRadio.setXPosition(xPosition);
+ expectedRadio.setYPosition(yPosition);
+ expectedRadio.setRequired(FALSE);
+
+ // Act
+ Radio radio = CreateTemplateService.createRadio(value, xPosition);
+
+ // Assert
+ Assert.assertNotNull(radio);
+ Assert.assertEquals(expectedRadio, radio);
+ }
+
+ @Test
+ public void CreateCheckbox_CorrectInputValues_Checkbox() {
+ // Arrange
+ String label = "blue";
+ String yPosition = "111";
+ String xPosition = "111";
+
+ Checkbox expectedCheckBox = new Checkbox();
+ expectedCheckBox.setDocumentId(DOCUMENT_ID);
+ expectedCheckBox.setPageNumber(PAGE_NUMBER);
+ expectedCheckBox.setXPosition(xPosition);
+ expectedCheckBox.setYPosition(yPosition);
+ expectedCheckBox.setTabLabel(label);
+
+ // Act
+ Checkbox check = CreateTemplateService.createCheckbox(label, xPosition, yPosition);
+
+ // Assert
+ Assert.assertNotNull(check);
+ Assert.assertEquals(expectedCheckBox, check);
+ }
+
+ @Test
+ public void CreateText_CorrectInputValues_Text() {
+ // Arrange
+ String xPosition = "1";
+ String yPosition = "5";
+ String label = "blue";
+ String font = "helvetica";
+ String fontSize = "size14";
+ String height = "23";
+ String width = "84";
+
+ Text expectedText = new Text();
+ expectedText.setDocumentId(DOCUMENT_ID);
+ expectedText.setPageNumber(PAGE_NUMBER);
+ expectedText.setXPosition(xPosition);
+ expectedText.setYPosition(yPosition);
+ expectedText.setFont(font);
+ expectedText.setFontSize(fontSize);
+ expectedText.setTabLabel(label);
+ expectedText.setHeight(height);
+ expectedText.setWidth(width);
+ expectedText.setRequired(FALSE);
+
+ // Act
+ Text text = CreateTemplateService.createText(label, xPosition, yPosition);
+
+ // Assert
+ Assert.assertNotNull(text);
+ Assert.assertEquals(expectedText, text);
+ }
+
+ @Test
+ public void CreateSignHere_CorrectInputValues_SignHere() {
+ // Arrange
+ String xPosition = "191";
+ String yPosition = "148";
+
+ SignHere expectedSignHere = new SignHere();
+ expectedSignHere.setDocumentId(DOCUMENT_ID);
+ expectedSignHere.setPageNumber(PAGE_NUMBER);
+ expectedSignHere.setXPosition(xPosition);
+ expectedSignHere.setYPosition(yPosition);
+
+ // Act
+ SignHere signHere = CreateTemplateService.createSignHere();
+
+ // Assert
+ Assert.assertNotNull(signHere);
+ Assert.assertEquals(expectedSignHere, signHere);
+ }
+}
diff --git a/src/test/java/tests/eSignature/EmbeddedSigningTest.java b/src/test/java/tests/eSignature/EmbeddedSigningTest.java
new file mode 100644
index 00000000..d029cfaf
--- /dev/null
+++ b/src/test/java/tests/eSignature/EmbeddedSigningTest.java
@@ -0,0 +1,166 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.EmbeddedSigningService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.util.Collections;
+
+public final class EmbeddedSigningTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf";
+
+ private static final String DOCUMENT_NAME = "Lorem Ipsum";
+
+ private static final int ANCHOR_OFFSET_Y = 20;
+
+ private static final int ANCHOR_OFFSET_X = 10;
+
+ private static final String SIGNER_CLIENT_ID = "1000";
+
+ private static final String basePathAddition = "/restapi";
+
+ private final String RedirectUrl = "https://developers.docusign.com/platform/auth/consent";
+
+ private final ApiClient apiClient;
+
+ private final TestConfig testConfig;
+
+ public EmbeddedSigningTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ }
+
+ @Test
+ public void MakeEnvelope_CorrectInputValues_EnvelopeDefinition() throws IOException {
+ // Arrange
+ String anchorString = "/sn1/";
+ String emailSubject = "Please sign this document";
+ String docId = "3";
+ String recipientId = "1";
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition();
+
+ Signer signer = new Signer();
+ signer.setEmail(testConfig.getSignerEmail());
+ signer.setName(testConfig.getSignerName());
+ signer.clientUserId(SIGNER_CLIENT_ID);
+ signer.recipientId(recipientId);
+ signer.setTabs(EnvelopeHelpers.createSingleSignerTab(anchorString, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X));
+ Recipients recipients = new Recipients();
+ recipients.setSigners(Collections.singletonList(signer));
+
+ expectedEnvelopeDefinition.setEmailSubject(emailSubject);
+ expectedEnvelopeDefinition.setRecipients(recipients);
+ Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, docId);
+ expectedEnvelopeDefinition.setDocuments(Collections.singletonList(doc));
+ expectedEnvelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT);
+
+ // Act
+ EnvelopeDefinition envelopeDefinition = EmbeddedSigningService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ ANCHOR_OFFSET_Y,
+ ANCHOR_OFFSET_X,
+ DOCUMENT_FILE_NAME,
+ DOCUMENT_NAME);
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void MakeRecipientViewRequest_CorrectInputValues_RecipientViewRequest() {
+ //Arrange
+ RecipientViewRequest expectedViewRequest = new RecipientViewRequest();
+ String stateValue = "?state=123";
+ String authenticationMethod = "none";
+ String pingFrequency = "600";
+
+ expectedViewRequest.setReturnUrl(RedirectUrl + stateValue);
+ expectedViewRequest.setAuthenticationMethod(authenticationMethod);
+ expectedViewRequest.setEmail(testConfig.getSignerEmail());
+ expectedViewRequest.setUserName(testConfig.getSignerName());
+ expectedViewRequest.setClientUserId(SIGNER_CLIENT_ID);
+ expectedViewRequest.setPingFrequency(pingFrequency);
+ expectedViewRequest.setPingUrl(RedirectUrl);
+
+ // Act
+ RecipientViewRequest viewRequest = EmbeddedSigningService.makeRecipientViewRequest(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ RedirectUrl,
+ RedirectUrl);
+
+ // Assert
+ Assert.assertNotNull(viewRequest);
+ Assert.assertEquals(expectedViewRequest, viewRequest);
+ }
+
+ @Test
+ public void CreateEnvelope_CorrectInputValues_EnvelopeId() throws IOException, ApiException {
+ //Arrange
+ EnvelopeDefinition envelope = EmbeddedSigningService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ ANCHOR_OFFSET_Y,
+ ANCHOR_OFFSET_X,
+ DOCUMENT_FILE_NAME,
+ DOCUMENT_NAME);
+
+ // Act
+ String envelopeId = EmbeddedSigningService.createEnvelope(apiClient, testConfig.getAccountId(), envelope);
+
+ // Assert
+ Assert.assertNotNull(envelopeId);
+ }
+
+ @Test
+ public void EmbeddedSigning_CorrectInputValues_ViewUrl() throws IOException, ApiException {
+ //Arrange
+ EnvelopeDefinition envelope = EmbeddedSigningService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ ANCHOR_OFFSET_Y,
+ ANCHOR_OFFSET_X,
+ DOCUMENT_FILE_NAME,
+ DOCUMENT_NAME);
+
+ String envelopeId = EmbeddedSigningService.createEnvelope(apiClient, testConfig.getAccountId(), envelope);
+
+ RecipientViewRequest viewRequest = EmbeddedSigningService.makeRecipientViewRequest(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ SIGNER_CLIENT_ID,
+ RedirectUrl,
+ RedirectUrl);
+
+ // Act
+ ViewUrl viewUrl = EmbeddedSigningService.embeddedSigning(
+ apiClient,
+ testConfig.getAccountId(),
+ envelopeId,
+ viewRequest
+ );
+
+ // Assert
+ Assert.assertNotNull(viewUrl);
+ }
+}
diff --git a/src/test/java/tests/eSignature/PermissionCreateTest.java b/src/test/java/tests/eSignature/PermissionCreateTest.java
new file mode 100644
index 00000000..fcea85aa
--- /dev/null
+++ b/src/test/java/tests/eSignature/PermissionCreateTest.java
@@ -0,0 +1,57 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.services.PermissionCreateService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.AccountsApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.PermissionProfile;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.Random;
+
+public final class PermissionCreateTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final AccountsApi accountsApi;
+
+ private final TestConfig testConfig;
+
+ public PermissionCreateTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.accountsApi = new AccountsApi(apiClient);
+ }
+
+ @Test
+ public void CreateNewProfile_CorrectInputValues_ReturnsPermissionProfile() throws ApiException {
+ // Arrange
+ byte[] byteArray = new byte[8];
+ new Random().nextBytes(byteArray);
+ var permissionName = new String(byteArray, StandardCharsets.UTF_8);
+
+ // Act
+ PermissionProfile permissionProfile = PermissionCreateService.createNewProfile(
+ this.accountsApi,
+ testConfig.getAccountId(),
+ permissionName);
+
+ // Assert
+ Assert.assertNotNull(permissionProfile);
+ Assert.assertEquals(permissionName, permissionProfile.getPermissionProfileName());
+ }
+}
diff --git a/src/test/java/tests/eSignature/SetTabValuesTest.java b/src/test/java/tests/eSignature/SetTabValuesTest.java
new file mode 100644
index 00000000..498b06e8
--- /dev/null
+++ b/src/test/java/tests/eSignature/SetTabValuesTest.java
@@ -0,0 +1,256 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.SetTabValuesService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.EnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public final class SetTabValuesTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx";
+
+ private static final String DOCUMENT_NAME = "Lorem Ipsum";
+
+ private static final String SIGNER_CLIENT_ID = "1000";
+
+ private static final String basePathAddition = "/restapi";
+
+ private final String RedirectUrl = "https://developers.docusign.com/platform/auth/consent";
+
+ private final ApiClient apiClient;
+
+ private final EnvelopesApi envelopesApi;
+
+ private final TestConfig testConfig;
+
+ public SetTabValuesTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.envelopesApi = new EnvelopesApi(apiClient);
+ }
+
+ @Test
+ public void MakeEnvelopeWithTabValues_CorrectInputValues_EnvelopeDefinition() throws IOException {
+ // Arrange
+ String emailSubject = "Please sign this document from the Java SDK";
+ String initialId = "1";
+ Integer salary = 123000;
+ String salaryString = "salary";
+ String fontSize = "size11";
+ String font = "helvetica";
+ String trueString = "true";
+ String falseString = "false";
+
+ Signer signer = new Signer();
+ signer.setEmail(testConfig.getSignerEmail());
+ signer.setName(testConfig.getSignerName());
+ signer.clientUserId(SIGNER_CLIENT_ID);
+ signer.recipientId(initialId);
+
+ SignHere signHere = new SignHere();
+ signHere.setAnchorString("/sn1");
+ signHere.setAnchorUnits("pixels");
+ signHere.setAnchorYOffset("10");
+ signHere.setAnchorXOffset("20");
+
+ Text textLegal = new Text();
+ textLegal.setAnchorString("/legal/");
+ textLegal.setAnchorUnits("pixels");
+ textLegal.setAnchorYOffset("-9");
+ textLegal.setAnchorXOffset("5");
+ textLegal.setFont(font);
+ textLegal.setFontSize(fontSize);
+ textLegal.setBold(trueString);
+ textLegal.setValue(testConfig.getSignerName());
+ textLegal.setLocked(falseString);
+ textLegal.setTabId("legal_name");
+ textLegal.setTabLabel("Legal Name");
+
+ Text textFamiliar = new Text();
+ textFamiliar.setAnchorString("/familiar/");
+ textFamiliar.setAnchorUnits("pixels");
+ textFamiliar.setAnchorYOffset("-9");
+ textFamiliar.setAnchorXOffset("5");
+ textFamiliar.setFont(font);
+ textFamiliar.setFontSize(fontSize);
+ textFamiliar.setBold(trueString);
+ textFamiliar.setValue(testConfig.getSignerName());
+ textFamiliar.setLocked(falseString);
+ textFamiliar.setTabId("familiar_name");
+ textFamiliar.setTabLabel("Familiar Name");
+
+ Numerical numericalSalary = new Numerical();
+ numericalSalary.setValidationType("Currency");
+ numericalSalary.setPageNumber(initialId);
+ numericalSalary.setDocumentId(initialId);
+ numericalSalary.setXPosition("210");
+ numericalSalary.setYPosition("235");
+ numericalSalary.setHeight("20");
+ numericalSalary.setWidth("70");
+ numericalSalary.setFont(font);
+ numericalSalary.setFontSize(fontSize);
+ numericalSalary.setBold(trueString);
+ numericalSalary.setNumericalValue(String.format("%d", salary));
+ numericalSalary.setTabId(salaryString);
+ numericalSalary.setTabLabel(salaryString);
+
+ LocalePolicyTab localePolicyTab = new LocalePolicyTab();
+ localePolicyTab.setCultureName("en-US");
+ localePolicyTab.setCurrencyCode("usd");
+ localePolicyTab.setCurrencyPositiveFormat("csym_1_comma_234_comma_567_period_89");
+ localePolicyTab.setCurrencyNegativeFormat("minus_csym_1_comma_234_comma_567_period_89");
+ localePolicyTab.setUseLongCurrencyFormat(trueString);
+ numericalSalary.setLocalePolicy(localePolicyTab);
+
+ TextCustomField salaryCustomField = new TextCustomField();
+ salaryCustomField.setName(salaryString);
+ salaryCustomField.setRequired(falseString);
+ salaryCustomField.setShow(trueString);
+ salaryCustomField.setValue(String.valueOf(salary));
+ CustomFields cf = new CustomFields();
+ cf.setTextCustomFields(Collections.singletonList(salaryCustomField));
+
+ Tabs tabs = new Tabs();
+ tabs.setSignHereTabs(Collections.singletonList(signHere));
+ tabs.setTextTabs(Arrays.asList(textLegal, textFamiliar));
+ tabs.setNumericalTabs(List.of(numericalSalary));
+
+ signer.setTabs(tabs);
+ Recipients recipients = new Recipients();
+ recipients.setSigners(Collections.singletonList(signer));
+
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition();
+ expectedEnvelopeDefinition.setEmailSubject(emailSubject);
+ expectedEnvelopeDefinition.setRecipients(recipients);
+ Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, initialId);
+ expectedEnvelopeDefinition.setDocuments(Collections.singletonList(doc));
+ expectedEnvelopeDefinition.setCustomFields(cf);
+ expectedEnvelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT);
+
+ // Act
+ EnvelopeDefinition envelopeDefinition = SetTabValuesService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName());
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void SetEmailAndSignerNameForRecipientViewRequest_CorrectInputValues_RecipientViewRequest() {
+ //Arrange
+ RecipientViewRequest expectedViewRequest = new RecipientViewRequest();
+ String authenticationMethod = "none";
+ String pingFrequency = "600";
+ expectedViewRequest.setAuthenticationMethod(authenticationMethod);
+ expectedViewRequest.setEmail(testConfig.getSignerEmail());
+ expectedViewRequest.setUserName(testConfig.getSignerName());
+ expectedViewRequest.setClientUserId(SIGNER_CLIENT_ID);
+ expectedViewRequest.setPingFrequency(pingFrequency);
+ expectedViewRequest.setPingUrl(RedirectUrl);
+
+ // Act
+ RecipientViewRequest viewRequest = SetTabValuesService.setEmailAndSignerNameForRecipientViewRequest(
+ new RecipientViewRequest(),
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ RedirectUrl);
+
+ // Assert
+ Assert.assertNotNull(viewRequest);
+ Assert.assertEquals(expectedViewRequest, viewRequest);
+ }
+
+ @Test
+ public void MakeRecipientViewRequest_CorrectInputValues_RecipientViewRequest() {
+ //Arrange
+ RecipientViewRequest expectedViewRequest = new RecipientViewRequest();
+ String state = "?state=123";
+ String pingFrequency = "600";
+ String authenticationMethod = "none";
+
+ expectedViewRequest.setReturnUrl(RedirectUrl + state);
+ expectedViewRequest.setAuthenticationMethod(authenticationMethod);
+ expectedViewRequest.setEmail(testConfig.getSignerEmail());
+ expectedViewRequest.setUserName(testConfig.getSignerName());
+ expectedViewRequest.setClientUserId(SIGNER_CLIENT_ID);
+ expectedViewRequest.setPingFrequency(pingFrequency);
+ expectedViewRequest.setPingUrl(RedirectUrl);
+
+ // Act
+ RecipientViewRequest viewRequest = SetTabValuesService.makeRecipientViewRequest(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ RedirectUrl,
+ RedirectUrl);
+
+ // Assert
+ Assert.assertNotNull(viewRequest);
+ Assert.assertEquals(expectedViewRequest, viewRequest);
+ }
+
+ @Test
+ public void CreateEnvelope_CorrectInputValues_EnvelopeSummary() throws IOException, ApiException {
+ //Arrange
+ EnvelopeDefinition envelope = SetTabValuesService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName());
+
+ // Act
+ EnvelopeSummary envelopeSummary = SetTabValuesService.createEnvelope(
+ envelopesApi,
+ testConfig.getAccountId(),
+ envelope);
+
+ // Assert
+ Assert.assertNotNull(envelopeSummary);
+ Assert.assertNotNull(envelopeSummary.getEnvelopeId());
+ }
+
+ @Test
+ public void CreateRecipientView_CorrectInputValues_ViewUrl() throws IOException, ApiException {
+ //Arrange
+ EnvelopeDefinition envelope = SetTabValuesService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName());
+
+ EnvelopeSummary envelopeSummary = SetTabValuesService.createEnvelope(
+ envelopesApi,
+ testConfig.getAccountId(),
+ envelope);
+
+ RecipientViewRequest viewRequest = SetTabValuesService.makeRecipientViewRequest(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ RedirectUrl,
+ RedirectUrl);
+
+ // Act
+ ViewUrl viewUrl = SetTabValuesService.createRecipientView(
+ envelopesApi,
+ testConfig.getAccountId(),
+ envelopeSummary.getEnvelopeId(),
+ viewRequest);
+
+ // Assert
+ Assert.assertNotNull(viewUrl);
+ }
+}
diff --git a/src/test/java/tests/eSignature/SigningViaEmailTest.java b/src/test/java/tests/eSignature/SigningViaEmailTest.java
new file mode 100644
index 00000000..4451a34a
--- /dev/null
+++ b/src/test/java/tests/eSignature/SigningViaEmailTest.java
@@ -0,0 +1,147 @@
+package tests.eSignature;
+
+import com.docusign.common.WorkArguments;
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.SigningViaEmailService;
+import com.docusign.core.common.DocumentType;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.EnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.*;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+
+public final class SigningViaEmailTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl";
+
+ private static final String HTML_DOCUMENT_NAME = "Order acknowledgement";
+
+ private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf";
+
+ private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum";
+
+ private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx";
+
+ private static final String DOCX_DOCUMENT_NAME = "Battle Plan";
+
+ private static final int ANCHOR_OFFSET_Y = 10;
+
+ private static final int ANCHOR_OFFSET_X = 20;
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final EnvelopesApi envelopesApi;
+
+ private final TestConfig testConfig;
+
+ public SigningViaEmailTest() throws IOException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.envelopesApi = new EnvelopesApi(apiClient);
+ }
+
+ @Test
+ public void MakeEnvelopeWithCC_CorrectInputValues_EnvelopeDefinition() throws IOException {
+ // Arrange
+ String ccEmail = "cc@gmail.com";
+ String ccName = "cc";
+ String anchorStringOne = "**signature_1**";
+ String anchorStringTwo = "/sn1/";
+ String emailSubject = "Please sign this document set";
+ String defaultIdOne = "1";
+ String defaultIdTwo = "2";
+ String defaultIdThree = "3";
+ WorkArguments args = new WorkArguments();
+ args.setSignerEmail(testConfig.getSignerEmail());
+ args.setSignerName(testConfig.getSignerName());
+ args.setCcEmail(ccEmail);
+ args.setCcName(ccName);
+
+ Tabs signerTabs = EnvelopeHelpers.createSignerTabs(
+ EnvelopeHelpers.createSignHere(anchorStringOne, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X),
+ EnvelopeHelpers.createSignHere(anchorStringTwo, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X));
+ Signer signer = new Signer();
+ signer.setEmail(testConfig.getSignerEmail());
+ signer.setName(testConfig.getSignerName());
+ signer.setRecipientId(defaultIdOne);
+ signer.setRoutingOrder(defaultIdOne);
+ signer.setTabs(signerTabs);
+
+ CarbonCopy cc = new CarbonCopy();
+ cc.setEmail(ccEmail);
+ cc.setName(ccName);
+ cc.setRecipientId(defaultIdTwo);
+ cc.setRoutingOrder(defaultIdTwo);
+
+ byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)
+ .getBytes(StandardCharsets.UTF_8);
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition();
+ expectedEnvelopeDefinition.setEmailSubject(emailSubject);
+ expectedEnvelopeDefinition.setDocuments(Arrays.asList(
+ EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME,
+ DocumentType.HTML.getDefaultFileExtention(), defaultIdOne),
+ EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, defaultIdTwo),
+ EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, defaultIdThree)));
+ expectedEnvelopeDefinition.setRecipients(EnvelopeHelpers.createRecipients(signer, cc));
+ expectedEnvelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT);
+
+ // Act
+ EnvelopeDefinition envelopeDefinition = SigningViaEmailService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ ccEmail,
+ ccName,
+ EnvelopeHelpers.ENVELOPE_STATUS_SENT,
+ args
+ );
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void SigningViaEmail_CorrectInputValues_EnvelopeSummary() throws IOException, ApiException {
+ //Arrange
+ String ccEmail = "cc@gmail.com";
+ String ccName = "cc";
+ WorkArguments args = new WorkArguments();
+ args.setSignerEmail(testConfig.getSignerEmail());
+ args.setSignerName(testConfig.getSignerName());
+ args.setCcEmail(ccEmail);
+ args.setCcName(ccName);
+
+ EnvelopeDefinition envelope = SigningViaEmailService.makeEnvelope(
+ testConfig.getSignerEmail(),
+ testConfig.getSignerName(),
+ ccEmail,
+ ccName,
+ EnvelopeHelpers.ENVELOPE_STATUS_SENT,
+ args
+ );
+
+ // Act
+ EnvelopeSummary envelopeSummary = SigningViaEmailService.signingViaEmail(
+ envelopesApi,
+ testConfig.getAccountId(),
+ envelope);
+
+ // Assert
+ Assert.assertNotNull(envelopeSummary);
+ }
+}
diff --git a/src/test/java/tests/eSignature/UseTemplateTest.java b/src/test/java/tests/eSignature/UseTemplateTest.java
new file mode 100644
index 00000000..49cb4cdf
--- /dev/null
+++ b/src/test/java/tests/eSignature/UseTemplateTest.java
@@ -0,0 +1,112 @@
+package tests.eSignature;
+
+import com.docusign.controller.eSignature.examples.EnvelopeHelpers;
+import com.docusign.controller.eSignature.services.UseTemplateService;
+import com.docusign.core.model.ApiType;
+import com.docusign.esign.api.EnvelopesApi;
+import com.docusign.esign.client.ApiClient;
+import com.docusign.esign.client.ApiException;
+import com.docusign.esign.model.EnvelopeDefinition;
+import com.docusign.esign.model.EnvelopeSummary;
+import com.docusign.esign.model.EnvelopeTemplateResults;
+import com.docusign.esign.model.TemplateRole;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import tests.common.JWTLoginMethodTest;
+import tests.common.TestConfig;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+public final class UseTemplateTest {
+ private static final String BEARER_AUTHENTICATION = "Bearer ";
+
+ private static final String basePathAddition = "/restapi";
+
+ private final ApiClient apiClient;
+
+ private final EnvelopesApi envelopesApi;
+
+ private final TestConfig testConfig;
+
+ public UseTemplateTest() throws IOException, ApiException {
+ JWTLoginMethodTest.RequestJWTUserToken_CorrectInputValues_ReturnOAuthToken(ApiType.ESIGNATURE);
+ this.testConfig = TestConfig.getInstance();
+
+ this.apiClient = new ApiClient(testConfig.getBasePath() + basePathAddition);
+ apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + testConfig.getAccessToken());
+ this.envelopesApi = new EnvelopesApi(apiClient);
+
+ CreateNewTemplateTest createNewTemplateTest = new CreateNewTemplateTest();
+ createNewTemplateTest.CreateTemplate_CorrectInputValues_TemplateSummary();
+ }
+
+ @Test
+ public void ListTemplates_CorrectInputValues_EnvelopeTemplateResults() throws ApiException {
+ // Act
+ EnvelopeTemplateResults templates = UseTemplateService.listTemplates(apiClient, testConfig.getAccountId());
+
+ // Assert
+ Assert.assertNotNull(templates);
+ }
+
+ @Test
+ public void MakeEnvelopeFromTemplate_CorrectInputValues_EnvelopeDefinition() {
+ // Arrange
+ String ccEmail = "cc@gmail.com";
+ String ccName = "cc";
+ TemplateRole signer = new TemplateRole();
+ signer.setEmail(testConfig.getSignerEmail());
+ signer.setName(testConfig.getSignerName());
+ signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME);
+
+ TemplateRole cc = new TemplateRole();
+ cc.setEmail(ccEmail);
+ cc.setName(ccName);
+ cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME);
+
+ EnvelopeDefinition expectedEnvelopeDefinition = new EnvelopeDefinition();
+ expectedEnvelopeDefinition.setTemplateId(testConfig.getTemplateId());
+ expectedEnvelopeDefinition.setTemplateRoles(Arrays.asList(signer, cc));
+ expectedEnvelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT);
+
+ // Act
+ EnvelopeDefinition envelopeDefinition = UseTemplateService.makeEnvelope(
+ testConfig.getSignerName(),
+ testConfig.getSignerEmail(),
+ ccEmail,
+ ccName,
+ testConfig.getTemplateId()
+ );
+
+ // Assert
+ Assert.assertNotNull(envelopeDefinition);
+ Assert.assertEquals(expectedEnvelopeDefinition, envelopeDefinition);
+ }
+
+ @Test
+ public void CreateEnvelopeTemplate_CorrectInputValues_EnvelopeSummary() throws ApiException {
+ // Arrange
+ String ccEmail = "cc@gmail.com";
+ String ccName = "cc";
+
+ EnvelopeDefinition envelopeDefinition = UseTemplateService.makeEnvelope(
+ testConfig.getSignerName(),
+ testConfig.getSignerEmail(),
+ ccEmail,
+ ccName,
+ testConfig.getTemplateId()
+ );
+
+ // Act
+ EnvelopeSummary envelopeSummary = UseTemplateService.createEnvelopeTemplate(
+ envelopesApi,
+ testConfig.getAccountId(),
+ envelopeDefinition);
+
+ // Assert
+ Assert.assertNotNull(envelopeSummary);
+ Assert.assertNotNull(envelopeSummary.getEnvelopeId());
+ }
+}