Skip to main content

BankAccount

Struct BankAccount 

Source
pub struct BankAccount {
Show 27 fields pub account_id: Uuid, pub account_number: String, pub account_type: BankAccountType, pub primary_owner_id: Uuid, pub joint_owner_ids: Vec<Uuid>, pub status: AccountStatus, pub currency: String, pub opening_date: NaiveDate, pub closing_date: Option<NaiveDate>, pub current_balance: Decimal, pub available_balance: Decimal, pub features: AccountFeatures, pub iban: Option<String>, pub swift_bic: Option<String>, pub routing_number: Option<String>, pub branch_code: Option<String>, pub interest_rate: Option<Decimal>, pub overdraft_limit: Decimal, pub last_activity: Option<DateTime<Utc>>, pub days_dormant: u32, pub is_nominee: bool, pub linked_cards: Vec<String>, pub declared_purpose: Option<String>, pub funding_source_account: Option<Uuid>, pub is_mule_account: bool, pub is_funnel_account: bool, pub case_id: Option<String>,
}
Expand description

A bank account with full metadata.

Fields§

§account_id: Uuid

Unique account identifier

§account_number: String

Account number (masked for output)

§account_type: BankAccountType

Account type

§primary_owner_id: Uuid

Primary owner customer ID

§joint_owner_ids: Vec<Uuid>

Joint owner customer IDs

§status: AccountStatus

Account status

§currency: String

Account currency (ISO 4217)

§opening_date: NaiveDate

Account opening date

§closing_date: Option<NaiveDate>

Account closing date (if closed)

§current_balance: Decimal

Current balance

§available_balance: Decimal

Available balance (may differ due to holds)

§features: AccountFeatures

Account features/capabilities

§iban: Option<String>

IBAN (for international accounts)

§swift_bic: Option<String>

BIC/SWIFT code

§routing_number: Option<String>

Routing number (for US accounts)

§branch_code: Option<String>

Branch code

§interest_rate: Option<Decimal>

Interest rate (for savings/CD)

§overdraft_limit: Decimal

Overdraft limit

§last_activity: Option<DateTime<Utc>>

Last activity timestamp

§days_dormant: u32

Days dormant (calculated field)

§is_nominee: bool

Is this a nominee account

§linked_cards: Vec<String>

Linked card numbers (masked)

§declared_purpose: Option<String>

Purpose of account (declared)

§funding_source_account: Option<Uuid>

Source account for linked funding

§is_mule_account: bool

Whether this is a mule account

§is_funnel_account: bool

Whether this is a funnel account

§case_id: Option<String>

Associated case ID for suspicious activity

Implementations§

Source§

impl BankAccount

Source

pub fn new( account_id: Uuid, account_number: String, account_type: BankAccountType, primary_owner_id: Uuid, currency: &str, opening_date: NaiveDate, ) -> Self

Create a new account.

Source

pub fn can_transact(&self) -> bool

Check if account can process transactions.

Source

pub fn has_sufficient_funds(&self, amount: Decimal) -> bool

Check if account has sufficient funds for debit.

Source

pub fn apply_debit(&mut self, amount: Decimal, timestamp: DateTime<Utc>) -> bool

Apply a debit (outgoing transaction).

Source

pub fn apply_credit(&mut self, amount: Decimal, timestamp: DateTime<Utc>)

Apply a credit (incoming transaction).

Source

pub fn place_hold(&mut self, amount: Decimal)

Place a hold on funds.

Source

pub fn release_hold(&mut self, amount: Decimal)

Release a hold on funds.

Source

pub fn close(&mut self, close_date: NaiveDate)

Close the account.

Source

pub fn freeze(&mut self)

Freeze the account.

Source

pub fn mark_dormant(&mut self, days: u32)

Mark as dormant.

Source

pub fn add_joint_owner(&mut self, owner_id: Uuid)

Add a joint owner.

Source

pub fn all_owner_ids(&self) -> Vec<Uuid>

Get all owner IDs (primary + joint).

Source

pub fn calculate_risk_score(&self) -> u8

Calculate risk score for the account.

Trait Implementations§

Source§

impl Clone for BankAccount

Source§

fn clone(&self) -> BankAccount

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BankAccount

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BankAccount

Source§

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 Serialize for BankAccount

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,