Skip to content

Commit

Permalink
add whatsapp option (#133)
Browse files Browse the repository at this point in the history
* add whatsapp option to SMS delivery example
  • Loading branch information
karissarjacobsen authored Aug 29, 2023
1 parent c5266db commit d2144a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/controllers/e_sign/eeg037_sms_delivery_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ESign::Eeg037SmsDeliveryController < EgController

def create
envelope_args = {
delivery_method: param_gsub(params['delivery_method']),
signer_name: param_gsub(params['signer_name']),
cc_name: param_gsub(params['cc_name']),
cc_phone_number: param_gsub(params['cc_phone_number']),
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/eg_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def get

def set_meta
@source_file = file_name.to_s
#remove extra character that doesn't exist in service file
index = @source_file.index('/')
@source_file[index + 1] = ''
@source_url = "#{Rails.application.config.github_example_url}#{@source_file}"
end

Expand Down
4 changes: 2 additions & 2 deletions app/services/e_sign/eg037_sms_delivery_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def make_envelope(envelope_args)
signer1.name = envelope_args[:signer_name]
signer1.recipient_id = '1'
signer1.routing_order = '1'
signer1.delivery_method = 'SMS'
signer1.delivery_method = envelope_args[:delivery_method]

## routingOrder (lower means earlier) determines the order of deliveries
# to the recipients. Parallel routing order is supported by using the
Expand All @@ -104,7 +104,7 @@ def make_envelope(envelope_args)
cc1.routing_order = '2'
cc1.recipient_id = '2'
cc1.phone_number = cc_phone_number
cc1.delivery_method = 'SMS'
cc1.delivery_method = envelope_args[:delivery_method]

# Create signHere fields (also known as tabs) on the documents
# We're using anchor (autoPlace) positioning
Expand Down
11 changes: 11 additions & 0 deletions app/views/e_sign/eeg037_sms_delivery/get.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@
<% cc_code_index = 3 %>
<% cc_phone_index = 4 %>
<% cc_name_index = 5 %>
<% delivery_method_index = 6 %>
<% sms_index = 7 %>
<% whatsapp_index = 8 %>

<form class="eg" id="data_form" action="" method="post" data-busy="form">
<% if @example["Forms"][form_index]["FormName"] %>
<%= sanitize @example["Forms"][form_index]["FormName"] %>
<% end %>

<div class="form-group">
<label for="delivery_method"><%= @example["Forms"][form_index]["Inputs"][delivery_method_index]["InputName"] %></label></br>
<label for="sms_delivery"><%= @example["Forms"][form_index]["Inputs"][sms_index]["InputName"] %></label>
<input type="radio" name="delivery_method" value="SMS" checked/>
<label for="whatsapp_delivery"><%= @example["Forms"][form_index]["Inputs"][whatsapp_index]["InputName"] %></label>
<input type="radio" name="delivery_method" value="WhatsApp"/>
</div>

<div class="form-group">
<label for="country_code"><%= @example["Forms"][form_index]["Inputs"][signer_code_index]["InputName"] %></label>
<input type="tel" class="form-control" id="country_code" name="country_code"
Expand Down

0 comments on commit d2144a7

Please sign in to comment.