Пример #1
0
        /// <summary>
        /// EslClient constructor.
        /// Initiates service classes that can be used by the client.
        /// </summary>
        /// <param name="apiKey">The client's api key.</param>
        /// <param name="baseUrl">The staging or production url.</param>
		public EslClient (string apiKey, string baseUrl)
		{
			Asserts.NotEmptyOrNull (apiKey, "apiKey");
			Asserts.NotEmptyOrNull (baseUrl, "baseUrl");
			this.baseUrl = AppendServicePath (baseUrl);

            configureJsonSerializationSettings();

            RestClient restClient = new RestClient(apiKey);
			packageService = new PackageService(restClient, this.baseUrl, jsonSerializerSettings);
			sessionService = new SessionService(apiKey, this.baseUrl);
			fieldSummaryService = new FieldSummaryService(new FieldSummaryApiClient(apiKey, this.baseUrl));
            auditService = new AuditService(apiKey, this.baseUrl);

            eventNotificationService = new EventNotificationService(new EventNotificationApiClient(restClient, this.baseUrl, jsonSerializerSettings));
            customFieldService = new CustomFieldService( new CustomFieldApiClient(restClient, this.baseUrl, jsonSerializerSettings) );
            groupService = new GroupService(new GroupApiClient(restClient, this.baseUrl, jsonSerializerSettings));
			accountService = new AccountService(new AccountApiClient(restClient, this.baseUrl, jsonSerializerSettings));
            approvalService = new ApprovalService(new ApprovalApiClient(restClient, this.baseUrl, jsonSerializerSettings));
			reminderService = new ReminderService(new ReminderApiClient(restClient, this.baseUrl, jsonSerializerSettings));
			templateService = new TemplateService(new TemplateApiClient(restClient, this.baseUrl, jsonSerializerSettings), packageService);
			authenticationTokenService = new AuthenticationTokenService(restClient, this.baseUrl); 
			attachmentRequirementService = new AttachmentRequirementService(new AttachmentRequirementApiClient(restClient, this.baseUrl, jsonSerializerSettings));
            layoutService = new LayoutService(new LayoutApiClient(restClient, this.baseUrl, jsonSerializerSettings));
            qrCodeService = new QRCodeService(new QRCodeApiClient(restClient, this.baseUrl, jsonSerializerSettings));
        }
		public void VerifyResult()
		{
			example = new AttachmentRequirementExample( Props.GetInstance() );
			example.Run();

			// Asserts the attachment requirements for each signer is set correctly.
			DocumentPackage retrievedPackage = example.RetrievedPackage;
			IDictionary<string, AttachmentRequirement> signer1Attachments = retrievedPackage.Signers[example.Email1].Attachments;
			IDictionary<string, AttachmentRequirement> signer2Attachments = retrievedPackage.Signers[example.Email2].Attachments;

			Assert.AreEqual(signer1Attachments.Count, 1);
			AttachmentRequirement signer1Att1 = signer1Attachments[example.NAME1];
			Assert.AreEqual(signer1Att1.Name, example.NAME1);
			Assert.AreEqual(signer1Att1.Description, example.DESCRIPTION1);
			Assert.AreEqual(signer1Att1.Required, true);
			Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.INCOMPLETE.ToString());

			Assert.AreEqual(signer2Attachments.Count, 2);
			AttachmentRequirement signer2Att1 = signer2Attachments[example.NAME2];
			AttachmentRequirement signer2Att2 = signer2Attachments[example.NAME3];
			Assert.AreEqual(signer2Att1.Name, example.NAME2);
			Assert.AreEqual(signer2Att1.Description, example.DESCRIPTION2);
			Assert.AreEqual(signer2Att1.Required, false);
			Assert.AreEqual(signer2Att1.Status.ToString(), RequirementStatus.INCOMPLETE.ToString());
			Assert.AreEqual(signer2Att2.Name, example.NAME3);
			Assert.AreEqual(signer2Att2.Description, example.DESCRIPTION3);
			Assert.AreEqual(signer2Att2.Required, true);
			Assert.AreEqual(signer2Att2.Status.ToString(), RequirementStatus.INCOMPLETE.ToString());

			// Upload attachment for signer1
			string signerAuthenticationToken = example.EslClient.AuthenticationTokenService.CreateSignerAuthenticationToken(example.PackageId, example.SIGNER1ID);
			AuthenticationClient authenticationClient = new AuthenticationClient(Props.GetInstance().Get("webpage.url"));
			String sessionIdForSigner = authenticationClient.GetSessionIdForSignerAuthenticationToken(signerAuthenticationToken);

			client = new RestClient("");
			template = new UrlTemplate(Props.GetInstance().Get("api.url"));

			Stream fileStream1 = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf").FullName);
			uploadAttachment(example.PackageId, signer1Att1.Id, "Test Attachment", fileStream1, sessionIdForSigner);

			// Reject signer1's attachment
			example.RejectAttachment();
			signer1Att1 = retrievedPackage.Signers[example.Email1].Attachments[example.NAME1];
			Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.REJECTED.ToString());
			Assert.AreEqual(signer1Att1.SenderComment, example.REJECTION_COMMENT);

			// Accept signer1's attachment
			example.AcceptAttachment();
			Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.COMPLETE.ToString());
			Assert.AreEqual(signer1Att1.SenderComment, "");

			// Download signer1's attachment
			byte[] downloadedAttachment = example.DownloadAttachment();
			System.IO.File.WriteAllBytes("/dev/null", downloadedAttachment);
		}
Пример #3
0
        /// <summary>
        /// EslClient constructor.
        /// Initiates service classes that can be used by the client.
        /// </summary>
        /// <param name="apiKey">The client's api key.</param>
        /// <param name="baseUrl">The staging or production url.</param>
		public EslClient (string apiKey, string baseUrl)
		{
			Asserts.NotEmptyOrNull (apiKey, "apiKey");
			Asserts.NotEmptyOrNull (baseUrl, "baseUrl");
			this.baseUrl = AppendServicePath (baseUrl);

            RestClient restClient = new RestClient(apiKey);
			packageService = new PackageService (restClient, this.baseUrl);
			sessionService = new SessionService (apiKey, this.baseUrl);
			fieldSummaryService = new FieldSummaryService (apiKey, this.baseUrl);
			auditService = new AuditService (apiKey, this.baseUrl);
            eventNotificationService = new EventNotificationService(restClient, this.baseUrl);
            customFieldService = new CustomFieldService( restClient, this.baseUrl );
            groupService = new GroupService(restClient, this.baseUrl);
			accountService = new AccountService(restClient, this.baseUrl);
			reminderService = new ReminderService(restClient, this.baseUrl);

		}
Пример #4
0
 public GroupApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     template = new UrlTemplate (baseUrl);
     this.settings = settings;
 }
 public EventNotificationApiClient(RestClient restClient, string apiUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     template = new UrlTemplate(apiUrl);
     this.settings = settings;
 }
Пример #6
0
 internal TemplateApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     urls = new UrlTemplate (baseUrl);
     this.settings = settings;
 }
Пример #7
0
 public CustomFieldApiClient(RestClient client, string baseUrl, JsonSerializerSettings settings)
 {
     template = new UrlTemplate(baseUrl);
     this.client = client;
     this.settings = settings;
 }
 public AttachmentRequirementApiClient(RestClient restClient, string apiUrl, JsonSerializerSettings jsonSettings)
 {
     this.restClient = restClient;
     template = new UrlTemplate (apiUrl);            
     this.jsonSettings = jsonSettings;
 }
Пример #9
0
 public SigningStyleService(RestClient restClient, string baseUrl, JsonSerializerSettings settings)
 {
     this.template   = new UrlTemplate(baseUrl);
     this.restClient = restClient;
     this.settings   = settings;
 }
		public AuthenticationTokenService (RestClient restClient, string baseUrl)
		{
			this.restClient = restClient;
			template = new UrlTemplate (baseUrl);
		}
Пример #11
0
 internal TemplateApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     urls            = new UrlTemplate(baseUrl);
     this.settings   = settings;
 }
Пример #12
0
 public ApprovalApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings jsonSettings)
 {
     this.restClient = restClient;
     template = new UrlTemplate (baseUrl);
     this.jsonSettings = jsonSettings;
 }