michaelormrod / code-examples-csharp

C# code examples and launcher

Home Page:https://developers.docusign.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C#: DocuSign Code Examples and Launcher

This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code example, modify the ExampleAPI settings at the end of the appsettings.json file from ESignature to Rooms.

Note: to use the Rooms API you must also create your DocuSign Developer Account for Rooms.

GitHub repo: code-examples-csharp

Introduction

This repo is a C# .NET Core MVC application that demonstrates:

  • Authentication with DocuSign via the Authorization Code Grant flow. When the token expires, the user is asked to re-authenticate. The refresh token is not used in this example.

eSignature API

  1. Use embedded signing. Source. This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website.
  2. Request a signature by email (Remote Signing). Source. The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents.
  3. List envelopes in the user's account. Source. The envelope's current status is included.
  4. Get an envelope's basic information. Source. The example lists the basic information about an envelope, including its overall status.
  5. List an envelope's recipients Source. Includes current recipient status.
  6. List an envelope's documents. Source.
  7. Download an envelope's documents. Source. The example can download individual documents, the documents concatenated together, or a zip file of the documents.
  8. Programmatically create a template. Source.
  9. Request a signature by email using a template. Source.
  10. Send an envelope and upload its documents with multpart binary transfer. Source. Binary transfer is 33% more efficient than using Base64 encoding.
  11. Use embedded sending. Source. Embeds the DocuSign web tool (NDSE) in your web app to finalize or update the envelope and documents before they are sent.
  12. Embedded DocuSign web tool (NDSE). Source.
  13. Use embedded signing from a template with an added document. Source. This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite Templates feature.
  14. Payments example: an order form, with online payment by credit card. Source.
  15. Get the envelope tab data. Retrieve the tab (field) values for all of the envelope's recipients. Source.
  16. Set envelope tab values. The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs are set to be read-only, others can be updated by the recipient. The example also stores metadata with the envelope. Source.
  17. Set template tab values. The example creates an envelope using a template and sets the initial values for its tabs (fields). The example also stores metadata with the envelope. Source.
  18. Get the envelope custom field data (metadata). The example retrieves the custom metadata (custom data fields) stored with the envelope. Source.
  19. Requiring an Access Code for a Recipient Source. This example sends an envelope that requires an access-code for the purpose of multi-factor authentication.
  20. Requiring SMS authentication for a recipient Source. This example sends an envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.
  21. Requiring Phone authentication for a recipient Source. This example sends an envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.
  22. Requiring Knowledge-Based Authentication (KBA) for a Recipient Source. This example sends an envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.
  23. Requiring ID Verification (IDV) for a recipient Source. This example sends an envelope that requires submitting a photo of a government issued id for the purpose of multi-factor authentication.
  24. Creating a permission profile Source. This code example demonstrates how to create a permission profile using the Create Permission Profile method.
  25. Setting a permission profile Source. This code example demonstrates how to set a user group's permission profile using the Update Group method. You must have already created permissions profile and group of users.
  26. Updating individual permission settings Source. This code example demonstrates how to edit individual permission settings on a permissions profile using the Update Permission Profile method.
  27. Deleting a permission profile Source. This code example demonstrates how to delete a permission profile using the Delete Permission Profile method.
  28. Creating a brand Source. This example creates a brand profile for an account using the Create Brand method.
  29. Applying a brand to an envelope Source. This code example demonstrates how to apply a brand you've created to an envelope using the Create Envelope method. First, the code creates the envelope and then applies the brand to it. Anchor text (AutoPlace) is used to position the signing fields in the documents.
  30. Applying a brand to a template Source. This code example demonstrates how to apply a brand you've created to a template using using the Create Envelope method. You must have at least one created template and brand. Anchor text (AutoPlace) is used to position the signing fields in the documents.
  31. Bulk sending envelopes to multiple recipients Source. This code example demonstrates how to send envelopes in bulk to multiple recipients using these methods: Create Bulk Send List, Create Bulk Send Request. First, the code creates a bulk send recipients list, and then creates an envelope. After that, initiates bulk envelope sending.
  32. Pause a signature workflow Source. This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient using the Create Envelope method.
  33. Unpause a signature workflow Source. This code example demonstrates how to update an envelope to resume the workflow that has been paused using the Update Envelope method. You must have created at least one envelope with a paused signature workflow.
  34. Conditional recipients Source. This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction using the Create Envelope method.

Rooms API

Note: to use the Rooms API you must also create your DocuSign Developer Account for Rooms.

  1. Create room with Data. Source. This code example creates a new room in your DocuSign Rooms account to be used for a transaction.
  2. Create a room from a template. Source. This code example creates a new room using a template.
  3. Create room with Data. Source. This code example exports all the avialalble data from a specific room in your DocuSign Rooms account.
  4. Add forms to a room. Source. This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account.
  5. How to search for rooms with filters. Source. This code example searches for rooms in your DocuSign Rooms account using a specific filter.
  6. Create an external form fillable session. Source. This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account.

Click API

Note: to use the Click API, include click_manage and click_send scopes. Review the Click API 101 Auth Guide for more details.

  1. Create Clickwraps. Source. This code example creates a clickwrap.
  2. Activate Clickwrap. Source. This code example activates a newly created clickwrap.
  3. Clickwrap Versioning. Source. This code example creates a new clickwrap version.
  4. Retrieve Clickwraps. Source. This code example demonstrates how to retrieve a clickwrap.
  5. Get Clickwrap Responses. Source. This code example demonstrates how to retrieve clickwrap responses.

Installation

Prerequisites

Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.

  1. A DocuSign developer account (email and password) on demo.docusign.net. Create a free account.

  2. A DocuSign Integration Key (a client ID) that is configured to use the OAuth Authorization Code flow. You will need the Integration Key itself, and its secret.

    If you use this example on your own workstation, the Integration key must include a Redirect URI of https://localhost:44333/ds/callback

    If you will not be running the example on your own workstation, use the appropriate DNS name and port instead of localhost

    This video demonstrates how to create an Integration Key (client id) for a user application like this example.

  3. C# .NET Core version 3.1 or later.

  4. Visual Studio 2019 with ASP.NET package.

  5. A name and email for a signer and a name and email for a cc recipient.

Installation steps

  • Download or clone this repository.

  • The repository includes a Visual Studio 2019 solution file and NuGet package references in the project file.

  • Configure the project by editing the existing project file for the API version you wish to use by modifying its appsettings.json

    See the Configuration section, below, for more information.

Configuration

Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.

  1. Create the appsettings.json (the configuration file) by using the example provided in appsettings.example.json.
  2. Two different authentication methods are supported:

Authorization Code Grant

  1. Update the values of ClientId, and ClientSecret text with your values.

For JWT (JSON Web Tokens)

  1. Replace the ClientId, and ImpersonatedUserId text with your values.
  2. Add and RSA Private Key from DocuSign eSignature Admin and copy/paste its value into private.key

See the Authentication guide for information on choosing the right authentication flow for your application.

The Client_id (Integration Key) and its secret are private. Please do not store the appsettings file in your code repository after you have added the private information to it.

To update to production, change all of the authorization service https://account-d.docusign.com addresses to https://account.docusign.com

Payments code example

To use the payments example, create a test payments gateway for your developer account.

See the PAYMENTS_INSTALLATION.md file for instructions.

Then add the payment gateway account id to the appsettings.json file.

Running the example

Build and then start the solution.

Your default browser will be opened to https://localhost:44333 and you will see the application's home page.

License and additional information

License

This repository uses the MIT License. Please see the LICENSE file for more information.

Pull Requests

Pull requests are welcomed. Pull requests will only be considered if their content uses the MIT License.

Additional Resources

About

C# code examples and launcher

https://developers.docusign.com/

License:MIT License


Languages

Language:C# 80.7%Language:HTML 18.0%Language:JavaScript 0.8%Language:CSS 0.5%