Esempio n. 1
0
        public void UpdateApprovals(DocumentPackage sdkPackage, string documentId, IList <Signature> signatureList)
        {
            Package apiPackage = new DocumentPackageConverter(sdkPackage).ToAPIPackage();

            IList <Approval> approvalList = new List <Approval>();

            foreach (Signature signature in signatureList)
            {
                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);
                }
                approvalList.Add(approval);
            }

            apiClient.UpdateApprovals(sdkPackage.Id, documentId, approvalList);
        }
Esempio n. 2
0
        public void ModifyApproval(DocumentPackage sdkPackage, string documentId, Signature signature)
        {
            Approval approval   = new SignatureConverter(signature).ToAPIApproval();
            Package  apiPackage = new DocumentPackageConverter(sdkPackage).ToAPIPackage();

            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);
            }

            apiClient.ModifyApproval(sdkPackage.Id, documentId, approval);
        }
Esempio n. 3
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);
        }