pub struct PaymentReminder {Show 19 fields
pub id: Uuid,
pub organization_id: Uuid,
pub expense_id: Uuid,
pub owner_id: Uuid,
pub level: ReminderLevel,
pub status: ReminderStatus,
pub amount_owed: f64,
pub penalty_amount: f64,
pub total_amount: f64,
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§organization_id: Uuid§expense_id: Uuid§owner_id: Uuid§level: ReminderLevel§status: ReminderStatus§amount_owed: f64§penalty_amount: f64§total_amount: f64§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: f64 = 0.080000000000000002f64
pub const BELGIAN_PENALTY_RATE: f64 = 0.080000000000000002f64
Taux légal de pénalité de retard en Belgique (8% annuel)
Sourcepub fn new(
organization_id: Uuid,
expense_id: Uuid,
owner_id: Uuid,
level: ReminderLevel,
amount_owed: f64,
due_date: DateTime<Utc>,
days_overdue: i64,
) -> Result<Self, String>
pub fn new( organization_id: Uuid, expense_id: Uuid, owner_id: Uuid, level: ReminderLevel, amount_owed: f64, due_date: DateTime<Utc>, days_overdue: i64, ) -> Result<Self, String>
Crée une nouvelle relance de paiement
Sourcepub fn calculate_penalty(amount: f64, days_overdue: i64) -> f64
pub fn calculate_penalty(amount: f64, days_overdue: i64) -> f64
Calcule les pénalités de retard selon le taux légal belge (8% annuel) Formule: pénalité = montant * 0.08 * (jours_retard / 365)
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 escalate(&mut self) -> Result<Option<ReminderLevel>, String>
pub fn escalate(&mut self) -> Result<Option<ReminderLevel>, String>
Escalade vers le niveau de relance supérieur
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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<PaymentReminder> for PaymentReminderResponseDto
impl From<PaymentReminder> for PaymentReminderResponseDto
Source§fn from(reminder: PaymentReminder) -> Self
fn from(reminder: PaymentReminder) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PaymentReminder
impl PartialEq 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 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
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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 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>
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 moreCreates a shared type from an unshared type.