feat(report): Zahlungsabwicklung im Lieferbericht dokumentieren

- Abschnitt "Zahlung": Zahlungsart mit Ergebnis (erhalten / bestaetigt),
  Zahlbetrag, Zeitpunkt, erfassender Fahrer und Fahrzeug der beim
  Abschluss gueltigen Zahlung (vor dem Abschluss: juengster Eintrag).
  Abschluesse ohne Zahlungs-Step behalten die bisherige Zeile
  "Betrag erhalten"
- Neuer Abschnitt "Protokoll - Zahlungsabwicklung" mit allen Eintraegen
  inkl. Korrekturen; Status "beim Abschluss" / "aktuell" / "ersetzt"
- Report-Daten: ReportPayment + ReportCompletion.payment_id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-25 14:28:41 +02:00
parent 954c5f52b2
commit caaf88ac3d
4 changed files with 156 additions and 7 deletions

View File

@ -7,6 +7,7 @@
//! damit der Renderer rein (ohne IO) bleibt.
use chrono::{DateTime, NaiveDate, Utc};
use uuid::Uuid;
#[derive(Debug, Clone)]
pub struct DeliveryReportData {
@ -39,6 +40,8 @@ pub struct DeliveryReportData {
pub completion: Option<ReportCompletion>,
pub scan_audit: Vec<ReportScanAudit>,
pub credit_audit: Vec<ReportCreditAudit>,
/// Protokoll der Zahlungsabwicklung, chronologisch (inkl. Korrekturen).
pub payments: Vec<ReportPayment>,
pub attachments: Vec<ReportAttachment>,
// Bild-Bytes (vom Use Case aus dem lokalen Speicher nachgeladen):
pub customer_signature_png: Option<Vec<u8>>,
@ -105,6 +108,23 @@ pub struct ReportCompletion {
pub payment_collected: bool,
/// Snapshot des kassierten offenen Betrags in Cent (None = kein Inkasso).
pub collected_amount_cents: Option<i64>,
/// Die beim Abschluss gültige protokollierte Zahlung (None = ohne
/// Zahlungs-Step abgeschlossen, z. B. nichts offen oder alte App).
pub payment_id: Option<Uuid>,
}
/// Ein Eintrag im Zahlungsprotokoll („Abkassieren").
#[derive(Debug, Clone)]
pub struct ReportPayment {
pub id: Uuid,
pub recorded_at: DateTime<Utc>,
/// Anzeigename der Methode aus den Stammdaten (None = nicht mehr vorhanden).
pub method_name: Option<String>,
/// Code-Snapshot zum Zeitpunkt der Abwicklung (cash/ec_card/invoice).
pub method_code: String,
pub amount_cents: i64,
pub recorded_by_personalnummer: i64,
pub car_plate: Option<String>,
}
#[derive(Debug, Clone)]

View File

@ -32,7 +32,7 @@ pub use car::{
pub use complete::CompleteDeliveryAcknowledgements;
pub use credit::{CreditAction, DeliveryCreditEventRequest, DeliveryCreditResponse};
pub use delivery_report::{
DeliveryReportData, ReportAttachment, ReportCompletion, ReportContact, ReportCreditAudit,
DeliveryReportData, ReportAttachment, ReportCompletion, ReportContact, ReportCreditAudit, ReportPayment,
ReportItem, ReportNote, ReportScanAudit, ReportService,
};
pub use delivery_action::{CancelDeliveryRequest, DeliveryResponse, HoldDeliveryRequest};