Skip to main content

PaymentReminder

Struct PaymentReminder 

Source
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: Uuid

L’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: Uuid

Le syndic qui a émis la relance, conservé comme trace d’auteur.

§expense_id: Uuid§owner_id: Uuid§level: ReminderLevel§status: ReminderStatus§amount_owed: Decimal

Montant dû (en euros). Decimal — ADR-0007/0008 : montant opposable.

§penalty_amount: Decimal

Pénalités de retard (taux légal civil belge, 4,5 % annuel en 2026).

§total_amount: Decimal

Montant 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

Source

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.

Source

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

Source

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.

Source

pub fn mark_as_sent(&mut self, pdf_path: Option<String>) -> Result<(), String>

Marque la relance comme envoyée

Source

pub fn mark_as_opened(&mut self) -> Result<(), String>

Marque la relance comme ouverte (email ouvert)

Source

pub fn mark_as_paid(&mut self) -> Result<(), String>

Marque la relance comme payée

Source

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.

Source

pub fn escalate(&mut self) -> Result<Option<ReminderLevel>, String>

Source

pub fn cancel(&mut self, reason: String) -> Result<(), String>

Annule la relance (paiement reçu avant envoi)

Source

pub fn set_tracking_number( &mut self, tracking_number: String, ) -> Result<(), String>

Ajoute un numéro de suivi (pour lettre recommandée)

Source

pub fn needs_escalation(&self, current_date: DateTime<Utc>) -> bool

Vérifie si la relance nécessite une escalade

Source

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

Source§

fn clone(&self) -> PaymentReminder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PaymentReminder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PaymentReminder

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<PaymentReminder> for PaymentReminderResponseDto

Source§

fn from(reminder: PaymentReminder) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PaymentReminder

Source§

fn eq(&self, other: &PaymentReminder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PieceDeGestion for PaymentReminder

Source§

fn acp_id(&self) -> Uuid

L’ACP dont relève la pièce. C’est elle qui en est propriétaire.
Source§

impl Serialize for PaymentReminder

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PaymentReminder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Fake for T

§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more