22from os import path
33
44from docusign_esign import EnvelopesApi , RecipientViewRequest , Document , Signer , EnvelopeDefinition , SignHere , Tabs , \
5- Recipients
5+ Recipients , InPersonSigner
66from flask import session , url_for , request
77
88from ...consts import authentication_method , demo_docs_path , pattern , signer_client_id
@@ -17,14 +17,11 @@ def get_args():
1717 # More data validation would be a good idea here
1818 # Strip anything other than characters listed
1919 # 1. Parse request arguments
20- #response = DSClient.get_user(session["ds_access_token"])
21- #print(response)
22- host_name = "host_name"
23- signer_name = "signer_name"
20+ signer_name = pattern .sub ("" , request .form .get ("signer_name" ))
2421 envelope_args = {
25- "host_email" : "raileendr@gmail.com" ,
26- "host_name" : "Raileen" ,
27- "signer_name" : "Fred" ,
22+ "host_email" : session [ "ds_user_email" ] ,
23+ "host_name" : session [ "ds_user_name" ] ,
24+ "signer_name" : signer_name ,
2825 "ds_return_url" : url_for ("ds.ds_return" , _external = True ),
2926 }
3027 args = {
@@ -59,13 +56,12 @@ def worker(cls, args):
5956 # 3. Create the Recipient View request object
6057 recipient_view_request = RecipientViewRequest (
6158 authentication_method = authentication_method ,
62- client_user_id = envelope_args ["signer_client_id" ],
6359 recipient_id = "1" ,
6460 return_url = envelope_args ["ds_return_url" ],
6561 user_name = envelope_args ["host_name" ],
6662 email = envelope_args ["host_email" ]
6763 )
68- # 4. Obtain the recipient_view_url for the embedded signing
64+ # 4. Obtain the recipient_view_url for the embedded signing session
6965 # Exceptions will be caught by the calling function
7066 results = envelope_api .create_recipient_view (
7167 account_id = args ["account_id" ],
@@ -100,17 +96,15 @@ def make_envelope(cls, args):
10096 document_id = 1 # a label used to reference the doc
10197 )
10298
103- # Create the signer recipient model
104- signer = Signer (
99+ # Create the in person signer recipient model
100+ signer = InPersonSigner (
105101 # The signer
106102 host_name = args ["host_name" ],
107103 host_email = args ["host_email" ],
108104 signer_name = args ["signer_name" ],
109105 recipient_id = "1" ,
110106 routing_order = "1" ,
111-
112- # Setting the client_user_id marks the signer as embedded
113- #client_user_id=args["signer_client_id"]
107+
114108 )
115109
116110 # Create a sign_here tab (field on the document)
@@ -124,14 +118,14 @@ def make_envelope(cls, args):
124118
125119 # Add the tabs model (including the sign_here tab) to the signer
126120 # The Tabs object wants arrays of the different field/tab types
127- signer .tabs = Tabs (sign_here_tabs = [sign_here ])
121+ InPersonSigner .tabs = Tabs (sign_here_tabs = [sign_here ])
128122
129123 # Next, create the top level envelope definition and populate it.
130124 envelope_definition = EnvelopeDefinition (
131125 email_subject = "Please host this in-person signing session" ,
132126 documents = [document ],
133127 # The Recipients object wants arrays for each recipient type
134- recipients = Recipients (signers = [signer ]),
128+ recipients = Recipients (in_person_signers = [signer ]),
135129 status = "sent" # requests that the envelope be created and sent.
136130 )
137131
0 commit comments