sbanken

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: AGPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-sbanken

Sbanken API client library in Golang

Build Status Quality Gate Status Technical Debt

--

import sbanken "github.com/elzapp/go-sbanken"

Usage

Example

This small program will print your accounts and their balance

package main
import {
	"fmt"
	sbanken "github.com/elzapp/go-sbanken"
}
func main() {
	creds := sbanken.Credentials{"MYAPIKEY","MYSECRET","MYSSN"}
	conn := sbanken.NewAPIConnection(creds)
	accounts := conn.GetAccounts()

	for _, account range accounts {
		fmt.Printf("%-14s %9.6f", account.AccountNumber, account.Balance)
	}
}
type APIConnection
type APIConnection struct {
}

APIConnection is the Api client

func NewAPIConnection
func NewAPIConnection(cred Credentials) APIConnection

NewAPIConnection creates an API connection for you This is your starting point, supply it with a Credentials struct, which you easily can read from a JSON file.

The returned APIConnection struct contains all the methods to communicate with the public Sbanken API

func (*APIConnection) GetAccounts
func (conn *APIConnection) GetAccounts() []Account

GetAccounts returns a list of all your bank accounts See the Account struct for details

func (*APIConnection) GetAllEFakturas
func (conn *APIConnection) GetAllEFakturas() []EFaktura

GetAllEFakturas returns all pending eFakturas

func (*APIConnection) GetEFaktura
func (conn *APIConnection) GetEFaktura(eFakturaID string) EFaktura

GetEFaktura returns information on a single EFaktura specified by eFakturaID

func (*APIConnection) GetNewEFakturas
func (conn *APIConnection) GetNewEFakturas() []EFaktura

GetNewEFakturas returns eFakturas that has not been accepted yet

func (*APIConnection) GetTransactions
func (conn *APIConnection) GetTransactions(accountid string) []Transaction

GetTransactions returns the latest transactions on a given account using the default limits set by Sbanken

type Account
type Account struct {
	AccountID       string  `json:"accountId"`
	AccountNumber   string  `json:"accountNumber"`
	OwnerCustomerID string  `json:"ownerCustomerId"`
	Name            string  `json:"name"`
	AccountType     string  `json:"accountType"`
	Available       float64 `json:"available"`
	Balance         float64 `json:"balance"`
	CreditLimit     float64 `json:"creditLimit"`
}

Account information

type Credentials
type Credentials struct {
	Apikey string `json:"apikey"`
	Secret string `json:"secret"`
	UserID string `json:"userid"`
}

Credentials holds login information

type EFaktura
type EFaktura struct {
	EFakturaID          string  `json:"eFakturaId"`
	IssuerID            string  `json:"issuerId"`
	EFakturaReference   string  `json:"eFakturaReference"`
	DocumentType        string  `json:"documentType"`
	Status              string  `json:"status"`
	KID                 string  `json:"kid"`
	OriginalDueDate     string  `json:"originalDueDate"`
	OriginalAmount      float64 `json:"originalAmount"`
	MinimumAmount       float64 `json:"minimumAmount"`
	NotificationDate    string  `json:"notificationDate"`
	IssuerName          string  `json:"issuerName"`
	UpdatedDueDate      string  `json:"updatedDueDate"`
	UpdatedAmount       float64 `json:"updatedAmount"`
	CreditAccountNumber string  `json:"creditAccountNumber"`
}

EFaktura as received from the Sbanken public API

type EFakturaPayRequest
type EFakturaPayRequest struct {
	EFakturaID           string `json:"eFakturaId"`
	AccountID            string `json:"accountId"`
	PayOnlyMinimumAmount bool   `json:"payOnlyMinimumAmount"`
}

EFakturaPayRequest is used to accept an eFaktura, charging the AccountID on the due date with the maximum or the minimun amount

type Transaction
type Transaction struct {
	TransactionID      string  `json:"transactionId"`
	AccountingDate     string  `json:"accountingDate"`
	InterestDate       string  `json:"interestDate"`
	OtherAccountNumber string  `json:"otherAccountNumber"`
	Amount             float64 `json:"amount"`
	Text               string  `json:"text"`
	Source             string  `json:"source"`
}

Transaction information

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConnection

type APIConnection struct {
	// contains filtered or unexported fields
}

APIConnection is the Api client

func NewAPIConnection

func NewAPIConnection(cred Credentials) APIConnection

NewAPIConnection creates an API connection for you This is your starting point, supply it with a Credentials struct, which you easily can read from a JSON file.

The returned APIConnection struct contains all the methods to communicate with the public Sbanken API

func (*APIConnection) GetAccounts

func (conn *APIConnection) GetAccounts() []Account

GetAccounts returns a list of all your bank accounts See the Account struct for details

func (*APIConnection) GetAllEFakturas

func (conn *APIConnection) GetAllEFakturas() []EFaktura

GetAllEFakturas returns all pending eFakturas

func (*APIConnection) GetEFaktura

func (conn *APIConnection) GetEFaktura(eFakturaID string) EFaktura

GetEFaktura returns information on a single EFaktura specified by eFakturaID

func (*APIConnection) GetNewEFakturas

func (conn *APIConnection) GetNewEFakturas() []EFaktura

GetNewEFakturas returns eFakturas that has not been accepted yet

func (*APIConnection) GetTransactions

func (conn *APIConnection) GetTransactions(accountid string) []Transaction

GetTransactions returns the latest transactions on a given account using the default limits set by Sbanken

type Account

type Account struct {
	AccountID       string  `json:"accountId"`
	AccountNumber   string  `json:"accountNumber"`
	OwnerCustomerID string  `json:"ownerCustomerId"`
	Name            string  `json:"name"`
	AccountType     string  `json:"accountType"`
	Available       float64 `json:"available"`
	Balance         float64 `json:"balance"`
	CreditLimit     float64 `json:"creditLimit"`
}

Account information

type Credentials

type Credentials struct {
	Apikey string `json:"apikey"`
	Secret string `json:"secret"`
	UserID string `json:"userid"`
}

Credentials holds login information

type EFaktura

type EFaktura struct {
	EFakturaID          string  `json:"eFakturaId"`
	IssuerID            string  `json:"issuerId"`
	EFakturaReference   string  `json:"eFakturaReference"`
	DocumentType        string  `json:"documentType"`
	Status              string  `json:"status"`
	KID                 string  `json:"kid"`
	OriginalDueDate     string  `json:"originalDueDate"`
	OriginalAmount      float64 `json:"originalAmount"`
	MinimumAmount       float64 `json:"minimumAmount"`
	NotificationDate    string  `json:"notificationDate"`
	IssuerName          string  `json:"issuerName"`
	UpdatedDueDate      string  `json:"updatedDueDate"`
	UpdatedAmount       float64 `json:"updatedAmount"`
	CreditAccountNumber string  `json:"creditAccountNumber"`
}

EFaktura as received from the Sbanken public API

type EFakturaPayRequest

type EFakturaPayRequest struct {
	EFakturaID           string `json:"eFakturaId"`
	AccountID            string `json:"accountId"`
	PayOnlyMinimumAmount bool   `json:"payOnlyMinimumAmount"`
}

EFakturaPayRequest is used to accept an eFaktura, charging the AccountID on the due date with the maximum or the minimun amount

type Transaction

type Transaction struct {
	TransactionID      string  `json:"transactionId"`
	AccountingDate     string  `json:"accountingDate"`
	InterestDate       string  `json:"interestDate"`
	OtherAccountNumber string  `json:"otherAccountNumber"`
	Amount             float64 `json:"amount"`
	Text               string  `json:"text"`
	Source             string  `json:"source"`
}

Transaction information

func (*Transaction) GetAccountingDate

func (t *Transaction) GetAccountingDate() time.Time

GetAccountingDate returns the interest date as a Time struct

func (*Transaction) GetInterestDate

func (t *Transaction) GetInterestDate() time.Time

GetInterestDate returns the interest date as a Time struct

Jump to

Keyboard shortcuts

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