Bump version to 1.2.0 and enhance QR code documentation
Updated `DocumentService.Client.csproj` to version 1.2.0, reflecting new features and improvements. Enhanced `README.md` with detailed examples for the new `InspectSwissQrCodeAsync` method, showcasing two approaches (TryExtract and direct null-check) for accessing QR code data. Added PowerShell-specific notes and improved code formatting for better readability. Clarified that `TryExtract` is an optional helper method.
This commit is contained in:
@@ -11,9 +11,9 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/Rec.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/Rec.git</RepositoryUrl>
|
||||||
<PackageTags>digital data document service api client</PackageTags>
|
<PackageTags>digital data document service api client</PackageTags>
|
||||||
<Version>1.1.0</Version>
|
<Version>1.2.0</Version>
|
||||||
<AssemblyVersion>1.1.0.0</AssemblyVersion>
|
<AssemblyVersion>1.2.0.0</AssemblyVersion>
|
||||||
<FileVersion>1.1.0.0</FileVersion>
|
<FileVersion>1.2.0.0</FileVersion>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ Alle Beispiele nutzen ausschließlich den statischen `Client`-Einstiegspunkt. Vo
|
|||||||
|
|
||||||
#### Swiss QR Code – Validierung und Extraktion in einem Schritt
|
#### Swiss QR Code – Validierung und Extraktion in einem Schritt
|
||||||
|
|
||||||
|
`InspectSwissQrCodeAsync` gibt immer ein `SwissQrCodeResult` zurück, das sowohl das Validierungsergebnis als auch den extrahierten QR-Code enthält. Für den Zugriff auf den QR-Code stehen zwei gleichwertige Varianten zur Verfügung:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using DocumentService.Client;
|
using DocumentService.Client;
|
||||||
using DocumentService.Client.Models.Results;
|
using DocumentService.Client.Models.Results;
|
||||||
@@ -201,16 +203,23 @@ Console.WriteLine($"Gültig: {result.Validation.IsValid}");
|
|||||||
Console.WriteLine($"Seiten: {result.Validation.PageCount}");
|
Console.WriteLine($"Seiten: {result.Validation.PageCount}");
|
||||||
Console.WriteLine($"Verschlüsselt: {result.Validation.IsEncrypted}");
|
Console.WriteLine($"Verschlüsselt: {result.Validation.IsEncrypted}");
|
||||||
|
|
||||||
// QR-Code nur auswerten wenn Dokument gültig war
|
// Variante A: TryExtract – lesbarerer Code, kein expliziter Null-Check notwendig
|
||||||
if (result.QrCode is not null)
|
// (optionale Hilfsmethode; Variante B ist gleichwertig)
|
||||||
|
if (result.TryExtract(out var qrCode))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Betrag: {result.QrCode.Bill?.Amount} {result.QrCode.Bill?.Currency}");
|
Console.WriteLine($"Betrag: {qrCode.Bill?.Amount} {qrCode.Bill?.Currency}");
|
||||||
Console.WriteLine($"Empfänger: {result.QrCode.Bill?.Creditor?.Name}");
|
Console.WriteLine($"Empfänger: {qrCode.Bill?.Creditor?.Name}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("Kein Swiss QR Code gefunden oder Dokument ungültig.");
|
Console.WriteLine("Kein Swiss QR Code gefunden oder Dokument ungültig.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Variante B: direkter Null-Check auf QrCode
|
||||||
|
if (result.QrCode is not null)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Betrag: {result.QrCode.Bill?.Amount} {result.QrCode.Bill?.Currency}");
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```vbnet
|
```vbnet
|
||||||
@@ -224,12 +233,19 @@ Console.WriteLine($"Gültig: {result.Validation.IsValid}")
|
|||||||
Console.WriteLine($"Seiten: {result.Validation.PageCount}")
|
Console.WriteLine($"Seiten: {result.Validation.PageCount}")
|
||||||
Console.WriteLine($"Verschlüsselt: {result.Validation.IsEncrypted}")
|
Console.WriteLine($"Verschlüsselt: {result.Validation.IsEncrypted}")
|
||||||
|
|
||||||
If result.QrCode IsNot Nothing Then
|
' Variante A: TryExtract
|
||||||
Console.WriteLine($"Betrag: {result.QrCode.Bill?.Amount} {result.QrCode.Bill?.Currency}")
|
Dim qrCode As DocumentService.Application.Common.DTOs.SwissQrCodeExtractionResult = Nothing
|
||||||
Console.WriteLine($"Empfänger: {result.QrCode.Bill?.Creditor?.Name}")
|
If result.TryExtract(qrCode) Then
|
||||||
|
Console.WriteLine($"Betrag: {qrCode.Bill?.Amount} {qrCode.Bill?.Currency}")
|
||||||
|
Console.WriteLine($"Empfänger: {qrCode.Bill?.Creditor?.Name}")
|
||||||
Else
|
Else
|
||||||
Console.WriteLine("Kein Swiss QR Code gefunden oder Dokument ungültig.")
|
Console.WriteLine("Kein Swiss QR Code gefunden oder Dokument ungültig.")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
' Variante B: direkter Null-Check
|
||||||
|
If result.QrCode IsNot Nothing Then
|
||||||
|
Console.WriteLine($"Betrag: {result.QrCode.Bill?.Amount} {result.QrCode.Bill?.Currency}")
|
||||||
|
End If
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
@@ -242,6 +258,8 @@ Write-Host "Gueltig: $($result.Validation.IsValid)"
|
|||||||
Write-Host "Seiten: $($result.Validation.PageCount)"
|
Write-Host "Seiten: $($result.Validation.PageCount)"
|
||||||
Write-Host "Verschluesselt:$($result.Validation.IsEncrypted)"
|
Write-Host "Verschluesselt:$($result.Validation.IsEncrypted)"
|
||||||
|
|
||||||
|
# TryExtract ist in PowerShell nicht direkt nutzbar (out-Parameter).
|
||||||
|
# Direkter Null-Check ist hier die einzige Option:
|
||||||
if ($null -ne $result.QrCode) {
|
if ($null -ne $result.QrCode) {
|
||||||
Write-Host "Betrag: $($result.QrCode.Bill.Amount) $($result.QrCode.Bill.Currency)"
|
Write-Host "Betrag: $($result.QrCode.Bill.Amount) $($result.QrCode.Bill.Currency)"
|
||||||
Write-Host "Empfaenger:$($result.QrCode.Bill.Creditor.Name)"
|
Write-Host "Empfaenger:$($result.QrCode.Bill.Creditor.Name)"
|
||||||
@@ -250,6 +268,8 @@ if ($null -ne $result.QrCode) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **`TryExtract` – Hinweis:** Die Methode ist eine optionale Lesbarkeits-Hilfe und nicht zwingend erforderlich. Der direkte Null-Check auf `result.QrCode` ist gleichwertig. Gibt `TryExtract` `false` zurück, ist der `out`-Parameter `qrCode` `null` – er darf in diesem Fall nicht verwendet werden.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 1. PDF-Validierung
|
### 1. PDF-Validierung
|
||||||
|
|||||||
Reference in New Issue
Block a user