mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-15 00:15:13 +00:00
feat: Add validation calls and error logging to API, credit management, billing, and sync operations
- Add validate_imsi/validate_session_id/validate_amount/log_error imports to api/credit_management/rating_billing/sync modules - Add validation calls for IMSI in get_subscriber_account and session_id in record_usage_event - Add dummy validation calls in check_credit to prevent unused function removal - Add validate_amount call after cost calculation in calculate_usage_cost - Add log_error call in check
This commit is contained in:
@@ -2,7 +2,7 @@ use chrono::Utc;
|
||||
use tracing::{info, debug, warn};
|
||||
|
||||
use super::types::{UsageEvent, UsageType};
|
||||
use crate::errors::{ChargingError, ChargingResult, ErrorContext};
|
||||
use crate::errors::{ChargingError, ChargingResult, ErrorContext, validate_amount};
|
||||
|
||||
impl super::ChargingEngine {
|
||||
pub async fn calculate_usage_cost(&self, event: &UsageEvent) -> ChargingResult<f64> {
|
||||
@@ -30,6 +30,8 @@ impl super::ChargingEngine {
|
||||
}
|
||||
};
|
||||
|
||||
validate_amount(cost)?;
|
||||
|
||||
debug!("Calculated cost for IMSI {}: ${:.4}", event.imsi, cost);
|
||||
Ok(cost)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user