librsigstopup 0.1.0

Super safe library untuk simulasi perhitungan top-up dengan JSON API, verbose logging, dan full trace
Documentation
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InstallmentCalculator;
impl InstallmentCalculator {
    pub fn calculate_total_paid(angsuran: Decimal, jumlah_bulan: u32) -> Decimal {
        tracing::debug!(
            event = "calculate_total_paid",
            angsuran = %angsuran,
            jumlah_bulan = jumlah_bulan,
            "Calculating total paid installments"
        );
        angsuran * Decimal::from(jumlah_bulan)
    }
    pub fn calculate_remaining(total: Decimal, paid: Decimal) -> Decimal {
        let remaining = total - paid;
        tracing::debug!(
            event = "calculate_remaining",
            total = %total,
            paid = %paid,
            remaining = %remaining,
            "Calculated remaining installments"
        );
        remaining
    }
}