Skip to content

DEVDOCS-1186/DEVDOCS-1178 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using DocuSign.eSign.Api;
using DocuSign.eSign.Client;
using DocuSign.eSign.Model;
using eg_03_csharp_auth_code_grant_core.Models;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;

namespace eg_03_csharp_auth_code_grant_core.Controllers
{
[Route("eg015")]
public class Eg015EnvelopeTabDataController : EgController
{
public Eg015EnvelopeTabDataController(DSConfiguration config, IRequestItemsService requestItemsService)
: base(config, requestItemsService)
{
ViewBag.title = "Get Envelope Tab Information";
}
public override string EgName => "eg015";

[HttpPost]
public IActionResult Create()
{
// Check the token with minimal buffer time.
bool tokenOk = CheckToken(3);
if (!tokenOk)
{
// We could store the parameters of the requested operation
// so it could be restarted automatically.
// But since it should be rare to have a token issue here,
// we'll make the user re-enter the form data after
// authentication.
RequestItemsService.EgName = EgName;
return Redirect("/ds/mustAuthenticate");
}

var basePath = RequestItemsService.Session.BasePath + "/restapi";

// Step 1: Obtain your OAuth token
var accessToken = RequestItemsService.User.AccessToken; //represents your {ACCESS_TOKEN}
var accountId = RequestItemsService.Session.AccountId; //represents your {ACCOUNT_ID}
var envelopeId = RequestItemsService.EnvelopeId;

// Step 2: Construct your API headers
var config = new Configuration(new ApiClient(basePath));
config.AddDefaultHeader("Authorization", "Bearer " + accessToken);

// Step 3: Call the eSignature REST API
EnvelopesApi envelopesApi = new EnvelopesApi(config);
EnvelopeFormData results = envelopesApi.GetFormData(accountId, envelopeId);

ViewBag.h1 = "Get envelope tab data information";
ViewBag.message = "Results from the Envelopes::get method:";
ViewBag.Locals.Json = JsonConvert.SerializeObject(results, Formatting.Indented);
return View("example_done");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using DocuSign.eSign.Api;
using DocuSign.eSign.Model;
using eg_03_csharp_auth_code_grant_core.Models;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using System.Text;
using DocuSign.eSign.Client;

namespace eg_03_csharp_auth_code_grant_core.Controllers
Expand All @@ -20,7 +20,6 @@ public Eg019AccessCodeAuthController(DSConfiguration config, IRequestItemsServic

public override string EgName => "eg019";


[HttpPost]
public IActionResult Create(string signerEmail, string signerName, string accessCode)
{
Expand All @@ -37,14 +36,12 @@ public IActionResult Create(string signerEmail, string signerName, string access

// Data for this method:
// signerEmail
// signerName

// signerName
var basePath = RequestItemsService.Session.BasePath + "/restapi";
var recipientId = Guid.NewGuid().ToString();

// Step 1: Obtain your OAuth token
var accessToken = RequestItemsService.User.AccessToken;
var accountId = RequestItemsService.Session.AccountId;
var accessToken = RequestItemsService.User.AccessToken; //represents your {ACCESS_TOKEN}
var accountId = RequestItemsService.Session.AccountId; //represents your {ACCOUNT_ID}

// Step 2: Construct your API headers
var config = new Configuration(new ApiClient(basePath));
Expand Down Expand Up @@ -80,7 +77,7 @@ public IActionResult Create(string signerEmail, string signerName, string access
DocumentId = "1",
// A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems.
// This value is referenced in the Tabs element below to assign tabs on a per-recipient basis.
RecipientId = recipientId
RecipientId = "1" //represents your {RECIPIENT_ID}
};

// Tabs are set per recipient/signer
Expand All @@ -96,12 +93,11 @@ public IActionResult Create(string signerEmail, string signerName, string access
RoutingOrder = "1",
Status = "Created",
DeliveryMethod = "Email",
RecipientId = recipientId,
AccessCode = accessCode,
RecipientId = "1", //represents your {RECIPIENT_ID}
AccessCode = accessCode, //represents your {ACCESS_CODE}
Tabs = signer1Tabs
};


Recipients recipients = new Recipients();
recipients.Signers = new List<Signer> { signer1 };
env.Recipients = recipients;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ namespace eg_03_csharp_auth_code_grant_core.Controllers
[Route("eg023")]
public class Eg023IdvAuthController : EgController
{
public Eg023IdvAuthController(DSConfiguration config, IRequestItemsService requestItemsService)
public Eg023IdvAuthController(DSConfiguration config, IRequestItemsService requestItemsService)
: base(config, requestItemsService)
{
ViewBag.title = "ID Verification Authentication";
}

public override string EgName => "eg023";


[HttpPost]
public IActionResult Create(string signerEmail, string signerName)
public IActionResult Create(string signerEmail, string signerName, string ccEmail, string ccName)
{
// Check the token with minimal buffer time.
bool tokenOk = CheckToken(3);
Expand All @@ -35,27 +34,23 @@ public IActionResult Create(string signerEmail, string signerName)
return Redirect("/ds/mustAuthenticate");
}


// Data for this method:
// Data for this method
// signerEmail
// signerName
var basePath = RequestItemsService.Session.BasePath + "/restapi";
var recipientId = Guid.NewGuid().ToString();


// Step 1: Obtain your OAuth token
var accessToken = RequestItemsService.User.AccessToken;
var accountId = RequestItemsService.Session.AccountId;
var accessToken = RequestItemsService.User.AccessToken; //represents your {ACCESS_TOKEN}
var accountId = RequestItemsService.Session.AccountId; //represents your {ACCOUNT_ID}

// Step 2: Construct your API headers
var config = new Configuration(new ApiClient(basePath));
config.AddDefaultHeader("Authorization", "Bearer " + accessToken);


//Step 3: Retreive the WorkflowId
//Step 3: Retreive the workflow ID
AccountsApi workflowDetails = new AccountsApi(config);
AccountIdentityVerificationResponse wfRes = workflowDetails.GetAccountIdentityVerification(accountId);
Console.WriteLine("Workflow id: " + wfRes.IdentityVerification[0].WorkflowId);
Console.WriteLine("Workflow ID: " + wfRes.IdentityVerification[0].WorkflowId);

// Step 4: Construct your envelope JSON body
// Note: If you did not successfully obtain your workflow ID, step 4 will fail.
Expand Down Expand Up @@ -88,9 +83,8 @@ public IActionResult Create(string signerEmail, string signerName)
DocumentId = "1",
// A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems.
// This value is referenced in the Tabs element below to assign tabs on a per-recipient basis.
RecipientId = recipientId
};

RecipientId = "1" //represents your {RECIPIENT_ID}
};

// Tabs are set per recipient/signer
Tabs signer1Tabs = new Tabs
Expand All @@ -111,7 +105,7 @@ public IActionResult Create(string signerEmail, string signerName)
Note = "",
Status = "created",
DeliveryMethod = "email",
RecipientId = recipientId,
RecipientId = "1", //represents your {RECIPIENT_ID}
IdentityVerification = workflow,
Tabs = signer1Tabs
};
Expand All @@ -124,7 +118,6 @@ public IActionResult Create(string signerEmail, string signerName)
EnvelopesApi envelopesApi = new EnvelopesApi(config);
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, env);


ViewBag.h1 = "Envelope sent";
ViewBag.message = "The envelope has been created and sent!<br />Envelope ID " + results.EnvelopeId + ".";
return View("example_done");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<h4>15. Get the tab data from an envelope</h4>
<p>Get the tab (field) values from an envelope for all of the envelope's recipients.</p>

<p>
This method is used to read the updated tab values from
the envelope. The method can be used after the envelope is complete or while it is
still in progress.
</p>

@if (ViewBag.showDoc) {
<p><a target='_blank' href='@ViewBag.documentation'>Documentation</a> about this example.</p>
}


<p>
API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeFormData/get">EnvelopeFormData::get</a>.
</p>

<p>
View source file <a target="_blank" href="@ViewBag.source">Eg015EnvelopeTabDataController.cs</a> on GitHub.
</p>

@if (ViewBag.envelopeOk) {
<p>
The last envelope you created with this example launcher will be queried.
Recommendation: use example 9, then this example, since example 9 includes many tabs of different types.
</p>

<form class="eg" action="" method="post" data-busy="form">
<input type="hidden" name="_csrf" value="<%- csrfToken %>">
<button type="submit" class="btn btn-primary">Continue</button>
</form>
} else {
<p>
Problem: please first create an envelope using <a href="eg009">example 9.</a> <br />
Thank you.
</p>

<form class="eg" action="eg009" method="get">
<button type="submit" class="btn btn-primary">Continue</button>
</form>

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="form-group">
<label for="accessCode">Access Code</label>
<input type="text" class="form-control" id="accessCode" name="accessCode"
aria-describedby="acText" placeholder="Rnter a recipient access code here" required>
aria-describedby="acText" placeholder="Enter a recipient access code here" required>
<small id="acText" class="form-text text-muted">Provide this string to a recipient that is different such as in person or by mail or via different email.</small>
</div>
<div class="form-group">
Expand Down
6 changes: 4 additions & 2 deletions eg-03-csharp-auth-code-grant-core/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@
</p>

<h2>Tabs Examples</h2>
<h4 id="example015">15. <a href="#">Get the tab data from an envelope</a></h4>
<p>Comming Soon...</p>
<h4 id="example015">15. <a href="eg015">Get the tab data from an envelope</a></h4>
<p>This example retrieves the <strong>tab</strong> (<a target="_blank" href="https://developers.docusign.com/esign-rest-api/guides/concepts/tabs">field</a>) values from an envelope.</p>
<p>
API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeFormData/get">EnvelopeFormData::get</a>.
</p>

<h4 id="example016">16. <a href="#">Set tab values for a envelope</a></h4>
Expand Down