Skip to content

Commit e9c4833

Browse files
committed
Merge pull request #32 from digipost/OrderOfSigner
Adds Order to signers
2 parents 8c4a8e1 + 6897694 commit e9c4833

File tree

6 files changed

+92
-2
lines changed

6 files changed

+92
-2
lines changed

Digipost.Signature.Api.Client.Core.Tests/Smoke/SmokeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected static Client ClientType
1313
return Client.DifiQa;
1414
}
1515

16-
return Client.Localhost;
16+
return Client.DifiQa;
1717
}
1818
}
1919

Digipost.Signature.Api.Client.Core/Signer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ public Signer(string personalIdentificationNumber)
88
}
99

1010
public string PersonalIdentificationNumber { get; }
11+
12+
public int? Order { get; set; } = null;
1113
}
1214
}

Digipost.Signature.Api.Client.Portal.Tests/DataTransferObjects/DataTransferObjectConverterTests.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,41 @@ public void ConvertsManifestWithoutAvailabilitySuccessfully()
7878
Assert.AreEqual(0, differences.Count());
7979
}
8080

81+
[TestMethod]
82+
public void ConvertsManifestWithOrderedSignersSuccessfully()
83+
{
84+
//Arrange
85+
const string organizationNumberSender = "12345678902";
86+
87+
var source = new PortalManifest(new Sender(organizationNumberSender), CoreDomainUtility.GetDocument(), new List<Signer> {new Signer("00000000000") {Order = 1}, new Signer("99999999999") {Order = 2}});
88+
89+
var expected = new portalsignaturejobmanifest
90+
{
91+
sender = new sender {organizationnumber = organizationNumberSender},
92+
document = new document
93+
{
94+
title = source.Document.Subject,
95+
description = source.Document.Message,
96+
href = source.Document.FileName,
97+
mime = source.Document.MimeType
98+
},
99+
signers = new[]
100+
{
101+
new signer {personalidentificationnumber = source.Signers.ElementAt(0).PersonalIdentificationNumber, order = 1},
102+
new signer {personalidentificationnumber = source.Signers.ElementAt(1).PersonalIdentificationNumber, order = 2}
103+
}
104+
};
105+
106+
//Act
107+
var result = DataTransferObjectConverter.ToDataTransferObject(source);
108+
109+
//Assert
110+
var comparator = new Comparator();
111+
IEnumerable<IDifference> differences;
112+
comparator.AreEqual(expected, result, out differences);
113+
Assert.AreEqual(0, differences.Count());
114+
}
115+
81116
[TestMethod]
82117
public void ConvertsManifestWithOnlyAvailableSecondsSuccessfully()
83118
{

Digipost.Signature.Api.Client.Portal/DataTransferObjects/DataTransferObjectConverter.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,17 @@ private static IEnumerable<signer> ToDataTransferObject(IEnumerable<Signer> sign
5252

5353
private static signer ToDataTransferObject(Signer signer)
5454
{
55-
return new signer
55+
var dataTransferObject = new signer
5656
{
5757
personalidentificationnumber = signer.PersonalIdentificationNumber
5858
};
59+
60+
if (signer.Order != null)
61+
{
62+
dataTransferObject.order = signer.Order.Value;
63+
}
64+
65+
return dataTransferObject;
5966
}
6067

6168
public static sender ToDataTransferObject(Sender sender)

Digipost.Signature.Api.Client.Scripts/XsdToCode/Code/direct-and-portal.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ public partial class signer {
320320

321321
private string personalidentificationnumberField;
322322

323+
private int orderField;
324+
325+
private bool orderFieldSpecified;
326+
323327
/// <remarks/>
324328
[System.Xml.Serialization.XmlElementAttribute("personal-identification-number")]
325329
public string personalidentificationnumber {
@@ -330,6 +334,28 @@ public string personalidentificationnumber {
330334
this.personalidentificationnumberField = value;
331335
}
332336
}
337+
338+
/// <remarks/>
339+
[System.Xml.Serialization.XmlAttributeAttribute()]
340+
public int order {
341+
get {
342+
return this.orderField;
343+
}
344+
set {
345+
this.orderField = value;
346+
}
347+
}
348+
349+
/// <remarks/>
350+
[System.Xml.Serialization.XmlIgnoreAttribute()]
351+
public bool orderSpecified {
352+
get {
353+
return this.orderFieldSpecified;
354+
}
355+
set {
356+
this.orderFieldSpecified = value;
357+
}
358+
}
333359
}
334360

335361
/// <remarks/>

Digipost.Signature.Api.Client.Scripts/XsdToCode/Xsd/common.xsd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@
5959
<xs:element name="personal-identification-number" minOccurs="1" maxOccurs="1"
6060
type="personal-identification-number"/>
6161
</xs:sequence>
62+
<xs:attribute name="order" use="optional">
63+
<xs:annotation>
64+
<xs:documentation>
65+
Specifies the order in which documents should be activated. Lower values indicates earlier activation.
66+
A document with higher order will only be made available when all lower order signers have signed the document.
67+
If two signers have the same order, the document will be made available to both in parallell.
68+
Specifying order with only one signer has no effect.
69+
70+
The specified signature deadline for portal jobs will be for each individual signer.
71+
For example, 1 day for 3 chained signers means 3 days maximum. The time only runs once for signers in paralell,
72+
so three paralell signers with 1 day deadline will maximum take 1 day.
73+
</xs:documentation>
74+
</xs:annotation>
75+
<xs:simpleType>
76+
<xs:restriction base="xs:int">
77+
<xs:minInclusive value="0"/>
78+
<xs:maxInclusive value="9"/>
79+
</xs:restriction>
80+
</xs:simpleType>
81+
</xs:attribute>
6282
</xs:complexType>
6383

6484
<xs:simpleType name="personal-identification-number">

0 commit comments

Comments
 (0)