pluto/core/lib/schemas/nordigen_s.py

200 lines
4.0 KiB
Python

from pydantic import BaseModel
class TokenNew(BaseModel):
access: str
access_expires: int
refresh: str
refresh_expires: int
TokenNewSchema = {
"access": "access",
"access_expires": "access_expires",
"refresh": "refresh",
"refresh_expires": "refresh_expires",
}
class RequisitionResult(BaseModel):
id: str
created: str
redirect: str
status: str
institution_id: str
agreement: str
reference: str
accounts: list[str]
link: str
ssn: str | None
account_selection: bool
redirect_immediate: bool
class Requisitions(BaseModel):
count: int
next: str | None
previous: str | None
results: list[RequisitionResult]
RequisitionsSchema = {
"count": "count",
"next": "next",
"previous": "previous",
"results": "results",
}
class RequisitionsPost(BaseModel):
id: str
created: str
redirect: str
status: str
institution_id: str
agreement: str
reference: str
accounts: list[str]
link: str
ssn: str | None
account_selection: bool
redirect_immediate: bool
RequisitionsPostSchema = {
"id": "id",
"created": "created",
"redirect": "redirect",
"status": "status",
"institution_id": "institution_id",
"agreement": "agreement",
"reference": "reference",
"accounts": "accounts",
"link": "link",
"ssn": "ssn",
"account_selection": "account_selection",
"redirect_immediate": "redirect_immediate",
}
class Requisition(BaseModel):
id: str
created: str
redirect: str
status: str
institution_id: str
agreement: str
reference: str
accounts: list[str]
link: str
ssn: str | None
account_selection: bool
redirect_immediate: bool
RequisitionSchema = {
"id": "id",
"created": "created",
"redirect": "redirect",
"status": "status",
"institution_id": "institution_id",
"agreement": "agreement",
"reference": "reference",
"accounts": "accounts",
"link": "link",
"ssn": "ssn",
"account_selection": "account_selection",
"redirect_immediate": "redirect_immediate",
}
class AccountDetailsNested(BaseModel):
resourceId: str
currency: str
ownerName: str
cashAccountType: str | None
status: str | None
maskedPan: str | None
details: str | None
iban: str | None
bban: str | None
name: str | None
product: str | None
class AccountDetails(BaseModel):
account: AccountDetailsNested
AccountDetailsSchema = {
"account": "account",
}
class AccountBalance(BaseModel):
balanceAmount: dict[str, str]
balanceType: str | None
referenceDate: str | None
class AccountBalances(BaseModel):
balances: list[AccountBalance]
summary: str | None
AccountBalancesSchema = {
"balances": "balances",
"summary": "summary",
}
class TXCurrencyAmount(BaseModel):
amount: str
currency: str
class TransactionsCurrencyExchange(BaseModel):
instructedAmount: TXCurrencyAmount
sourceCurrency: str
exchangeRate: str
unitCurrency: str
targetCurrency: str
class TXAccount(BaseModel):
iban: str
bban: str | None
class TransactionsNested(BaseModel):
transactionId: str | None
bookingDate: str | None
valueDate: str
bookingDateTime: str | None
valueDateTime: str | None
transactionAmount: TXCurrencyAmount
creditorName: str | None
creditorAccount: TXAccount | None
debtorName: str | None
debtorAccount: TXAccount | None
remittanceInformationUnstructuredArray: list[str] | None
remittanceInformationUnstructured: str | None
proprietaryBankTransactionCode: str | None
internalTransactionId: str | None
currencyExchange: TransactionsCurrencyExchange | None
class TransactionsBookedPending(BaseModel):
booked: list[TransactionsNested]
pending: list[TransactionsNested]
class Transactions(BaseModel):
transactions: TransactionsBookedPending
TransactionsSchema = {
"booked": "transactions.booked",
"pending": "transactions.pending",
}