Пример #1
0
        internal OneSpanSign.API.Document ToAPIDocument()
        {
            if (sdkDocument == null)
            {
                return(apiDocument);
            }

            OneSpanSign.API.Document doc = new OneSpanSign.API.Document();

            doc.Name            = sdkDocument.Name;
            doc.Index           = sdkDocument.Index;
            doc.Extract         = sdkDocument.Extract;
            doc.ExtractionTypes = sdkDocument.ExtractionTypes;
            doc.External        = new ExternalConverter(sdkDocument.External).ToAPIExternal();
            doc.Data            = sdkDocument.Data;
            doc.Tagged          = sdkDocument.Tagged;

            if (sdkDocument.Id != null)
            {
                doc.Id = sdkDocument.Id;
            }

            if (sdkDocument.Description != null)
            {
                doc.Description = sdkDocument.Description;
            }

            return(doc);
        }
Пример #2
0
        internal OneSpanSign.API.Document ToAPIDocument(OneSpanSign.API.Package apiPackage)
        {
            if (sdkDocument == null)
            {
                return(apiDocument);
            }

            OneSpanSign.API.Document doc = ToAPIDocument();

            foreach (Signature signature in sdkDocument.Signatures)
            {
                OneSpanSign.API.Approval approval = new SignatureConverter(signature).ToAPIApproval();

                if (signature.IsPlaceholderSignature())
                {
                    approval.Role = signature.RoleId.Id;
                }
                else if (signature.IsGroupSignature())
                {
                    approval.Role = FindRoleIdForGroup(signature.GroupId, apiPackage);
                }
                else
                {
                    approval.Role = FindRoleIdForSigner(signature.SignerEmail, apiPackage);
                }
                doc.AddApproval(approval);
            }

            foreach (Field field in sdkDocument.Fields)
            {
                doc.AddField(new FieldConverter(field).ToAPIField());
            }

            foreach (Field field in sdkDocument.QRCodes)
            {
                doc.AddField(new FieldConverter(field).ToAPIField());
            }

            return(doc);
        }
Пример #3
0
        internal SignedDocument ConvertToSignedDocument(OneSpanSign.API.Document document)
        {
            SignedDocument signedDocument = new SignedDocument();

            signedDocument.Id                      = document.Id;
            signedDocument.Name                    = document.Name;
            signedDocument.Description             = document.Description;
            signedDocument.Approvals               = document.Approvals;
            signedDocument.External                = document.External;
            signedDocument.Index                   = document.Index;
            signedDocument.Extract                 = document.Extract;
            signedDocument.ExtractionTypes         = document.ExtractionTypes;
            signedDocument.Fields                  = document.Fields;
            signedDocument.Data                    = document.Data;
            signedDocument.SignedHash              = document.SignedHash;
            signedDocument.Pages                   = document.Pages;
            signedDocument.Size                    = document.Size;
            signedDocument.Status                  = document.Status;
            signedDocument.SignerVerificationToken = document.SignerVerificationToken;
            signedDocument.Tagged                  = document.Tagged;

            return(signedDocument);
        }
Пример #4
0
 /*
  * Construct with API objects
  */
 public DocumentConverter(OneSpanSign.API.Document apiDocument, OneSpanSign.API.Package apiPackage)
 {
     this.apiDocument = apiDocument;
     this.apiPackage  = apiPackage;
 }