From 2ca518962c79d4794262739307af2428c9d9de5f Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 25 Mar 2022 18:09:32 +0000 Subject: [PATCH] Commit serde code --- handler/lib/serde/nordigen.py | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 handler/lib/serde/nordigen.py diff --git a/handler/lib/serde/nordigen.py b/handler/lib/serde/nordigen.py new file mode 100644 index 0000000..f546526 --- /dev/null +++ b/handler/lib/serde/nordigen.py @@ -0,0 +1,84 @@ +from serde import Model, fields + + +class Amount(Model): + amount: fields.Str() + currency: fields.Str() + + +class Transaction(Model): + bookingDate: fields.Date() + proprietaryBankTransactionCode: fields.Optional(fields.Str()) + remittanceInformationUnstructured: fields.Optional(fields.Str()) + transactionAmount: fields.Nested(Amount) + transactionId: fields.Str() + + +class Pending(Transaction): + pass + + +class Booked(Transaction): + pass + + +class Transactions(Model): + pending: fields.List(Pending) + booked: fields.List(Booked) + + +class TXRoot(Model): + transactions: fields.Nested(Transactions) + + +class AccessToken(Model): + access: fields.Str() + + +class Institution(Model): + id: fields.Str() + name: fields.Str() + bic: fields.Str() + transaction_total_days: fields.Str() + countries: fields.List() + logo: fields.Url() + + +class Institutions(Model): + institutions: fields.List(Institution) + + +class Agreement(Model): + id: fields.Str() + created: fields.DateTime() + redirect: fields.Url() + status: fields.Str() + institution_id: fields.Str() + agreement: fields.Str() + reference: fields.Str() + accounts: fields.List() + link: fields.Url() + ssn: fields.Literal(None) # ? + account_selection: fields.Bool() + redirect_immediate: fields.Bool() + + +class Requisitions(Model): + count: fields.Int() + next: fields.Literal(None) # wrong + previous: fields.Literal(None) # wrong + results: fields.List(Agreement) + + +class Account(Model): + resourceId: fields.Str() + iban: fields.Str() + bban: fields.Str() + currency: fields.Str() + ownerName: fields.Str() + status: fields.Str() + details: fields.Str() + + +class AccountDetails(Model): + account: fields.Nested(Account)