Refactor envelope receiver auth flow and state handling

- Introduce IReceiverAuthService and ReceiverAuthService for all envelope receiver authentication and status API calls
- Add ReceiverAuthModel as a client-side DTO for API responses
- Refactor EnvelopeState to store all relevant fields and update via ApplyApiResponse
- Overhaul EnvelopePage.razor to use new service and state, with improved status handling and UI
- Enhance ApiResponse and ApiServiceBase to support structured error deserialization
- Register IReceiverAuthService in DI container
This commit is contained in:
OlgunR
2026-03-23 15:57:20 +01:00
parent 4aa889f178
commit 93488ba83e
8 changed files with 320 additions and 59 deletions

View File

@@ -0,0 +1,26 @@
using EnvelopeGenerator.ReceiverUI.Client.Models;
using EnvelopeGenerator.ReceiverUI.Client.Services.Base;
namespace EnvelopeGenerator.ReceiverUI.Client.Services;
/// <summary>
/// Kommuniziert mit dem ReceiverAuthController der API.
///
/// Drei Methoden — eine pro Endpunkt:
/// 1. GetStatusAsync → GET /api/receiverauth/{key}/status
/// 2. SubmitAccessCodeAsync → POST /api/receiverauth/{key}/access-code
/// 3. SubmitTfaCodeAsync → POST /api/receiverauth/{key}/tfa
/// </summary>
public interface IReceiverAuthService
{
/// <summary>Prüft den aktuellen Status des Empfänger-Flows</summary>
Task<ApiResponse<ReceiverAuthModel>> GetStatusAsync(string key, CancellationToken ct = default);
/// <summary>Sendet den Zugangscode zur Prüfung</summary>
Task<ApiResponse<ReceiverAuthModel>> SubmitAccessCodeAsync(
string key, string accessCode, bool preferSms, CancellationToken ct = default);
/// <summary>Sendet den TFA-Code (SMS oder Authenticator) zur Prüfung</summary>
Task<ApiResponse<ReceiverAuthModel>> SubmitTfaCodeAsync(
string key, string code, string type, CancellationToken ct = default);
}