Skip to content

Commit

Permalink
Merge pull request #81 from digipost/b_IdentifyResultTypeNone
Browse files Browse the repository at this point in the history
Bug identify result type none.
Aleksander-OK
  • Loading branch information
kristianenge committed Oct 22, 2015
2 parents 253b224 + f1cb832 commit 8b4a943
Show file tree
Hide file tree
Showing 10 changed files with 1,307 additions and 1,045 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public enum IdentificationResultCode
Unidentified,

[XmlEnum("INVALID")]
Invalid,
Invalid
}
}
7 changes: 6 additions & 1 deletion Digipost.Api.Client.Domain/Enums/IdentificationResultType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ namespace Digipost.Api.Client.Domain.Enums
[XmlType("ItemChoiceType", Namespace = "http://api.digipost.no/schema/v6", IncludeInSchema = false)]
public enum IdentificationResultType
{

[XmlEnum("")]
None,

[XmlEnum("digipost-address")]
DigipostAddress,

Expand All @@ -17,6 +21,7 @@ public enum IdentificationResultType
Personalias,

[XmlEnum("unidentified-reason")]
UnidentifiedReason,
UnidentifiedReason

}
}
7 changes: 5 additions & 2 deletions Digipost.Api.Client.Domain/Identify/IdentificationResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Digipost.Api.Client.Domain.Identify
{
public class IdentificationResult : IIdentificationResult
{
public IdentificationResult(IdentificationResultType resultType, string result)
public IdentificationResult(IdentificationResultType resultType, string result = "")
{
ResultType = resultType;
SetResultByIdentificationResultType(result);
Expand All @@ -20,7 +20,10 @@ public IdentificationResult(IdentificationResultType resultType, string result)
private void SetResultByIdentificationResultType(string result)
{
bool allSuccessfulResultType = ResultType == IdentificationResultType.DigipostAddress ||
ResultType == IdentificationResultType.Personalias;
ResultType == IdentificationResultType.Personalias ||
ResultType == IdentificationResultType.None;



if (allSuccessfulResultType)
{
Expand Down
532 changes: 274 additions & 258 deletions Digipost.Api.Client.Domain/Utilities/DataTransferObjectConverter.cs

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions Digipost.Api.Client.Testklient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ internal class Program

private static void Main(string[] args)
{
CompareLogic comparelogic = new CompareLogic();

var v = comparelogic.Compare(new SearchDetails(){DigipostAddress = "Halloen"}, new SearchDetails());
List<Difference> diff = v.Differences;
var descr = diff.ElementAt(0).GetWhatIsCompared();

//Performance();
Send();
RunSingle();

Console.ReadKey();
}

Expand All @@ -45,9 +40,9 @@ private static void Performance()
Initializer.Run(); //concurency runner
}

private static void Send()
private static void RunSingle()
{


var config = new ClientConfig(SenderId)
{
ApiUrl = new Uri(Url),
Expand All @@ -58,20 +53,20 @@ private static void Send()
);
}
};



//Logging.Initialize(config);
var api = new DigipostClient(config, Thumbprint);

//IdentifyPerson(api);
SendMessageToPerson(api, false);
var response = Search(api);
IdentifyPerson(api);
//SendMessageToPerson(api, false);
//var response = Search(api);


//var res = api.GetPersonDetails(response.AutcompleteSuggestions[0]);
//ConcurrencyTest.Initializer.Run(); //concurency runner

Console.ReadKey();
Console.ReadKey();
}

private static ISearchDetailsResult Search(DigipostClient api)
Expand Down Expand Up @@ -126,17 +121,25 @@ private static void IdentifyPerson(DigipostClient api)
Console.WriteLine("======================================");

//var identification = new Identification(IdentificationChoice.PersonalidentificationNumber, "01013300001");
var identification = new Identification(new RecipientById(IdentificationType.DigipostAddress, "jarand.bjarte.t.k.grindheim#71WZ"));
//var identification = new Identification(new RecipientById(IdentificationType.PersonalIdentificationNumber, "31010986802"));
//var identification = new Identification(new RecipientById(IdentificationType.PersonalIdentificationNumber, "16014139692"));
//var identification = new Identification(new RecipientById(IdentificationType.PersonalIdentificationNumber, "01108448586"));
//var identification = new Identification(new RecipientById(IdentificationType.PersonalIdentificationNumber, "01108448511"));
// var identification = new Identification(new RecipientByNameAndAddress("Kristian Sæther Enge","Collettsgate 68","0460","Oslo"));
//var identification = new Identification(new RecipientByNameAndAddress("Kristian Sæther Enge", "blåbærveien 1", "9999", "Oslo"));
var identification = new Identification(new RecipientById(IdentificationType.OrganizationNumber, "896295291"));

try
{
var identificationResponse = api.Identify(identification);
Logging.Log(TraceEventType.Information, "Identification resp: \n" + identificationResponse);
WriteToConsoleWithColor("> Personen ble identifisert!", false);

//Console.WriteLine("IdentificationValue: " + identificationResponse.IdentificationValue);
//Console.WriteLine("IdentificationType: " + identificationResponse.IdentificationType)
;

Console.WriteLine("ResultType: " + identificationResponse.ResultType);
Console.WriteLine("IdentificationValue: " + identificationResponse.Data);
Console.WriteLine("Error: " + identificationResponse.Error);



}
catch (ClientResponseException e)
Expand Down Expand Up @@ -178,8 +181,8 @@ private static IMessage GetMessage()
new PrintReturnRecipient("Kristian Sæther Enge",
new NorwegianAddress("0460", "Oslo", "Colletts gate 68"))
);

//recipientIdentifier for digital mail

//recipientIdentifier for digital mail
var recipientByNameAndAddress = new RecipientByNameAndAddressDataTranferObject("Kristian Sæther Enge", "0460",
"Oslo", "Collettsgate 68");

Expand Down
Loading

0 comments on commit 8b4a943

Please sign in to comment.