def embedded_signing_ceremony(): """ The document <file_name> will be signed by <signer_name> via an embedded signing ceremony. """ # # Step 1. The envelope definition is created. # One signHere tab is added. # The document path supplied is relative to the working directory # envDef = EnvelopeDefinition() envDef.email_subject = 'PLEASE GOD HELP ME, I NEED THIS WORKING!!' envDef.template_id = 'd5e617be-da0a-4431-9014-4575282f61d4' tRole = TemplateRole() tRole.role_name = 'Manager' tRole.name = 'Manuel Galvez' tRole.email = '*****@*****.**' tRole.client_user_id = clientUserId text_example = Text() text_example.tab_label = 'example' text_example.value = 'SIIII GRACIAS DIOS!! -- EXAMPLE' text_name = Text() text_name.tab_label = 'name' text_name.value = 'SIIII GRACIAS DIOS!! -- NAME' # text.document_id = '1' # text.page_number = '1' # text.recipient_id = '1' # text.x_position = '100' # text.y_position = '100' # text.scale_value = '0.5' tabs = Tabs() tabs.text_tabs = [text_example, text_name] tRole.tabs = tabs # Tabs(text_tabs=[Text(name='example', value='SIiiiiiii Gracias DIOS')]) envDef.template_roles = [tRole] name = TextCustomField(field_id='name', name='name', value='Manuel') last_name = TextCustomField(field_id='lastname', name='lastname', value='Galvez') testing = TextCustomField(field_id='testing', name='testing', value='Elks') manu = TextCustomField(field_id='manu', name='manu', value='manu') example = TextCustomField(field_id='example', name='example', value='Siiiiiiii') custom_fields = CustomFields( text_custom_fields=[example, name, last_name, testing, manu]) envDef.custom_fields = custom_fields '''recipients = Recipients() # Create the signer recipient model signer = Signer( # The signer email='*****@*****.**', name='Andres Vasquez', recipient_id="1", routing_order="1", client_user_id=clientUserId, # Setting the client_user_id marks the signer as embedded ) text = Text() text.document_id = '1' text.page_number = '1' text.recipient_id = '1' text.x_position = '100' text.y_position = '100' text.scale_value = '0.5' tabs = Tabs() tabs.text_tabs = [text] signer.tabs = tabs recipients.signers = [signer] envDef.recipients = recipients''' envDef.status = 'sent' api_client = ApiClient() api_client.host = base_path api_client.set_default_header("Authorization", "Bearer " + access_token) envelope_api = EnvelopesApi(api_client) envelopeSummary = envelope_api.create_envelope(account_id, envelope_definition=envDef) envelope_id = envelopeSummary.envelope_id print("Envelope {} has been sent to {} : {}".format( envelope_id, tRole.email, envelopeSummary)) '''recipient_view_request = RecipientViewRequest( authentication_method='None', client_user_id=clientUserId, recipient_id='1', return_url=base_url + '/dsreturn', user_name='Andres Vasquez', email='*****@*****.**' ) results = envelope_api.create_recipient_view(account_id, envelope_id, recipient_view_request=recipient_view_request)''' return '' #results.url
def make_template_req(cls): """Creates template req object""" # document 1 (pdf) # # The template has two recipient roles. # recipient 1 - signer # recipient 2 - cc with open(path.join(demo_docs_path, doc_file), "rb") as file: content_bytes = file.read() base64_file_content = base64.b64encode(content_bytes).decode("ascii") # Create the document model document = Document( # create the DocuSign document object document_base64=base64_file_content, name="Lorem Ipsum", # can be different from actual file name file_extension="pdf", # many different document types are accepted document_id=1 # a label used to reference the doc ) # Create the signer recipient model signer = Signer(role_name="signer", recipient_id="1", routing_order="1") # create a cc recipient to receive a copy of the envelope (transaction) cc = CarbonCopy(role_name="cc", recipient_id="2", routing_order="2") # Create fields using absolute positioning # Create a sign_here tab (field on the document) sign_here = SignHere(document_id="1", page_number="1", x_position="191", y_position="148") check1 = Checkbox(document_id="1", page_number="1", x_position="75", y_position="417", tab_label="ckAuthorization") check2 = Checkbox(document_id="1", page_number="1", x_position="75", y_position="447", tab_label="ckAuthentication") check3 = Checkbox(document_id="1", page_number="1", x_position="75", y_position="478", tab_label="ckAgreement") check4 = Checkbox(document_id="1", page_number="1", x_position="75", y_position="508", tab_label="ckAcknowledgement") list1 = List(document_id="1", page_number="1", x_position="142", y_position="291", font="helvetica", font_size="size14", tab_label="list", required="false", list_items=[ ListItem(text="Red", value="red"), ListItem(text="Orange", value="orange"), ListItem(text="Yellow", value="yellow"), ListItem(text="Green", value="green"), ListItem(text="Blue", value="blue"), ListItem(text="Indigo", value="indigo"), ListItem(text="Violet", value="violet") ]) number1 = Number(document_id="1", page_number="1", x_position="163", y_position="260", font="helvetica", font_size="size14", tab_label="numbersOnly", width="84", required="false") radio_group = RadioGroup(document_id="1", group_name="radio1", radios=[ Radio(page_number="1", x_position="142", y_position="384", value="white", required="false"), Radio(page_number="1", x_position="74", y_position="384", value="red", required="false"), Radio(page_number="1", x_position="220", y_position="384", value="blue", required="false") ]) text = Text(document_id="1", page_number="1", x_position="153", y_position="230", font="helvetica", font_size="size14", tab_label="text", height="23", width="84", required="false") # Add the tabs model to the signer # The Tabs object wants arrays of the different field/tab types signer.tabs = Tabs(sign_here_tabs=[sign_here], checkbox_tabs=[check1, check2, check3, check4], list_tabs=[list1], number_tabs=[number1], radio_group_tabs=[radio_group], text_tabs=[text]) # Top object: template_request = EnvelopeTemplate( documents=[document], email_subject="Please sign this document", recipients=Recipients(signers=[signer], carbon_copies=[cc]), description="Example template created via the API", name=template_name, shared="false", status="created") return template_request
def embedded_signing_ceremony(): """ The document <file_name> will be signed by <signer_name> via an embedded signing ceremony. """ # # Step 1. The envelope definition is created. # One signHere tab is added. # The document path supplied is relative to the working directory # env_def = EnvelopeDefinition() env_def.email_subject = 'PLEASE GOD HELP ME, I NEED THIS WORKING!!' env_def.template_id = template_id t_role = TemplateRole() t_role.role_name = role_name t_role.name = user_name t_role.email = user_email t_role.client_user_id = client_user_id text_example = Text() text_example.tab_label = 'example' text_example.value = 'SIIII GRACIAS DIOS!! -- EXAMPLE' text_name = Text() text_name.tab_label = 'name' text_name.value = 'SIIII GRACIAS DIOS!! -- NAME' text_name2 = Text() text_name2.tab_label = 'name2' text_name2.value = 'SIIII GRACIAS DIOS!! -- NAME2' text = Text() text.document_id = '1' text.page_number = '1' text.recipient_id = '1' text.x_position = '100' text.y_position = '100' text.scale_value = '0.5' text.value = 'THANKS GOD!!' title_label = Title() title_label.tab_label = 'lablel_example' title_label.value = 'LendingFront' tabs = Tabs() tabs.text_tabs = [text_example, text_name, text_name2, text] tabs.title_tabs = [title_label] t_role.tabs = tabs env_def.template_roles = [t_role] env_def.status = environment_status # # Step 2. Create/send the envelope. # api_client = ApiClient() api_client.host = base_path api_client.set_default_header("Authorization", "Bearer " + access_token) envelope_api = EnvelopesApi(api_client) envelope_summary = envelope_api.create_envelope( account_id, envelope_definition=env_def) envelope_id = envelope_summary.envelope_id print("Envelope {} has been sent to {}".format(envelope_id, t_role.email)) return 'Works!'
def make_envelope(cls, args): """ Creates envelope args -- parameters for the envelope: signer_email, signer_name, signer_client_id returns an envelope definition """ # Set the values for the fields in the template # List item list1 = List(value="green", document_id="1", page_number="1", tab_label="list") # Checkboxes check1 = Checkbox(tab_label="ckAuthorization", selected="true") check3 = Checkbox(tab_label="ckAgreement", selected="true") radio_group = RadioGroup( group_name="radio1", radios=[Radio(value="white", selected="true")]) text = Text(tab_label="text", value="Jabberywocky!") # We can also add a new tab (field) to the ones already in the template: text_extra = Text(document_id="1", page_number="1", x_position="280", y_position="172", font="helvetica", font_size="size14", tab_label="added text field", height="23", width="84", required="false", bold="true", value=args["signer_name"], locked="false", tab_id="name") # Add the tabs model (including the SignHere tab) to the signer. # The Tabs object wants arrays of the different field/tab types # Tabs are set per recipient / signer tabs = Tabs(checkbox_tabs=[check1, check3], radio_group_tabs=[radio_group], text_tabs=[text, text_extra], list_tabs=[list1]) # create a signer recipient to sign the document, identified by name and email # We"re setting the parameters via the object creation signer = TemplateRole( # The signer email=args["signer_email"], name=args["signer_name"], # Setting the client_user_id marks the signer as embedded client_user_id=args["signer_client_id"], role_name="signer", tabs=tabs) cc = TemplateRole(email=args["cc_email"], name=args["cc_name"], role_name="cc") # create an envelope custom field to save our application"s # data about the envelope custom_field = TextCustomField( name="app metadata item", required="false", show="true", # Yes, include in the CoC value="1234567") cf = CustomFields(text_custom_fields=[custom_field]) # Next, create the top level envelope definition and populate it. envelope_definition = EnvelopeDefinition( email_subject="Please sign this document sent from the Python SDK", # The Recipients object wants arrays for each recipient type template_id=session["template_id"], template_roles=[signer, cc], custom_fields=cf, status="sent" # requests that the envelope be created and sent. ) return envelope_definition
def make_envelope(cls, args): """ Creates envelope args -- parameters for the envelope: signer_email, signer_name, signer_client_id returns an envelope definition """ # Document 1 (PDF) has tag /sn1/ # # The envelope has one recipient: # recipient 1 - signer with open(path.join(demo_docs_path, DS_CONFIG["doc_salary_docx"]), "rb") as file: content_bytes = file.read() base64_file_content = base64.b64encode(content_bytes).decode("ascii") # Create the document model document = Document( # Create the DocuSign document object document_base64=base64_file_content, name="Lorem Ipsum", # Can be different from the actual filename file_extension="docx", # Many different document types are accepted document_id=1 # A label used to reference the doc ) # Create the signer recipient model signer = Signer( # The signer email=args["signer_email"], name=args["signer_name"], recipient_id="1", routing_order="1", # Setting the client_user_id marks the signer as embedded client_user_id=args["signer_client_id"] ) # Create a SignHere tab (field on the document) sign_here = SignHere( # DocuSign SignHere field/tab anchor_string="/sn1/", anchor_units="pixels", anchor_y_offset="10", anchor_x_offset="20" ) text_legal = Text( anchor_string="/legal/", anchor_units="pixels", anchor_y_offset="-9", anchor_x_offset="5", font="helvetica", font_size="size11", bold="true", value=args["signer_name"], locked="false", tab_id="legal_name", tab_label="Legal name") text_familar = Text( anchor_string="/familiar/", anchor_units="pixels", anchor_y_offset="-9", anchor_x_offset="5", font="helvetica", font_size="size11", bold="true", value=args["signer_name"], locked="false", tab_id="familar_name", tab_label="Familiar name") salary = 123000 text_salary = Text( anchor_string="/salary/", anchor_units="pixels", anchor_y_offset="-9", anchor_x_offset="5", font="helvetica", font_size="size11", bold="true", value="${:.2f}".format(salary), locked="true", tab_id="salary", tab_label="Salary") salary_custom_field = TextCustomField( name="salary", required="false", show="true", # Yes, include in the CoC value=str(salary) ) cf = CustomFields(text_custom_fields=[salary_custom_field]) # Add the tabs model (including the SignHere tab) to the signer # The Tabs object wants arrays of the different field/tab types signer.tabs = Tabs(sign_here_tabs=[sign_here], text_tabs=[text_legal, text_familar, text_salary]) # Create the top level envelope definition and populate it envelope_definition = EnvelopeDefinition( email_subject="Please sign this document sent from the Python SDK", documents=[document], # The Recipients object wants arrays for each recipient type recipients=Recipients(signers=[signer]), custom_fields=cf, status="sent" # Requests that the envelope be created and sent ) return envelope_definition
def embedded_signing_ceremony(): """ The document <file_name> will be signed by <signer_name> via an embedded signing ceremony. """ # # Step 1. Create and define the API Client. # api_client = get_api_client_by_jwt_authorization_flow() # # Step 2. The envelope definition is created. # One signHere tab is added. # The document path supplied is relative to the working directory # env_def = EnvelopeDefinition() env_def.email_subject = 'Sign the document needed to finish the loan process!!' env_def.template_id = DS_CONFIG['template_id'] t_role = TemplateRole() t_role.role_name = DS_CONFIG['signer_role'] t_role.name = DS_CONFIG['signer_name'] t_role.email = DS_CONFIG['signer_email'] t_role.client_user_id = DS_CONFIG['client_user_id'] text_name = Text() text_name.tab_label = 'name' text_name.value = 'Jonathan' text_last_name = Text() text_last_name.tab_label = 'last_name' text_last_name.value = 'Vallejo' tabs = Tabs() tabs.text_tabs = [text_name, text_last_name] t_role.tabs = tabs env_def.template_roles = [t_role] env_def.status = DS_CONFIG['environment_status'] # # Step 3. Create/send the envelope. # envelope_api = EnvelopesApi(api_client) envelope_summary = envelope_api.create_envelope( DS_CONFIG['account_id'], envelope_definition=env_def) envelope_id = envelope_summary.envelope_id print("Envelope {} has been sent to {} and the summary id: {}".format( envelope_id, t_role.email, envelope_summary)) # # Step 4. Create/send the Recipient View Request in order to get a URL to sign the document. # recipient_view_request = RecipientViewRequest( authentication_method=DS_CONFIG['authentication_method'], client_user_id=DS_CONFIG['client_user_id'], recipient_id='1', return_url=DS_CONFIG['app_url'] + '/ds_return?envelope_id={}'.format(envelope_id), user_name=DS_CONFIG['signer_name'], email=DS_CONFIG['signer_email']) results = envelope_api.create_recipient_view( DS_CONFIG['account_id'], envelope_id, recipient_view_request=recipient_view_request) return results.url
def embedded_signing_ceremony(): """ The document <file_name> will be signed by <signer_name> via an embedded signing ceremony. """ # # Step 1. The envelope definition is created. # One signHere tab is added. # The document path supplied is relative to the working directory # envDef = EnvelopeDefinition() envDef.email_subject = 'PLEASE GOD HELP ME, I NEED THIS WORKING!!' envDef.template_id = 'd5e617be-da0a-4431-9014-4575282f61d4' tRole = TemplateRole() tRole.role_name = 'Manager' tRole.name = 'Lending Front' tRole.email = '*****@*****.**' tRole.client_user_id = client_user_id text_example = Text() text_example.tab_label = 'example' text_example.value = 'SIIII GRACIAS DIOS!! -- EXAMPLE' text_name = Text() text_name.tab_label = 'name' text_name.value = 'SIIII GRACIAS DIOS!! -- NAME' text_name2 = Text() text_name2.tab_label = 'name2' text_name2.value = 'SIIII GRACIAS DIOS!! -- NAME2' text = Text() text.document_id = '1' text.page_number = '1' text.recipient_id = '1' text.x_position = '100' text.y_position = '100' text.scale_value = '0.5' text.value = 'THANKS GOD!!' title_label = Title() title_label.tab_label = 'lablel_example' title_label.value = 'LendingFront' tabs = Tabs() tabs.text_tabs = [text_example, text_name, text_name2, text] tabs.title_tabs = [title_label] tRole.tabs = tabs envDef.template_roles = [tRole] envDef.status = 'sent' name = TextCustomField(field_id='name', name='name', value='Manuel') last_name = TextCustomField(field_id='lastname', name='lastname', value='Galvez') testing = TextCustomField(field_id='testing', name='testing', value='Elks') manu = TextCustomField(field_id='manu', name='manu', value='manu') example = TextCustomField(field_id='example', name='example', value='Siiiiiiii') '''item_name = ListItem(text='name', value='Allen') item_lastname = ListItem(text='lastname', value='Galvez') item_testing = ListItem(text='testing', value='testing') item_manu = ListItem(text='manu', value='manu') listcf = ListCustomField(list_items=[item_name, item_lastname, item_testing, item_manu])''' custom_fields = CustomFields( text_custom_fields=[example, name, last_name, testing, manu]) envDef.custom_fields = custom_fields # envDef.recipients # print('*&**&*^&*&^%$#$%^&*(*&^%$#@!@#$%^&') print('') # # Step 2. Create/send the envelope. # api_client = ApiClient() api_client.host = base_path api_client.set_default_header("Authorization", "Bearer " + access_token) envelope_api = EnvelopesApi(api_client) envelopeSummary = envelope_api.create_envelope(account_id, envelope_definition=envDef) envelope_id = envelopeSummary.envelope_id print("Envelope {} has been sent to {}".format(envelope_id, tRole.email)) '''client_user_id = '2939' 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 = 'Manuel Galvez' recipient_view_request.email = '*****@*****.**' view_url = envelope_api.create_recipient_view(account_id, envelope_id, recipient_view_request=recipient_view_request) ''' recipient_view_request = RecipientViewRequest( authentication_method='None', client_user_id=client_user_id, recipient_id='1', return_url=base_url + '/dsreturn', user_name='Lending Front', email='*****@*****.**') results = envelope_api.create_recipient_view( account_id, envelope_id, recipient_view_request=recipient_view_request) return results.url
def embedded_signing_ceremony(): """ The document <file_name> will be signed by <signer_name> via an embedded signing ceremony. """ # # Step 1. The envelope definition is created. # One signHere tab is added. # The document path supplied is relative to the working directory # env_def = EnvelopeDefinition() env_def.email_subject = 'PLEASE GOD HELP ME, I NEED THIS WORKING!!' # env_def.template_id = 'd5e617be-da0a-4431-9014-4575282f61d4' env_def.template_id = '57e2a00c-b8b5-415c-8c8b-db31d75e8253' t_role = TemplateRole() t_role.role_name = 'Cliente' t_role.name = 'Alejandro Galvez' t_role.email = '*****@*****.**' t_role.client_user_id = client_user_id text_example = Text() text_example.tab_label = 'example' text_example.value = 'SIIII GRACIAS DIOS!! -- EXAMPLE' text_name = Text() text_name.tab_label = 'name' text_name.value = 'SIIII GRACIAS DIOS!! -- NAME' text_name2 = Text() text_name2.tab_label = 'name2' text_name2.value = 'SIIII GRACIAS DIOS!! -- NAME2' text = Text() text.document_id = '1' text.page_number = '1' text.recipient_id = '1' text.x_position = '100' text.y_position = '100' text.scale_value = '0.5' text.value = 'THANKS GOD!!' title_label = Title() title_label.tab_label = 'lablel_example' title_label.value = 'LendingFront' tabs = Tabs() tabs.text_tabs = [text_example, text_name, text_name2, text] tabs.title_tabs = [title_label] t_role.tabs = tabs env_def.template_roles = [t_role] env_def.status = 'sent' # # Step 2. Create/send the envelope. # api_client = ApiClient() api_client.host = base_path api_client.set_default_header("Authorization", "Bearer " + access_token) envelope_api = EnvelopesApi(api_client) envelope_summary = envelope_api.create_envelope( account_id, envelope_definition=env_def) envelope_id = envelope_summary.envelope_id print("Envelope {} has been sent to {}".format(envelope_id, t_role.email)) '''' recipient_view_request = RecipientViewRequest( authentication_method='None', client_user_id=client_user_id, recipient_id='1', return_url=base_url + '/dsreturn', user_name='Lending Front', email='*****@*****.**' ) results = envelope_api.create_recipient_view(account_id, envelope_id, recipient_view_request=recipient_view_request) return results.url ''' return ''
def embedded_signing_ceremony(): """ The document <file_name> will be signed by <signer_name> via an embedded signing ceremony. """ # # Step 1. The envelope definition is created. # One signHere tab is added. # The document path supplied is relative to the working directory # env_def = EnvelopeDefinition() env_def.email_subject = 'PLEASE GOD HELP ME, I NEED THIS WORKING!!' env_def.template_id = template_id t_role = TemplateRole() t_role.role_name = role_name t_role.name = name t_role.email = email t_role.client_user_id = client_user_id text_example = Text() text_example.tab_label = 'example' text_example.value = 'SIIII GRACIAS DIOS!! -- EXAMPLE' text_name = Text() text_name.tab_label = 'name' text_name.value = 'SIIII GRACIAS DIOS!! -- NAME' text_name2 = Text() text_name2.tab_label = 'name2' text_name2.value = 'SIIII GRACIAS DIOS!! -- NAME2' text = Text() text.document_id = '1' text.page_number = '1' text.recipient_id = '1' text.x_position = '100' text.y_position = '100' text.scale_value = '0.5' text.value = 'THANKS GOD!!' title_label = Title() title_label.tab_label = 'lablel_example' title_label.value = 'LendingFront' tabs = Tabs() tabs.text_tabs = [text_example, text_name, text_name2, text] tabs.title_tabs = [title_label] t_role.tabs = tabs # Create the signer recipient model signer = Signer( # The signer email=email, name=name, recipient_id="1", routing_order="1", client_user_id=client_user_id # Setting the client_user_id marks the signer as embedded ) # Create a sign_here tab (field on the document) sign_here = SignHere( # DocuSign SignHere field/tab document_id='1', page_number='3', recipient_id='1', tab_label='SignHereTab', x_position='175', y_position='320', ) # Add the tabs model (including the sign_here tab) to the signer signer.tabs = Tabs(sign_here_tabs=[ sign_here ]) # The Tabs object wants arrays of the different field/tab types recipients = Recipients() recipients.signers = [signer] env_def.recipients = recipients env_def.template_roles = [t_role] env_def.status = environment_status # # Step 2. Create/send the envelope. # api_client = ApiClient() api_client.host = base_path api_client.set_default_header("Authorization", "Bearer " + access_token) # authentication_api = AuthenticationApi() # authentication_api.api_client = api_client # access_token = authentication_api.get_o_auth_token() # accessToken = api_client. GetOAuthToken(client_id, client_secret, true, AccessCode); # Console.WriteLine("Access_token: " + accessToken); envelope_api = EnvelopesApi(api_client) envelope_summary = envelope_api.create_envelope( account_id, envelope_definition=env_def) envelope_id = envelope_summary.envelope_id print("Envelope {} has been sent to {}".format(envelope_id, t_role.email)) recipient_view_request = RecipientViewRequest( authentication_method=authentication_method, client_user_id=client_user_id, recipient_id='1', return_url=base_url + '/dsreturn', user_name=name, email=email) results = envelope_api.create_recipient_view( account_id, envelope_id, recipient_view_request=recipient_view_request) return results.url