Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected static Client ClientType
return Client.DifiQa;
}

return Client.Localhost;
return Client.DifiQa;
}
}

Expand Down
2 changes: 2 additions & 0 deletions Digipost.Signature.Api.Client.Core/Signer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ public Signer(string personalIdentificationNumber)
}

public string PersonalIdentificationNumber { get; }

public int? Order { get; set; } = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Signer> {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<IDifference> differences;
comparator.AreEqual(expected, result, out differences);
Assert.AreEqual(0, differences.Count());
}

[TestMethod]
public void ConvertsManifestWithOnlyAvailableSecondsSuccessfully()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ private static IEnumerable<signer> ToDataTransferObject(IEnumerable<Signer> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ public partial class signer {

private string personalidentificationnumberField;

private int orderField;

private bool orderFieldSpecified;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("personal-identification-number")]
public string personalidentificationnumber {
Expand All @@ -330,6 +334,28 @@ public string personalidentificationnumber {
this.personalidentificationnumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public int order {
get {
return this.orderField;
}
set {
this.orderField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool orderSpecified {
get {
return this.orderFieldSpecified;
}
set {
this.orderFieldSpecified = value;
}
}
}

/// <remarks/>
Expand Down
20 changes: 20 additions & 0 deletions Digipost.Signature.Api.Client.Scripts/XsdToCode/Xsd/common.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@
<xs:element name="personal-identification-number" minOccurs="1" maxOccurs="1"
type="personal-identification-number"/>
</xs:sequence>
<xs:attribute name="order" use="optional">
<xs:annotation>
<xs:documentation>
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.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="9"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>

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