pub struct BankTransaction {Show 34 fields
pub transaction_id: Uuid,
pub account_id: Uuid,
pub timestamp_initiated: DateTime<Utc>,
pub timestamp_booked: DateTime<Utc>,
pub timestamp_settled: Option<DateTime<Utc>>,
pub amount: Decimal,
pub currency: String,
pub direction: Direction,
pub channel: TransactionChannel,
pub category: TransactionCategory,
pub counterparty: CounterpartyRef,
pub mcc: Option<MerchantCategoryCode>,
pub reference: String,
pub balance_before: Option<Decimal>,
pub balance_after: Option<Decimal>,
pub original_currency: Option<String>,
pub original_amount: Option<Decimal>,
pub fx_rate: Option<Decimal>,
pub location_country: Option<String>,
pub location_city: Option<String>,
pub device_id: Option<String>,
pub ip_address: Option<String>,
pub is_authorized: bool,
pub auth_code: Option<String>,
pub status: TransactionStatus,
pub parent_transaction_id: Option<Uuid>,
pub is_suspicious: bool,
pub suspicion_reason: Option<AmlTypology>,
pub laundering_stage: Option<LaunderingStage>,
pub case_id: Option<String>,
pub is_spoofed: bool,
pub spoofing_intensity: Option<f64>,
pub scenario_id: Option<String>,
pub scenario_sequence: Option<u32>,
}Expand description
A bank transaction with full metadata and ground truth labels.
Fields§
§transaction_id: UuidUnique transaction identifier
account_id: UuidAccount ID
timestamp_initiated: DateTime<Utc>Timestamp when transaction was initiated
timestamp_booked: DateTime<Utc>Timestamp when transaction was booked
timestamp_settled: Option<DateTime<Utc>>Timestamp when transaction was settled
amount: DecimalTransaction amount (always positive)
currency: StringTransaction currency (ISO 4217)
direction: DirectionTransaction direction (inbound/outbound)
channel: TransactionChannelTransaction channel
category: TransactionCategoryTransaction category
counterparty: CounterpartyRefCounterparty reference
mcc: Option<MerchantCategoryCode>Merchant category code (for card transactions)
reference: StringTransaction reference/description
balance_before: Option<Decimal>Balance before transaction
balance_after: Option<Decimal>Balance after transaction
original_currency: Option<String>Original currency (if FX conversion)
original_amount: Option<Decimal>Original amount (if FX conversion)
fx_rate: Option<Decimal>FX rate applied
location_country: Option<String>Location (country code)
location_city: Option<String>Location (city)
device_id: Option<String>Device fingerprint (for online/mobile)
ip_address: Option<String>IP address (masked for output)
Whether transaction was authorized
auth_code: Option<String>Authorization code
status: TransactionStatusTransaction status
parent_transaction_id: Option<Uuid>Parent transaction ID (for reversals, fees)
is_suspicious: boolWhether transaction is suspicious (ground truth)
suspicion_reason: Option<AmlTypology>Suspicion reason (AML typology)
laundering_stage: Option<LaunderingStage>Money laundering stage
case_id: Option<String>Case ID linking suspicious transactions
is_spoofed: boolWhether transaction is spoofed (adversarial mode)
spoofing_intensity: Option<f64>Spoofing intensity (0.0-1.0)
scenario_id: Option<String>Scenario ID for linked transactions
scenario_sequence: Option<u32>Transaction sequence number within scenario
Implementations§
Source§impl BankTransaction
impl BankTransaction
Sourcepub fn new(
transaction_id: Uuid,
account_id: Uuid,
amount: Decimal,
currency: &str,
direction: Direction,
channel: TransactionChannel,
category: TransactionCategory,
counterparty: CounterpartyRef,
reference: &str,
timestamp: DateTime<Utc>,
) -> Self
pub fn new( transaction_id: Uuid, account_id: Uuid, amount: Decimal, currency: &str, direction: Direction, channel: TransactionChannel, category: TransactionCategory, counterparty: CounterpartyRef, reference: &str, timestamp: DateTime<Utc>, ) -> Self
Create a new transaction.
Sourcepub fn mark_suspicious(self, reason: AmlTypology, case_id: &str) -> Self
pub fn mark_suspicious(self, reason: AmlTypology, case_id: &str) -> Self
Mark as suspicious.
Sourcepub fn with_laundering_stage(self, stage: LaunderingStage) -> Self
pub fn with_laundering_stage(self, stage: LaunderingStage) -> Self
Set laundering stage.
Sourcepub fn mark_spoofed(self, intensity: f64) -> Self
pub fn mark_spoofed(self, intensity: f64) -> Self
Mark as spoofed.
Sourcepub fn with_scenario(self, scenario_id: &str, sequence: u32) -> Self
pub fn with_scenario(self, scenario_id: &str, sequence: u32) -> Self
Set scenario information.
Sourcepub fn with_mcc(self, mcc: MerchantCategoryCode) -> Self
pub fn with_mcc(self, mcc: MerchantCategoryCode) -> Self
Set MCC.
Sourcepub fn with_location(self, country: &str, city: Option<&str>) -> Self
pub fn with_location(self, country: &str, city: Option<&str>) -> Self
Set location.
Sourcepub fn with_fx_conversion(
self,
original_currency: &str,
original_amount: Decimal,
rate: Decimal,
) -> Self
pub fn with_fx_conversion( self, original_currency: &str, original_amount: Decimal, rate: Decimal, ) -> Self
Set FX conversion.
Sourcepub fn with_balance(self, before: Decimal, after: Decimal) -> Self
pub fn with_balance(self, before: Decimal, after: Decimal) -> Self
Set balance information.
Sourcepub fn calculate_risk_score(&self) -> u8
pub fn calculate_risk_score(&self) -> u8
Calculate risk score for the transaction.
Sourcepub fn is_cross_border(&self) -> bool
pub fn is_cross_border(&self) -> bool
Check if this is a cross-border transaction.
Trait Implementations§
Source§impl Clone for BankTransaction
impl Clone for BankTransaction
Source§fn clone(&self) -> BankTransaction
fn clone(&self) -> BankTransaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more