pluto/core/lib/schemas/nordigen_s.py

214 lines
4.3 KiB
Python

from pydantic import BaseModel, Extra
class MyModel(BaseModel):
class Config:
extra = Extra.forbid
# TODO: inherit from MyModel
class TokenNew(MyModel):
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(MyModel):
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(MyModel):
count: int
next: str | None
previous: str | None
results: list[RequisitionResult]
RequisitionsSchema = {
"count": "count",
"next": "next",
"previous": "previous",
"results": "results",
}
class RequisitionsPost(MyModel):
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(MyModel):
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(MyModel):
resourceId: str
currency: str
ownerName: str | None
cashAccountType: str | None
status: str | None
maskedPan: str | None
details: str | None
iban: str | None
bban: str | None
name: str | None
product: str | None
bic: str | None
class AccountDetails(MyModel):
account: AccountDetailsNested
AccountDetailsSchema = {
"account": "account",
}
class AccountBalance(MyModel):
balanceAmount: dict[str, str]
balanceType: str | None
referenceDate: str | None
class AccountBalances(MyModel):
balances: list[AccountBalance]
summary: str | None
AccountBalancesSchema = {
"balances": "balances",
"summary": "summary",
}
class TXCurrencyAmount(MyModel):
amount: str
currency: str
class TransactionsCurrencyExchange(MyModel):
instructedAmount: TXCurrencyAmount
sourceCurrency: str
exchangeRate: str
unitCurrency: str
targetCurrency: str
class TXAccount(MyModel):
iban: str | None
bban: str | None
class TransactionsNested(MyModel):
transactionId: str | None
bookingDate: str | None
valueDate: str | None
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
merchantCategoryCode: str | None
class TransactionsBookedPending(MyModel):
booked: list[TransactionsNested] | None
pending: list[TransactionsNested] | None
class Transactions(MyModel):
transactions: TransactionsBookedPending | None
detail: str | None
status_code: int | None
summary: str | None
TransactionsSchema = {
"transactions": "transactions",
"status_code": "status_code",
"summary": "summary",
}