rustkernel_payments/
lib.rs

1//! # RustKernel Payment Processing
2//!
3//! GPU-accelerated payment processing kernels.
4//!
5//! ## Kernels
6//! - `PaymentProcessing` - Real-time transaction execution
7//! - `FlowAnalysis` - Payment flow network analysis and metrics
8
9#![warn(missing_docs)]
10
11pub mod flow;
12pub mod processing;
13pub mod types;
14
15pub use flow::{AccountFlowAnalysis, FlowAnalysis, FlowAnalysisConfig};
16pub use processing::{PaymentProcessing, PaymentRouting, ProcessingConfig};
17pub use types::*;
18
19/// Register all payment kernels.
20pub fn register_all(
21    registry: &rustkernel_core::registry::KernelRegistry,
22) -> rustkernel_core::error::Result<()> {
23    use rustkernel_core::traits::GpuKernel;
24
25    tracing::info!("Registering payment processing kernels");
26
27    // Processing kernel (1)
28    registry.register_metadata(processing::PaymentProcessing::new().metadata().clone())?;
29
30    // Flow analysis kernel (1)
31    registry.register_metadata(flow::FlowAnalysis::new().metadata().clone())?;
32
33    tracing::info!("Registered 2 payment processing kernels");
34    Ok(())
35}
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40    use rustkernel_core::{domain::Domain, registry::KernelRegistry, traits::GpuKernel};
41
42    #[test]
43    fn test_register_all() {
44        let registry = KernelRegistry::new();
45        register_all(&registry).expect("Failed to register payments kernels");
46        assert_eq!(registry.total_count(), 2);
47    }
48
49    #[test]
50    fn test_payment_processing_metadata() {
51        let kernel = PaymentProcessing::new();
52        let metadata = kernel.metadata();
53        assert!(metadata.id.contains("processing"));
54        assert_eq!(metadata.domain, Domain::PaymentProcessing);
55    }
56
57    #[test]
58    fn test_flow_analysis_metadata() {
59        let kernel = FlowAnalysis::new();
60        let metadata = kernel.metadata();
61        assert!(metadata.id.contains("flow"));
62        assert_eq!(metadata.domain, Domain::PaymentProcessing);
63    }
64}