Example #1
0
        public void ConvertAPIToSDK()
        {
            apiCompletionReport1 = CreateTypicalAPICompletionReport();
            sdkCompletionReport1 = new CompletionReportConverter(apiCompletionReport1).ToSDKCompletionReport();

            Assert.AreEqual(sdkCompletionReport1.From, apiCompletionReport1.From);
            Assert.AreEqual(sdkCompletionReport1.To, apiCompletionReport1.To);

            Assert.AreEqual(sdkCompletionReport1.Senders[0].Sender.Id, apiCompletionReport1.Senders[0].Sender.Id);
            Assert.AreEqual(sdkCompletionReport1.Senders[0].Sender.FirstName, apiCompletionReport1.Senders[0].Sender.FirstName);
            Assert.AreEqual(sdkCompletionReport1.Senders[0].Sender.LastName, apiCompletionReport1.Senders[0].Sender.LastName);

            OneSpanSign.API.PackageCompletionReport apiPackageCompletionReport = apiCompletionReport1.Senders[0].Packages[0];
            OneSpanSign.Sdk.PackageCompletionReport sdkPackageCompletionReport = sdkCompletionReport1.Senders[0].Packages[0];
            Assert.AreEqual(sdkPackageCompletionReport.Id, apiPackageCompletionReport.Id);
            Assert.AreEqual(sdkPackageCompletionReport.Name, apiPackageCompletionReport.Name);
            Assert.AreEqual(sdkPackageCompletionReport.DocumentPackageStatus.ToString(), apiPackageCompletionReport.Status.ToString());
            Assert.AreEqual(sdkPackageCompletionReport.Created, apiPackageCompletionReport.Created);
            Assert.AreEqual(sdkPackageCompletionReport.Documents.Count, 1);
            Assert.AreEqual(sdkPackageCompletionReport.Signers.Count, 1);

            OneSpanSign.API.DocumentsCompletionReport apiDocumentsCompletionReport = apiPackageCompletionReport.Documents[0];
            OneSpanSign.Sdk.DocumentsCompletionReport sdkDocumentsCompletionReport = sdkPackageCompletionReport.Documents[0];
            Assert.AreEqual(sdkDocumentsCompletionReport.Id, apiDocumentsCompletionReport.Id);
            Assert.AreEqual(sdkDocumentsCompletionReport.Name, apiDocumentsCompletionReport.Name);
            Assert.AreEqual(sdkDocumentsCompletionReport.FirstSigned, apiDocumentsCompletionReport.FirstSigned);
            Assert.AreEqual(sdkDocumentsCompletionReport.LastSigned, apiDocumentsCompletionReport.LastSigned);

            OneSpanSign.API.SignersCompletionReport apiSignersCompletionReport = apiPackageCompletionReport.Signers[0];
            OneSpanSign.Sdk.SignersCompletionReport sdkSignersCompletionReport = sdkPackageCompletionReport.Signers[0];
            Assert.AreEqual(sdkSignersCompletionReport.Id, apiSignersCompletionReport.Id);
            Assert.AreEqual(sdkSignersCompletionReport.Email, apiSignersCompletionReport.Email);
            Assert.AreEqual(sdkSignersCompletionReport.FirstName, apiSignersCompletionReport.FirstName);
            Assert.AreEqual(sdkSignersCompletionReport.LastName, apiSignersCompletionReport.LastName);
            Assert.AreEqual(sdkSignersCompletionReport.FirstSigned, apiSignersCompletionReport.FirstSigned);
            Assert.AreEqual(sdkSignersCompletionReport.LastSigned, apiSignersCompletionReport.LastSigned);
        }
Example #2
0
        override public void Execute()
        {
            DocumentPackage superDuperPackage =
                PackageBuilder.NewPackageNamed(PackageName)
                .DescribedAs("This is a package created using the eSignLive SDK")
                .ExpiresOn(DateTime.Now.AddMonths(100))
                .WithEmailMessage("This message should be delivered to all signers")
                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                            .WithCustomId("Client1")
                            .WithFirstName("John")
                            .WithLastName("Smith")
                            .WithTitle("Managing Director")
                            .WithCompany("Acme Inc.")
                            )
                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                              .FromStream(fileStream1, DocumentType.PDF)
                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                             .OnPage(0)
                                             .WithField(FieldBuilder.CheckBox()
                                                        .OnPage(0)
                                                        .AtPosition(400, 200)
                                                        .WithValue(FieldBuilder.CHECKBOX_CHECKED)
                                                        )
                                             .AtPosition(100, 100)
                                             )
                              )
                .Build();

            packageId = ossClient.CreatePackage(superDuperPackage);

            DocumentPackage superDuperPackage2 =
                PackageBuilder.NewPackageNamed("DownloadReportForSent: " + DateTime.Now)
                .DescribedAs("This is a package created using the eSignLive SDK")
                .ExpiresOn(DateTime.Now.AddMonths(100))
                .WithEmailMessage("This message should be delivered to all signers")
                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                            .WithCustomId("Client1")
                            .WithFirstName("John")
                            .WithLastName("Smith")
                            .WithTitle("Managing Director")
                            .WithCompany("Acme Inc.")
                            )
                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                              .FromStream(fileStream2, DocumentType.PDF)
                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                             .OnPage(0)
                                             .WithField(FieldBuilder.CheckBox()
                                                        .OnPage(0)
                                                        .AtPosition(400, 200)
                                                        .WithValue(FieldBuilder.CHECKBOX_CHECKED)
                                                        )
                                             .AtPosition(100, 100)
                                             )
                              )
                .Build();

            package2Id = ossClient.CreateAndSendPackage(superDuperPackage2);

            // Date and time range to get completion report.
            DateTime from = DateTime.Now.AddMinutes(-5);
            DateTime to   = DateTime.Now.AddMinutes(5);

            // Download the completion report for a sender
            sdkCompletionReportForSenderDraft = ossClient.ReportService.DownloadCompletionReport(DocumentPackageStatus.DRAFT, senderUID, from, to);
            csvCompletionReportForSenderDraft = ossClient.ReportService.DownloadCompletionReportAsCSV(DocumentPackageStatus.DRAFT, senderUID, from, to);

            sdkCompletionReportForSenderSent = ossClient.ReportService.DownloadCompletionReport(DocumentPackageStatus.SENT, senderUID, from, to);
            csvCompletionReportForSenderSent = ossClient.ReportService.DownloadCompletionReportAsCSV(DocumentPackageStatus.SENT, senderUID, from, to);

            // Download the completion report for all senders
            sdkCompletionReportDraft = ossClient.ReportService.DownloadCompletionReport(DocumentPackageStatus.DRAFT, from, to);
            csvCompletionReportDraft = ossClient.ReportService.DownloadCompletionReportAsCSV(DocumentPackageStatus.DRAFT, from, to);

            sdkCompletionReportSent = ossClient.ReportService.DownloadCompletionReport(DocumentPackageStatus.SENT, from, to);
            csvCompletionReportSent = ossClient.ReportService.DownloadCompletionReportAsCSV(DocumentPackageStatus.SENT, from, to);

            // Download the usage report
            sdkUsageReport = ossClient.ReportService.DownloadUsageReport(from, to);
            csvUsageReport = ossClient.ReportService.DownloadUsageReportAsCSV(from, to);

            // Download the delegation report for a sender
            sdkDelegationReportForAccountWithoutDate = ossClient.ReportService.DownloadDelegationReport();
            csvDelegationReportForAccountWithoutDate = ossClient.ReportService.DownloadDelegationReportAsCSV();

            sdkDelegationReportForAccount = ossClient.ReportService.DownloadDelegationReport(from, to);
            csvDelegationReportForAccount = ossClient.ReportService.DownloadDelegationReportAsCSV(from, to);

            sdkDelegationReportForSender = ossClient.ReportService.DownloadDelegationReport(senderUID, from, to);
            csvDelegationReportForSender = ossClient.ReportService.DownloadDelegationReportAsCSV(senderUID, from, to);
        }