From 1c6f153247967de4f2b2609de362895d077ce1d8 Mon Sep 17 00:00:00 2001 From: RomanBachaloSigmaSoftware <77355790+RomanBachaloSigmaSoftware@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:06:31 +0300 Subject: [PATCH] Maestro API code examples (#156) * added Maestro code examples --- Gemfile | 2 +- Gemfile.lock | 120 ++-- app/assets/javascripts/search.js | 3 + .../eeg008_create_template_controller.rb | 1 + .../mseg001_trigger_workflow_controller.rb | 112 ++++ .../mseg002_cancel_workflow_controller.rb | 52 ++ .../mseg003_get_workflow_status_controller.rb | 34 + app/controllers/session_controller.rb | 1 + app/services/jwt_auth/jwt_creator.rb | 1 + .../mseg001_trigger_workflow_service.rb | 71 ++ .../mseg002_cancel_workflow_service.rb | 41 ++ .../mseg003_get_workflow_status_service.rb | 29 + app/services/maestro_api/utils.rb | 621 ++++++++++++++++++ app/services/utils.rb | 13 + app/views/ds_common/index.html.erb | 2 + .../mseg001_trigger_workflow/get.html.erb | 54 ++ .../publish_workflow.html.erb | 7 + .../mseg002_cancel_workflow/get.html.erb | 33 + .../mseg003_get_workflow_status/get.html.erb | 33 + config/appsettings.example.yml | 1 + config/initializers/omniauth.rb | 2 + config/routes.rb | 12 + 22 files changed, 1185 insertions(+), 60 deletions(-) create mode 100644 app/controllers/maestro_api/mseg001_trigger_workflow_controller.rb create mode 100644 app/controllers/maestro_api/mseg002_cancel_workflow_controller.rb create mode 100644 app/controllers/maestro_api/mseg003_get_workflow_status_controller.rb create mode 100644 app/services/maestro_api/mseg001_trigger_workflow_service.rb create mode 100644 app/services/maestro_api/mseg002_cancel_workflow_service.rb create mode 100644 app/services/maestro_api/mseg003_get_workflow_status_service.rb create mode 100644 app/services/maestro_api/utils.rb create mode 100644 app/views/maestro_api/mseg001_trigger_workflow/get.html.erb create mode 100644 app/views/maestro_api/mseg001_trigger_workflow/publish_workflow.html.erb create mode 100644 app/views/maestro_api/mseg002_cancel_workflow/get.html.erb create mode 100644 app/views/maestro_api/mseg003_get_workflow_status/get.html.erb diff --git a/Gemfile b/Gemfile index c87beb2..3a3e8cb 100644 --- a/Gemfile +++ b/Gemfile @@ -71,9 +71,9 @@ end gem 'docusign_admin', '~> 1.3.0' gem 'docusign_click', '~> 1.4.0' gem 'docusign_esign', '~> 3.25.0' +gem 'docusign_maestro', '~> 1.0.0.rc1' gem 'docusign_monitor', '~> 1.2.0' gem 'docusign_rooms', '~> 1.3.0' -gem 'docusign_webforms', '~> 1.0.0' gem 'omniauth-oauth2', '~> 1.8.0' gem 'omniauth-rails_csrf_protection' diff --git a/Gemfile.lock b/Gemfile.lock index 71e12a2..aa7bfb2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -66,11 +66,12 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) archive-zip (0.12.0) io-like (~> 0.3.0) ast (2.4.2) + base64 (0.2.0) bindex (0.8.1) bootsnap (1.7.7) msgpack (~> 1.0) @@ -96,9 +97,9 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) crass (1.0.6) - date (3.3.3) + date (3.3.4) docusign_admin (1.3.0) addressable (~> 2.7, >= 2.7.0) json (~> 2.1, >= 2.1.0) @@ -114,17 +115,17 @@ GEM json (~> 2.1, >= 2.1.0) jwt (~> 2.2, >= 2.2.1) typhoeus (~> 1.0, >= 1.0.1) - docusign_monitor (1.2.0) + docusign_maestro (1.0.0.rc1) addressable (~> 2.7, >= 2.7.0) json (~> 2.1, >= 2.1.0) jwt (~> 2.2, >= 2.2.1) typhoeus (~> 1.0, >= 1.0.1) - docusign_rooms (1.3.0) + docusign_monitor (1.2.0) addressable (~> 2.7, >= 2.7.0) json (~> 2.1, >= 2.1.0) jwt (~> 2.2, >= 2.2.1) typhoeus (~> 1.0, >= 1.0.1) - docusign_webforms (1.0.0) + docusign_rooms (1.3.0) addressable (~> 2.7, >= 2.7.0) json (~> 2.1, >= 2.1.0) jwt (~> 2.2, >= 2.2.1) @@ -132,28 +133,29 @@ GEM erubi (1.12.0) ethon (0.16.0) ffi (>= 1.15.0) - execjs (2.8.1) - faraday (2.7.10) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.2) - ffi (1.15.5) - ffi (1.15.5-x64-mingw-ucrt) - globalid (1.1.0) - activesupport (>= 5.0) + execjs (2.9.1) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-net_http (3.1.0) + net-http + ffi (1.16.3) + ffi (1.16.3-x64-mingw-ucrt) + globalid (1.2.1) + activesupport (>= 6.1) hashie (5.0.0) - i18n (1.14.1) + i18n (1.14.4) concurrent-ruby (~> 1.0) io-like (0.3.1) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.6.3) - jwt (2.7.1) + json (2.7.2) + jwt (2.8.1) + base64 listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -161,28 +163,28 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.19.0) + minitest (5.22.3) msgpack (1.7.2) multi_xml (0.6.0) - net-imap (0.3.7) + net-http (0.4.1) + uri + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.5.0) net-protocol - nio4r (2.5.9) - nokogiri (1.15.4-x64-mingw-ucrt) - racc (~> 1.4) - nokogiri (1.15.4-x86_64-darwin) + nio4r (2.7.1) + nokogiri (1.16.3-x64-mingw-ucrt) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.3-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -191,7 +193,7 @@ GEM rack (>= 1.2, < 4) snaky_hash (~> 2.0) version_gem (~> 1.1) - omniauth (2.1.1) + omniauth (2.1.2) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection @@ -201,8 +203,8 @@ GEM omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) omniauth (~> 2.0) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc power_assert (2.0.3) @@ -213,12 +215,13 @@ GEM pry (>= 0.9.10, < 0.15) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (5.0.3) + public_suffix (5.0.5) puma (6.1.1) nio4r (~> 2.0) - racc (1.7.1) - rack (2.2.8) - rack-protection (3.1.0) + racc (1.7.3) + rack (2.2.9) + rack-protection (3.2.0) + base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) @@ -251,11 +254,11 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.0.6) + rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.8.1) + regexp_parser (2.9.0) rexml (3.2.6) rubocop (1.48.1) json (~> 2.3) @@ -267,10 +270,9 @@ GEM rubocop-ast (>= 1.26.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) rubyzip (2.3.2) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -289,29 +291,28 @@ GEM snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) - spring (4.1.1) + spring (4.1.3) spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) spring (>= 4) - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.4-x64-mingw-ucrt) - sqlite3 (1.6.4-x86_64-darwin) - sqlite3 (1.6.4-x86_64-linux) - test-unit (3.6.1) + sqlite3 (1.6.9-x64-mingw-ucrt) + sqlite3 (1.6.9-x86_64-linux) + test-unit (3.6.2) power_assert - thor (1.2.2) - tilt (2.2.0) - timeout (0.4.0) + thor (1.3.1) + tilt (2.3.0) + timeout (0.4.1) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - typhoeus (1.4.0) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -319,24 +320,25 @@ GEM tzinfo (>= 1.0.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (2.4.2) - version_gem (1.1.3) - web-console (4.2.0) + unicode-display_width (2.5.0) + uri (0.13.0) + version_gem (1.1.4) + wdm (0.1.1) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket (1.2.9) + websocket (1.2.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.13) PLATFORMS x64-mingw-ucrt - x86_64-darwin-21 x86_64-linux DEPENDENCIES @@ -348,9 +350,9 @@ DEPENDENCIES docusign_admin (~> 1.3.0) docusign_click (~> 1.4.0) docusign_esign (~> 3.25.0) + docusign_maestro (~> 1.0.0.rc1) docusign_monitor (~> 1.2.0) docusign_rooms (~> 1.3.0) - docusign_webforms (~> 1.0.0) jbuilder (~> 2.11.5) listen (~> 3.8.0) matrix (~> 0.4.2) @@ -377,4 +379,4 @@ RUBY VERSION ruby 3.1.2p20 BUNDLED WITH - 2.3.7 + 2.4.22 diff --git a/app/assets/javascripts/search.js b/app/assets/javascripts/search.js index 9668b39..612e088 100644 --- a/app/assets/javascripts/search.js +++ b/app/assets/javascripts/search.js @@ -7,6 +7,7 @@ const DS_SEARCH = (function () { ADMIN: "admin", CONNECT: "connect", WEBFORMS: "webforms", + MAESTRO: "maestro", } const processJSONData = function () { @@ -145,6 +146,8 @@ const DS_SEARCH = (function () { return "cneg"; case API_TYPES.WEBFORMS: return "weg"; + case API_TYPES.MAESTRO: + return "mseg"; } } diff --git a/app/controllers/e_sign/eeg008_create_template_controller.rb b/app/controllers/e_sign/eeg008_create_template_controller.rb index 43b08fd..4a38528 100644 --- a/app/controllers/e_sign/eeg008_create_template_controller.rb +++ b/app/controllers/e_sign/eeg008_create_template_controller.rb @@ -13,6 +13,7 @@ def create } results = ESign::Eg008CreateTemplateService.new(args).worker session[:template_id] = results[:template_id] + session[:workflow_template_id] = results[:template_id] msg = if results.fetch(:created_new_template) 'The template has been created!' else diff --git a/app/controllers/maestro_api/mseg001_trigger_workflow_controller.rb b/app/controllers/maestro_api/mseg001_trigger_workflow_controller.rb new file mode 100644 index 0000000..db30552 --- /dev/null +++ b/app/controllers/maestro_api/mseg001_trigger_workflow_controller.rb @@ -0,0 +1,112 @@ +class MaestroApi::Mseg001TriggerWorkflowController < EgController + before_action -> { check_auth('Maestro') } + before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Maestro') } + + def create + args = { + instance_name: params[:instance_name], + signer_email: params[:signer_email], + signer_name: params[:signer_name], + cc_email: params[:cc_email], + cc_name: params[:cc_name], + workflow_id: session[:workflow_id], + account_id: session[:ds_account_id], + access_token: session[:ds_access_token], + base_path: Rails.application.config.maestro_client_host + } + + trigger_workflow_service = MaestroApi::Mseg001TriggerWorkflowService.new args + workflow = trigger_workflow_service.get_workflow_definition + results = trigger_workflow_service.trigger_workflow workflow + + session[:instance_id] = results.instance_id + + @title = @example['ExampleName'] + @message = format_string(@example['ResultsPageText'], results.instance_id) + @json = results.to_json.to_json + + render 'ds_common/example_done' + rescue DocuSign_Maestro::ApiError => e + @error_code = e.code || error['errorCode'] + if e.to_s == '403' + @error_message = format_string(@manifest['SupportingTexts']['ContactSupportToEnableFeature'], 'Maestro') + return render 'ds_common/error' + end + handle_error(e) + end + + def get + args = { + template_id: session[:workflow_template_id], + account_id: session[:ds_account_id], + access_token: session[:ds_access_token], + base_path: Rails.application.config.maestro_client_host + } + + trigger_workflow_service = MaestroApi::Mseg001TriggerWorkflowService.new args + workflows = trigger_workflow_service.get_workflow_definitions + + if workflows.count.positive? + sorted_workflows = workflows.value.sort_by(&:last_updated_date).reverse + + session[:workflow_id] = sorted_workflows[0].id if sorted_workflows + session[:is_workflow_published] = true + end + + unless session[:workflow_id] + unless session[:workflow_template_id] + @show_template_not_ok = true + return render 'maestro_api/mseg001_trigger_workflow/get' + end + + session[:workflow_id] = MaestroApi::Utils.new.create_workflow args + end + unless session[:is_workflow_published] + consent_url = MaestroApi::Utils.new.publish_workflow args, session[:workflow_id] + if consent_url + additional_page_data = @example['AdditionalPage'].find { |p| p['Name'] == 'publish_workflow' } + @title = @example['ExampleName'] + @message = additional_page_data['ResultsPageText'] + @consent_url = consent_url + + render 'maestro_api/mseg001_trigger_workflow/publish_workflow' + end + end + rescue DocuSign_Maestro::ApiError => e + @error_code = e.code || error['errorCode'] + if e.to_s == '403' + @error_message = format_string(@manifest['SupportingTexts']['ContactSupportToEnableFeature'], 'Maestro') + return render 'ds_common/error' + end + handle_error(e) + end + + def publish + args = { + account_id: session[:ds_account_id], + access_token: session[:ds_access_token], + base_path: Rails.application.config.maestro_client_host + } + + consent_url = MaestroApi::Utils.new.publish_workflow args, session[:workflow_id] + + if consent_url + additional_page_data = @example['AdditionalPage'].find { |p| p['Name'] == 'publish_workflow' } + @title = @example['ExampleName'] + @message = additional_page_data['ResultsPageText'] + @consent_url = consent_url + + return render 'maestro_api/mseg001_trigger_workflow/publish_workflow' + end + + session[:is_workflow_published] = true + render 'maestro_api/mseg001_trigger_workflow/get' + rescue DocuSign_Maestro::ApiError => e + @error_code = e.code || error['errorCode'] + if e.to_s == '403' + @error_message = format_string(@manifest['SupportingTexts']['ContactSupportToEnableFeature'], 'Maestro') + return render 'ds_common/error' + end + handle_error(e) + end +end diff --git a/app/controllers/maestro_api/mseg002_cancel_workflow_controller.rb b/app/controllers/maestro_api/mseg002_cancel_workflow_controller.rb new file mode 100644 index 0000000..673ab8c --- /dev/null +++ b/app/controllers/maestro_api/mseg002_cancel_workflow_controller.rb @@ -0,0 +1,52 @@ +class MaestroApi::Mseg002CancelWorkflowController < EgController + before_action -> { check_auth('Maestro') } + before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 2, 'Maestro') } + + def create + args = { + workflow_id: session[:workflow_id], + instance_id: session[:instance_id], + account_id: session[:ds_account_id], + access_token: session[:ds_access_token], + base_path: Rails.application.config.maestro_client_host + } + + results = MaestroApi::Mseg002CancelWorkflowService.new(args).cancel_workflow_instance + + @title = @example['ExampleName'] + @message = format_string(@example['ResultsPageText'], session[:instance_id]) + @json = results.to_json.to_json + + render 'ds_common/example_done' + rescue DocuSign_Maestro::ApiError => e + @error_code = e.code || error['errorCode'] + if e.to_s == '403' + @error_message = format_string(@manifest['SupportingTexts']['ContactSupportToEnableFeature'], 'Maestro') + return render 'ds_common/error' + end + handle_error(e) + end + + def get + args = { + workflow_id: session[:workflow_id], + instance_id: session[:instance_id], + account_id: session[:ds_account_id], + access_token: session[:ds_access_token], + base_path: Rails.application.config.maestro_client_host + } + + state = MaestroApi::Mseg002CancelWorkflowService.new(args).get_instance_state + @instance_ok = state.downcase == 'in progress' + + @workflow_id = session[:workflow_id] + @instance_id = session[:instance_id] + rescue DocuSign_Maestro::ApiError => e + @error_code = e.code || error['errorCode'] + if e.to_s == '403' + @error_message = format_string(@manifest['SupportingTexts']['ContactSupportToEnableFeature'], 'Maestro') + return render 'ds_common/error' + end + handle_error(e) + end +end diff --git a/app/controllers/maestro_api/mseg003_get_workflow_status_controller.rb b/app/controllers/maestro_api/mseg003_get_workflow_status_controller.rb new file mode 100644 index 0000000..43bcd2e --- /dev/null +++ b/app/controllers/maestro_api/mseg003_get_workflow_status_controller.rb @@ -0,0 +1,34 @@ +class MaestroApi::Mseg003GetWorkflowStatusController < EgController + before_action -> { check_auth('Maestro') } + before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 3, 'Maestro') } + + def create + args = { + workflow_id: session[:workflow_id], + instance_id: session[:instance_id], + account_id: session[:ds_account_id], + access_token: session[:ds_access_token], + base_path: Rails.application.config.maestro_client_host + } + + results = MaestroApi::Mseg003GetWorkflowStatusService.new(args).get_instance_state + + @title = @example['ExampleName'] + @message = format_string(@example['ResultsPageText'], results.instance_state) + @json = results.to_json.to_json + + render 'ds_common/example_done' + rescue DocuSign_Maestro::ApiError => e + @error_code = e.code || error['errorCode'] + if e.to_s == '403' + @error_message = format_string(@manifest['SupportingTexts']['ContactSupportToEnableFeature'], 'Maestro') + return render 'ds_common/error' + end + handle_error(e) + end + + def get + @workflow_id = session[:workflow_id] + @instance_id = session[:instance_id] + end +end diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index 97a70eb..466fa6b 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -59,6 +59,7 @@ def internal_destroy session.delete :eg session.delete :manifest session.delete :status_cfr + session.delete :is_workflow_published end def store_auth_hash_from_docusign_callback diff --git a/app/services/jwt_auth/jwt_creator.rb b/app/services/jwt_auth/jwt_creator.rb index 708ca2f..8dbbc72 100644 --- a/app/services/jwt_auth/jwt_creator.rb +++ b/app/services/jwt_auth/jwt_creator.rb @@ -18,6 +18,7 @@ def self.consent_url(state, api) scope = 'signature impersonation click.manage click.send' if api == 'Click' scope = 'signature impersonation organization_read group_read permission_read user_read user_write account_read domain_read identity_provider_read user_data_redact asset_group_account_read asset_group_account_clone_write asset_group_account_clone_read' if api == 'Admin' scope = 'signature webforms_read webforms_instance_read webforms_instance_write' if api == 'WebForms' + scope = 'signature aow_manage' if api == 'Maestro' base_uri = "#{Rails.configuration.authorization_server}/oauth/auth" response_type = 'code' diff --git a/app/services/maestro_api/mseg001_trigger_workflow_service.rb b/app/services/maestro_api/mseg001_trigger_workflow_service.rb new file mode 100644 index 0000000..bf7262d --- /dev/null +++ b/app/services/maestro_api/mseg001_trigger_workflow_service.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +class MaestroApi::Mseg001TriggerWorkflowService + include Utils + attr_reader :args + + def initialize(args) + @args = args + end + + def get_workflow_definitions + #ds-snippet-start:Maestro1Step2 + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + #ds-snippet-end:Maestro1Step2 + + workflow_management_api = DocuSign_Maestro::WorkflowManagementApi.new(api_client) + + options = DocuSign_Maestro::GetWorkflowDefinitionsOptions.new + options.status = 'active' + workflow_management_api.get_workflow_definitions(args[:account_id], options) + end + + def get_workflow_definition + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + + #ds-snippet-start:Maestro1Step3 + workflow_management_api = DocuSign_Maestro::WorkflowManagementApi.new(api_client) + workflow_management_api.get_workflow_definition(args[:account_id], args[:workflow_id]) + #ds-snippet-end:Maestro1Step3 + end + + def trigger_workflow(workflow) + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + + #ds-snippet-start:Maestro1Step4 + trigger_payload = DocuSign_Maestro::TriggerPayload.new + trigger_payload.instance_name = args[:instance_name] + trigger_payload.participants = {} + trigger_payload.payload = { + signerEmail: args[:signer_email], + signerName: args[:signer_name], + ccEmail: args[:cc_email], + ccName: args[:cc_name] + } + trigger_payload.metadata = {} + + mtid = URLUtils.new.get_parameter_value_from_url(workflow.trigger_url, 'mtid') + mtsec = URLUtils.new.get_parameter_value_from_url(workflow.trigger_url, 'mtsec') + trigger_options = DocuSign_Maestro::TriggerWorkflowOptions.new + trigger_options.mtid = mtid + trigger_options.mtsec = mtsec + #ds-snippet-end:Maestro1Step4 + + #ds-snippet-start:Maestro1Step5 + workflow_trigger_api = DocuSign_Maestro::WorkflowTriggerApi.new(api_client) + workflow_trigger_api.trigger_workflow(args[:account_id], trigger_payload, trigger_options) + #ds-snippet-end:Maestro1Step5 + end +end diff --git a/app/services/maestro_api/mseg002_cancel_workflow_service.rb b/app/services/maestro_api/mseg002_cancel_workflow_service.rb new file mode 100644 index 0000000..1717e49 --- /dev/null +++ b/app/services/maestro_api/mseg002_cancel_workflow_service.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class MaestroApi::Mseg002CancelWorkflowService + attr_reader :args + + def initialize(args) + @args = args + end + + def get_instance_state + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + + workflow_instance_management_api = DocuSign_Maestro::WorkflowInstanceManagementApi.new(api_client) + + workflow_instance_management_api.get_workflow_instance( + args[:account_id], + args[:workflow_id], + args[:instance_id] + ).instance_state + end + + def cancel_workflow_instance + #ds-snippet-start:Maestro2Step2 + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + #ds-snippet-end:Maestro2Step2 + + #ds-snippet-start:Maestro2Step3 + workflow_instance_management_api = DocuSign_Maestro::WorkflowInstanceManagementApi.new(api_client) + + workflow_instance_management_api.cancel_workflow_instance(args[:account_id], args[:instance_id]) + #ds-snippet-end:Maestro2Step3 + end +end diff --git a/app/services/maestro_api/mseg003_get_workflow_status_service.rb b/app/services/maestro_api/mseg003_get_workflow_status_service.rb new file mode 100644 index 0000000..47e1c06 --- /dev/null +++ b/app/services/maestro_api/mseg003_get_workflow_status_service.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class MaestroApi::Mseg003GetWorkflowStatusService + attr_reader :args + + def initialize(args) + @args = args + end + + def get_instance_state + #ds-snippet-start:Maestro3Step2 + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + #ds-snippet-end:Maestro3Step2 + + #ds-snippet-start:Maestro3Step3 + workflow_instance_management_api = DocuSign_Maestro::WorkflowInstanceManagementApi.new(api_client) + + workflow_instance_management_api.get_workflow_instance( + args[:account_id], + args[:workflow_id], + args[:instance_id] + ) + #ds-snippet-end:Maestro3Step3 + end +end diff --git a/app/services/maestro_api/utils.rb b/app/services/maestro_api/utils.rb new file mode 100644 index 0000000..58a9f02 --- /dev/null +++ b/app/services/maestro_api/utils.rb @@ -0,0 +1,621 @@ +# frozen_string_literal: true + +require 'securerandom' + +class MaestroApi::Utils + def create_workflow(args) + signer_id = SecureRandom.uuid + cc_id = SecureRandom.uuid + trigger_id = 'wfTrigger' + + participants = { + signer_id => { + 'participantRole' => 'Signer' + }, + cc_id => { + 'participantRole' => 'CC' + } + } + + dac_id_field = "dacId_#{trigger_id}" + id_field = "id_#{trigger_id}" + signer_name_field = "signerName_#{trigger_id}" + signer_email_field = "signerEmail_#{trigger_id}" + cc_name_field = "ccName_#{trigger_id}" + cc_email_field = "ccEmail_#{trigger_id}" + + trigger = DocuSign_Maestro::DSWorkflowTrigger.new({ + name: 'Get_URL', + type: 'Http', + httpType: 'Get', + id: trigger_id, + input: { + metadata: { + customAttributes: {} + }, + payload: { + "#{dac_id_field}": { + source: 'step', + propertyName: 'dacId', + stepId: trigger_id + }, + "#{id_field}": { + source: 'step', + propertyName: 'id', + stepId: trigger_id + }, + "#{signer_name_field}": { + source: 'step', + propertyName: 'signerName', + stepId: trigger_id + }, + "#{signer_email_field}": { + source: 'step', + propertyName: 'signerEmail', + stepId: trigger_id + }, + "#{cc_name_field}": { + source: 'step', + propertyName: 'ccName', + stepId: trigger_id + }, + "#{cc_email_field}": { + source: 'step', + propertyName: 'ccEmail', + stepId: trigger_id + } + }, + participants: {} + }, + output: { + "#{dac_id_field}": { + source: 'step', + propertyName: 'dacId', + stepId: trigger_id + } + } + }) + + variables = { + "#{dac_id_field}": DocuSign_Maestro::DSWorkflowVariableFromVariable.new({ + source: 'step', + propertyName: 'dacId', + stepId: trigger_id + }), + "#{id_field}": DocuSign_Maestro::DSWorkflowVariableFromVariable.new({ + source: 'step', + propertyName: 'id', + stepId: trigger_id + }), + "#{signer_name_field}": DocuSign_Maestro::DSWorkflowVariableFromVariable.new({ + source: 'step', + propertyName: 'signerName', + stepId: trigger_id + }), + "#{signer_email_field}": DocuSign_Maestro::DSWorkflowVariableFromVariable.new({ + source: 'step', + propertyName: 'signerEmail', + stepId: trigger_id + }), + "#{cc_name_field}": DocuSign_Maestro::DSWorkflowVariableFromVariable.new({ + source: 'step', + propertyName: 'ccName', + stepId: trigger_id + }), + "#{cc_email_field}": DocuSign_Maestro::DSWorkflowVariableFromVariable.new({ + source: 'step', + propertyName: 'ccEmail', + stepId: trigger_id + }), + 'envelopeId_step2': { + 'source': 'step', + 'propertyName': 'envelopeId', + 'stepId': 'step2', + 'type': 'String' + }, + 'combinedDocumentsBase64_step2': { + 'source': 'step', + 'propertyName': 'combinedDocumentsBase64', + 'stepId': 'step2', + 'type': 'File' + }, + 'fields.signer.text.value_step2': { + 'source': 'step', + 'propertyName': 'fields.signer.text.value', + 'stepId': 'step2', + 'type': 'String' + } + } + + step1 = { + 'id': 'step1', + 'name': 'Set Up Invite', + 'moduleName': 'Notification-SendEmail', + 'configurationProgress': 'Completed', + 'type': 'DS-EmailNotification', + 'config': { + 'templateType': 'WorkflowParticipantNotification', + 'templateVersion': 1, + 'language': 'en', + 'sender_name': 'DocuSign Orchestration', + 'sender_alias': 'Orchestration', + 'participantId': signer_id + }, + 'input': { + 'recipients': [ + { + 'name': { + 'source': 'step', + 'propertyName': 'signerName', + 'stepId': trigger_id + }, + 'email': { + 'source': 'step', + 'propertyName': 'signerEmail', + 'stepId': trigger_id + } + } + ], + 'mergeValues': { + 'CustomMessage': 'Follow this link to access and complete the workflow.', + 'ParticipantFullName': { + 'source': 'step', + 'propertyName': 'signerName', + 'stepId': trigger_id + } + } + }, + 'output': {} + } + + step2 = { + "id": 'step2', + "name": 'Get Signatures', + "moduleName": 'ESign', + "configurationProgress": 'Completed', + "type": 'DS-Sign', + "config": { + "participantId": signer_id + }, + "input": { + "isEmbeddedSign": true, + "documents": [ + { + "type": 'FromDSTemplate', + "eSignTemplateId": args[:template_id] + } + ], + "emailSubject": 'Please sign this document', + "emailBlurb": '', + "recipients": { + "signers": [ + { + "defaultRecipient": 'false', + "tabs": { + "signHereTabs": [ + { + "stampType": 'signature', + "name": 'SignHere', + "tabLabel": 'Sign Here', + "scaleValue": '1', + "optional": 'false', + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '191', + "yPosition": '148', + "tabId": '1', + "tabType": 'signhere' + } + ], + 'textTabs': [ + { + "requireAll": 'false', + "value": '', + "required": 'false', + "locked": 'false', + "concealValueOnDocument": 'false', + "disableAutoSize": 'false', + "tabLabel": 'text', + "font": 'helvetica', + "fontSize": 'size14', + "localePolicy": {}, + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '153', + "yPosition": '230', + "width": '84', + "height": '23', + "tabId": '2', + "tabType": 'text' + } + ], + "checkboxTabs": [ + { + "name": '', + "tabLabel": 'ckAuthorization', + "selected": 'false', + "selectedOriginal": 'false', + "requireInitialOnSharedChange": 'false', + "required": 'true', + "locked": 'false', + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '75', + "yPosition": '417', + "width": '0', + "height": '0', + "tabId": '3', + "tabType": 'checkbox' + }, + { + "name": '', + "tabLabel": 'ckAuthentication', + "selected": 'false', + "selectedOriginal": 'false', + "requireInitialOnSharedChange": 'false', + "required": 'true', + "locked": 'false', + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '75', + "yPosition": '447', + "width": '0', + "height": '0', + "tabId": '4', + "tabType": 'checkbox' + }, + { + "name": '', + "tabLabel": 'ckAgreement', + "selected": 'false', + "selectedOriginal": 'false', + "requireInitialOnSharedChange": 'false', + "required": 'true', + "locked": 'false', + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '75', + "yPosition": '478', + "width": '0', + "height": '0', + "tabId": '5', + "tabType": 'checkbox' + }, + { + "name": '', + "tabLabel": 'ckAcknowledgement', + "selected": 'false', + "selectedOriginal": 'false', + "requireInitialOnSharedChange": 'false', + "required": 'true', + "locked": 'false', + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '75', + "yPosition": '508', + "width": '0', + "height": '0', + "tabId": '6', + "tabType": 'checkbox' + } + ], + "radioGroupTabs": [ + { + "documentId": '1', + "recipientId": '1', + "groupName": 'radio1', + "radios": [ + { + "pageNumber": '1', + "xPosition": '142', + "yPosition": '384', + "value": 'white', + "selected": 'false', + "tabId": '7', + "required": 'false', + "locked": 'false', + "bold": 'false', + "italic": 'false', + "underline": 'false', + "fontColor": 'black', + "fontSize": 'size7' + }, + { + "pageNumber": '1', + "xPosition": '74', + "yPosition": '384', + "value": 'red', + "selected": 'false', + "tabId": '8', + "required": 'false', + "locked": 'false', + "bold": 'false', + "italic": 'false', + "underline": 'false', + "fontColor": 'black', + "fontSize": 'size7' + }, + { + "pageNumber": '1', + "xPosition": '220', + "yPosition": '384', + "value": 'blue', + "selected": 'false', + "tabId": '9', + "required": 'false', + "locked": 'false', + "bold": 'false', + "italic": 'false', + "underline": 'false', + "fontColor": 'black', + "fontSize": 'size7' + } + ], + "shared": 'false', + "requireInitialOnSharedChange": 'false', + "requireAll": 'false', + "tabType": 'radiogroup', + "value": '', + "originalValue": '' + } + ], + "listTabs": [ + { + "listItems": [ + { + "text": 'Red', + "value": 'red', + "selected": 'false' + }, + { + "text": 'Orange', + "value": 'orange', + "selected": 'false' + }, + { + "text": 'Yellow', + "value": 'yellow', + "selected": 'false' + }, + { + "text": 'Green', + "value": 'green', + "selected": 'false' + }, + { + "text": 'Blue', + "value": 'blue', + "selected": 'false' + }, + { + "text": 'Indigo', + "value": 'indigo', + "selected": 'false' + }, + { + "text": 'Violet', + "value": 'violet', + "selected": 'false' + } + ], + "value": '', + "originalValue": '', + "required": 'false', + "locked": 'false', + "requireAll": 'false', + "tabLabel": 'list', + "font": 'helvetica', + "fontSize": 'size14', + "localePolicy": {}, + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '142', + "yPosition": '291', + "width": '78', + "height": '0', + "tabId": '10', + "tabType": 'list' + } + ], + "numericalTabs": [ + { + "validationType": 'currency', + "value": '', + "required": 'false', + "locked": 'false', + "concealValueOnDocument": 'false', + "disableAutoSize": 'false', + "tabLabel": 'numericalCurrency', + "font": 'helvetica', + "fontSize": 'size14', + "localePolicy": { + "cultureName": 'en-US', + "currencyPositiveFormat": + 'csym_1_comma_234_comma_567_period_89', + "currencyNegativeFormat": + 'opar_csym_1_comma_234_comma_567_period_89_cpar', + "currencyCode": 'usd' + }, + "documentId": '1', + "recipientId": '1', + "pageNumber": '1', + "xPosition": '163', + "yPosition": '260', + "width": '84', + "height": '0', + "tabId": '11', + "tabType": 'numerical' + } + ] + }, + "signInEachLocation": 'false', + "agentCanEditEmail": 'false', + "agentCanEditName": 'false', + "requireUploadSignature": 'false', + "name": { + "source": 'step', + "propertyName": 'signerName', + "stepId": trigger_id + }, + "email": { + "source": 'step', + "propertyName": 'signerEmail', + "stepId": trigger_id + }, + "recipientId": '1', + "recipientIdGuid": '00000000-0000-0000-0000-000000000000', + "accessCode": '', + "requireIdLookup": 'false', + "routingOrder": '1', + "note": '', + "roleName": 'signer', + "completedCount": '0', + "deliveryMethod": 'email', + "templateLocked": 'false', + "templateRequired": 'false', + "inheritEmailNotificationConfiguration": 'false', + "recipientType": 'signer' + } + ], + "carbonCopies": [ + { + "agentCanEditEmail": 'false', + "agentCanEditName": 'false', + "name": { + "source": 'step', + "propertyName": 'ccName', + "stepId": trigger_id + }, + "email": { + "source": 'step', + "propertyName": 'ccEmail', + "stepId": trigger_id + }, + "recipientId": '2', + "recipientIdGuid": '00000000-0000-0000-0000-000000000000', + "accessCode": '', + "requireIdLookup": 'false', + "routingOrder": '2', + "note": '', + "roleName": 'cc', + "completedCount": '0', + "deliveryMethod": 'email', + "templateLocked": 'false', + "templateRequired": 'false', + "inheritEmailNotificationConfiguration": 'false', + "recipientType": 'carboncopy' + } + ], + "certifiedDeliveries": [] + } + }, + "output": { + "envelopeId_step2": { + "source": 'step', + "propertyName": 'envelopeId', + "stepId": 'step2', + "type": 'String' + }, + "combinedDocumentsBase64_step2": { + "source": 'step', + "propertyName": 'combinedDocumentsBase64', + "stepId": 'step2', + "type": 'File' + }, + 'fields.signer.text.value_step2': { + "source": 'step', + "propertyName": 'fields.signer.text.value', + "stepId": 'step2', + "type": 'String' + } + } + } + + step3 = { + "id": 'step3', + "name": 'Show a Confirmation Screen', + "moduleName": 'ShowConfirmationScreen', + "configurationProgress": 'Completed', + "type": 'DS-ShowScreenStep', + "config": { + "participantId": signer_id + }, + "input": { + "httpType": 'Post', + "payload": { + "participantId": signer_id, + "confirmationMessage": { + "title": 'Tasks complete', + "description": 'You have completed all your workflow tasks.' + } + } + }, + "output": {} + } + + workflow_definition = DocuSign_Maestro::WorkflowDefinition.new({ + workflowName: 'Example workflow - send invite to signer', + workflowDescription: '', + documentVersion: '1.0.0', + schemaVersion: '1.0.0', + accountId: args[:account_id], + participants: participants, + trigger: trigger, + variables: variables, + steps: [step1, step2, step3] + }) + + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + + workflow_management_api = DocuSign_Maestro::WorkflowManagementApi.new(api_client) + workflow_management_api.create_workflow_definition( + args[:account_id], + { "workflowDefinition": workflow_definition } + ).workflow_definition_id + end + + def publish_workflow(args, workflow_id) + configuration = DocuSign_Maestro::Configuration.new + configuration.host = args[:base_path] + + api_client = DocuSign_Maestro::ApiClient.new(configuration) + api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}") + + workflow_management_api = DocuSign_Maestro::WorkflowManagementApi.new(api_client) + + deploy_request = DocuSign_Maestro::DeployRequest.new({ + deploymentStatus: DocuSign_Maestro::DeployStatus::PUBLISH + }) + begin + workflow_management_api.publish_or_un_publish_workflow_definition( + args[:account_id], + workflow_id, + deploy_request + ) + + # return false if workflow does not require a consent to be published + false + rescue Exception => e + return raise e unless e.respond_to?(:response_body) + + response_body = JSON.parse(e.response_body) + return raise e unless response_body.key?('responseType') + + is_consent_required = response_body['responseType'] == 'NeedConsent' + return response_body['consentUrl'] if is_consent_required + + raise e + end + end +end diff --git a/app/services/utils.rb b/app/services/utils.rb index 23b8254..43af62a 100644 --- a/app/services/utils.rb +++ b/app/services/utils.rb @@ -40,4 +40,17 @@ def replace_template_id(file_path, template_id) File.write(file_path, content) end end + + class URLUtils + def get_parameter_value_from_url(url, param_name) + parsed_url = URI.parse(url) + query_params = URI.decode_www_form(parsed_url.query || '') + + # Access the parameter value (returns a list) + param_value_list = query_params.assoc(param_name) + + # If the parameter exists, return the first value; otherwise, return nil + param_value_list ? param_value_list[1] : nil + end + end end diff --git a/app/views/ds_common/index.html.erb b/app/views/ds_common/index.html.erb index 35cb5ae..cb5221e 100644 --- a/app/views/ds_common/index.html.erb +++ b/app/views/ds_common/index.html.erb @@ -55,6 +55,8 @@ "cn" elsif api["Name"] == "WebForms" "w" + elsif api["Name"] == "Maestro" + "ms" else "e" end %> diff --git a/app/views/maestro_api/mseg001_trigger_workflow/get.html.erb b/app/views/maestro_api/mseg001_trigger_workflow/get.html.erb new file mode 100644 index 0000000..0a76846 --- /dev/null +++ b/app/views/maestro_api/mseg001_trigger_workflow/get.html.erb @@ -0,0 +1,54 @@ +<%= render('partials/example_info') %> + +<% form_index = 0 %> +<% instance_name_index = 0 %> +<% signer_email_index = 1 %> +<% signer_name_index = 2 %> +<% cc_email_index = 3 %> +<% cc_name_index = 4 %> +<% redirect_to8_index = 0 %> + +<% unless @show_template_not_ok %> +
+ <% if @example["Forms"][form_index]["FormName"] %> + <%= sanitize @example["Forms"][form_index]["FormName"] %> + <% end %> + +
+ + +
+
+ + + <%= render('partials/email_will_not_be_shared') %> +
+
+ + +
+
+ + + The email for the cc recipient must be different from the signer's email. +
+
+ + +
+ + <%= render('partials/submit_button') %> +
+<% else %> + <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to8_index]["RedirectText"], 'href="eeg008"') %> + +
+ <%= render('partials/continue_button') %> +
+<% end %> diff --git a/app/views/maestro_api/mseg001_trigger_workflow/publish_workflow.html.erb b/app/views/maestro_api/mseg001_trigger_workflow/publish_workflow.html.erb new file mode 100644 index 0000000..0ea0ec4 --- /dev/null +++ b/app/views/maestro_api/mseg001_trigger_workflow/publish_workflow.html.erb @@ -0,0 +1,7 @@ +

<%= @title %>

+<%= format_string(@message, @consent_url).html_safe %> + +
+ + <%= render('partials/submit_button') %> +
diff --git a/app/views/maestro_api/mseg002_cancel_workflow/get.html.erb b/app/views/maestro_api/mseg002_cancel_workflow/get.html.erb new file mode 100644 index 0000000..5ad3a90 --- /dev/null +++ b/app/views/maestro_api/mseg002_cancel_workflow/get.html.erb @@ -0,0 +1,33 @@ +<%= render('partials/example_info') %> + +<% form_index = 0 %> +<% workflow_id_index = 0 %> +<% instance_id_index = 1 %> +<% redirect_to1_index = 0 %> + +<% if @instance_ok %> +
+ <% if @example["Forms"][form_index]["FormName"] %> + <%= sanitize @example["Forms"][form_index]["FormName"] %> + <% end %> + +
+ + +
+
+ + +
+ + <%= render('partials/submit_button') %> +
+<% else %> + <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="mseg001"') %> + +
+ <%= render('partials/continue_button') %> +
+<% end %> diff --git a/app/views/maestro_api/mseg003_get_workflow_status/get.html.erb b/app/views/maestro_api/mseg003_get_workflow_status/get.html.erb new file mode 100644 index 0000000..9e536b8 --- /dev/null +++ b/app/views/maestro_api/mseg003_get_workflow_status/get.html.erb @@ -0,0 +1,33 @@ +<%= render('partials/example_info') %> + +<% form_index = 0 %> +<% workflow_id_index = 0 %> +<% instance_id_index = 1 %> +<% redirect_to1_index = 0 %> + +<% if @workflow_id && @instance_id %> +
+ <% if @example["Forms"][form_index]["FormName"] %> + <%= sanitize @example["Forms"][form_index]["FormName"] %> + <% end %> + +
+ + +
+
+ + +
+ + <%= render('partials/submit_button') %> +
+<% else %> + <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="mseg001"') %> + +
+ <%= render('partials/continue_button') %> +
+<% end %> diff --git a/config/appsettings.example.yml b/config/appsettings.example.yml index 067b8b9..c6f9fcb 100644 --- a/config/appsettings.example.yml +++ b/config/appsettings.example.yml @@ -24,6 +24,7 @@ default: &default monitor_host: "https://lens-d.docusign.net" admin_host: "https://api-d.docusign.net/management" webforms_host: "https://apps-d.docusign.com/api/webforms/v1.1" + maestro_client_host: "https://demo.services.docusign.net/" allow_silent_authentication: true # A user can be silently authenticated if they have an # Active login session on another tab of the same browser # Set if you want a specific DocuSign AccountId, If false, the users default account will be used. diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 0a6c88c..65c5b37 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -50,6 +50,8 @@ strategy.options[:authorize_params].scope = 'signature organization_read group_read permission_read user_read user_write account_read domain_read identity_provider_read user_data_redact asset_group_account_read asset_group_account_clone_write asset_group_account_clone_read' when 'WebForms' strategy.options[:authorize_params].scope = 'signature webforms_read webforms_instance_read webforms_instance_write' + when 'Maestro' + strategy.options[:authorize_params].scope = 'signature aow_manage' end } end diff --git a/config/routes.rb b/config/routes.rb index 80a483b..a1078c3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -242,6 +242,18 @@ post 'weg001webForm' => 'weg001_create_instance#create_web_form_instance' end + scope module: 'maestro_api' do + get 'mseg001' => 'mseg001_trigger_workflow#get' + post 'mseg001' => 'mseg001_trigger_workflow#create' + post 'mseg001publish' => 'mseg001_trigger_workflow#publish' + + get 'mseg002' => 'mseg002_cancel_workflow#get' + post 'mseg002' => 'mseg002_cancel_workflow#create' + + get 'mseg003' => 'mseg003_get_workflow_status#get' + post 'mseg003' => 'mseg003_get_workflow_status#create' + end + root 'ds_common#index' # Login starts with POST'ing to: /auth/docusign