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
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +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",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
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",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
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",
|
|
|
|
}
|
2023-03-08 18:38:53 +00:00
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class Requisition(MyModel):
|
2023-03-08 18:38:53 +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
|
|
|
|
|
|
|
|
|
|
|
|
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",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class AccountDetailsNested(MyModel):
|
2023-03-08 18:38:53 +00:00
|
|
|
resourceId: str
|
|
|
|
currency: str
|
2023-04-18 07:58:36 +00:00
|
|
|
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
|
2023-03-08 18:38:53 +00:00
|
|
|
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
|
2023-03-11 18:30:56 +00:00
|
|
|
bic: str | None
|
2023-03-08 18:38:53 +00:00
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class AccountDetails(MyModel):
|
2023-03-08 18:38:53 +00:00
|
|
|
account: AccountDetailsNested
|
|
|
|
|
|
|
|
|
|
|
|
AccountDetailsSchema = {
|
|
|
|
"account": "account",
|
|
|
|
}
|
2023-03-09 18:28:50 +00:00
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +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
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class AccountBalances(MyModel):
|
2023-03-09 18:28:50 +00:00
|
|
|
balances: list[AccountBalance]
|
|
|
|
summary: str | None
|
|
|
|
|
|
|
|
|
|
|
|
AccountBalancesSchema = {
|
|
|
|
"balances": "balances",
|
|
|
|
"summary": "summary",
|
|
|
|
}
|
2023-03-09 20:24:46 +00:00
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class TXCurrencyAmount(MyModel):
|
2023-03-09 20:24:46 +00:00
|
|
|
amount: str
|
|
|
|
currency: str
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class TransactionsCurrencyExchange(MyModel):
|
2023-03-09 20:24:46 +00:00
|
|
|
instructedAmount: TXCurrencyAmount
|
|
|
|
sourceCurrency: str
|
|
|
|
exchangeRate: str
|
|
|
|
unitCurrency: str
|
|
|
|
targetCurrency: str
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class TXAccount(MyModel):
|
2023-03-16 20:20:36 +00:00
|
|
|
iban: str | None
|
2023-03-09 20:24:46 +00:00
|
|
|
bban: str | None
|
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class TransactionsNested(MyModel):
|
2023-03-09 20:24:46 +00:00
|
|
|
transactionId: str | None
|
|
|
|
bookingDate: str | None
|
2023-03-11 18:30:56 +00:00
|
|
|
valueDate: str | None
|
2023-03-09 20:24:46 +00:00
|
|
|
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
|
2023-03-16 20:20:36 +00:00
|
|
|
merchantCategoryCode: str | None
|
2023-03-09 20:24:46 +00:00
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class TransactionsBookedPending(MyModel):
|
2023-04-20 07:42:39 +00:00
|
|
|
booked: list[TransactionsNested] | None
|
|
|
|
pending: list[TransactionsNested] | None
|
2023-03-09 20:24:46 +00:00
|
|
|
|
|
|
|
|
2023-03-11 18:30:56 +00:00
|
|
|
class Transactions(MyModel):
|
2023-04-20 07:42:39 +00:00
|
|
|
transactions: TransactionsBookedPending | None
|
|
|
|
detail: str | None
|
|
|
|
status_code: int | None
|
|
|
|
summary: str | None
|
2023-03-09 20:24:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
TransactionsSchema = {
|
2023-04-20 07:42:39 +00:00
|
|
|
"transactions": "transactions",
|
|
|
|
"status_code": "status_code",
|
|
|
|
"summary": "summary",
|
2023-03-09 20:24:46 +00:00
|
|
|
}
|