rut

package
v0.0.0-...-f67e159 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRUT = errors.New("invalid rut")
View Source
var ErrInvalidVD = errors.New("invalid verification figit")

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Name         string    `json:"name"`
	Code         int       `json:"code"`
	Category     string    `json:"category"`
	SubjectToVAT bool      `json:"subject_to_vat"`
	Date         time.Time `json:"date"`
}

type DefaultService

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

func NewDefaultService

func NewDefaultService() *DefaultService

func (*DefaultService) GetProfile

func (s *DefaultService) GetProfile(rut RUT) (*SIIProfile, error)

type Handler

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

func NewHandler

func NewHandler(env *env.Env, service Service) *Handler

func (*Handler) Activity

func (h *Handler) Activity() gin.HandlerFunc

func (*Handler) Generate

func (h *Handler) Generate() gin.HandlerFunc

func (*Handler) VD

func (h *Handler) VD() gin.HandlerFunc

func (*Handler) Validate

func (h *Handler) Validate() gin.HandlerFunc

type RUT

type RUT struct {
	Digits []uint8
	VD     VD
}

func (RUT) IsValid

func (r RUT) IsValid() bool

func (RUT) String

func (r RUT) String() string

type SIIProfile

type SIIProfile struct {
	Name       string      `json:"name"`
	Activities []*Activity `json:"activities"`
}

type Service

type Service interface {
	GetProfile(rut RUT) (*SIIProfile, error)
}

type VD

type VD int8
const (
	VDNone VD = iota - 2
	VDK
	VD0
	VD1
	VD2
	VD3
	VD4
	VD5
	VD6
	VD7
	VD8
	VD9
)

func (VD) String

func (d VD) String() string

Jump to

Keyboard shortcuts

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