dkbclient

package
v0.0.0-...-815c7ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Type       string            `json:"type"`
	Id         string            `json:"id"`
	Attributes AccountAttributes `json:"attributes"`
}

type AccountAttributes

type AccountAttributes struct {
	HolderName                        string           `json:"holderName"`
	Iban                              string           `json:"iban"`
	Permissions                       []string         `json:"permissions"`
	CurrencyCode                      string           `json:"currencyCode"`
	Balance                           CurrencyValue    `json:"balance"`
	AvailableBalance                  CurrencyValue    `json:"availableBalance"`
	NearTimeBalance                   CurrencyValue    `json:"nearTimeBalance"`
	Product                           Product          `json:"product"`
	State                             string           `json:"state"`
	UpdatedAt                         string           `json:"updatedAt"`
	OpeningDate                       string           `json:"openingDate"`
	OverdraftLimit                    string           `json:"overdraftLimit"`
	OverdraftInterestRate             string           `json:"overdraftInterestRate,omitempty"`
	InterestRate                      string           `json:"interestRate"`
	UnauthorizedOverdraftInterestRate string           `json:"unauthorizedOverdraftInterestRate"`
	LastAccountStatementDate          string           `json:"lastAccountStatementDate"`
	ReferenceAccount                  ReferenceAccount `json:"referenceAccount,omitempty"`
}

type AccountTransaction

type AccountTransaction struct {
	Type       string                       `json:"type"`
	Id         string                       `json:"id"`
	Attributes AccountTransactionAttributes `json:"attributes"`
}

type AccountTransactionAttributes

type AccountTransactionAttributes struct {
	Status                  string        `json:"status"`
	BookingDate             string        `json:"bookingDate"`
	Description             string        `json:"description"`
	EndToEndId              string        `json:"endToEndId,omitempty"`
	TransactionType         string        `json:"transactionType"`
	PurposeCode             string        `json:"purposeCode,omitempty"`
	BusinessTransactionCode string        `json:"businessTransactionCode"`
	Amount                  CurrencyValue `json:"amount"`
	Creditor                struct {
		Name            string `json:"name,omitempty"`
		CreditorAccount struct {
			AccountNr string `json:"accountNr,omitempty"`
			Blz       string `json:"blz,omitempty"`
			Iban      string `json:"iban,omitempty"`
		} `json:"creditorAccount"`
		Agent struct {
			Bic string `json:"bic"`
		} `json:"agent,omitempty"`
		IntermediaryName string `json:"intermediaryName,omitempty"`
		Id               string `json:"id,omitempty"`
	} `json:"creditor"`
	Debtor struct {
		Name          string `json:"name,omitempty"`
		DebtorAccount struct {
			AccountNr string `json:"accountNr,omitempty"`
			Blz       string `json:"blz,omitempty"`
			Iban      string `json:"iban,omitempty"`
		} `json:"debtorAccount"`
		Agent struct {
			Bic string `json:"bic"`
		} `json:"agent,omitempty"`
		IntermediaryName string `json:"intermediaryName,omitempty"`
	} `json:"debtor"`
	IsRevocable bool   `json:"isRevocable"`
	ValueDate   string `json:"valueDate,omitempty"`
	MandateId   string `json:"mandateId,omitempty"`
}

type AccountTransactions

type AccountTransactions struct {
	Data []AccountTransaction `json:"data"`
}

type Accounts

type Accounts struct {
	Data []Account `json:"data"`
}

type Client

type Client struct {
	VerificationStatusPollInterval time.Duration
	VerificationStatusPollRetries  int
	// contains filtered or unexported fields
}

Client is an HTTP client for the DKB web interface

func New

func New() Client

New creates a new Client

func (*Client) GetAccountTransactions

func (c *Client) GetAccountTransactions(accountID string) (AccountTransactions, error)

func (*Client) GetAccounts

func (c *Client) GetAccounts() (Accounts, error)

func (*Client) GetCreditCardTransactions

func (c *Client) GetCreditCardTransactions(creditCardID string) (CreditCardTransactions, error)

func (*Client) GetCreditCards

func (c *Client) GetCreditCards() (CreditCards, error)

func (*Client) GetDocumentData

func (c *Client) GetDocumentData(id string) ([]byte, error)

func (*Client) GetDocuments

func (c *Client) GetDocuments() (Documents, error)

func (*Client) Login

func (c *Client) Login(username, password string, mfaMethodSelector MfaMethodSelector) error

Login logs in to the DKB website using the provided credentials

type CreditCard

type CreditCard struct {
	Type       string `json:"type"`
	Id         string `json:"id"`
	Attributes struct {
		MaskedPan      string `json:"maskedPan"`
		Network        string `json:"network"`
		EngravedLine1  string `json:"engravedLine1"`
		EngravedLine2  string `json:"engravedLine2,omitempty"`
		ActivationDate string `json:"activationDate,omitempty"`
		ExpiryDate     string `json:"expiryDate"`
		Balance        struct {
			Date         string `json:"date"`
			CurrencyCode string `json:"currencyCode"`
			Value        string `json:"value"`
		} `json:"balance,omitempty"`
		State string `json:"state"`
		Owner struct {
			FirstName  string `json:"firstName"`
			LastName   string `json:"lastName"`
			Title      string `json:"title"`
			Salutation string `json:"salutation"`
		} `json:"owner,omitempty"`
		Holder struct {
			Person struct {
				FirstName string `json:"firstName"`
				LastName  string `json:"lastName"`
			} `json:"person"`
		} `json:"holder"`
		Product struct {
			SuperProductId string `json:"superProductId"`
			DisplayName    string `json:"displayName"`
			Institute      string `json:"institute"`
			ProductType    string `json:"productType"`
			OwnerType      string `json:"ownerType"`
			Id             string `json:"id"`
			Type           string `json:"type"`
		} `json:"product"`
		Limit struct {
			CurrencyCode string `json:"currencyCode,omitempty"`
			Value        string `json:"value,omitempty"`
			Identifier   string `json:"identifier,omitempty"`
			Categories   []struct {
				Name   string `json:"name"`
				Amount struct {
					CurrencyCode string `json:"currencyCode"`
					Value        string `json:"value"`
				} `json:"amount"`
			} `json:"categories,omitempty"`
		} `json:"limit"`
		AvailableLimit struct {
			CurrencyCode string `json:"currencyCode"`
			Value        string `json:"value"`
		} `json:"availableLimit,omitempty"`
		AuthorizedAmount struct {
			CurrencyCode string `json:"currencyCode"`
			Value        string `json:"value"`
		} `json:"authorizedAmount,omitempty"`
		ReferenceAccount struct {
			Iban string `json:"iban"`
			Bic  string `json:"bic"`
		} `json:"referenceAccount"`
		Status struct {
			Category       string        `json:"category"`
			LimitationsFor []interface{} `json:"limitationsFor,omitempty"`
		} `json:"status"`
		BillingDetails struct {
			Days         []int  `json:"days"`
			CalendarType string `json:"calendarType"`
			Cycle        string `json:"cycle"`
		} `json:"billingDetails,omitempty"`
		CreationDate      string `json:"creationDate,omitempty"`
		FailedPinAttempts int    `json:"failedPinAttempts,omitempty"`
	} `json:"attributes"`
	Relationships struct {
		Owner struct {
			Data struct {
				Type string `json:"type"`
				Id   string `json:"id"`
			} `json:"data"`
		} `json:"owner,omitempty"`
		Legitimates struct {
			Data []struct {
				Type string `json:"type"`
				Id   string `json:"id"`
			} `json:"data"`
		} `json:"legitimates,omitempty"`
	} `json:"relationships"`
}

type CreditCardTransaction

type CreditCardTransaction struct {
	Type       string                          `json:"type"`
	Id         string                          `json:"id"`
	Attributes CreditCardTransactionAttributes `json:"attributes"`
}

type CreditCardTransactionAttributes

type CreditCardTransactionAttributes struct {
	Amount struct {
		ConversionRate string `json:"conversionRate"`
		CurrencyCode   string `json:"currencyCode"`
		Value          string `json:"value"`
	} `json:"amount"`
	CardId         string `json:"cardId"`
	MerchantAmount struct {
		CurrencyCode string `json:"currencyCode"`
		Value        string `json:"value"`
	} `json:"merchantAmount"`
	MerchantCategory struct {
		Code string `json:"code"`
	} `json:"merchantCategory,omitempty"`
	Status            string        `json:"status"`
	TransactionType   string        `json:"transactionType"`
	AuthorizationDate time.Time     `json:"authorizationDate"`
	BookingDate       string        `json:"bookingDate"`
	Description       string        `json:"description"`
	Bonuses           []interface{} `json:"bonuses"`
}

type CreditCardTransactions

type CreditCardTransactions struct {
	Data []CreditCardTransaction `json:"data"`
}

type CreditCards

type CreditCards struct {
	Data []CreditCard `json:"data"`
	Meta struct {
		Messages []interface{} `json:"messages"`
	} `json:"meta"`
}

type CurrencyValue

type CurrencyValue struct {
	CurrencyCode string `json:"currencyCode"`
	Value        string `json:"value"`
}

type Document

type Document struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreationDate    time.Time `json:"creationDate"`
		ExpirationDate  string    `json:"expirationDate"`
		RetentionPeriod string    `json:"retentionPeriod"`
		ContentType     string    `json:"contentType"`
		Checksum        string    `json:"checksum"`
		FileName        string    `json:"fileName"`
		Metadata        struct {
			CardID            string `json:"cardId"`
			StatementDate     string `json:"statementDate"`
			StatementAmount   string `json:"statementAmount"`
			Subject           string `json:"subject"`
			StatementID       string `json:"statementID"`
			StatementCurrency string `json:"statementCurrency"`
		} `json:"metadata"`
		Owner string `json:"owner"`
	} `json:"attributes"`
	Relationships struct {
		DocumentType struct {
			Links struct {
				Self    string `json:"self"`
				Related string `json:"related"`
			} `json:"links"`
		} `json:"documentType"`
	} `json:"relationships"`
}

type Documents

type Documents struct {
	Data []Document `json:"data"`
}

type MFAChallenge

type MFAChallenge struct {
	Data MFAChallengeData `json:"data"`
}

type MFAChallengeData

type MFAChallengeData struct {
	Attributes MFAChallengeDataAttributes `json:"attributes"`
	Type       string                     `json:"type"`
}

type MFAChallengeDataAttributes

type MFAChallengeDataAttributes struct {
	MethodID   string `json:"methodId"`
	MethodType string `json:"methodType"`
	MfaID      string `json:"mfaId"`
}

type MFAChallengeResponse

type MFAChallengeResponse struct {
	Data     MFAChallengeResponseData `json:"data"`
	Included []MFAMethod              `json:"included"`
}

type MFAChallengeResponseData

type MFAChallengeResponseData struct {
	Type       string `json:"type"`
	ID         string `json:"id"`
	Attributes struct {
		MfaID              string `json:"mfaId"`
		MethodID           string `json:"methodId"`
		MethodType         string `json:"methodType"`
		VerificationStatus string `json:"verificationStatus"`
	} `json:"attributes"`
	Relationships struct {
		Method struct {
			Data struct {
				Type string `json:"type"`
				ID   string `json:"id"`
			} `json:"data"`
		} `json:"method"`
	} `json:"relationships"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
}

type MFAMethod

type MFAMethod struct {
	Type       string `json:"type"`
	ID         string `json:"id"`
	Attributes struct {
		MethodType                      string    `json:"methodType"`
		DeviceName                      string    `json:"deviceName"`
		Locked                          bool      `json:"locked"`
		RemainingValidationAttempts     int       `json:"remainingValidationAttempts"`
		RemainingChallenges             int       `json:"remainingChallenges"`
		MethodTypeOrder3Ds              int       `json:"methodTypeOrder3ds"`
		SealOneID                       string    `json:"sealOneId"`
		EnrolledAt                      time.Time `json:"enrolledAt"`
		Portfolio                       string    `json:"portfolio"`
		PreferredDevice                 bool      `json:"preferredDevice"`
		LockingPeriodAfterEnrollmentEnd time.Time `json:"lockingPeriodAfterEnrollmentEnd"`
	} `json:"attributes"`
}

func GetMostRecentlyEnrolledMFAMethod

func GetMostRecentlyEnrolledMFAMethod(methods []MFAMethod) (MFAMethod, error)

func UserSelectMFAMethod

func UserSelectMFAMethod(methods []MFAMethod) (MFAMethod, error)

type MFAMethodsResponse

type MFAMethodsResponse struct {
	Data []MFAMethod `json:"data"`
}

type MfaMethodSelector

type MfaMethodSelector func(methods []MFAMethod) (MFAMethod, error)

type Product

type Product struct {
	Id          string `json:"id"`
	Type        string `json:"type"`
	DisplayName string `json:"displayName"`
}

type ReferenceAccount

type ReferenceAccount struct {
	Iban          string `json:"iban"`
	AccountNumber string `json:"accountNumber"`
	Blz           string `json:"blz"`
}

type TokenData

type TokenData struct {
	AccessToken           string `json:"access_token"`
	RefreshTokenExpiresIn string `json:"refresh_token_expires_in"`
	RefreshToken          string `json:"refresh_token"`
	TokenFactorType       string `json:"token_factor_type"`
	AnonymousUserID       string `json:"anonymous_user_id"`
	Scope                 string `json:"scope"`
	IDToken               string `json:"id_token"`
	MfaID                 string `json:"mfa_id"`
	TokenType             string `json:"token_type"`
	ExpiresIn             int    `json:"expires_in"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL