Skip to content

Commit 22c7c5b

Browse files
Devdocs 6120 (#47)
* update phone auth example Co-authored-by: meihDS <70775251+meihDS@users.noreply.github.com>
1 parent 4ec0555 commit 22c7c5b

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

app/services/e_sign/eg020_phone_authentication_service.rb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ def initialize(request, session)
2424
end
2525

2626
def call
27-
# ***DS.snippet.0.start
28-
envelope_api = create_envelope_api(args)
29-
30-
# Step 3: Construct your envelope JSON body
27+
# Construct your envelope JSON body
28+
# Step 4 start
3129
envelope_definition = DocuSign_eSign::EnvelopeDefinition.new
3230
envelope_definition.email_subject = 'Please sign this document set'
3331

@@ -64,8 +62,8 @@ def call
6462
input_option.phone_number_list = [phone_number]
6563

6664
identity_verification = DocuSign_eSign::RecipientIdentityVerification.new
67-
6865
identity_verification.workflow_id = session[:workflow_id]
66+
6967
identity_verification.input_options = [input_option]
7068

7169
signer1.identity_verification = identity_verification
@@ -92,28 +90,38 @@ def call
9290
# To request that the envelope be created as a draft, set to "created"
9391
envelope_definition.recipients = recipients
9492
envelope_definition.status = envelope_args[:status]
93+
# Step 4 end
9594

96-
# Step 4. Call the eSignature REST API
95+
# Call the eSignature REST API
96+
# Step 5 start
97+
envelope_api = create_envelope_api(args)
9798
results = envelope_api.create_envelope args[:account_id], envelope_definition
98-
# ***DS.snippet.0.end
99+
# Step 5 end
99100
end
100101

101102
def get_workflow(args)
102103
#Retrieve the workflow id
104+
103105
begin
106+
# Step 3 start
104107
workflow_details = create_account_api(args)
105108
workflow_response = workflow_details.get_account_identity_verification(args[:account_id])
106109

107110
# Check that idv authentication is enabled
108-
# The workflow ID is a hard-coded value which is unique to this phone authentication workflow
109111
if workflow_response.identity_verification
110-
session[:workflow_id] = "c368e411-1592-4001-a3df-dca94ac539ae"
112+
phone_auth_workflow = workflow_response.identity_verification.find{ |item| item.default_name == "Phone Authentication" }
113+
if phone_auth_workflow
114+
session[:workflow_id] = phone_auth_workflow.workflow_id
111115
return session[:workflow_id]
116+
else
117+
return None
118+
end
112119
else
113120
return None
114121
end
122+
# Step 3 end
115123

116-
rescue DocuSign_Admin::ApiError => e
124+
rescue DocuSign_eSign::ApiError => e
117125
error = JSON.parse e.response_body
118126
@error_code = e.code
119127
@error_message = error['error_description']

app/views/ds_common/index.html.erb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<tbody>
66
<tr>
77
<td>
8-
<h1 class="display-4">DocuSign Code Launcher: Ruby</h1>
9-
<p class="Xlead">This launcher both demonstrates use of Authorization Code Grant and JWT OAuth flows and includes multiple usage examples for the DocuSign eSignature REST API.</p>
8+
<h1 class="display-4">Ruby Launcher</h1>
9+
<p class="Xlead">Run and explore eSignature REST API code examples with Authorization Code Grant or JWT Grant authentication</p>
1010
</td>
1111
<td>
1212
<img src="banner-code.png" />
@@ -26,11 +26,10 @@
2626
<div class="container" style="margin-top: 40px" id="index-page">
2727

2828
<% if @show_doc %>
29-
<p><a target='_blank' href='<%= :documentation %>'>Documentation</a> on using JWT or OAuth Authorization Code Grant from a Node Express application.</p>
29+
<p><a target='_blank' href='<%= :documentation %>'>Documentation</a> on using JWT or OAuth Authorization Code Grant from a Ruby on Rails application.</p>
3030
<% end %>
3131

3232

33-
3433
<h2>Basic examples</h2>
3534

3635
<h4 id="example001">1. <a href="eg001">Use embedded signing</a></h4>
@@ -133,9 +132,8 @@
133132
<a target ='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/">EnvelopeViews::createRecipient</a>.
134133
</p>
135134

136-
137-
138-
<h2>Payments Example</h2>
135+
<h2>Payments</h2>
136+
139137
<h4 id="example014">14. <a href="eg014">Send an envelope with an order form and payment field</a></h4>
140138
<p>Anchor text
141139
(<a target ='_blank' href="https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/auto-place/">AutoPlace</a>)
@@ -145,9 +143,7 @@
145143
<a target ='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
146144
</p>
147145

148-
149-
150-
<h2>Tabs examples</h2>
146+
<h2>Tabs</h2>
151147
<h4 id="example015">15. <a href="eg015">Get the tab data from an envelope</a></h4>
152148
<p>This example retrieves the <a target="_blank" href="https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/">tab</a> (field) values from an envelope for all of the envelope’s recipients.</p>
153149
<p>
@@ -179,34 +175,35 @@
179175
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopecustomfields/list/">EnvelopeCustomFields::list</a>.
180176
</p>
181177

182-
<h2>Recipient Authentication</h2>
183-
<h4 id="example019">19. <a href="eg019">Send an envelope with access code authentication</a></h4>
178+
<h2>Recipient authentication</h2>
179+
180+
<h4 id="example019">19. <a href="eg019">Require access code authentication for a recipient</a></h4>
184181
<p>This example sends an envelope requiring the recipient to enter an access code for multifactor authentication.</p>
185182
<p >API method used:
186183
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
187184
</p>
188185

189-
<h4 id="example020">20. <a href="eg020">Require Phone Authentication for a Recipient</a></h4>
186+
<h4 id="example020">20. <a href="eg020">Require phone authentication for a recipient</a></h4>
190187
<p>Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.</p>
191188
<p>API method used:
192189
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
193190
</p>
194191

195-
<h4 id="example022">22. <a href="eg022">Send an envelope with Recipient Knowledged Based Authentication</a></h4>
192+
<h4 id="example022">22. <a href="eg022">Require knowledge based authentication (KBA) for a recipient</a></h4>
196193
<p>Submit an envelope with multiple choice, public records based questions to provide multi-factor authentication.</p>
197194
<p>API method used:
198195
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
199196
</p>
200197

201-
<h4 id="example023">23. <a href="eg023">IDV Authentication</a></h4>
202-
<p>This is an example of an envelope utilizing Id verification authentication for a recipient.</p>
198+
<h4 id="example023">23. <a href="eg023">Require ID verification (IDV) for a recipient</a></h4>
199+
<p>This is an example of an envelope utilizing ID verification authentication for a recipient.</p>
203200
<p>API methods used:
204201
<a target ='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/accounts/identityverifications/list/">Accounts::getAccountIdentityVerificationsList</a> and <a target ='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
205202
</p>
206203

207-
208204
<h2>Permissions</h2>
209-
<h4 id="example024">24. <a href="eg024">Create a permission profile</a></h4>
205+
206+
<h4 id="example024">24. <a href="eg024">Create a permission profile</a></h4>
210207
<p>
211208
This example creates a user group’s permission profile.
212209
</p>
@@ -234,8 +231,8 @@
234231
<a target='_blank' rel="noopener noreferrer" href="https://developers.docusign.com/docs/esign-rest-api/reference/accounts/accountpermissionprofiles/delete/">AccountPermissionProfiles::delete</a>.
235232
</p>
236233

237-
238234
<h2>Brands</h2>
235+
239236
<h4 id="example028">28. <a href="eg028">Create a brand</a></h4>
240237
<p>This example creates an account brand that can be used to apply customization to your envelopes, including your own logo, colors, and text elements.</p>
241238
<p>API method used:
@@ -255,6 +252,7 @@
255252
</p>
256253

257254
<h2>Bulk operations</h2>
255+
258256
<h4 id="example031">31. <a href="eg031">Bulk send envelopes</a></h4>
259257
<p>This example creates and sends an envelope to multiple recipients using bulk lists.</p>
260258
<p>API methods used:
@@ -273,6 +271,7 @@
273271
</p>
274272

275273
<h2>Advanced recipient routing</h2>
274+
276275
<h4 id="example032">32. <a href="eg032">Pause a signature workflow</a></h4>
277276
<p>This example creates an envelope where the workflow is paused before the envelope is sent to a second recipient.</p>
278277
<p >API method used:
@@ -291,7 +290,8 @@
291290
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
292291
</p>
293292

294-
<h2>Premium Features</h2>
293+
<h2>Premium features</h2>
294+
295295
<h4 id="example035">35. <a href="eg035">Send an envelope by SMS delivery</a></h4>
296296
<p>
297297
This example demonstrates how to send an envelope via an SMS message for a signer (and CC) to read and sign.

0 commit comments

Comments
 (0)