ksef

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelWarn   = slog.LevelWarn
	LevelInfo   = slog.LevelInfo
	LevelDebug  = slog.LevelDebug
	LevelTrace  = slog.LevelDebug - 4
	LevelSecret = slog.LevelDebug - 8
)

Variables

This section is empty.

Functions

func JSON400ToString

func JSON400ToString(errorResponse *ksefapi.ExceptionResponse) string

Types

type Client

type Client interface {
	Login(ctx context.Context, nip string, token string) (*Tokens, error)
	GetInvoices(ctx context.Context, query InvoiceQuery, page InvoicePage) ([]Invoice, error)
	RefreshTokens(ctx context.Context) (*Tokens, error)

	SetTokens(tokens *Tokens)
	GetTokens() *Tokens
}

func NewClient

func NewClient(serverURL string) (Client, error)

type Invoice

type Invoice struct {
	GrossAmount          float64   `json:"gross_amount"`
	NetAmount            float64   `json:"net_amount"`
	InvoiceNumber        string    `json:"invoice_number"`
	KsefNumber           string    `json:"ksef_number"`
	PermanentStorageDate time.Time `json:"permanent_storage_date"`
	SellerNIP            string    `json:"seller_nip"`
	SellerName           string    `json:"seller_name"`
}

type InvoicePage

type InvoicePage struct {
	PageSize   int32
	PageOffset int32
}

type InvoiceQuery

type InvoiceQuery struct {
	From        time.Time
	To          time.Time
	SubjectType SubjectType
}

type SubjectType

type SubjectType string
const (
	Subject1          SubjectType = "Subject1"
	Subject2          SubjectType = "Subject2"
	Subject3          SubjectType = "Subject3"
	SubjectAuthorized SubjectType = "SubjectAuthorized"
)

type Tokens

type Tokens struct {
	AccessToken        string    `json:"access_token"`
	AccessTokenExpiry  time.Time `json:"access_token_expiry"`
	RefreshToken       string    `json:"refresh_token"`
	RefreshTokenExpiry time.Time `json:"refresh_token_expiry"`
	KsefToken          string    `json:"ksef_token,omitempty"`
}

Jump to

Keyboard shortcuts

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