def create_recipient_view_for_hpa( user: JustfixUser, envelope_id: str, api_client: dse.ApiClient, return_url: str, ) -> str: envelope_api = dse.EnvelopesApi(api_client) recipient_view_request = dse.RecipientViewRequest( authentication_method="None", client_user_id=docusign_client_user_id(user), recipient_id=TENANT_RECIPIENT_ID, return_url=return_url, user_name=user.full_legal_name, email=user.email, ) results = envelope_api.create_recipient_view( settings.DOCUSIGN_ACCOUNT_ID, envelope_id, recipient_view_request=recipient_view_request, ) return results.url
def testEmbeddedSigning(self): with open(SignTest1File, 'rb') as sign_file: file_contents = sign_file.read() # create an envelope to be signed envelope_definition = docusign.EnvelopeDefinition() envelope_definition.email_subject = 'Please Sign my Python SDK Envelope' envelope_definition.email_blurb = 'Hello, Please sign my Python SDK Envelope.' # add a document to the envelope doc = docusign.Document() base64_doc = base64.b64encode(file_contents).decode("utf-8") doc.document_base64 = base64_doc doc.name = 'TestFile.pdf' doc.document_id = '1' envelope_definition.documents = [doc] # Add a recipient to sign the document signer = docusign.Signer() signer.email = Username signer.name = 'Pat Developer' signer.recipient_id = '1' # this value represents the client's unique identifier for the signer client_user_id = '2939' signer.client_user_id = client_user_id # Create a SignHere tab somewhere on the document for the signer to sign sign_here = docusign.SignHere() sign_here.document_id = '1' sign_here.page_number = '1' sign_here.recipient_id = '1' sign_here.x_position = '100' sign_here.y_position = '100' sign_here.scale_value = '0.5' tabs = docusign.Tabs() tabs.sign_here_tabs = [sign_here] signer.tabs = tabs recipients = docusign.Recipients() recipients.signers = [signer] envelope_definition.recipients = recipients envelope_definition.status = 'sent' envelopes_api = EnvelopesApi() try: return_url = 'http://www.docusign.com/developer-center' recipient_view_request = docusign.RecipientViewRequest() recipient_view_request.return_url = return_url recipient_view_request.client_user_id = client_user_id recipient_view_request.authentication_method = 'email' recipient_view_request.user_name = 'Pat Developer' recipient_view_request.email = Username envelope_summary = envelopes_api.create_envelope( self.user_info.accounts[0].account_id, envelope_definition=envelope_definition) envelope_id = envelope_summary.envelope_id view_url = envelopes_api.create_recipient_view( self.user_info.accounts[0].account_id, envelope_id, recipient_view_request=recipient_view_request) assert view_url is not None assert view_url.url is not None # This Url should work in an Iframe or browser to allow signing print("ViewUrl is ", end="") pprint(view_url) except ApiException as e: print("\nException when calling DocuSign API: %s" % e) assert e is None # make the test case fail in case of an API exception
def testEmbeddedSigning(self): with open(SignTest1File, 'rb') as sign_file: file_contents = sign_file.read() # Set properties and create an envelope later on email_subject = 'Please Sign my Python SDK Envelope' email_blurb = 'Hello, Please sign my Python SDK Envelope.' # add a document to the envelope base64_doc = base64.b64encode(file_contents).decode("utf-8") name = 'TestFile.pdf' document_id = '1' doc = docusign.Document(document_base64=base64_doc, name=name, document_id=document_id) documents = [doc] # Add a recipient to sign the document email = Username name = 'Pat Developer' recipient_id_for_doc = '1' # this value represents the client's unique identifier for the signer client_user_id = '2939' # Create a SignHere tab somewhere on the document for the signer to sign document_id = '1' page_number = '1' recipient_id = '1' x_position = '100' y_position = '100' scale_value = '0.5' # create sign here object with the properties sign_here = docusign.SignHere(document_id=document_id, page_number=page_number, recipient_id=recipient_id, x_position=x_position, y_position=y_position, scale_value=scale_value) sign_here_tabs = [sign_here] tabs = docusign.Tabs(sign_here_tabs=sign_here_tabs) signer = docusign.Signer(email=email, name=name, recipient_id=recipient_id_for_doc, client_user_id=client_user_id, tabs=tabs) signers = [signer] recipients = docusign.Recipients(signers=signers) status = 'sent' # create the envelope definition with the properties set envelope_definition = docusign.EnvelopeDefinition( email_subject=email_subject, email_blurb=email_blurb, documents=documents, recipients=recipients, status=status) envelopes_api = EnvelopesApi() try: return_url = 'http://www.docusign.com/developer-center' recipient_view_request = docusign.RecipientViewRequest() recipient_view_request.return_url = return_url recipient_view_request.client_user_id = client_user_id recipient_view_request.authentication_method = 'email' recipient_view_request.user_name = 'Pat Developer' recipient_view_request.email = Username envelope_summary = envelopes_api.create_envelope( self.user_info.accounts[0].account_id, envelope_definition=envelope_definition) envelope_id = envelope_summary.envelope_id view_url = envelopes_api.create_recipient_view( self.user_info.accounts[0].account_id, envelope_id, recipient_view_request=recipient_view_request) assert view_url is not None assert view_url.url is not None # This Url should work in an Iframe or browser to allow signing print("ViewUrl is ", end="") pprint(view_url) except ApiException as e: print("\nException when calling DocuSign API: %s" % e) assert e is None # make the test case fail in case of an API exception