viesapi

package module
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

VIES API Client for Go

Go Report Card Release Go Reference GitHub go.mod Go version License

This is the unofficial repository for VIES API Client for Go: https://viesapi.eu

Viesapi.eu service provides selected entrepreneurs data using i.a. web services, programming libraries and dedicated applications. By using the available software (libraries, applications and Excel add-in) your customers will be able to:

  • check contractors EU VAT number status in VIES system,
  • download company details from VIES system,
  • automatic fill in the invoice forms,

in the fastest possible way.

Documentation

The documentation and samples are available at https://viesapi.eu/docs/

Go modules

If your application uses Go modules for dependency management (recommended), add an import for each service that you use in your application.

Example:

import (
  "github.com/glaydus/viesapi"
)

Next, run go build or go mod tidy to download and install the new dependencies and update your application's go.mod file.

go get command

Alternatively, you can use the go get command to download and install the appropriate packages that your application uses:

go get -u github.com/glaydus/viesapi

License

This project is delivered under the Apache 2.0 license. You can find the license's full text in LICENSE.

Documentation

Index

Constants

View Source
const (
	NIP_EMPTY = iota + 1
	NIP_UNKNOWN
	GUS_LOGIN
	GUS_CAPTCHA
	GUS_SYNC
	NIP_UPDATE
	NIP_BAD
	CONTENT_SYNTAX
	NIP_NOT_ACTIVE
	INVALID_PATH
	EXCEPTION
	NO_PERMISSION
	GEN_INVOICES
	GEN_SPEC_INV
	SEND_INVOICE
	PREMIUM_FEATURE
	SEND_ANNOUNCEMENT
	INVOICE_PAYMENT
	REGON_BAD
	SEARCH_KEY_EMPTY
	KRS_BAD
	EUVAT_BAD
	VIES_SYNC
	CEIDG_SYNC
	RANDOM_NUMBER
	PLAN_FEATURE
	SEARCH_TYPE
	PPUMF_SYNC
	PPUMF_DIRECT
	NIP_FEATURE
	REGON_FEATURE
	KRS_FEATURE
	TEST_MODE
	ACTIVITY_CHECK
	ACCESS_DENIED
	MAINTENANCE
	BILLING_PLANS
	DOCUMENT_PDF
	EXPORT_PDF
	RANDOM_TYPE
	LEGAL_FORM
	GROUP_CHECKS
	CLIENT_COUNTERS
	URE_SYNC
	URE_DATA
	DKN_BAD
	SEND_REMAINDER
	EXPORT_JPK
	GEN_ORDER_INV
	SEND_EXPIRATION
	IBAN_SYNC
	ORDER_CANCEL
	WHITELIST_CHECK
	AUTH_TIMESTAMP
	AUTH_MAC
	IBAN_BAD
)
View Source
const (
	DB_AUTH_IP = iota + 101
	DB_AUTH_KEY_STATUS
	DB_AUTH_KEY_VALUE
	DB_AUTH_OVER_PLAN
	DB_CLIENT_LOCKED
	DB_CLIENT_TYPE
	DB_CLIENT_NOT_PAID
	DB_AUTH_KEYID_VALUE
)
View Source
const (
	CLI_CONNECT = iota + 201
	CLI_RESPONSE
	CLI_NUMBER
	CLI_NIP
	CLI_REGON
	CLI_KRS
	CLI_EUVAT
	CLI_IBAN
	CLI_EXCEPTION
	CLI_DATEFORMAT
	CLI_INPUT
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountStatus

type AccountStatus struct {
	UID               string     `json:"uid" xml:"uid"`
	Type              string     `json:"type" xml:"type"`
	ValidTo           *time.Time `json:"valid_to" xml:"validTo"` // nil if not set
	BillingPlanName   string     `json:"billing_plan_name" xml:"billingPlanName"`
	SubscriptionPrice float64    `json:"subscription_price" xml:"subscriptionPrice"`
	ItemPrice         float64    `json:"item_price" xml:"itemPrice"`
	ItemPriceStatus   float64    `json:"item_price_status" xml:"itemPriceCheckStatus"`
	Limit             int        `json:"limit" xml:"limit"`
	RequestDelay      int        `json:"request_delay" xml:"requestDelay"`
	DomainLimit       int        `json:"domain_limit" xml:"domainLimit"`
	OverPlanAllowed   bool       `json:"over_plan_allowed" xml:"overplanAllowed"`
	ExcelAddIn        bool       `json:"excel_add_in" xml:"excelAddin"`
	App               bool       `json:"app" xml:"app"`
	CLI               bool       `json:"cli" xml:"cli"`
	Stats             bool       `json:"stats" xml:"stats"`
	Monitor           bool       `json:"monitor" xml:"monitor"`
	FuncGetVIESData   bool       `json:"func_get_vies_data" xml:"funcGetVIESData"`
	VIESDataCount     int        `json:"vies_data_count" xml:"viesDataCount"`
	TotalCount        int        `json:"total_count" xml:"totalCount"`
}

func (*AccountStatus) String

func (a *AccountStatus) String() string

Return account status as string

type EUVAT

type EUVAT struct{}

EU VAT number verificator

type Error

type Error struct{}

VIES API error codes

type NIP

type NIP struct{}

NIP number validator

type VIESClient

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

func NewVIESClient

func NewVIESClient(id, key string) *VIESClient

Create new VIESClient instance with specified id and key or use test credentials

func (*VIESClient) GetAccountStatus

func (c *VIESClient) GetAccountStatus() (*AccountStatus, *ViesError)

Get current account status GetAccountStatus returns account status or nil in case of error

func (*VIESClient) GetLastError

func (c *VIESClient) GetLastError() (int, string)

Get last error message

func (*VIESClient) GetVIESData

func (c *VIESClient) GetVIESData(euvat string) (*VIESData, *ViesError)

Get VIES data for specified number from EU VIES system GetVIESData returns VIES data or nil in case of error

func (*VIESClient) SetUrl

func (c *VIESClient) SetUrl(url string)

Set non default service URL

type VIESData

type VIESData struct {
	UID               string `json:"uid" xml:"uid"`
	CountryCode       string `json:"country_code" xml:"countryCode"`
	VATNumber         string `json:"vat_number" xml:"vatNumber"`
	Valid             bool   `json:"valid" xml:"valid"`
	TraderName        string `json:"trader_name" xml:"traderName"`
	TraderCompanyType string `json:"trader_company_type" xml:"traderCompanyType"`
	TraderAddress     string `json:"trader_address" xml:"traderAddress"`
	ID                string `json:"id" xml:"id"`
	Date              string `json:"date" xml:"date"`
	Source            string `json:"source" xml:"source"`
}

func (*VIESData) String

func (v *VIESData) String() string

Return VIES data as string

type ViesError

type ViesError struct {
	Code        int    `json:"code" xml:"code"`
	Description string `json:"description" xml:"description"`
}

func (*ViesError) Error

func (e *ViesError) Error() string

Return last code and description of error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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