1
1
import base64
2
2
from os import path
3
3
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
6
7
from flask import url_for , session , request
7
8
8
9
from ...consts import pattern , demo_docs_path
@@ -36,6 +37,7 @@ def get_args():
36
37
"access_token" : session ["ds_access_token" ],
37
38
"envelope_args" : envelope_args ,
38
39
"ds_return_url" : url_for ("ds.ds_return" , _external = True ),
40
+ "starting_view" : starting_view ,
39
41
}
40
42
return args
41
43
@@ -58,23 +60,55 @@ def worker(cls, args, doc_docx_path, doc_pdf_path):
58
60
@classmethod
59
61
#ds-snippet-start:eSign11Step3
60
62
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 )
62
64
# Exceptions will be caught by the calling function
63
65
api_client = create_api_client (base_path = args ["base_path" ], access_token = args ["access_token" ])
64
66
65
67
envelope_api = EnvelopesApi (api_client )
66
68
sender_view = envelope_api .create_sender_view (
67
69
account_id = args ["account_id" ],
68
70
envelope_id = envelope_id ,
69
- return_url_request = view_request
71
+ envelope_view_request = view_request
70
72
)
71
73
72
74
# Switch to Recipient and Documents view if requested by the user
73
75
url = sender_view .url
74
- if args ["starting_view" ] == "recipient" :
75
- url = url .replace ("send=1" , "send=0" )
76
76
77
77
return url
78
+
79
+ @classmethod
80
+ def make_envelope_view_request (cls , args ):
81
+ view_request = EnvelopeViewRequest (
82
+ return_url = args ["ds_return_url" ],
83
+ view_access = "envelope" ,
84
+ settings = EnvelopeViewSettings (
85
+ starting_screen = args ["starting_view" ],
86
+ send_button_action = "send" ,
87
+ show_back_button = "false" ,
88
+ back_button_action = "previousPage" ,
89
+ show_header_actions = "false" ,
90
+ show_discard_action = "false" ,
91
+ lock_token = "" ,
92
+ recipient_settings = EnvelopeViewRecipientSettings (
93
+ show_edit_recipients = "false" ,
94
+ show_contacts_list = "false"
95
+ ),
96
+ document_settings = EnvelopeViewDocumentSettings (
97
+ show_edit_documents = "false" ,
98
+ show_edit_document_visibility = "false" ,
99
+ show_edit_pages = "false"
100
+ ),
101
+ tagger_settings = EnvelopeViewTaggerSettings (
102
+ palette_sections = "default" ,
103
+ palette_default = "custom"
104
+ ),
105
+ template_settings = EnvelopeViewTemplateSettings (
106
+ show_matching_templates_prompt = "true"
107
+ )
108
+ )
109
+ )
110
+
111
+ return view_request
78
112
#ds-snippet-end:eSign11Step3
79
113
80
114
@classmethod
0 commit comments