pub struct TransferService<'a> { /* private fields */ }Expand description
Service for managing transfers between accounts
Implementations§
Source§impl<'a> TransferService<'a>
impl<'a> TransferService<'a>
Sourcepub fn create_transfer(
&self,
from_account_id: AccountId,
to_account_id: AccountId,
amount: Money,
date: NaiveDate,
memo: Option<String>,
) -> EnvelopeResult<TransferResult>
pub fn create_transfer( &self, from_account_id: AccountId, to_account_id: AccountId, amount: Money, date: NaiveDate, memo: Option<String>, ) -> EnvelopeResult<TransferResult>
Create a transfer between two accounts
This creates two linked transactions:
- An outflow (negative amount) from the source account
- An inflow (positive amount) to the destination account
Sourcepub fn get_linked_transaction(
&self,
transaction_id: TransactionId,
) -> EnvelopeResult<Option<Transaction>>
pub fn get_linked_transaction( &self, transaction_id: TransactionId, ) -> EnvelopeResult<Option<Transaction>>
Get the linked transaction for a transfer
Sourcepub fn update_transfer_amount(
&self,
transaction_id: TransactionId,
new_amount: Money,
) -> EnvelopeResult<TransferResult>
pub fn update_transfer_amount( &self, transaction_id: TransactionId, new_amount: Money, ) -> EnvelopeResult<TransferResult>
Update a transfer’s amount
This updates both the source and destination transactions to maintain consistency.
Sourcepub fn update_transfer_date(
&self,
transaction_id: TransactionId,
new_date: NaiveDate,
) -> EnvelopeResult<TransferResult>
pub fn update_transfer_date( &self, transaction_id: TransactionId, new_date: NaiveDate, ) -> EnvelopeResult<TransferResult>
Update a transfer’s date
This updates both the source and destination transactions to maintain consistency.
Sourcepub fn delete_transfer(
&self,
transaction_id: TransactionId,
) -> EnvelopeResult<TransferResult>
pub fn delete_transfer( &self, transaction_id: TransactionId, ) -> EnvelopeResult<TransferResult>
Delete a transfer (both transactions)
Auto Trait Implementations§
impl<'a> Freeze for TransferService<'a>
impl<'a> RefUnwindSafe for TransferService<'a>
impl<'a> Send for TransferService<'a>
impl<'a> Sync for TransferService<'a>
impl<'a> Unpin for TransferService<'a>
impl<'a> UnwindSafe for TransferService<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more