diff --git a/Digipost.Signature.Api.Client.Core.Tests/Smoke/SmokeTests.cs b/Digipost.Signature.Api.Client.Core.Tests/Smoke/SmokeTests.cs index 535e233f..67206702 100755 --- a/Digipost.Signature.Api.Client.Core.Tests/Smoke/SmokeTests.cs +++ b/Digipost.Signature.Api.Client.Core.Tests/Smoke/SmokeTests.cs @@ -13,7 +13,7 @@ protected static Client ClientType return Client.DifiQa; } - return Client.Localhost; + return Client.DifiQa; } } diff --git a/Digipost.Signature.Api.Client.Core/Signer.cs b/Digipost.Signature.Api.Client.Core/Signer.cs index 250980b3..2f2888e5 100755 --- a/Digipost.Signature.Api.Client.Core/Signer.cs +++ b/Digipost.Signature.Api.Client.Core/Signer.cs @@ -8,5 +8,7 @@ public Signer(string personalIdentificationNumber) } public string PersonalIdentificationNumber { get; } + + public int? Order { get; set; } = null; } } \ No newline at end of file diff --git a/Digipost.Signature.Api.Client.Portal.Tests/DataTransferObjects/DataTransferObjectConverterTests.cs b/Digipost.Signature.Api.Client.Portal.Tests/DataTransferObjects/DataTransferObjectConverterTests.cs index 7c113ede..4f5a0b41 100755 --- a/Digipost.Signature.Api.Client.Portal.Tests/DataTransferObjects/DataTransferObjectConverterTests.cs +++ b/Digipost.Signature.Api.Client.Portal.Tests/DataTransferObjects/DataTransferObjectConverterTests.cs @@ -78,6 +78,41 @@ public void ConvertsManifestWithoutAvailabilitySuccessfully() Assert.AreEqual(0, differences.Count()); } + [TestMethod] + public void ConvertsManifestWithOrderedSignersSuccessfully() + { + //Arrange + const string organizationNumberSender = "12345678902"; + + var source = new PortalManifest(new Sender(organizationNumberSender), CoreDomainUtility.GetDocument(), new List {new Signer("00000000000") {Order = 1}, new Signer("99999999999") {Order = 2}}); + + var expected = new portalsignaturejobmanifest + { + sender = new sender {organizationnumber = organizationNumberSender}, + document = new document + { + title = source.Document.Subject, + description = source.Document.Message, + href = source.Document.FileName, + mime = source.Document.MimeType + }, + signers = new[] + { + new signer {personalidentificationnumber = source.Signers.ElementAt(0).PersonalIdentificationNumber, order = 1}, + new signer {personalidentificationnumber = source.Signers.ElementAt(1).PersonalIdentificationNumber, order = 2} + } + }; + + //Act + var result = DataTransferObjectConverter.ToDataTransferObject(source); + + //Assert + var comparator = new Comparator(); + IEnumerable differences; + comparator.AreEqual(expected, result, out differences); + Assert.AreEqual(0, differences.Count()); + } + [TestMethod] public void ConvertsManifestWithOnlyAvailableSecondsSuccessfully() { diff --git a/Digipost.Signature.Api.Client.Portal/DataTransferObjects/DataTransferObjectConverter.cs b/Digipost.Signature.Api.Client.Portal/DataTransferObjects/DataTransferObjectConverter.cs index 9747227f..feadb1e4 100755 --- a/Digipost.Signature.Api.Client.Portal/DataTransferObjects/DataTransferObjectConverter.cs +++ b/Digipost.Signature.Api.Client.Portal/DataTransferObjects/DataTransferObjectConverter.cs @@ -52,10 +52,17 @@ private static IEnumerable ToDataTransferObject(IEnumerable sign private static signer ToDataTransferObject(Signer signer) { - return new signer + var dataTransferObject = new signer { personalidentificationnumber = signer.PersonalIdentificationNumber }; + + if (signer.Order != null) + { + dataTransferObject.order = signer.Order.Value; + } + + return dataTransferObject; } public static sender ToDataTransferObject(Sender sender) diff --git a/Digipost.Signature.Api.Client.Scripts/XsdToCode/Code/direct-and-portal.cs b/Digipost.Signature.Api.Client.Scripts/XsdToCode/Code/direct-and-portal.cs index 6bf40762..2cc0b505 100755 --- a/Digipost.Signature.Api.Client.Scripts/XsdToCode/Code/direct-and-portal.cs +++ b/Digipost.Signature.Api.Client.Scripts/XsdToCode/Code/direct-and-portal.cs @@ -320,6 +320,10 @@ public partial class signer { private string personalidentificationnumberField; + private int orderField; + + private bool orderFieldSpecified; + /// [System.Xml.Serialization.XmlElementAttribute("personal-identification-number")] public string personalidentificationnumber { @@ -330,6 +334,28 @@ public string personalidentificationnumber { this.personalidentificationnumberField = value; } } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + public int order { + get { + return this.orderField; + } + set { + this.orderField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool orderSpecified { + get { + return this.orderFieldSpecified; + } + set { + this.orderFieldSpecified = value; + } + } } /// diff --git a/Digipost.Signature.Api.Client.Scripts/XsdToCode/Xsd/common.xsd b/Digipost.Signature.Api.Client.Scripts/XsdToCode/Xsd/common.xsd index 2b3df9b3..b96abb90 100755 --- a/Digipost.Signature.Api.Client.Scripts/XsdToCode/Xsd/common.xsd +++ b/Digipost.Signature.Api.Client.Scripts/XsdToCode/Xsd/common.xsd @@ -59,6 +59,26 @@ + + + + Specifies the order in which documents should be activated. Lower values indicates earlier activation. + A document with higher order will only be made available when all lower order signers have signed the document. + If two signers have the same order, the document will be made available to both in parallell. + Specifying order with only one signer has no effect. + + The specified signature deadline for portal jobs will be for each individual signer. + For example, 1 day for 3 chained signers means 3 days maximum. The time only runs once for signers in paralell, + so three paralell signers with 1 day deadline will maximum take 1 day. + + + + + + + + +