pluto/core/lib/schemas/nordigen_s.py

214 lines
4.3 KiB
Python
Raw Normal View History

2023-03-11 16:57:08 +00:00
from pydantic import BaseModel, Extra
class MyModel(BaseModel):
class Config:
extra = Extra.forbid
# TODO: inherit from MyModel
2023-03-08 12:48:05 +00:00
class TokenNew(MyModel):
2023-03-08 12:48:05 +00:00
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):
2023-03-08 12:48:05 +00:00
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):
2023-03-08 12:48:05 +00:00
count: int
next: str | None
previous: str | None
results: list[RequisitionResult]
RequisitionsSchema = {
"count": "count",
"next": "next",
"previous": "previous",
"results": "results",
}
class RequisitionsPost(MyModel):
2023-03-08 12:48:05 +00:00
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
2023-03-09 18:43:50 +00:00
cashAccountType: str | None
2023-03-09 16:44:16 +00:00
status: str | None
maskedPan: str | None
2023-03-09 16:44:16 +00:00
details: str | None
iban: str | None
2023-03-09 18:46:49 +00:00
bban: str | None
2023-03-09 16:44:16 +00:00
name: str | None
product: str | None
bic: str | None
class AccountDetails(MyModel):
account: AccountDetailsNested
AccountDetailsSchema = {
"account": "account",
}
2023-03-09 18:28:50 +00:00
class AccountBalance(MyModel):
2023-03-09 18:28:50 +00:00
balanceAmount: dict[str, str]
2023-03-09 18:58:08 +00:00
balanceType: str | None
referenceDate: str | None
2023-03-09 18:28:50 +00:00
class AccountBalances(MyModel):
2023-03-09 18:28:50 +00:00
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):
2023-04-20 07:42:39 +00:00
booked: list[TransactionsNested] | None
pending: list[TransactionsNested] | None
class Transactions(MyModel):
2023-04-20 07:42:39 +00:00
transactions: TransactionsBookedPending | None
detail: str | None
status_code: int | None
summary: str | None
TransactionsSchema = {
2023-04-20 07:42:39 +00:00
"transactions": "transactions",
"status_code": "status_code",
"summary": "summary",
}