Skip to content
Snippets Groups Projects
Commit 1138a610 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

update sender with latest informaiton

parent 60e062bf
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,9 @@ logger.LogInformation("Starting FIT-Connect");
//await SenderDemo.Run(config, logger);
//await SubscriberDemo.Run(config, logger);
SenderDemo.SimpleSend(config,Guid.Parse("f726bcdd-2296-4863-ae52-570c67eee0ce"),
File.ReadAllText("/Users/kfischer/Downloads/TestDatei.xml")
var (submissionId, caseId) = await SenderDemo.SimpleSend(config,Guid.Parse("f726bcdd-2296-4863-ae52-570c67eee0ce"),
"urn:de:fim:leika:leistung:99102013000000",
File.ReadAllText("/Users/kfischer/Downloads/TestDatei.xml"),
"/Users/kfischer/Documents/ScanSnap Home folder/27092024.pdf"
, logger);
......@@ -116,11 +116,14 @@ public static class SenderDemo {
.SendAsync(sendableEncryptedSubmission);
}
public static void SimpleSend(IConfigurationRoot config, Guid destination, string data, ILogger logger) {
public static async Task<(Guid SubmissionId, Guid CaseId)> SimpleSend(IConfigurationRoot config, Guid destination, string serviceType, string data,
string attachment,
ILogger logger) {
var sendableSubmission = SendableSubmission.Builder()
.SetDestination(destination)
.SetServiceType(config["FitConnect:Sender:ServiceIdentifier"], "FIT Connect Demo")
.SetServiceType(serviceType, "FIT Connect Demo")
.SetXmlData(data, new Uri("https://schema.example.com"))
.AddAttachments(Attachment.FromPath(attachment, "application/pdf"))
.Build();
var clientId = config["FitConnect:Sender:ClientId"];
......@@ -143,6 +146,11 @@ public static class SenderDemo {
var sender = ClientFactory.CreateSenderClient(environment, clientId, clientSecret, logger);
var sentSubmission = sender.SendAsync(sendableSubmission).Result;
var sentSubmission = await sender.SendAsync(sendableSubmission);
var status = await sender.GetStatusForSubmissionAsync(sentSubmission);
logger.LogInformation("Status for {submission} is {status}",sentSubmission.SubmissionId, status.SubmissionState.ToString());
return (sentSubmission.SubmissionId, sentSubmission.CaseId);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment