pub struct PaymentReminder {Show 20 fields
pub id: Uuid,
pub acp_id: Uuid,
pub organization_id: Uuid,
pub expense_id: Uuid,
pub owner_id: Uuid,
pub level: ReminderLevel,
pub status: ReminderStatus,
pub amount_owed: Decimal,
pub penalty_amount: Decimal,
pub total_amount: Decimal,
pub due_date: DateTime<Utc>,
pub days_overdue: i64,
pub delivery_method: DeliveryMethod,
pub sent_date: Option<DateTime<Utc>>,
pub opened_date: Option<DateTime<Utc>>,
pub pdf_path: Option<String>,
pub tracking_number: Option<String>,
pub notes: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Représente une relance de paiement pour charges impayées
Fields§
§id: Uuid§acp_id: UuidL’ACP au profit de laquelle la somme est réclamée.
Art. 3.86 § 3 : « Le syndic peut prendre toutes les mesures judiciaires et extrajudiciaires pour la récupération des charges ». Il recouvre pour l’association ; la créance et les pénalités lui reviennent. Cf. ADR-0045.
organization_id: UuidLe syndic qui a émis la relance, conservé comme trace d’auteur.
expense_id: Uuid§owner_id: Uuid§level: ReminderLevel§status: ReminderStatus§amount_owed: DecimalMontant dû (en euros). Decimal — ADR-0007/0008 : montant opposable.
penalty_amount: DecimalPénalités de retard (taux légal civil belge, 4,5 % annuel en 2026).
total_amount: DecimalMontant total (amount_owed + penalty_amount). L’égalité est garantie
par un CHECK en base, exact depuis le passage en NUMERIC.
due_date: DateTime<Utc>§days_overdue: i64§delivery_method: DeliveryMethod§sent_date: Option<DateTime<Utc>>§opened_date: Option<DateTime<Utc>>§pdf_path: Option<String>§tracking_number: Option<String>§notes: Option<String>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl PaymentReminder
impl PaymentReminder
Sourcepub const BELGIAN_PENALTY_RATE: Decimal
pub const BELGIAN_PENALTY_RATE: Decimal
Taux légal civil de pénalité de retard en Belgique (Moniteur belge) Ce taux est publié annuellement par Arrêté Royal. 2024: 5.25%, 2025: 4.0%, 2026: 4.5% A mettre à jour chaque année selon publication au Moniteur belge.
Sourcepub fn new(
acp_id: Uuid,
organization_id: Uuid,
expense_id: Uuid,
owner_id: Uuid,
level: ReminderLevel,
amount_owed: Decimal,
due_date: DateTime<Utc>,
days_overdue: i64,
) -> Result<Self, String>
pub fn new( acp_id: Uuid, organization_id: Uuid, expense_id: Uuid, owner_id: Uuid, level: ReminderLevel, amount_owed: Decimal, due_date: DateTime<Utc>, days_overdue: i64, ) -> Result<Self, String>
Crée une nouvelle relance de paiement
Sourcepub fn calculate_penalty(amount: Decimal, days_overdue: i64) -> Decimal
pub fn calculate_penalty(amount: Decimal, days_overdue: i64) -> Decimal
Calcule les pénalités de retard selon le taux légal civil belge (4,5 % annuel en 2026).
Formule : pénalité = montant × 0,045 × (jours_retard / 365), arrondie au centime.
Calcul en Decimal (suite #661) : c’est un montant réclamé à un
copropriétaire, et l’ancienne version arrondissait via
(x * 100.0).round() / 100.0 en f64 — un motif qui produit des écarts
d’un centime sur des valeurs parfaitement ordinaires, et qui n’arrondit
pas au plus proche de façon fiable près des demis.
L’arrondi est MidpointAwayFromZero (arrondi commercial : 0,005 €
donne 0,01 €), et non le « banker’s rounding » que round_dp applique
par défaut : sur une somme due, arrondir la moitié vers le pair n’a
aucun fondement, et diverge de ce que produit un tableur.
Sourcepub fn mark_as_sent(&mut self, pdf_path: Option<String>) -> Result<(), String>
pub fn mark_as_sent(&mut self, pdf_path: Option<String>) -> Result<(), String>
Marque la relance comme envoyée
Sourcepub fn mark_as_opened(&mut self) -> Result<(), String>
pub fn mark_as_opened(&mut self) -> Result<(), String>
Marque la relance comme ouverte (email ouvert)
Sourcepub fn mark_as_paid(&mut self) -> Result<(), String>
pub fn mark_as_paid(&mut self) -> Result<(), String>
Marque la relance comme payée
Sourcepub fn can_escalate(&self) -> Result<(), String>
pub fn can_escalate(&self) -> Result<(), String>
Escalade vers le niveau de relance supérieur Vérifie sans muter qu’une escalade est permise.
Extrait de escalate pour que l’appelant puisse contrôler l’ordre :
la couche application doit refuser un dossier soldé AVANT de construire
le niveau suivant, sinon un dossier payé se voit reprocher son délai
plutôt que son statut — un message qui envoie chercher le problème au
mauvais endroit.
pub fn escalate(&mut self) -> Result<Option<ReminderLevel>, String>
Sourcepub fn cancel(&mut self, reason: String) -> Result<(), String>
pub fn cancel(&mut self, reason: String) -> Result<(), String>
Annule la relance (paiement reçu avant envoi)
Sourcepub fn set_tracking_number(
&mut self,
tracking_number: String,
) -> Result<(), String>
pub fn set_tracking_number( &mut self, tracking_number: String, ) -> Result<(), String>
Ajoute un numéro de suivi (pour lettre recommandée)
Sourcepub fn needs_escalation(&self, current_date: DateTime<Utc>) -> bool
pub fn needs_escalation(&self, current_date: DateTime<Utc>) -> bool
Vérifie si la relance nécessite une escalade
Sourcepub fn recalculate_penalties(&mut self, current_days_overdue: i64)
pub fn recalculate_penalties(&mut self, current_days_overdue: i64)
Recalcule les pénalités en fonction du nombre de jours actuel
Trait Implementations§
Source§impl Clone for PaymentReminder
impl Clone for PaymentReminder
Source§fn clone(&self) -> PaymentReminder
fn clone(&self) -> PaymentReminder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaymentReminder
impl Debug for PaymentReminder
Source§impl<'de> Deserialize<'de> for PaymentReminder
impl<'de> Deserialize<'de> for PaymentReminder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<PaymentReminder> for PaymentReminderResponseDto
impl From<PaymentReminder> for PaymentReminderResponseDto
Source§fn from(reminder: PaymentReminder) -> Self
fn from(reminder: PaymentReminder) -> Self
Source§impl PartialEq for PaymentReminder
impl PartialEq for PaymentReminder
Source§fn eq(&self, other: &PaymentReminder) -> bool
fn eq(&self, other: &PaymentReminder) -> bool
self and other values to be equal, and is used by ==.Source§impl PieceDeGestion for PaymentReminder
impl PieceDeGestion for PaymentReminder
Source§impl Serialize for PaymentReminder
impl Serialize for PaymentReminder
impl StructuralPartialEq for PaymentReminder
Auto Trait Implementations§
impl Freeze for PaymentReminder
impl RefUnwindSafe for PaymentReminder
impl Send for PaymentReminder
impl Sync for PaymentReminder
impl Unpin for PaymentReminder
impl UnsafeUnpin for PaymentReminder
impl UnwindSafe for PaymentReminder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more