Skip to content

Commit 1d07408

Browse files
author
Olena Harkusha
committed
minor corrections
1 parent a059a6a commit 1d07408

8 files changed

Lines changed: 98 additions & 98 deletions

File tree

app/eSignature/examples/eg032_pause_signature_workflow/controller.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,7 @@ def make_envelope(cls, args):
9191
)
9292

9393
# The order in the docs array determines the order in the envelope.
94-
env.documents = [document,]
95-
96-
# Create a workflow model
97-
workflow_step = WorkflowStep(
98-
action="pause_before",
99-
trigger_on_item="routing_order",
100-
item_id="2"
101-
)
102-
workflow = Workflow(workflow_steps=[workflow_step,])
103-
# Add the workflow to the envelope object
104-
env.workflow = workflow
94+
env.documents = [document, ]
10595

10696
# Create the signer recipient models
10797
# routingOrder (lower means earlier) determines the order of deliveries
@@ -138,13 +128,24 @@ def make_envelope(cls, args):
138128

139129
# Add the tabs model (including the sign_here tabs) to the signer
140130
# The Tabs object wants arrays of the different field/tab types
141-
signer1.tabs = Tabs(sign_here_tabs=[sign_here1,])
142-
signer2.tabs = Tabs(sign_here_tabs=[sign_here2,])
131+
signer1.tabs = Tabs(sign_here_tabs=[sign_here1, ])
132+
signer2.tabs = Tabs(sign_here_tabs=[sign_here2, ])
143133

144134
# Add the recipients to the envelope object
145135
recipients = Recipients(signers=[signer1, signer2])
146136
env.recipients = recipients
147137

138+
# Create a workflow model.
139+
# Signature workflow will be paused after it is signed by the signer1.
140+
workflow_step = WorkflowStep(
141+
action="pause_before",
142+
trigger_on_item="routing_order",
143+
item_id="2"
144+
)
145+
workflow = Workflow(workflow_steps=[workflow_step, ])
146+
# Add the workflow to the envelope object
147+
env.workflow = workflow
148+
148149
# Request that the envelope be sent by setting |status| to "sent".
149150
# To request that the envelope be created as a draft, set to "created"
150151
env.status = args["status"]

app/eSignature/examples/eg032_pause_signature_workflow/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def pause_signature_workflow():
4141
h1="Envelope sent",
4242
message=f"The envelope has been created and sent!"
4343
f"<br/>Envelope ID {results['paused_envelope_id']}.<br/>"
44-
f"<p>To resume a workflow after the first resipient signs "
44+
f"<p>To resume a workflow after the first recipient signs "
4545
f"the envelope use <a href='eg033'>example33.</a><br/>"
4646
)
4747

app/eSignature/examples/eg033_unpause_signature_workflow/views.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ def unpause_signature_workflow():
3131
except ApiException as err:
3232
return process_error(err)
3333

34-
# Delete "paused_envelope_id" field from session to prevent an error on
35-
# a repeated unpause action for the same envelopeID.
36-
session.pop('paused_envelope_id', None)
37-
3834
# 2. Render success response with envelopeId
3935
return render_template(
4036
"example_done.html",

app/eSignature/examples/eg034_use_conditional_recipients/controller.py

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
)
88
from docusign_esign.models import (
99
ConditionalRecipientRule, ConditionalRecipientRuleCondition,
10-
ConditionalRecipientRuleFilter, RecipientGroup,
11-
RecipientOption, RecipientRouting, RecipientRules, Workflow, WorkflowStep
10+
ConditionalRecipientRuleFilter, RecipientGroup, RecipientOption,
11+
RecipientRouting, RecipientRules, Workflow, WorkflowStep
1212
)
1313
from flask import session, request
1414

@@ -79,10 +79,10 @@ def make_envelope(cls, args):
7979

8080
# The envelope has two recipients.
8181
# recipient 1 - signer1
82-
# recipient 2 - signer2
82+
# recipient 2 - signer_2a or signer_2b
8383
# The envelope will be sent first to the signer1.
84-
# After it is signed, a signature workflow will be paused.
85-
# After resuming (unpause) the signature workflow will send to the second recipient.
84+
# If signer1 doesn't check the checkbox the envelope will be sent to the signer_2a.
85+
# If signer1 check the checkbox the envelope will be sent to the signer_2b.
8686

8787
# create the envelope definition
8888
env = EnvelopeDefinition(email_subject="ApproveIfChecked")
@@ -101,29 +101,26 @@ def make_envelope(cls, args):
101101
file_extension="txt", # many different document types are accepted
102102
document_id="1" # a label used to reference the doc
103103
)
104-
105-
# The order in the docs array determines the order in the envelope.
106104
env.documents = [document, ]
107105

108-
# Create the signer model
109-
# routingOrder (lower means earlier) determines the order of deliveries
110-
# to the recipients.
106+
# Create the signer modelы
107+
# routingOrder (lower means earlier) determines the order of deliveries to the recipients.
111108
signer1 = Signer(
112109
email=args["signer1_email"],
113110
name=args["signer1_name"],
114111
recipient_id="1",
115112
routing_order="1",
116113
role_name="Purchaser"
117114
)
118-
# signer2 = Signer(
119-
# email="gravecapa@gmail.com",
120-
# name="Alpaca",
121-
# recipient_id="2",
122-
# routing_order="2",
123-
# role_name="Approver"
124-
# )
115+
signer2 = Signer(
116+
email="placeholder@example.com",
117+
name="Approver",
118+
recipient_id="2",
119+
routing_order="2",
120+
role_name="Approver"
121+
)
125122

126-
# Create signHere fields (also known as tabs) on the documents.
123+
# Create signHere fieldы (also known as tabs) on the documents.
127124
sign_here1 = SignHere(
128125
document_id="1",
129126
page_number="1",
@@ -142,6 +139,7 @@ def make_envelope(cls, args):
142139
y_position="200"
143140
)
144141

142+
# Create checkbox field on the documents.
145143
checkbox = Checkbox(
146144
document_id="1",
147145
page_number="1",
@@ -151,41 +149,43 @@ def make_envelope(cls, args):
151149
x_position="50",
152150
y_position="50"
153151
)
154-
#
155-
# Add the tabs model (including the sign_here tabs) to the signer
152+
153+
# Add the tabs models (including the sign_here tabs) to the signer
156154
# The Tabs object wants arrays of the different field/tab types
157155
signer1.tabs = Tabs(
158156
sign_here_tabs=[sign_here1, ],
159157
checkbox_tabs=[checkbox, ]
160158
)
161-
# signer2.tabs = Tabs(sign_here_tabs=[sign_here2, ])
159+
signer2.tabs = Tabs(sign_here_tabs=[sign_here2, ])
162160

163161
# Add the recipients to the envelope object
164-
env_recipients = Recipients(signers=[signer1, ])
165-
# recipients = Recipients(signers=[signer1, signer2])
162+
env_recipients = Recipients(signers=[signer1, signer2])
163+
# env_recipients = Recipients(signers=[signer1, ])
166164
env.recipients = env_recipients
167165

168-
# !!!!!!!! Create RecipientRouting model.
166+
# Create recipientOption models.
169167
signer_2a = RecipientOption(
170168
email=args["signer_2a_email"],
171169
name=args["signer_2a_name"],
172170
role_name="Signer when not checked",
173171
recipient_label="signer2a"
174172
)
175-
176173
signer_2b = RecipientOption(
177174
email=args["signer_2b_email"],
178175
name=args["signer_2b_name"],
179176
role_name="Signer when checked",
180177
recipient_label="signer2b"
181178
)
182179
recipients = [signer_2a, signer_2b]
180+
181+
# Create recipientGroup model.
183182
recipient_group = RecipientGroup(
184183
group_name="Approver",
185184
group_message="Members of this group approve a workflow",
186185
recipients=recipients
187186
)
188187

188+
# Create conditionalRecipientRuleFilter models.
189189
filter1 = ConditionalRecipientRuleFilter(
190190
scope="tabs",
191191
recipient_id="1",
@@ -203,6 +203,7 @@ def make_envelope(cls, args):
203203
tab_label="ApproveWhenChecked"
204204
)
205205

206+
# Create conditionalRecipientRuleCondition models.
206207
condition1 = ConditionalRecipientRuleCondition(
207208
filters=[filter1, ],
208209
order="1",
@@ -214,26 +215,28 @@ def make_envelope(cls, args):
214215
recipient_label="signer2b"
215216
)
216217
conditions = [condition1, condition2]
218+
219+
# Create conditionalRecipientRule model.
217220
conditional_recipient = ConditionalRecipientRule(
218221
conditions=conditions,
219222
recipient_group=recipient_group,
220223
recipient_id="2",
221224
order="0",
222225

223226
)
227+
228+
# Create recipientRules model.
224229
rules = RecipientRules(conditional_recipients=[conditional_recipient, ])
225230
recipient_routing = RecipientRouting(rules=rules)
226231

227232
# Create a workflow model.
228-
# Signature workflow will be paused after it is signed by the signer1.
229233
workflow_step = WorkflowStep(
230234
action="pause_before",
231235
trigger_on_item="routing_order",
232236
item_id="2",
233237
status="pending",
234238
recipient_routing=recipient_routing
235239
)
236-
237240
workflow = Workflow(workflow_steps=[workflow_step, ])
238241
# Add the workflow to the envelope object
239242
env.workflow = workflow
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33

4-
Welcome to the DocuSign Recruiting Event
4+
Thanks for reviewing this!
55

66

7-
Please Sign in!
7+
We'll move forward as soon as we hear back.

app/templates/eg032_pause_signature_workflow.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h4>32. Pausing a signature workflow</h4>
2020

2121
<form class="eg" action="" method="post" data-busy="form">
2222

23-
<h5>First Signer</h5>
23+
<h5>Signer #1</h5>
2424
<div class="form-group">
2525
<label for="signer1_email">Email</label>
2626
<input type="email" class="form-control" id="signer1_email" name="signer1_email"
@@ -34,7 +34,7 @@ <h5>First Signer</h5>
3434
value="{{ signer1_name }}" required />
3535
<br/>
3636
</div>
37-
<h5>Second Signer</h5>
37+
<h5>Signer #2</h5>
3838
<div class="form-group">
3939
<label for="signer2_email">Email</label>
4040
<input type="email" class="form-control" id="signer2_email" name="signer2_email"
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
<!-- extend base layout --> {% extends "base.html" %} {% block content %}
22

33
<h4>33. Unpausing a signature workflow</h4>
4-
<p>This example demonstrates how to resume an envelope workflow that has been paused.
4+
<p>This example demonstrates how to resume an envelope workflow that has been
5+
paused.
56
</p>
67

78
{% if show_doc %}
8-
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> about this example.</p>
9+
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> about
10+
this example.</p>
911
{% endif %}
1012

11-
<p>API method used:
12-
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/update/">Envelopes::update</a>.
13+
<p>API method used:
14+
<a target='_blank'
15+
href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/update/">Envelopes::update</a>.
1316
</p>
1417

1518
<p>
16-
View source file <a target="_blank" href="{{ source_url | safe }}">{{ source_file }}</a> on GitHub.
19+
View source file <a target="_blank" href="{{ source_url | safe }}">{{
20+
source_file }}</a> on GitHub.
1721
</p>
1822

1923
{% if envelope_ok %}
20-
<p>The envelope you created via example 32 will be queried.</p>
21-
22-
<form class="eg" action="" method="post" data-busy="form">
23-
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
24-
<button type="submit" class="btn btn-docu">Continue</button>
25-
</form>
24+
<p>The envelope you created via example 32 will be queried.</p>
25+
26+
<form class="eg" action="" method="post" data-busy="form">
27+
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
28+
<button type="submit" class="btn btn-docu">Continue</button>
29+
</form>
2630

2731
{% else %}
28-
<p>Problem: please first create an envelope using <a href="eg032">example 32.</a> <br/>
29-
Thank you.</p>
32+
<p>Problem: please first create an envelope using <a href="eg032">example
33+
32.</a> <br/>
34+
Thank you.</p>
3035

31-
<form class="eg" action="eg032" method="get">
32-
<button type="submit" class="btn btn-docu">Continue</button>
33-
</form>
36+
<form class="eg" action="eg032" method="get">
37+
<button type="submit" class="btn btn-docu">Continue</button>
38+
</form>
3439
{% endif %}
3540

3641
{% endblock %}

app/templates/eg034_use_conditional_recipients.html

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,35 @@ <h5>Signer #1</h5>
3939
value="{{ signer1_name }}" required/>
4040
<br/>
4141
</div>
42-
<div class="row">
43-
<div class="col-md-6">
44-
<h6><b>Signer when not checked</b></h6>
45-
<div class="form-group">
46-
<label for="signer_2a_email">Email</label>
47-
<input type="email" class="form-control" id="signer_2a_email"
48-
name="signer_2a_email"
49-
aria-describedby="emailHelp"
50-
placeholder="pat@example.com" required
51-
value="{{ signer_2a_email }}">
52-
</div>
53-
<div class="form-group">
54-
<label for="signer_2a_name">Name</label>
55-
<input type="text" class="form-control" id="signer_2a_name"
56-
placeholder="Pat Johnson" name="signer_2a_name"
57-
value="{{ signer_2a_name }}" required>
58-
</div>
59-
</div>
6042

61-
<div class="col-md-6">
62-
<h6><b>Signer when checked</b></h6>
63-
<div class="form-group">
64-
<label for="signer_2b_email">Email</label>
65-
<input type="email" class="form-control" id="signer_2b_email"
66-
name="signer_2b_email"
67-
aria-describedby="emailHelp"
68-
placeholder="pat@example.com" required>
69-
</div>
70-
<div class="form-group">
71-
<label for="signer_2b_name">Name</label>
72-
<input type="text" class="form-control" id="signer_2b_name"
73-
placeholder="Pat Johnson" name="signer_2b_name" required>
74-
</div>
75-
</div>
43+
<h5>Conditional signer #2 (when not checked)</h5>
44+
<div class="form-group">
45+
<label for="signer_2a_email">Email</label>
46+
<input type="email" class="form-control" id="signer_2a_email"
47+
name="signer_2a_email"
48+
aria-describedby="emailHelp"
49+
placeholder="pat@example.com" required
50+
value="{{ signer_2a_email }}">
51+
</div>
52+
<div class="form-group">
53+
<label for="signer_2a_name">Name</label>
54+
<input type="text" class="form-control" id="signer_2a_name"
55+
placeholder="Pat Johnson" name="signer_2a_name"
56+
value="{{ signer_2a_name }}" required>
57+
</div>
58+
59+
<h5>Conditional signer #2 (when checked)</h5>
60+
<div class="form-group">
61+
<label for="signer_2b_email">Email</label>
62+
<input type="email" class="form-control" id="signer_2b_email"
63+
name="signer_2b_email"
64+
aria-describedby="emailHelp"
65+
placeholder="pat@example.com" required>
66+
</div>
67+
<div class="form-group">
68+
<label for="signer_2b_name">Name</label>
69+
<input type="text" class="form-control" id="signer_2b_name"
70+
placeholder="Pat Johnson" name="signer_2b_name" required>
7671
</div>
7772
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
7873
<button type="submit" class="btn btn-docu">Submit</button>

0 commit comments

Comments
 (0)