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

144 lines
4.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>,
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>,
2025-11-19 21:18:37 +00:00
}
#[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 = "entryReference")]
pub entry_reference: Option<String>,
#[serde(rename = "endToEndId")]
pub end_to_end_id: Option<String>,
#[serde(rename = "mandateId")]
pub mandate_id: Option<String>,
#[serde(rename = "checkId")]
pub check_id: Option<String>,
#[serde(rename = "creditorId")]
pub creditor_id: Option<String>,
2025-11-19 21:18:37 +00:00
#[serde(rename = "bookingDate")]
pub booking_date: Option<String>,
#[serde(rename = "valueDate")]
pub value_date: Option<String>,
#[serde(rename = "bookingDateTime")]
pub booking_date_time: Option<String>,
#[serde(rename = "valueDateTime")]
pub value_date_time: Option<String>,
2025-11-19 21:18:37 +00:00
#[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 = "ultimateCreditor")]
pub ultimate_creditor: Option<String>,
2025-11-19 21:18:37 +00:00
#[serde(rename = "debtorName")]
pub debtor_name: Option<String>,
#[serde(rename = "debtorAccount")]
pub debtor_account: Option<AccountDetails>,
#[serde(rename = "ultimateDebtor")]
pub ultimate_debtor: Option<String>,
2025-11-19 21:18:37 +00:00
#[serde(rename = "remittanceInformationUnstructured")]
pub remittance_information_unstructured: Option<String>,
#[serde(rename = "remittanceInformationUnstructuredArray")]
pub remittance_information_unstructured_array: Option<Vec<String>>,
#[serde(rename = "remittanceInformationStructured")]
pub remittance_information_structured: Option<String>,
#[serde(rename = "remittanceInformationStructuredArray")]
pub remittance_information_structured_array: Option<Vec<String>>,
#[serde(rename = "additionalInformation")]
pub additional_information: Option<String>,
#[serde(rename = "purposeCode")]
pub purpose_code: Option<String>,
#[serde(rename = "bankTransactionCode")]
pub bank_transaction_code: Option<String>,
2025-11-19 21:18:37 +00:00
#[serde(rename = "proprietaryBankTransactionCode")]
pub proprietary_bank_transaction_code: Option<String>,
#[serde(rename = "internalTransactionId")]
pub internal_transaction_id: Option<String>,
2025-11-19 21:18:37 +00:00
}
#[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>,
pub bban: Option<String>,
pub pan: Option<String>,
#[serde(rename = "maskedPan")]
pub masked_pan: Option<String>,
pub msisdn: Option<String>,
pub currency: Option<String>,
2025-11-19 21:18:37 +00:00
}