Skip to content

Commit a6a7462

Browse files
Devdocs 6974 (#61)
update sms delivery
1 parent 2a56fd3 commit a6a7462

File tree

4 files changed

+34
-60
lines changed

4 files changed

+34
-60
lines changed

app/controllers/e_sign/eg037_sms_delivery_controller.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ class ESign::Eg037SmsDeliveryController < EgController
66
def create
77
begin
88
envelope_args = {
9-
signer_email: param_gsub(params['signer_email']),
109
signer_name: param_gsub(params['signer_name']),
11-
cc_email: param_gsub(params['cc_email']),
1210
cc_name: param_gsub(params['cc_name']),
1311
cc_phone_number: param_gsub(params['cc_phone_number']),
1412
cc_country_code: param_gsub(params['cc_country_code']),
@@ -25,8 +23,8 @@ def create
2523

2624
results = ESign::Eg037SmsDeliveryService.new(args).worker
2725
session[:envelope_id] = results['envelope_id']
28-
@title = 'Envelope sent'
29-
@h1 = 'Envelope sent'
26+
@title = 'Request a signature by SMS delivery'
27+
@h1 = 'Request a signature by SMS delivery'
3028
@message = "The envelope has been created and sent!<br/>Envelope ID #{results['envelope_id']}."
3129
render 'ds_common/example_done'
3230
rescue DocuSign_eSign::ApiError => e

app/services/e_sign/eg037_sms_delivery_service.rb

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ def worker
1212
# Create the envelope request object
1313
envelope_definition = make_envelope(args[:envelope_args])
1414

15-
# Step 3. Create and send the envelope
15+
# Create and send the envelope
1616
# Call Envelopes::create API method
1717
# Exceptions will be caught by the calling function
1818
envelope_api = create_envelope_api(args)
19-
19+
# Step 3 start
2020
results = envelope_api.create_envelope args[:account_id], envelope_definition
21+
# Step 3 end
2122
envelope_id = results.envelope_id
2223
{ 'envelope_id' => envelope_id }
2324
end
2425

2526
private
26-
27+
# Step 2 start
2728
def make_envelope(envelope_args)
2829
# document 1 (HTML) has tag **signature_1**
2930
# document 2 (DOCX) has tag /sn1/
@@ -35,7 +36,7 @@ def make_envelope(envelope_args)
3536
# The envelope will be sent first to the signer via SMS
3637
# After it is signed, a copy is sent to the cc person via SMS
3738

38-
# Step 2. Create the envelope definition
39+
# Create the envelope definition
3940
envelope_definition = DocuSign_eSign::EnvelopeDefinition.new
4041

4142
envelope_definition.email_subject = 'Please sign this document set'
@@ -75,43 +76,31 @@ def make_envelope(envelope_args)
7576
# The order in the docs array determines the order in the envelope
7677
envelope_definition.documents = [document1, document2, document3]
7778

78-
phone_number = DocuSign_eSign::RecipientPhoneNumber.new
79-
phone_number.country_code=envelope_args[:country_code]
80-
phone_number.number=envelope_args[:phone_number]
81-
82-
sms_notification = DocuSign_eSign::RecipientAdditionalNotification.new
83-
sms_notification.phone_number = phone_number
84-
sms_notification.secondary_delivery_method = "SMS"
79+
signer_phone_number = DocuSign_eSign::RecipientPhoneNumber.new
80+
signer_phone_number.country_code=envelope_args[:country_code]
81+
signer_phone_number.number=envelope_args[:phone_number]
8582

8683
# Create the signer recipient model
8784
signer1 = DocuSign_eSign::Signer.new
88-
signer1.additional_notifications=[sms_notification]
89-
signer1.email = envelope_args[:signer_email]
85+
signer1.phone_number = signer_phone_number
9086
signer1.name = envelope_args[:signer_name]
9187
signer1.recipient_id = '1'
9288
signer1.routing_order = '1'
9389
## routingOrder (lower means earlier) determines the order of deliveries
9490
# to the recipients. Parallel routing order is supported by using the
9591
# same integer as the order for two or more recipients
9692

97-
# Create a RecipientPhoneNumber and add it to the additional SMS notification
9893
cc_phone_number = DocuSign_eSign::RecipientPhoneNumber.new
9994
cc_phone_number.country_code=envelope_args[:cc_country_code]
10095
cc_phone_number.number=envelope_args[:cc_phone_number]
10196

102-
103-
cc_sms_notification = DocuSign_eSign::RecipientAdditionalNotification.new
104-
cc_sms_notification.phone_number=cc_phone_number
105-
cc_sms_notification.secondary_delivery_method = "SMS"
106-
10797
# Create a cc recipient to receive a copy of the documents
108-
cc1 = DocuSign_eSign::CarbonCopy.new(
109-
email: envelope_args[:cc_email],
110-
name: envelope_args[:cc_name],
111-
routingOrder: '2',
112-
recipientId: '2',
113-
additionalNotifications: [cc_sms_notification]
114-
)
98+
cc1 = DocuSign_eSign::CarbonCopy.new
99+
cc1.name = envelope_args[:cc_name]
100+
cc1.routing_order = '2'
101+
cc1.recipient_id = '2'
102+
cc1.phone_number = cc_phone_number
103+
115104
# Create signHere fields (also known as tabs) on the documents
116105
# We're using anchor (autoPlace) positioning
117106
#
@@ -165,8 +154,8 @@ def create_document1(args)
165154
margin-top: 0px;margin-bottom: 3.5em;font-size: 1em;
166155
color: darkblue;\">Order Processing Division</h2>
167156
<h4>Ordered by #{args[:signer_name]}</h4>
168-
<p style=\"margin-top:0em; margin-bottom:0em;\">Email: #{args[:signer_email]}</p>
169-
<p style=\"margin-top:0em; margin-bottom:0em;\">Copy to: #{args[:cc_name]}, #{args[:cc_email]}</p>
157+
<p style=\"margin-top:0em; margin-bottom:0em;\">Phone number: #{args[:phone_number]}</p>
158+
<p style=\"margin-top:0em; margin-bottom:0em;\">Copy to: #{args[:cc_name]}, #{args[:cc_phone_number]}</p>
170159
<p style=\"margin-top:3em;\">
171160
Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie. Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée. Gummi bears cupcake biscuit tiramisu sugar plum pastry. Dragée gummies applicake pudding liquorice. Donut jujubes oat cake jelly-o. Dessert bear claw chocolate cake gummies lollipop sugar plum ice cream gummies cheesecake.
172161
</p>
@@ -175,4 +164,5 @@ def create_document1(args)
175164
</body>
176165
</html>"
177166
end
178-
end
167+
# Step 2 end
168+
end

app/views/ds_common/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@
309309

310310
<h2>Premium features</h2>
311311

312-
<h4 id="example037">37. <a href="eg037">Send an envelope by SMS delivery</a></h4>
312+
<h4 id="example037">37. <a href="eg037">Request a signature by SMS delivery</a></h4>
313313
<p>
314-
This example demonstrates how to send an envelope via an SMS message for a signer (and CC) to read and sign.
314+
Sends a signature request via an SMS message.
315315
</p>
316316
<p>
317317
API method used:
Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
<h4>37. Send an envelope via SMS delivery</h4>
2-
1+
<h4>37. Request a signature by SMS delivery</h4>
32
<p>
4-
This is a general example of creating and sending an envelope (a signing request) to a recipient and notifying that recipient via SMS delivery.
3+
Sends a signature request via an SMS message.
54
</p>
65

76
<p>API method used:
8-
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>,
7+
<a target='_blank' href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create</a>.
98
</p>
109

1110
<p>
@@ -16,49 +15,36 @@ This is a general example of creating and sending an envelope (a signing request
1615
<div class="form-group">
1716
<label for="country_code">Signer Country Code</label>
1817
<input type="tel" class="form-control" id="country_code" name="country_code"
19-
aria-describedby="accessHelp" placeholder="1" required
18+
aria-describedby="accessHelp" placeholder="1" required />
2019
<small id="accessHelp" class="form-text text-muted">The country code for the phone number below.</small>
2120
</div>
2221
<div class="form-group">
2322
<label for="phone_number">Signer Phone Number</label>
2423
<input type="tel" class="form-control" id="phone_number" name="phone_number"
25-
aria-describedby="accessHelp" placeholder="415-555-1212" required
26-
<small id="accessHelp" class="form-text text-muted">This phone number will receive a notification. We'll never share your phone number with anyone else.</small>
27-
</div>
28-
<div class="form-group">
29-
<label for="signer_email">Signer Email</label>
30-
<input type="email" class="form-control" id="signer_email" name="signer_email"
31-
aria-describedby="emailHelp" placeholder="pat@example.com" required
32-
value="<%= @config.signer_email %>">
33-
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
24+
aria-describedby="accessHelp" placeholder="415-555-1212" required />
25+
<small id="accessHelp" class="form-text text-muted">This phone number will receive a notification. We'll never share your phone number.</small>
3426
</div>
3527
<div class="form-group">
3628
<label for="signer_name">Signer Name</label>
3729
<input type="text" class="form-control" id="signer_name" placeholder="Pat Johnson" name="signer_name"
38-
value="<%= @config.signer_name %>" required>
30+
value="<%= @config.signer_name %>" required />
3931
</div>
4032
<div class="form-group">
4133
<label for="country_code">CC Country Code</label>
4234
<input type="tel" class="form-control" id="cc_country_code" name="cc_country_code"
43-
aria-describedby="accessHelp" placeholder="1" required
35+
aria-describedby="accessHelp" placeholder="1" required />
4436
<small id="accessHelp" class="form-text text-muted">The country code for the phone number below.</small>
4537
</div>
4638
<div class="form-group">
4739
<label for="phone_number">CC Phone Number</label>
4840
<input type="tel" class="form-control" id="cc_phone_number" name="cc_phone_number"
49-
aria-describedby="accessHelp" placeholder="415-555-1212" required
50-
<small id="accessHelp" class="form-text text-muted">This phone number will receive a notification. We'll never share your phone number with anyone else.</small>
51-
</div>
52-
<div class="form-group">
53-
<label for="cc_email">CC Email</label>
54-
<input type="email" class="form-control" id="cc_email" name="cc_email"
55-
aria-describedby="emailHelp" placeholder="pat@example.com" required />
56-
<small id="emailHelp" class="form-text text-muted">The email for the cc recipient must be different from the signer's email.</small>
41+
aria-describedby="accessHelp" placeholder="415-555-1212" required />
42+
<small id="accessHelp" class="form-text text-muted">This phone number will receive a notification. We'll never share your phone number.</small>
5743
</div>
5844
<div class="form-group">
5945
<label for="cc_name">CC Name</label>
6046
<input type="text" class="form-control" id="cc_name" placeholder="Pat Johnson" name="cc_name"
6147
required />
6248
</div>
6349
<button type="submit" class="btn btn-docu">Submit</button>
64-
</form>
50+
</form>

0 commit comments

Comments
 (0)