docusign怎么用_轨道上的Ruby上的docusign集成

docusign怎么用

DocuSign is a platform for the online signing of documents, legal agreements where you as an application owner or developer can send documents to the end-users for signing process after approval/consent from DocuSign & users can sign with their own electronic signature.

DocuSign是用于文档在线签署,法律协议的平台,您可以作为应用程序所有者或开发人员在经过DocuSign批准/同意后将文档发送给最终用户以进行签名过程,并且用户可以使用自己的电子签名进行签名。

Remote Signing
远程签名

定价和计划 (Pricing And Plans)

Docusign comes with a three plan Personal, Standard, and Business Pro plans.

Docusign附带了三个计划,即Personal,Standard和Business Pro计划。

Apart from document signing, DocuSign offers features like reminder notifications, payment gateway, bulk-sending of templates to multiple users in premium plans.

除文档签名外,DocuSign还提供提醒通知,付款网关,将模板批量发送给高级计划中的多个用户的功能。

Go through below link for details :

通过以下链接了解详细信息:

入门 (Getting Started)

Gem Used : docusign_esign

使用的宝石 :docusign_esign

gem 'docusign_esign'
bundle install

Account and keys setup :

帐户和密钥设置

  1. Signup: create your DocuSign account

    注册 :创建您的DocuSign帐户

  2. Login to your demo account

    登录到您的模拟账户

  3. Account ID (Click on upper right avatar and get your account id)

    帐户ID(点击右上角的头像并获取您的帐户ID)
  4. Get Integration key (Go to settings -> Integration -> API and Keys -> My Apps / Integration Keys -> Add key). Also, copy the user-id and base-URI listed on the same page.

    获取集成密钥(转到设置->集成-> API和密钥->我的应用程序/集成密钥->添加密钥)。 另外,复制同一页面上列出的用户ID和基本URI。
  5. In the My Apps / Integration Keys section on API and Keys page click on Actions -> Edit. Now, in the service integration section add RSA key and copy the public key and private key in config/public_key.txt & config/private_key.txt respectively.

    在“ API和密钥”页面上的“我的应用程序/集成密钥”部分中,单击“操作”->“编辑”。 现在,在“服务集成”部分中,添加RSA密钥,并将公共密钥和私有密钥分别复制到config / public_key.txt和config / private_key.txt中。
  6. In additional settings, add a redirect URL to get redirected to the application after getting DocuSign consent. For local development http://localhost:3000/***.

    在其他设置中,添加重定向URL以在获得DocuSign同意后重定向到应用程序。 对于本地开发,请ttp:// localhost:3000 / ***。

  7. Now, add all the keys in application.yml or .env of your application.

    现在,将所有密钥添加到应用程序的application.yml或.env中。
BASE_URL: 'http://localhost:3000'
DOCUSIGN_USERNAME: '****@gmail.com'
DOCUSIGN_PASSWORD: '*******'
DOCUSIGN_INTEGRATION_KEY: 'e8**-2***-7***-6***-a********'
DOCUSIGN_ACCOUNT_ID: '11*****'
DOCUSIGN_USER_ID: '8******-1***-4***-9***-e********'
DOCUSIGN_ENDPOINT: 'http://demo.docusign.net/restapi'
DOCUSIGN_API_VERSION: 'v2'
DOCUSIGN_AUTH_SERVER: 'account-d.docusign.com'

DocuSign在应用程序中的集成: (DocuSign Integration in Application :)

There are two ways in which the signing process can be executed:

有两种执行签名过程的方式:

  1. Remote Signing (Signing via mail)

    远程签名(通过邮件签名)
  2. Embedded signing (Signing within the application)

    嵌入式签名(在应用程序内签名)

I will go deep down into integrating the remote signing process while for embedded signing you can check the launcher code example here.

我将深入集成远程签名过程,而对于嵌入式签名,您可以在此处查看启动器代码示例。

Firstly, create some templates on your remote account to be sent to the end-users within an envelope for signing.

首先,在您的远程帐户上创建一些模板,以在信封内发送给最终用户进行签名。

Image for post

Step 1. Get Docusign Consent for application :

步骤1.获得Docusign同意进行申请:

(I have used gem Figaro for keys configuration)

(我已经使用了Figaro宝石来进行按键配置)

integration_key = Figaro.env.DOCUSIGN_INTEGRATION_KEY
redirect_uri = "#{Figaro.env.BASE_URL}"
consent_scopes = "signature%20impersonation"path = "https://#{Figaro.env.DOCUSIGN_AUTH_SERVER}/oauth/auth?
response_type=code&scope=#{consent_scopes}&client_id=#{integration_key}&redirect_uri=#{redirect_uri}"redirect_to path

After getting authorized, DocuSign redirects back to the redirect URI.

获得授权后,DocuSign重定向回到重定向URI。

Step 2. Initiate api_client object

步骤2. 启动api_client对象

template_name = 'template name' #search name from remote
configuration = DocuSign_eSign::Configuration.new
configuration.host = base_path
api_client = DocuSign_eSign::ApiClient.new(configuration)

Step 3. Get JWT bearer token

步骤3. G et JWT承载令牌

base_path = Figaro.env.DOCUSIGN_ENDPOINT
integrator_key = Figaro.env.DOCUSIGN_INTEGRATION_KEY
user_id = Figaro.env.DOCUSIGN_USER_ID
expires_in_seconds = 5000api_client.set_base_path(base_path)
private_key_filename = File.join(Rails.root, 'config', 'private_key.txt')
bearer_token = api_client.request_jwt_user_token(integrator_key, user_id, private_key_filename, expires_in_seconds)

Step 4. Access template from remote

步骤4.从远程访问模板

@template_name = template_name
templates_api = DocuSign_eSign::TemplatesApi.new api_client
options = DocuSign_eSign::ListTemplatesOptions.new
options.search_text = @template_nameresults = templates_api.list_templates(Figaro.env.DOCUSIGN_ACCOUNT_ID, options)template_id = results.envelope_templates[0].template_id

Step 5. Create envelope definition and send to end user via mail

步骤5.创建信封定义并通过邮件发送给最终用户

user = current_user
envelope_definition= DocuSign_eSign::EnvelopeDefinition.new({status: 'sent', templateId: template_id, emailSubject: 'Document Signing'})signer = DocuSign_eSign::TemplateRole.new({email: user.email, name: user.full_name, roleName: 'signer'})signer.name = 'Default User' unless signer.name.present?envelope_definition.template_roles = [signer]envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)result = envelopes_api.create_envelope(account_id, envelope_definition)

That’s it! an email with an envelope containing metadata and template to get signed is sent successfully to the user.

而已! 带有包含要签名的元数据和模板的信封的电子邮件已成功发送给用户。

DocuSign连接 (DocuSign Connect)

Get notified when users review or complete the signing process and hence update your database in your application.

当用户查看或完成签名过程并因此在您的应用程序中更新数据库时得到通知。

For this purpose, I added a webhook in my application which gets called every time the envelope status changes like sent, delivered, completed, declined, voided.

为此,我在应用程序中添加了一个Webhook,每次信封状态更改(例如发送,交付,完成,拒绝,作废)时都会调用该Webhook。

Configuring Connect

配置连接

  1. Go to Settings -> Integration -> Connect

    转到设置->集成->连接
  2. Add webhook URL -> https://3b******.ngrok.io/webhooks

    添加webhook URL-> https://3b******.ngrok.io/webhooks

(I added ngrok URL as connect accepts https secured URL only)

(我添加了ngrok URL,因为connect仅接受https保护的URL)

3. Now, add events to get triggered and save.

3.现在,添加事件以触发并保存。

Coming to the code ..

来到代码..

resp = Hash.from_xml(request.raw_post)
envelope_id = resp["DocuSignEnvelopeInformation"]["EnvelopeStatus"]["EnvelopeID"]
envelope = Envelope.find_by(envelope_id: envelope_id)envelope.update(status: resp["DocuSignEnvelopeInformation"]["EnvelopeStatus"]["Status"].downcase)

上线:查看以下链接以使用DocuSign上线。 (Go LIVE: Check out the below link to go live with DocuSign.)

翻译自: https://medium.com/@gunjansolanki_007/docusign-integration-on-ruby-on-rails-b384405aef37

docusign怎么用

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值