Files
banks2ff/gocardless-client/src/models.rs

96 lines
2.8 KiB
Rust
Raw Normal View History

2025-11-19 21:18:37 +00:00
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TokenResponse {
pub access: String,
pub access_expires: i32,
pub refresh: Option<String>,
pub refresh_expires: Option<i32>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Requisition {
pub id: String,
pub status: String,
pub accounts: Option<Vec<String>>,
pub reference: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PaginatedResponse<T> {
pub count: Option<i32>,
pub next: Option<String>,
pub previous: Option<String>,
pub results: Vec<T>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Account {
pub id: String,
pub created: Option<String>,
pub last_accessed: Option<String>,
pub iban: Option<String>,
pub institution_id: Option<String>,
pub status: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransactionsResponse {
pub transactions: TransactionBookedPending,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransactionBookedPending {
pub booked: Vec<Transaction>,
pub pending: Option<Vec<Transaction>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Transaction {
#[serde(rename = "transactionId")]
pub transaction_id: Option<String>,
#[serde(rename = "bookingDate")]
pub booking_date: Option<String>,
#[serde(rename = "valueDate")]
pub value_date: Option<String>,
#[serde(rename = "transactionAmount")]
pub transaction_amount: TransactionAmount,
#[serde(rename = "currencyExchange")]
pub currency_exchange: Option<Vec<CurrencyExchange>>,
#[serde(rename = "creditorName")]
pub creditor_name: Option<String>,
#[serde(rename = "creditorAccount")]
pub creditor_account: Option<AccountDetails>,
#[serde(rename = "debtorName")]
pub debtor_name: Option<String>,
#[serde(rename = "debtorAccount")]
pub debtor_account: Option<AccountDetails>,
#[serde(rename = "remittanceInformationUnstructured")]
pub remittance_information_unstructured: Option<String>,
#[serde(rename = "proprietaryBankTransactionCode")]
pub proprietary_bank_transaction_code: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransactionAmount {
pub amount: String,
pub currency: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CurrencyExchange {
#[serde(rename = "sourceCurrency")]
pub source_currency: Option<String>,
#[serde(rename = "exchangeRate")]
pub exchange_rate: Option<String>,
#[serde(rename = "unitCurrency")]
pub unit_currency: Option<String>,
#[serde(rename = "targetCurrency")]
pub target_currency: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccountDetails {
pub iban: Option<String>,
}