- Implement robust End User Agreement expiry detection and handling - Add graceful error recovery for failed accounts - Rewrite README.md to focus on user benefits - Add documentation guidelines to AGENTS.md
106 lines
3.2 KiB
Rust
106 lines
3.2 KiB
Rust
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>,
|
|
pub agreement: Option<String>, // EUA ID associated with this requisition
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct EndUserAgreement {
|
|
pub id: String,
|
|
pub created: Option<String>,
|
|
pub accepted: Option<String>, // When user accepted the agreement
|
|
pub access_valid_for_days: Option<i32>, // Validity period (default 90)
|
|
pub institution_id: 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>,
|
|
}
|