예제 #1
0
        public void SendSignatureRequestWithExistingFieldsForTemplateTest()
        {
            // build signature request
            SignatureRequest signatureRequest = new SignatureRequest();

            signatureRequest.SendEmails = false;

            Document document = new Document(relativePathToFileOfTheDocument);

            document.ID = idOfTheDocumentWithFileds;

            // add first signer
            Signer signer = new Signer(signers["signer1"]["email"]);

            signer.Role  = "Employee";
            signer.Order = 1;

            // add field for first signer
            ExistingField field1 = new ExistingField((string)existingField1["fieldId"]);

            field1.Content  = (string)existingField1["content"];
            field1.Label    = (string)existingField1["label"];
            field1.Required = (bool)existingField1["required"];
            field1.ReadOnly = (bool)existingField1["readonly"];
            signer.ExistingFields.Add(field1);

            // add second field to first signer
            ExistingField field2 = new ExistingField((string)existingField2["fieldId"]);

            field2.Content  = (string)existingField2["content"];
            field2.Label    = (string)existingField2["label"];
            field2.Required = (bool)existingField2["required"];
            field2.ReadOnly = (bool)existingField2["readonly"];
            signer.ExistingFields.Add(field2);

            document.Signers.Add(signer);
            signatureRequest.Documents.Add(document);

            // execute signature request
            DigiSignerClient client = new DigiSignerClient(apiId);
            SignatureRequest signatureRequestResponse = client.SendSignatureRequest(signatureRequest);

            // validate signature request response
            ValidateResponse(signatureRequest, signatureRequestResponse, false);

            // get and validate signature request from database
            SignatureRequest createdSignatureRequest = client.GetSignatureRequest(
                signatureRequestResponse.SignatureRequestId);

            ValidateSignatureRequest(signatureRequest, createdSignatureRequest, false);

            // get and validate fields from database
            Document       expectedDocument = signatureRequest.Documents[0];
            DocumentFields documentFields   = client.GetDocumentFields(createdSignatureRequest.Documents[0].ID);

            ValidateDocumentFields(expectedDocument, documentFields);
        }
예제 #2
0
        public void SendSignatureRequestWithFieldsTest()
        {
            // build signature request
            SignatureRequest signatureRequest = new SignatureRequest();

            signatureRequest.SendEmails = false;

            // add document from file and one signer
            Document document = new Document(relativePathToFileOfTheDocument);
            Signer   signer   = new Signer(signers["signer1"]["email"]);
            // add field with API ID to be able find it latter
            Field field1 = new Field(0, new int[] { 100, 100, 300, 200 }, FieldType.SIGNATURE);

            field1.ApiId = "Fild1ApiId";

            signer.Fields.Add(field1);
            Field field2 = new Field(0, new int[] { 350, 100, 400, 220 }, FieldType.TEXT);

            field2.ApiId = "Fild2ApiId";
            signer.Fields.Add(field2);

            document.Signers.Add(signer);
            signatureRequest.Documents.Add(document);

            // execute signature request
            DigiSignerClient client = new DigiSignerClient(apiId);
            SignatureRequest signatureRequestResponse = client.SendSignatureRequest(signatureRequest);

            // validate signature request response
            ValidateResponse(signatureRequest, signatureRequestResponse, true);

            // get and validate signature request from database
            string           signatureRequestId      = signatureRequestResponse.SignatureRequestId;
            SignatureRequest createdSignatureRequest = client.GetSignatureRequest(signatureRequestId);

            ValidateSignatureRequest(signatureRequest, createdSignatureRequest, true);

            // get and validate fields from database
            Document       expectedDocument = signatureRequest.Documents[0];
            DocumentFields documentFields   = client.GetDocumentFields(createdSignatureRequest.Documents[0].ID);

            ValidateDocumentFields(expectedDocument, documentFields);
        }
예제 #3
0
 public void GetFieldsFromDocumentTest()
 {
     DigiSignerClient client = new DigiSignerClient(apiId);
     DocumentFields   fileds = client.GetDocumentFields(idOfTheDocumentWithFileds);
 }