Skip to content

Commit

Permalink
Merge pull request #150 from docusign/feature/embedded-sending-update
Browse files Browse the repository at this point in the history
Embedded sending example updates
  • Loading branch information
raileendr authored May 20, 2024
2 parents 3d43624 + d2980ee commit 68539a0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
46 changes: 40 additions & 6 deletions app/eSignature/examples/eg011_embedded_sending.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import base64
from os import path

from docusign_esign import EnvelopesApi, ReturnUrlRequest, EnvelopesApi, EnvelopeDefinition, \
Document, Signer, CarbonCopy, SignHere, Tabs, Recipients
from docusign_esign import EnvelopesApi, EnvelopesApi, EnvelopeDefinition, \
Document, Signer, CarbonCopy, SignHere, Tabs, Recipients, EnvelopeViewRequest, EnvelopeViewSettings, \
EnvelopeViewRecipientSettings, EnvelopeViewDocumentSettings, EnvelopeViewTaggerSettings, EnvelopeViewTemplateSettings
from flask import url_for, session, request

from ...consts import pattern, demo_docs_path
Expand Down Expand Up @@ -36,6 +37,7 @@ def get_args():
"access_token": session["ds_access_token"],
"envelope_args": envelope_args,
"ds_return_url": url_for("ds.ds_return", _external=True),
"starting_view": starting_view,
}
return args

Expand All @@ -58,23 +60,55 @@ def worker(cls, args, doc_docx_path, doc_pdf_path):
@classmethod
#ds-snippet-start:eSign11Step3
def create_sender_view(cls, args, envelope_id):
view_request = ReturnUrlRequest(return_url=args["ds_return_url"])
view_request = cls.make_envelope_view_request(args)
# Exceptions will be caught by the calling function
api_client = create_api_client(base_path=args["base_path"], access_token=args["access_token"])

envelope_api = EnvelopesApi(api_client)
sender_view = envelope_api.create_sender_view(
account_id=args["account_id"],
envelope_id=envelope_id,
return_url_request=view_request
envelope_view_request=view_request
)

# Switch to Recipient and Documents view if requested by the user
url = sender_view.url
if args["starting_view"] == "recipient":
url = url.replace("send=1", "send=0")

return url

@classmethod
def make_envelope_view_request(cls, args):
view_request = EnvelopeViewRequest(
return_url=args["ds_return_url"],
view_access="envelope",
settings=EnvelopeViewSettings(
starting_screen=args["starting_view"],
send_button_action="send",
show_back_button="false",
back_button_action="previousPage",
show_header_actions="false",
show_discard_action="false",
lock_token="",
recipient_settings=EnvelopeViewRecipientSettings(
show_edit_recipients="false",
show_contacts_list="false"
),
document_settings=EnvelopeViewDocumentSettings(
show_edit_documents="false",
show_edit_document_visibility="false",
show_edit_pages="false"
),
tagger_settings=EnvelopeViewTaggerSettings(
palette_sections="default",
palette_default="custom"
),
template_settings=EnvelopeViewTemplateSettings(
show_matching_templates_prompt="true"
)
)
)

return view_request
#ds-snippet-end:eSign11Step3

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions app/templates/eSignature/eg011_embedded_sending.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<div class="form-group">
<label for="starting_view">{{ example['Forms'][recipient_form_index]['Inputs'][starting_view_index]['InputName'] }}</label>
<select id="starting_view" name="starting_view" class="form-control">
<option value="tagging" selected>Tagging view</option>
<option value="recipient">Recipient &amp; Documents view</option>
<option value="Tagger" selected>Tagging view</option>
<option value="Prepare">Prepare view</option>
</select>
</div>
<div class="form-group">
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cffi==1.15.1
chardet==5.1.0
Click
cryptography==39.0.0
docusign-esign==3.26.0rc1
docusign-esign==4.0.0rc1
docusign-rooms==1.3.0
docusign-monitor==1.2.0
docusign-click==1.4.0
Expand Down

0 comments on commit 68539a0

Please sign in to comment.