Skip to content

Commit c3a2bc8

Browse files
update embedded sending
1 parent 3d43624 commit c3a2bc8

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

app/eSignature/examples/eg011_embedded_sending.py

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import base64
22
from os import path
33

4-
from docusign_esign import EnvelopesApi, ReturnUrlRequest, EnvelopesApi, EnvelopeDefinition, \
5-
Document, Signer, CarbonCopy, SignHere, Tabs, Recipients
4+
from docusign_esign import EnvelopesApi, EnvelopesApi, EnvelopeDefinition, \
5+
Document, Signer, CarbonCopy, SignHere, Tabs, Recipients, EnvelopeViewRequest, EnvelopeViewSettings, \
6+
EnvelopeViewRecipientSettings, EnvelopeViewDocumentSettings, EnvelopeViewTaggerSettings, EnvelopeViewTemplateSettings
67
from flask import url_for, session, request
78

89
from ...consts import pattern, demo_docs_path
@@ -36,6 +37,7 @@ def get_args():
3637
"access_token": session["ds_access_token"],
3738
"envelope_args": envelope_args,
3839
"ds_return_url": url_for("ds.ds_return", _external=True),
40+
"starting_view": starting_view,
3941
}
4042
return args
4143

@@ -58,21 +60,19 @@ def worker(cls, args, doc_docx_path, doc_pdf_path):
5860
@classmethod
5961
#ds-snippet-start:eSign11Step3
6062
def create_sender_view(cls, args, envelope_id):
61-
view_request = ReturnUrlRequest(return_url=args["ds_return_url"])
63+
view_request = cls.make_envelope_view_request(args)
6264
# Exceptions will be caught by the calling function
6365
api_client = create_api_client(base_path=args["base_path"], access_token=args["access_token"])
6466

6567
envelope_api = EnvelopesApi(api_client)
6668
sender_view = envelope_api.create_sender_view(
6769
account_id=args["account_id"],
6870
envelope_id=envelope_id,
69-
return_url_request=view_request
71+
envelope_view_request=view_request
7072
)
7173

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

7777
return url
7878
#ds-snippet-end:eSign11Step3
@@ -199,6 +199,40 @@ def make_envelope(cls, args, doc_docx_path, doc_pdf_path):
199199
env.status = args["status"]
200200

201201
return env
202+
203+
@classmethod
204+
def make_envelope_view_request(cls, args):
205+
view_request = EnvelopeViewRequest(
206+
return_url=args["ds_return_url"],
207+
view_access="envelope",
208+
settings=EnvelopeViewSettings(
209+
starting_screen=args["starting_view"],
210+
send_button_action="send",
211+
show_back_button="false",
212+
back_button_action="previousPage",
213+
show_header_actions="false",
214+
show_discard_action="false",
215+
lock_token="",
216+
recipient_settings=EnvelopeViewRecipientSettings(
217+
show_edit_recipients="false",
218+
show_contacts_list="false"
219+
),
220+
document_settings=EnvelopeViewDocumentSettings(
221+
show_edit_documents="false",
222+
show_edit_document_visibility="false",
223+
show_edit_pages="false"
224+
),
225+
tagger_settings=EnvelopeViewTaggerSettings(
226+
palette_sections="default",
227+
palette_default="custom"
228+
),
229+
template_settings=EnvelopeViewTemplateSettings(
230+
show_matching_templates_prompt="true"
231+
)
232+
)
233+
)
234+
235+
return view_request
202236

203237
@classmethod
204238
def create_document1(cls, args):

app/templates/eSignature/eg011_embedded_sending.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<div class="form-group">
1818
<label for="starting_view">{{ example['Forms'][recipient_form_index]['Inputs'][starting_view_index]['InputName'] }}</label>
1919
<select id="starting_view" name="starting_view" class="form-control">
20-
<option value="tagging" selected>Tagging view</option>
21-
<option value="recipient">Recipient &amp; Documents view</option>
20+
<option value="Tagger" selected>Tagging view</option>
21+
<option value="Prepare">Prepare view</option>
2222
</select>
2323
</div>
2424
<div class="form-group">

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cffi==1.15.1
44
chardet==5.1.0
55
Click
66
cryptography==39.0.0
7-
docusign-esign==3.26.0rc1
7+
docusign-esign==4.0.0rc1
88
docusign-rooms==1.3.0
99
docusign-monitor==1.2.0
1010
docusign-click==1.4.0

0 commit comments

Comments
 (0)