plaid/model/
transfer_sweep.rs

1use serde::{Serialize, Deserialize};
2use super::{SweepStatus, SweepTrigger};
3/**Describes a sweep of funds to / from the sweep account.
4
5A sweep is associated with many sweep events (events of type `swept` or `return_swept`) which can be retrieved by invoking the `/transfer/event/list` endpoint with the corresponding `sweep_id`.
6
7`swept` events occur when the transfer amount is credited or debited from your sweep account, depending on the `type` of the transfer. `return_swept` events occur when a transfer is returned and Plaid undoes the credit or debit.
8
9The total sum of the `swept` and `return_swept` events is equal to the `amount` of the sweep Plaid creates and matches the amount of the entry on your sweep account ledger.*/
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct TransferSweep {
12    /**Signed decimal amount of the sweep as it appears on your sweep account ledger (e.g. "-10.00")
13
14If amount is not present, the sweep was net-settled to zero and outstanding debits and credits between the sweep account and Plaid are balanced.*/
15    pub amount: String,
16    ///The datetime when the sweep occurred, in RFC 3339 format.
17    pub created: chrono::DateTime<chrono::Utc>,
18    ///The description of the deposit that will be passed to the receiving bank (up to 10 characters). Note that banks utilize this field differently, and may or may not show it on the bank statement.
19    #[serde(default, skip_serializing_if = "Option::is_none")]
20    pub description: Option<String>,
21    ///The id of the funding account to use, available in the Plaid Dashboard. This determines which of your business checking accounts will be credited or debited.
22    pub funding_account_id: String,
23    ///Identifier of the sweep.
24    pub id: String,
25    ///The currency of the sweep, e.g. "USD".
26    pub iso_currency_code: String,
27    ///Plaid’s unique identifier for a Plaid Ledger Balance.
28    #[serde(default, skip_serializing_if = "Option::is_none")]
29    pub ledger_id: Option<String>,
30    /**The trace identifier for the transfer based on its network. This will only be set after the transfer has posted.
31
32For `ach` or `same-day-ach` transfers, this is the ACH trace number.
33For `rtp` transfers, this is the Transaction Identification number.
34For `wire` transfers, this is the IMAD (Input Message Accountability Data) number.*/
35    #[serde(default, skip_serializing_if = "Option::is_none")]
36    pub network_trace_id: Option<String>,
37    ///The date when the sweep settled, in the YYYY-MM-DD format.
38    #[serde(default, skip_serializing_if = "Option::is_none")]
39    pub settled: Option<chrono::NaiveDate>,
40    /**The status of a sweep transfer
41
42`"pending"` - The sweep is currently pending
43`"posted"` - The sweep has been posted
44`"settled"` - The sweep has settled
45`"returned"` - The sweep has been returned
46`"failed"` - The sweep has failed*/
47    #[serde(default, skip_serializing_if = "Option::is_none")]
48    pub status: Option<SweepStatus>,
49    /**The trigger of the sweep
50
51`"manual"` - The sweep is created manually by the customer
52`"incoming"` - The sweep is created by incoming funds flow (e.g. Incoming Wire)
53`"balance_threshold"` - The sweep is created by balance threshold setting
54`"automatic_aggregate"` - The sweep is created by the Plaid automatic aggregation process. These funds did not pass through the Plaid Ledger balance.*/
55    #[serde(default, skip_serializing_if = "Option::is_none")]
56    pub trigger: Option<SweepTrigger>,
57}
58impl std::fmt::Display for TransferSweep {
59    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
60        write!(f, "{}", serde_json::to_string(self).unwrap())
61    }
62}