-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultipleSignersInSerialFlow.cs
81 lines (72 loc) · 2.15 KB
/
MultipleSignersInSerialFlow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.IO;
using Bulksign.Api;
namespace Bulksign.ApiSamples
{
public class MultipleSignersInSerialFlow
{
public void RunSample()
{
AuthenticationApiModel token = new Authentication().GetAuthenticationModel();
if (string.IsNullOrEmpty(token.Key))
{
Console.WriteLine("Please edit Authentication.cs and set your own API key there");
return;
}
BulksignApiClient client = new BulksignApiClient();
EnvelopeApiModel envelope = new EnvelopeApiModel();
envelope.EnvelopeType = EnvelopeTypeApi.Serial;
envelope.DaysUntilExpire = 10;
envelope.DisableSignerEmailNotifications = false;
envelope.Name = "Test envelope";
envelope.Recipients = new []
{
//the Index property will determine the order in which the recipients will sign the document(s).
new RecipientApiModel()
{
Name = "Bulksign Test",
Email = "contact@bulksign.com",
Index = 1,
RecipientType = RecipientTypeApi.Signer
},
new RecipientApiModel()
{
Name = "Bulksign Test",
Email = "contact@bulksign.com",
Index = 2,
RecipientType = RecipientTypeApi.Signer,
}
};
envelope.Documents = new[]
{
new DocumentApiModel()
{
Index = 1,
FileName = "test.pdf",
FileContentByteArray = new FileContentByteArray()
{
ContentBytes = File.ReadAllBytes(Environment.CurrentDirectory + @"\Files\bulksign_test_Sample.pdf")
}
}
};
try
{
BulksignResult<SendEnvelopeResultApiModel> result = client.SendEnvelope(token, envelope);
if (result.IsSuccessful)
{
Console.WriteLine("Access code for recipient " + result.Result.RecipientAccess[0].RecipientEmail + " is " + result.Result.RecipientAccess[0].AccessCode);
Console.WriteLine("Envelope id is : " + result.Result.EnvelopeId);
}
else
{
Console.WriteLine($"Request failed : ErrorCode '{result.ErrorCode}' , Message {result.ErrorMessage}");
}
}
catch (BulksignException bex)
{
//handle failed request here
Console.WriteLine($"Exception {bex.Message}, response is {bex.Response}");
}
}
}
}