Skip to content

Commit

Permalink
Add support for the v1.IATSSCD interface
Browse files Browse the repository at this point in the history
  • Loading branch information
forsthug committed Mar 19, 2024
1 parent c9ad1b6 commit 446753b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/fiskaltrust.Launcher/Extensions/WebApplicationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using fiskaltrust.ifPOS.v1;
using fiskaltrust.ifPOS.v1.at;
using fiskaltrust.ifPOS.v1.de;
using fiskaltrust.ifPOS.v1.it;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -21,8 +22,8 @@ private static IEnumerable<RouteHandlerBuilder> MapMultiplePrefixed(this WebAppl

public static WebApplication AddQueueEndpoints(this WebApplication app, IPOS pos)
{
app.MapMultiplePrefixed(_prefixesV1, "Echo", EndpointRouteBuilderExtensions.MapPost, async (EchoRequest req) => await pos.EchoAsync(req));
app.MapMultiplePrefixed(_prefixesV0, "Echo", EndpointRouteBuilderExtensions.MapPost, async ([FromBody] string message) => (await pos.EchoAsync(new EchoRequest { Message = message })).Message);
app.MapMultiplePrefixed(_prefixesV1, "Echo", EndpointRouteBuilderExtensions.MapPost, async (ifPOS.v1.EchoRequest req) => await pos.EchoAsync(req));
app.MapMultiplePrefixed(_prefixesV0, "Echo", EndpointRouteBuilderExtensions.MapPost, async ([FromBody] string message) => (await pos.EchoAsync(new ifPOS.v1.EchoRequest { Message = message })).Message);
app.MapMultiplePrefixed(_prefixes, "Sign", EndpointRouteBuilderExtensions.MapPost, async (ReceiptRequest req) => await pos.SignAsync(req));
app.MapMultiplePrefixed(_prefixes, "Journal", EndpointRouteBuilderExtensions.MapPost, ([FromQuery] long type, [FromQuery] long? from, [FromQuery] long? to) =>
{
Expand Down Expand Up @@ -72,5 +73,14 @@ public static WebApplication AddScuItEndpoints(this WebApplication app, IITSSCD
app.MapMultiplePrefixed(_prefixesV1, "GetRTInfo", EndpointRouteBuilderExtensions.MapGet, async () => await sscd.GetRTInfoAsync());
return app;
}


public static WebApplication AddScuAtEndpoints(this WebApplication app, IATSSCD ssat)
{
app.MapMultiplePrefixed(_prefixesV1, "Certificate", EndpointRouteBuilderExtensions.MapGet, async () => await ssat.CertificateAsync());
app.MapMultiplePrefixed(_prefixesV1, "ZDA", EndpointRouteBuilderExtensions.MapGet, async () => await ssat.ZdaAsync());
app.MapMultiplePrefixed(_prefixesV1, "Sign", EndpointRouteBuilderExtensions.MapGet, async (SignRequest req) => await ssat.SignAsync(req));
return app;
}
}
}
7 changes: 7 additions & 0 deletions src/fiskaltrust.Launcher/ProcessHost/ProcessHostPlebeian.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using fiskaltrust.ifPOS.v1;
using fiskaltrust.ifPOS.v1.at;
using fiskaltrust.ifPOS.v1.de;
using fiskaltrust.ifPOS.v1.it;
using fiskaltrust.Launcher.Common.Configuration;
Expand Down Expand Up @@ -212,6 +213,12 @@ private static (object, Action<WebApplication>, Type) GetScu(IServiceProvider se
return (scuIt, (WebApplication app) => app.AddScuItEndpoints(scuIt), typeof(IITSSCD));
}

var scuAt = services.GetService<IATSSCD>();
if (scuAt is not null)
{
return (scuAt, (WebApplication app) => app.AddScuAtEndpoints(scuAt), typeof(IATSSCD));
}

throw new Exception("Could not resolve SCU with supported country. (Curently supported are DE and IT)");
}

Expand Down

0 comments on commit 446753b

Please sign in to comment.