eet

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package eet

Index

Constants

View Source
const DateTimeLayout = time.RFC3339

DateTimeLayout is the datetime layout of the EET system.

Variables

View Source
var ErrInvalidBKP = errors.New("incorrect response BKP")

ErrInvalidBKP is returned if the response BKP code is different.

View Source
var ErrInvalidSOAPMessage = errors.New("SOAP message with an unexpected structure")

ErrInvalidSOAPMessage is returned if a SOAP message has an unexpected structure.

View Source
var ErrInvalidUUID = errors.New("invalid UUID value or format")

ErrInvalidUUID is returned if the response UUID is different, or it has invalid format.

View Source
var ErrInvalidXMLDigest = errors.New("computed digest differs from the digest in the XML")

ErrInvalidXMLDigest is returned if the referenced computed digest differs from the digest in the XML.

Functions

func NewRequestEnvelope added in v0.4.0

func NewRequestEnvelope(t *TrzbaType, cert *x509.Certificate, pk *rsa.PrivateKey) ([]byte, error)

NewRequestEnvelope returns a populated and signed SOAP request envelope.

func VerifyResponse added in v0.4.0

func VerifyResponse(trzba *TrzbaType, respEnv []byte, odpoved *OdpovedType, verifyCert func(*x509.Certificate) error) error

VerifyResponse checks whether the response envelope is valid and is signed by a trusted certificate.

Types

type BkpDigestType

type BkpDigestType string

May be one of SHA1

type BkpElementType

type BkpElementType struct {
	BkpType  BkpType         `xml:",chardata"`
	Digest   BkpDigestType   `xml:"digest,attr"`
	Encoding BkpEncodingType `xml:"encoding,attr"`
}

type BkpEncodingType

type BkpEncodingType string

May be one of base16

type BkpType

type BkpType string

Must match the pattern [0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}

type CZDICType

type CZDICType string

Must match the pattern CZ[0-9]{8,10}

type CastkaType

type CastkaType float64

Must match the pattern ((0|-?[1-9]\d{0,7})\.\d\d|-0\.(0[1-9]|[1-9]\d))

func (CastkaType) MarshalText

func (c CastkaType) MarshalText() ([]byte, error)

MarshalText encodes CastkaType value to the correct form with two decimal places included.

type Client

type Client struct {
	HTTPClient   *http.Client
	ResponseHook func(*http.Response) *http.Response
	RequestHook  func(*http.Request) *http.Request
}

type DateTime

type DateTime time.Time

func (DateTime) MarshalText

func (t DateTime) MarshalText() ([]byte, error)

func (*DateTime) Normalize added in v0.7.0

func (t *DateTime) Normalize()

Normalize canonicalizes the DateTime data. All DateTime needs to be normalized.

func (*DateTime) UnmarshalText

func (t *DateTime) UnmarshalText(text []byte) error

type FikType

type FikType string

Must match the pattern [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}-[0-9a-fA-F]{2}

type OdpovedBody

type OdpovedBody struct {
	Odpoved OdpovedType `xml:"Odpoved"`
}

OdpovedBody represents a SOAP Body of the response envelope.

type OdpovedChybaType

type OdpovedChybaType struct {
	Zprava string `xml:",chardata"`
	Kod    int    `xml:"kod,attr"`
	Test   bool   `xml:"test,attr,omitempty"`
}

type OdpovedHlavickaType

type OdpovedHlavickaType struct {
	Uuidzpravy UUIDType `xml:"uuid_zpravy,attr,omitempty"`
	Bkp        BkpType  `xml:"bkp,attr,omitempty"`
	Datprij    DateTime `xml:"dat_prij,attr,omitempty"`
	Datodmit   DateTime `xml:"dat_odmit,attr,omitempty"`
}

type OdpovedPotvrzeniType

type OdpovedPotvrzeniType struct {
	Fik  FikType `xml:"fik,attr"`
	Test bool    `xml:"test,attr,omitempty"`
}

type OdpovedType

type OdpovedType struct {
	Hlavicka  OdpovedHlavickaType   `xml:"Hlavicka,omitempty"`
	Potvrzeni OdpovedPotvrzeniType  `xml:"Potvrzeni,omitempty"`
	Chyba     OdpovedChybaType      `xml:"Chyba,omitempty"`
	Varovani  []OdpovedVarovaniType `xml:"Varovani,omitempty"`
}

func ParseResponseEnvelope added in v0.4.0

func ParseResponseEnvelope(env []byte) (*OdpovedType, error)

ParseResponseEnvelope returns a parsed SOAP response envelope.

type OdpovedVarovaniType

type OdpovedVarovaniType struct {
	Zprava   string `xml:",chardata"`
	Kodvarov int    `xml:"kod_varov,attr"`
}

type PkpCipherType

type PkpCipherType string

May be one of RSA2048

type PkpDigestType

type PkpDigestType string

May be one of SHA256

type PkpElementType

type PkpElementType struct {
	PkpType  PkpType         `xml:",chardata"`
	Digest   PkpDigestType   `xml:"digest,attr"`
	Cipher   PkpCipherType   `xml:"cipher,attr"`
	Encoding PkpEncodingType `xml:"encoding,attr"`
}

type PkpEncodingType

type PkpEncodingType string

May be one of base64

type PkpType

type PkpType []byte

func (PkpType) MarshalText

func (t PkpType) MarshalText() ([]byte, error)

func (*PkpType) UnmarshalText

func (t *PkpType) UnmarshalText(text []byte) error

type RezimType

type RezimType int

May be one of 0, 1

type String20

type String20 string

Must match the pattern [0-9a-zA-Z\.,:;/#\-_ ]{1,20}

type String25

type String25 string

Must match the pattern [0-9a-zA-Z\.,:;/#\-_ ]{1,25}

type TrzbaDataType

type TrzbaDataType struct {
	Dicpopl         CZDICType  `xml:"dic_popl,attr"`
	Dicpoverujiciho CZDICType  `xml:"dic_poverujiciho,attr,omitempty"`
	Idprovoz        int        `xml:"id_provoz,attr"`
	Idpokl          String20   `xml:"id_pokl,attr"`
	Poradcis        String25   `xml:"porad_cis,attr"`
	Dattrzby        DateTime   `xml:"dat_trzby,attr"`
	Celktrzba       CastkaType `xml:"celk_trzba,attr"`
	Zaklnepodldph   CastkaType `xml:"zakl_nepodl_dph,attr,omitempty"`
	Zakldan1        CastkaType `xml:"zakl_dan1,attr,omitempty"`
	Dan1            CastkaType `xml:"dan1,attr,omitempty"`
	Zakldan2        CastkaType `xml:"zakl_dan2,attr,omitempty"`
	Dan2            CastkaType `xml:"dan2,attr,omitempty"`
	Zakldan3        CastkaType `xml:"zakl_dan3,attr,omitempty"`
	Dan3            CastkaType `xml:"dan3,attr,omitempty"`
	Cestsluz        CastkaType `xml:"cest_sluz,attr,omitempty"`
	Pouzitzboz1     CastkaType `xml:"pouzit_zboz1,attr,omitempty"`
	Pouzitzboz2     CastkaType `xml:"pouzit_zboz2,attr,omitempty"`
	Pouzitzboz3     CastkaType `xml:"pouzit_zboz3,attr,omitempty"`
	Urcenocerpzuct  CastkaType `xml:"urceno_cerp_zuct,attr,omitempty"`
	Cerpzuct        CastkaType `xml:"cerp_zuct,attr,omitempty"`
	Rezim           RezimType  `xml:"rezim,attr"`
}

type TrzbaHlavickaType

type TrzbaHlavickaType struct {
	Uuidzpravy   UUIDType `xml:"uuid_zpravy,attr"`
	Datodesl     DateTime `xml:"dat_odesl,attr"`
	Prvnizaslani bool     `xml:"prvni_zaslani,attr"`
	Overeni      bool     `xml:"overeni,attr,omitempty"`
}

type TrzbaKontrolniKodyType

type TrzbaKontrolniKodyType struct {
	Pkp PkpElementType `xml:"pkp"`
	Bkp BkpElementType `xml:"bkp"`
}

type TrzbaType

type TrzbaType struct {
	Hlavicka      TrzbaHlavickaType      `xml:"Hlavicka"`
	Data          TrzbaDataType          `xml:"Data"`
	KontrolniKody TrzbaKontrolniKodyType `xml:"KontrolniKody"`
}

type UUIDType

type UUIDType string

Must match the pattern [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}

Jump to

Keyboard shortcuts

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