1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use serde::{Serialize, Deserialize};
use super::{
WalletPaymentScheme, WalletTransactionAmount, WalletTransactionCounterparty,
WalletTransactionFailureReason, WalletTransactionRelation, WalletTransactionStatus,
};
///The transaction details
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WalletTransaction {
///The amount and currency of a transaction
pub amount: WalletTransactionAmount,
///An object representing the e-wallet transaction's counterparty
pub counterparty: WalletTransactionCounterparty,
///Timestamp when the transaction was created, in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
pub created_at: chrono::DateTime<chrono::Utc>,
/**The error code of a failed transaction. Error codes include:
`EXTERNAL_SYSTEM`: The transaction was declined by an external system.
`EXPIRED`: The transaction request has expired.
`CANCELLED`: The transaction request was rescinded.
`INVALID`: The transaction did not meet certain criteria, such as an inactive account or no valid counterparty, etc.
`UNKNOWN`: The transaction was unsuccessful, but the exact cause is unknown.*/
#[serde(default, skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<WalletTransactionFailureReason>,
///The date and time of the last time the `status` was updated, in IS0 8601 format
pub last_status_update: chrono::DateTime<chrono::Utc>,
///The payment id that this transaction is associated with, if any. This is present only for transaction types `PIS_PAY_IN` and `REFUND`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub payment_id: Option<String>,
///A reference for the transaction
pub reference: String,
///A list of wallet transactions that this transaction is associated with, if any.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub related_transactions: Option<Vec<WalletTransactionRelation>>,
/**The payment scheme used to execute this transaction. This is present only for transaction types `PAYOUT` and `REFUND`.
`FASTER_PAYMENTS`: The standard payment scheme within the UK.
`SEPA_CREDIT_TRANSFER`: The standard payment to a beneficiary within the SEPA area.
`SEPA_CREDIT_TRANSFER_INSTANT`: Instant payment to a beneficiary within the SEPA area.*/
#[serde(default, skip_serializing_if = "Option::is_none")]
pub scheme: Option<WalletPaymentScheme>,
/**The status of the transaction.
`AUTHORISING`: The transaction is being processed for validation and compliance.
`INITIATED`: The transaction has been initiated and is currently being processed.
`EXECUTED`: The transaction has been successfully executed and is considered complete. This is only applicable for debit transactions.
`SETTLED`: The transaction has settled and funds are available for use. This is only applicable for credit transactions. A transaction will typically settle within seconds to several days, depending on which payment rail is used.
`FAILED`: The transaction failed to process successfully. This is a terminal status.
`BLOCKED`: The transaction has been blocked for violating compliance rules. This is a terminal status.*/
pub status: WalletTransactionStatus,
///A unique ID identifying the transaction
pub transaction_id: String,
/**The type of the transaction. The supported transaction types that are returned are:
`BANK_TRANSFER:` a transaction which credits an e-wallet through an external bank transfer.
`PAYOUT:` a transaction which debits an e-wallet by disbursing funds to a counterparty.
`PIS_PAY_IN:` a payment which credits an e-wallet through Plaid's Payment Initiation Services (PIS) APIs. For more information see the [Payment Initiation endpoints](https://plaid.com/docs/api/products/payment-initiation/).
`REFUND:` a transaction which debits an e-wallet by refunding a previously initiated payment made through Plaid's [PIS APIs](https://plaid.com/docs/api/products/payment-initiation/).
`FUNDS_SWEEP`: an automated transaction which debits funds from an e-wallet to a designated client-owned account.
`RETURN`: an automated transaction where a debit transaction was reversed and money moved back to originating account.
`RECALL`: a transaction where the sending bank has requested the return of funds due to a fraud claim, technical error, or other issue associated with the payment.*/
#[serde(rename = "type")]
pub type_: String,
///The EMI (E-Money Institution) wallet that this payment is associated with, if any. This wallet is used as an intermediary account to enable Plaid to reconcile the settlement of funds for Payment Initiation requests.
pub wallet_id: String,
}
impl std::fmt::Display for WalletTransaction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}