From 388cc7fe9693c22ef9b59c674f2fc01ce9409ef0 Mon Sep 17 00:00:00 2001 From: Abdallah Al Trabeishi <51375082+abdallahbeshi@users.noreply.github.com> Date: Tue, 31 Dec 2024 16:27:23 +0100 Subject: [PATCH] Improved Austrian fiscalization response handling. (#257) --- .../ATrust/ATrustSigner.cs | 15 +++++++++++++-- .../Mews.Fiscalizations.Austria.csproj | 2 +- .../Mews.Fiscalizations.All.csproj | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Austria/Mews.Fiscalizations.Austria/ATrust/ATrustSigner.cs b/src/Austria/Mews.Fiscalizations.Austria/ATrust/ATrustSigner.cs index ab3177be..da2b492c 100644 --- a/src/Austria/Mews.Fiscalizations.Austria/ATrust/ATrustSigner.cs +++ b/src/Austria/Mews.Fiscalizations.Austria/ATrust/ATrustSigner.cs @@ -32,8 +32,19 @@ public async Task SignAsync(QrData qrData) var response = await HttpClient.PostAsync($"{EndpointUrl.Value}/Sign/JWS", requestContent); var responseContent = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(responseContent); - return new SignerOutput(new JwsRepresentation(result.JwsRepresentation), input.QrData); + try + { + var result = JsonConvert.DeserializeObject(responseContent); + return new SignerOutput(new JwsRepresentation(result.JwsRepresentation), input.QrData); + } + catch (JsonException jsonEx) + { + throw new Exception($"Failed to deserialize response content: {responseContent}", jsonEx); + } + catch (Exception ex) + { + throw new Exception($"An error occurred while processing the response: {responseContent}", ex); + } } public async Task GetCertificateInfoAsync() diff --git a/src/Austria/Mews.Fiscalizations.Austria/Mews.Fiscalizations.Austria.csproj b/src/Austria/Mews.Fiscalizations.Austria/Mews.Fiscalizations.Austria.csproj index c5ae34e0..f12745f4 100644 --- a/src/Austria/Mews.Fiscalizations.Austria/Mews.Fiscalizations.Austria.csproj +++ b/src/Austria/Mews.Fiscalizations.Austria/Mews.Fiscalizations.Austria.csproj @@ -10,7 +10,7 @@ https://github.com/MewsSystems/fiscalizations https://raw.githubusercontent.com/msigut/eet/master/receipt.png true - 8.0.1 + 9.0.0 12 true diff --git a/src/Mews.Fiscalizations.All/Mews.Fiscalizations.All.csproj b/src/Mews.Fiscalizations.All/Mews.Fiscalizations.All.csproj index c912f510..cef8bcb9 100644 --- a/src/Mews.Fiscalizations.All/Mews.Fiscalizations.All.csproj +++ b/src/Mews.Fiscalizations.All/Mews.Fiscalizations.All.csproj @@ -10,7 +10,7 @@ https://github.com/MewsSystems/fiscalizations https://raw.githubusercontent.com/msigut/eet/master/receipt.png true - 27.0.2 + 28.0.0 12 true $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage