merit

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API_HOST

type API_HOST string
const (
	API_HOST_EST API_HOST = "aktiva.merit.ee"
	API_HOST_FIN API_HOST = "aktiva.meritaktiva.fi"
)

type Article

type Article struct {
	ItemCode         string  `json:"ItemCode"`
	EANCode          string  `json:"EANCode"`
	ItemName         string  `json:"ItemName"`
	LocName          string  `json:"LocName"`
	Quantity         float64 `json:"Quantity"`
	ReservedQuantity float64 `json:"ReservedQuantity"`
	UnitCode         string  `json:"UnitCode"`
	Amount           float64 `json:"Amount"`
	Price            float64 `json:"Price"`
}

type Client

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

func NewClient

func NewClient(apiID, apiKey string, apiHost API_HOST, logger *zap.Logger) *Client

func (*Client) CreateInvoiceFromOffer added in v0.3.0

func (c *Client) CreateInvoiceFromOffer(query CreateInvoiceFromOfferQuery) (*CreateInvoiceFromOfferResponse, error)

CreateInvoiceFromOffer creates a sales invoice from an existing offer.

func (*Client) CreateSalesOffer

func (c *Client) CreateSalesOffer(query CreateSalesOfferQuery) (*CreateSalesOfferResponse, error)

func (*Client) GetCustomers

func (c *Client) GetCustomers(query GetCustomersQuery) ([]Customer, error)

func (*Client) GetDimensions

func (c *Client) GetDimensions(query Dimension) ([]Dimension, error)

func (*Client) GetInventoryMovements

func (c *Client) GetInventoryMovements(query GetInventoryMovementsQuery) ([]InventoryMovement, error)

func (*Client) GetInventoryReport

func (c *Client) GetInventoryReport(query GetInventoryReportQuery) ([]Article, error)

func (*Client) GetItemGroups

func (c *Client) GetItemGroups() ([]ItemGroup, error)

func (*Client) GetItems

func (c *Client) GetItems(query GetItemsQuery) ([]Item, error)

func (*Client) GetListOfLocations

func (c *Client) GetListOfLocations() ([]Location, error)

func (*Client) GetPurchaseReportByArticle

func (c *Client) GetPurchaseReportByArticle(query GetPurchaseReportQuery) ([]PurchaseReportByArticle, error)

func (*Client) GetPurchaseReportByFixedAsset

func (c *Client) GetPurchaseReportByFixedAsset(query GetPurchaseReportQuery) ([]PurchaseReportByFixedAsset, error)

func (*Client) GetPurchaseReportByInvoice

func (c *Client) GetPurchaseReportByInvoice(query GetPurchaseReportQuery) ([]PurchaseReportByInvoice, error)

func (*Client) GetPurchaseReportByVendor

func (c *Client) GetPurchaseReportByVendor(query GetPurchaseReportQuery) ([]PurchaseReportByVendor, error)

func (*Client) GetSalesOffers

func (c *Client) GetSalesOffers(query GetSalesOffersQuery) ([]SalesOffer, error)

func (*Client) GetTaxes

func (c *Client) GetTaxes(query *Tax) ([]Tax, error)

func (*Client) GetUnitsOfMeasure

func (c *Client) GetUnitsOfMeasure() ([]UnitOfMeasure, error)

func (*Client) SendInvoiceAsEInv added in v0.3.0

func (c *Client) SendInvoiceAsEInv(query SendInvoiceAsEInvQuery) (bool, error)

SendInvoiceAsEInv sends a sales invoice as an e-invoice via Merit Aktiva. Returns (true, nil) on success, including when Merit sends without operator routing ("api-noeinv"). Returns (true, nil) when the invoice was already sent as an e-invoice (idempotent, HTTP 400). Returns (false, err) on transport or unexpected response errors.

func (*Client) SendItems added in v0.2.1

func (c *Client) SendItems(query SendItemsQuery) ([]SendItemResult, error)

SendItems creates or updates inventory items in Merit.

func (*Client) SetOfferStatus added in v0.2.1

func (c *Client) SetOfferStatus(query SetOfferStatusQuery) error

SetOfferStatus changes the status of an existing sales offer.

type CommentsObject

type CommentsObject struct {
	CommDate string `json:"CommDate"`
	Comment  string `json:"Comment"`
}

type CostDimension

type CostDimension struct {
	HeaderID    string  `json:"HeaderId"`
	LineID      string  `json:"LineId"`
	DimID       int     `json:"DimId"`
	Code        string  `json:"Code"`
	AllocPct    float64 `json:"AllocPct"`
	AllocAmount float64 `json:"AllocAmount"`
}

type CreateInvoiceFromOfferQuery added in v0.3.0

type CreateInvoiceFromOfferQuery struct {
	ID string `json:"Id"`
}

CreateInvoiceFromOfferQuery is the request payload for the v2/offer2inv endpoint.

type CreateInvoiceFromOfferResponse added in v0.3.0

type CreateInvoiceFromOfferResponse struct {
	CustomerID  guid.GUID `json:"CustomerId"`
	InvoiceID   guid.GUID `json:"InvoiceId"`
	InvoiceNo   string    `json:"InvoiceNo"`
	RefNo       string    `json:"RefNo"`
	NewCustomer bool      `json:"NewCustomer"`
}

CreateInvoiceFromOfferResponse is the response from the v2/offer2inv endpoint.

type CreateSalesOfferQuery

type CreateSalesOfferQuery struct {
	Customer       CustomerObject // CustomerObject
	DocDate        time.Time
	ExpireDate     time.Time // if DocType 2 or 3, ExpireDate=DueDate
	DeliveryDate   time.Time
	OfferNo        string      `json:"OfferNo"`            // Required
	DocType        OfferType   `json:"DocType,omitzero"`   // 1=quote, 2=sales order, 3=prepayment invoice
	DocStatus      OfferStatus `json:"DocStatus,omitzero"` // 1=created, 2=sent, 3=approved, 4=rejected, 5=comment received, 6=invoice created, 7=canceled
	RefNo          string      `json:"RefNo,omitempty"`    // Please validate this number yourself.
	CurrencyCode   string      `json:"CurrencyCode,omitempty"`
	DepartmentCode string      `json:"DepartmentCode,omitempty"` // If used then must be found in the company database.
	Dimensions     []DimensionsObject
	OfferRow       []OfferRow
	TotalAmount    *decimal.Decimal `json:"TotalAmount,omitempty"`    // Amount without VAT
	RoundingAmount *decimal.Decimal `json:"RoundingAmount,omitempty"` // Use it for getting PDF invoice to round number. Does not affect TotalAmount.
	TaxAmount      []TaxObject      // Required
	Payment        *OfferPayment    `json:"Payment,omitempty"`
	HeaderComment  string           `json:"Hcomment,omitempty"`     // If not specified, API will get it from client record, if it is written there.
	FooterComment  string           `json:"Fcomment,omitempty"`     // If not specified, API will get it from client record, if it is written there.
	ReserveItems   bool             `json:"ReserveItems,omitempty"` // If true, then stock items will be reserved.
	PrepaymPct     *decimal.Decimal `json:"PrepaymPct,omitempty"`   // Prepayment percentage. Required for prepayment invoices.
	Payer          *PayerObject     `json:"Payer,omitempty"`
}

type CreateSalesOfferQueryFormated

type CreateSalesOfferQueryFormated struct {
	CreateSalesOfferQuery
	DocDate      queryDate `json:"DocDate,omitzero"`
	ExpireDate   queryDate `json:"ExpireDate,omitzero"`
	DeliveryDate queryDate `json:"DeliveryDate,omitzero"`
}

type CreateSalesOfferResponse

type CreateSalesOfferResponse struct {
	CustomerID  guid.GUID `json:"CustomerId"`
	InvoiceID   guid.GUID `json:"InvoiceId"`
	InvoiceNo   string    `json:"InvoiceNo"`
	RefNo       string    `json:"RefNo"`
	NewCustomer bool      `json:"NewCustomer"`
}

type Customer

type Customer struct {
	ID                guid.GUID          `json:"CustomerId"`
	Name              string             `json:"Name"`
	RegNo             string             `json:"RegNo"`
	Contact           string             `json:"Contact"`
	PhoneNo           string             `json:"PhoneNo"`
	Address           string             `json:"Address"`
	City              string             `json:"City"`
	Email             string             `json:"Email"`
	CurrencyCode      string             `json:"CurrencyCode"`
	CustomerGroupId   string             `json:"CustomerGroupId"`
	CustomerGroupName string             `json:"CustomerGroupName"`
	PostalCode        string             `json:"PostalCode"`
	CountryName       string             `json:"CountryName"`
	CountryCode       string             `json:"CountryCode"`
	County            string             `json:"County"`
	PhoneNo2          string             `json:"PhoneNo2"`
	FaxNo             string             `json:"FaxNo"`
	HomePage          string             `json:"HomePage"`
	PaymentDeadLine   int                `json:"PaymentDeadLine"`
	OverdueCharge     decimal.Decimal    `json:"OverdueCharge"`
	VatRegNo          string             `json:"VatRegNo"`
	NotTDCustomer     bool               `json:"NotTDCustomer"`
	BankName          string             `json:"BankName"`
	BankAccount       string             `json:"BankAccount"`
	SalesInvLang      string             `json:"SalesInvLang"`
	RefNoBase         string             `json:"RefNoBase"`
	Comments          []CommentsObject   `json:"Comments"`
	Dimensions        []DimensionsObject `json:"Dimensions"`
	ChangedDate       string             `json:"ChangedDate"`
}

type CustomerObject

type CustomerObject struct {
	ID              guid.GUID        `json:"Id,omitempty"`   // If filled and customer is found in the database then following fields are not important. If not found, the customer is added using the following fields.
	Name            string           `json:"Name,omitempty"` // Required when customer is added
	RegNo           string           `json:"RegNo,omitempty"`
	NotTDCustomer   bool             `json:"NotTDCustomer,omitempty"` // Required when customer is added. EE True for physical persons and foreign companies. PL True for physical persons. Allowed “true” or “false” (lowercase).
	VatRegNo        string           `json:"VatRegNo,omitempty"`
	CurrencyCode    string           `json:"CurrencyCode,omitempty"`
	PaymentDeadLine int              `json:"PaymentDeadLine,omitzero"` // If missing then taken from default settings.
	OverDueCharge   *decimal.Decimal `json:"OverDueCharge,omitempty"`  // If missing then taken from default settings.
	Address         string           `json:"Address,omitempty"`
	City            string           `json:"City,omitempty"`
	County          string           `json:"County,omitempty"`
	PostalCode      string           `json:"PostalCode,omitempty"`
	CountryCode     string           `json:"CountryCode,omitempty"` // Required when adding
	PhoneNo         string           `json:"PhoneNo,omitempty"`
	PhoneNo2        string           `json:"PhoneNo2,omitempty"`
	HomePage        string           `json:"HomePage,omitempty"`
	Email           string           `json:"Email,omitempty"`
	SalesInvLang    string           `json:"SalesInvLang,omitempty"` // Invoice language for this specific customer.(ET,EN,RU,FI,PL,SV)
	GLNCode         string           `json:"GLNCode,omitempty"`
	PartyCode       string           `json:"PartyCode,omitempty"`
	RefNoBase       string           `json:"RefNoBase,omitempty"`
	EInvPaymId      string           `json:"EInvPaymId,omitempty"`
	EInvOperator    int              `json:"EInvOperator,omitzero"` // 1 - Not exist, 2 - E-invoices to the bank through Omniva, 3 - Bank ( full extent E-invoice), 4- Bank (limited extent E-invoice)
	BankAccount     string           `json:"BankAccount,omitempty"`
}

type Dimension

type Dimension struct {
	DimID   int       `json:"DimId"`
	DimName string    `json:"DimName"`
	ID      guid.GUID `json:"Id"`
	Code    string    `json:"Code"`
	Name    string    `json:"Name"`
	EndDate string    `json:"EndDate"`
}

type DimensionsObject

type DimensionsObject struct {
	DimID      int       `json:"DimId"`
	DimValueId guid.GUID `json:"DimValueId"`
	DimCode    string    `json:"DimCode"`
}

type ErrInvalidVendorChoice

type ErrInvalidVendorChoice struct {
	Choice int
}

func (ErrInvalidVendorChoice) Error

func (e ErrInvalidVendorChoice) Error() string

type GetCustomersQuery

type GetCustomersQuery struct {
	ID           string `json:"Id,omitempty"`       // If filled, next fields will be ignored
	RegNo        string `json:"RegNo,omitempty"`    // Exact match.
	VatRegNo     string `json:"VatRegNo,omitempty"` // Exact match.
	Name         string `json:"Name,omitempty"`     // Broad match.
	WithComments bool   `json:"WithComments"`
	CommentsFrom string `json:"CommentsFrom,omitempty"`
	ChangedDate  string `json:"ChangedDate,omitempty"`
}

type GetInventoryMovementsQuery

type GetInventoryMovementsQuery struct {
	PeriodStart time.Time `json:"PeriodStart,omitempty"`
	PeriodEnd   time.Time `json:"PeriodEnd,omitempty"`
	WithLines   bool      `json:"WithLines,omitempty"`
	ChangedDate int       `json:"ChangedDate,omitempty"`
}

type GetInventoryReportQuery

type GetInventoryReportQuery struct {
	ArticleGroups    []string  `json:"ArticleGroups,omitempty"`
	Location         string    `json:"Location,omitempty"`
	RepDate          time.Time `json:"RepDate,omitempty"`
	ShowZero         bool      `json:"ShowZero,omitempty"`
	WithReservations bool      `json:"WithReservations,omitempty"`
}

type GetItemsQuery

type GetItemsQuery struct {
	ID           string `json:"Id,omitempty"`
	Code         string `json:"Code,omitempty"`
	Description  string `json:"Description,omitempty"`
	LocationCode string `json:"LocationCode,omitempty"`
}

type GetPurchaseReportQuery

type GetPurchaseReportQuery struct {
	StartDate      time.Time // Start date of the report
	EndDate        time.Time // End date of the report
	VendChoice     int       // Vendor choice: 1-Vendor and Reporting entry, 2-Vendor, 3-Reporting entry
	VendGrpFilter  string    // Vendor group filter
	VendFilter     string    // Vendor filter
	ItemGrFilter   string    // Item group filter
	ItemFilter     []string  // Array of items filter
	DepartFilter   []string  // Array of departments filter
	FixAssetFilter []string  // Array of Fixed assets filter
	ByEntryNo      bool      // Flag to include entry number in the report
}

GetPurchaseReportQuery represents the query parameters for retrieving purchase reports.

type GetSalesOffersQuery

type GetSalesOffersQuery struct {
	PeriodStart time.Time `json:"PeriodStart,omitempty"`
	PeriodEnd   time.Time `json:"PeriodEnd,omitempty"`
	DateType    int       `json:"DateType,omitempty"`
	UnPaid      bool      `json:"UnPaid,omitempty"`
}

type InventoryMovement

type InventoryMovement struct {
	DocumentID     string             `json:"DocumentId"`
	DocDate        string             `json:"DocDate"`
	DocNo          string             `json:"DocNo"`
	Location1Code  string             `json:"Location1Code"`
	Location2Code  string             `json:"Location2Code"`
	DepartmentCode string             `json:"DepartmentCode"`
	Type           int                `json:"Type"`
	Comment        string             `json:"Comment"`
	Dimensions     []DimensionsObject `json:"Dimensions"`
	Rows           []Row              `json:"Rows"`
	ChangedDate    string             `json:"ChangedDate"`
}

type Item

type Item struct {
	ID                   guid.GUID       `json:"ItemId"`
	Code                 string          `json:"Code"`
	Name                 string          `json:"Name"`
	UnitofMeasureName    string          `json:"UnitofMeasureName"`
	Type                 string          `json:"Type"`
	SalesPrice           decimal.Decimal `json:"SalesPrice"`
	InventoryQty         decimal.Decimal `json:"InventoryQty"`
	ReservedQty          decimal.Decimal `json:"ReservedQty"`
	VatTaxName           string          `json:"VatTaxName"`
	Usage                string          `json:"Usage"`
	SalesAccountCode     string          `json:"SalesAccountCode"`
	PurchaseAccountCode  string          `json:"PurchaseAccountCode"`
	InventoryAccountCode string          `json:"InventoryAccountCode"`
	ItemCostAccountCode  string          `json:"ItemCostAccountCode"`
	DiscountPct          decimal.Decimal `json:"DiscountPct"`
	LastPurchasePrice    decimal.Decimal `json:"LastPurchasePrice"`
	ItemUnitCost         decimal.Decimal `json:"ItemUnitCost"`
	InventoryCost        decimal.Decimal `json:"InventoryCost"`
	ItemGroupName        string          `json:"ItemGroupName"`
	DefLocName           string          `json:"DefLoc_Name"`
	EANCode              string          `json:"EANCode"`
}

type ItemGroup

type ItemGroup struct {
	Code string `json:"Code"`
	Name string `json:"Name"`
	ID   string `json:"Id"`
}

type ItemObject

type ItemObject struct {
	Code            string   `json:"Code"`                      // Required
	Description     string   `json:"Description"`               // Required
	Type            ItemType `json:"Type,omitzero"`             // 1 = stock item, 2 = service, 3 = item. Required.
	UOMName         string   `json:"UOMName,omitempty"`         //
	DefLocationCode string   `json:"DefLocationCode,omitempty"` //
	EANCode         string   `json:"EANCode,omitempty"`         //
}

type ItemType

type ItemType int
const (
	ItemTypeStock ItemType = iota + 1
	ItemTypeService
	ItemTypeItem
)

type ItemUsage added in v0.2.1

type ItemUsage int

ItemUsage describes whether an item is used for sales, purchases, or both.

const (
	ItemUsageSales             ItemUsage = 1
	ItemUsagePurchases         ItemUsage = 2
	ItemUsageSalesAndPurchases ItemUsage = 3
)

type Location

type Location struct {
	CompanyID     int    `json:"CompanyId"`
	LocationID    string `json:"LocationId"`
	Code          string `json:"Code"`
	Name          string `json:"Name"`
	InBPrefix     string `json:"InBPrefix"`
	InBNextNo     int    `json:"InBNextNo"`
	OutBPrefix    string `json:"OutBPrefix"`
	OutBNextNo    int    `json:"OutBNextNo"`
	Loc2LocPrefix string `json:"Loc2LocPrefix"`
	Loc2LocNextNo int    `json:"Loc2LocNextNo"`
	InvSetPrefix  string `json:"InvSetPrefix"`
	InvSetNextNo  int    `json:"InvSetNextNo"`
}

type OfferPayment

type OfferPayment struct {
	PaymentMethod string          `json:"PaymentMethod"` // Name of the payment method. Must be found in the company database.
	PaidAmount    decimal.Decimal `json:"PaidAmount"`    // Amount with VAT (not more) or less if partial payment
	PaymDate      string          `json:"PaymDate"`      // YYYYmmddHHii
}

type OfferRow

type OfferRow struct {
	Item           ItemObject       `json:"Item"` // Sometimes the volume of transactions in the sales software is very high and there is no need to duplicate all the data in accounting. In those cases, you could consider using the same item code for the items with the same VAT rate.
	Quantity       decimal.Decimal  `json:"Quantity"`
	Price          decimal.Decimal  `json:"Price"`
	DiscountPct    *decimal.Decimal `json:"DiscountPct,omitempty"`
	DiscountAmount *decimal.Decimal `json:"DiscountAmount,omitempty"` // Amount * Price * (DiscountPCt / 100). This is not rounded. Will be substracted from row amount before row roundings.
	TaxId          string           `json:"TaxId,omitempty"`
	LocationCode   string           `json:"LocationCode,omitempty"`   // Used for stock items and multiple stocks. If used then must be found in the company database.
	DepartmentCode string           `json:"DepartmentCode,omitempty"` // If used then must be found in the company database.
	ItemCostAmount *decimal.Decimal `json:"ItemCostAmount,omitempty"` // Required for credit invoices when crediting stock items.
	GLAccountCode  string           `json:"GLAccountCode,omitempty"`  // If used, must be found in the company database.
	ProjectCode    string           `json:"ProjectCode,omitempty"`    // If used, must be found in the company database.
	CostCenterCode string           `json:"CostCenterCode,omitempty"` // If used, must be found in the company database.
}

type OfferStatus

type OfferStatus int
const (
	OfferStatusCreated OfferStatus = iota + 1
	OfferStatusSent
	OfferStatusApproved
	OfferStatusRejected
	OfferStatusCommentReceived
	OfferStatusInvoiceCreated
	OfferStatusCanceled
)

func (OfferStatus) String

func (s OfferStatus) String() string

type OfferType

type OfferType int
const (
	OfferTypeQuote OfferType = iota + 1
	OfferTypeSalesOrder
	OfferTypePrepaymentInvoice
)

type PayerObject

type PayerObject struct{}

type PurchaseReportByArticle

type PurchaseReportByArticle struct {
	ItemId       string          `json:"itemId"`
	ItemCode     string          `json:"itemCode"`
	ItemName     string          `json:"itemName"`
	ItemGrId     string          `json:"itemGrId"`
	ItemGrName   string          `json:"itemGrName"`
	CurrencyCode string          `json:"currencyCode"`
	Unit         string          `json:"unit"`
	Quantity     decimal.Decimal `json:"quantity"`
	Price        decimal.Decimal `json:"price"`
	Amount       decimal.Decimal `json:"amount"`
	UomID1       string          `json:"uomId1"`
	UomID2       string          `json:"uomId2"`
}

type PurchaseReportByFixedAsset

type PurchaseReportByFixedAsset struct {
	DocId        string          `json:"docId"`
	FaId         string          `json:"faId"`
	InventaryNo  string          `json:"inventaryNo"`
	Name         string          `json:"name"`
	CurrencyCode string          `json:"currencyCode"`
	Quantity     decimal.Decimal `json:"quantity"`
	Price        decimal.Decimal `json:"price"`
	Amount       decimal.Decimal `json:"amount"`
	RemAmount    decimal.Decimal `json:"remAmount"`
	DocNo        string          `json:"docNo"`
	DocDate      string          `json:"docDate"`
}

type PurchaseReportByInvoice

type PurchaseReportByInvoice struct {
	DocId          string          `json:"docId"`
	InvoiceNo      string          `json:"invoiceNo"`
	CurrencyCode   string          `json:"currencyCode"`
	CurrencyRate   decimal.Decimal `json:"currencyRate"`
	VendorId       string          `json:"vendorId"`
	VendorName     string          `json:"vendorName"`
	RegNo          string          `json:"regNo"`
	VatRegNo       string          `json:"vatRegNo"`
	InvoiceDate    string          `json:"invoiceDate"`
	Amount         decimal.Decimal `json:"amount"`
	VatAmount      decimal.Decimal `json:"vatAmount"`
	RoundingAmount decimal.Decimal `json:"roundingAmount"`
	TotalAmount    decimal.Decimal `json:"totalAmount"`
	ExpenseClaim   bool            `json:"expenseClaim"`
	BatchId        string          `json:"batchId"`
	BatchCode      string          `json:"batchCode"`
	BatchNo        int             `json:"batchNo"`
	Ctry           string          `json:"ctry"`
}

type PurchaseReportByVendor

type PurchaseReportByVendor struct {
	CustomerId      string          `json:"customerId"`
	CurrencyCode    string          `json:"currencyCode"`
	VendorName      string          `json:"vendorName"`
	RegNo           string          `json:"regNo"`
	VatRegNo        string          `json:"vatRegNo"`
	Amount          decimal.Decimal `json:"amount"`
	CAmount         decimal.Decimal `json:"cAmount"`
	VatAmount       decimal.Decimal `json:"vatAmount"`
	RoundingAmount  decimal.Decimal `json:"roundingAmount"`
	TotalAmount     decimal.Decimal `json:"totalAmount"`
	CVatAmount      decimal.Decimal `json:"cVatAmount"`
	CRoundingAmount decimal.Decimal `json:"cRoundingAmount"`
	CTotalAmount    decimal.Decimal `json:"cTotalAmount"`
	LnCnt           decimal.Decimal `json:"lnCnt"`
	DiscAmt         decimal.Decimal `json:"discAmt"`
	CDiscAmt        decimal.Decimal `json:"cDiscAmt"`
}

type Row

type Row struct {
	HeaderID      string          `json:"HeaderId"`
	LineID        string          `json:"LineId"`
	ArticleCode   string          `json:"ArticleCode"`
	UOMName       string          `json:"UOMName"`
	Quantity      float64         `json:"Quantity"`
	Amount        float64         `json:"Amount"`
	Dimensions    []CostDimension `json:"Dimensions"`
	GLAccountCode string          `json:"GLAccountCode"`
}

type SalesOffer

type SalesOffer struct {
	ID              string          `json:"SIHId"`
	DepartmentName  string          `json:"DepartmentName"`
	Dimension1Code  string          `json:"Dimension1Code"`
	Dimension2Code  string          `json:"Dimension2Code"`
	Dimension3Code  string          `json:"Dimension3Code"`
	Dimension4Code  string          `json:"Dimension4Code"`
	Dimension5Code  string          `json:"Dimension5Code"`
	Dimension6Code  string          `json:"Dimension6Code"`
	Dimension7Code  string          `json:"Dimension7Code"`
	BatchInfo       string          `json:"BatchInfo"`
	OfferNo         string          `json:"OfferNo"`
	DocumentDate    string          `json:"DocumentDate"`
	TransactionDate string          `json:"TransactionDate"`
	CustomerId      string          `json:"CustomerId"`
	CustomerName    string          `json:"CustomerName"`
	HComment        string          `json:"HComment"`
	FComment        string          `json:"FComment"`
	DueDate         string          `json:"DueDate"`
	CurrencyCode    string          `json:"CurrencyCode"`
	CurrencyRate    decimal.Decimal `json:"CurrencyRate"`
	TaxAmount       decimal.Decimal `json:"TaxAmount"`
	RoundingAmount  decimal.Decimal `json:"RoundingAmount"`
	TotalAmount     decimal.Decimal `json:"TotalAmount"`
	ProfitAmount    decimal.Decimal `json:"ProfitAmount"`
	TotalSum        decimal.Decimal `json:"TotalSum"`
	UserName        string          `json:"UserName"`
	ReferenceNo     string          `json:"ReferenceNo"`
	PriceInclVat    bool            `json:"PriceInclVat"`
	VatRegNo        string          `json:"VatRegNo"`
	PaidAmount      decimal.Decimal `json:"PaidAmount"`
	EInvSent        bool            `json:"EInvSent"`
	EmailSent       string          `json:"EmailSent"`
	DocType         OfferType       `json:"DocType"`
	DocStatus       OfferStatus     `json:"DocStatus"`
	DeliveryDate    string          `json:"DeliveryDate"`
	Paid            bool            `json:"Paid"`
	ChangedDate     string          `json:"ChangedDate"`
}

type SendInvoiceAsEInvQuery added in v0.3.0

type SendInvoiceAsEInvQuery struct {
	ID        string `json:"Id"`        // SIHId GUID of the sales invoice
	DelivNote bool   `json:"DelivNote"` // true = delivery note format (omits prices)
}

SendInvoiceAsEInvQuery is the request payload for v2/sendinvoiceaseinv.

type SendItemObject added in v0.2.1

type SendItemObject struct {
	Type             ItemType  `json:"Type"`        // Required. 1=stock item, 2=service, 3=item.
	Usage            ItemUsage `json:"Usage"`       // Required. 1=sales, 2=purchases, 3=both.
	Code             string    `json:"Code"`        // Required. Max 20 chars.
	Description      string    `json:"Description"` // Required. Max 100 chars.
	EANCode          string    `json:"EANCode,omitempty"`
	UOMName          string    `json:"UOMName,omitempty"`         // Required for stock items.
	DefLocationCode  string    `json:"DefLocationCode,omitempty"` // Required if multiple stocks.
	DescriptionEN    string    `json:"DescriptionEN,omitempty"`
	DescriptionRU    string    `json:"DescriptionRU,omitempty"`
	DescriptionFI    string    `json:"DescriptionFI,omitempty"`
	TaxId            guid.GUID `json:"TaxId,omitempty"`
	ItemGrCode       string    `json:"ItemGrCode,omitempty"`
	SalesAccCode     string    `json:"SalesAccCode,omitempty"`
	PurchaseAccCode  string    `json:"PurchaseAccCode,omitempty"`
	InventoryAccCode string    `json:"InventoryAccCode,omitempty"`
	CostAccCode      string    `json:"CostAccCode,omitempty"`
}

SendItemObject is the payload for a single item in a SendItems request.

type SendItemResult added in v0.2.1

type SendItemResult struct {
	ItemId guid.GUID `json:"ItemId"`
	Code   string    `json:"Code"`
}

SendItemResult is the per-item response from the v2/senditems endpoint.

type SendItemsQuery added in v0.2.1

type SendItemsQuery struct {
	Items []SendItemObject `json:"Items"`
}

SendItemsQuery is the request payload for the v2/senditems endpoint.

type SetOfferStatusQuery added in v0.2.1

type SetOfferStatusQuery struct {
	ID        string      `json:"ID"`
	NewStatus OfferStatus `json:"NewStatus"`
	Comment   string      `json:"Comment,omitempty"` // Required if NewStatus == OfferStatusCommentReceived
}

SetOfferStatusQuery is the payload for the v2/setofferstatus endpoint.

type Tax

type Tax struct {
	ID     guid.GUID       `json:"Id"`
	Code   string          `json:"Code"`
	Name   string          `json:"Name"`
	NameEN string          `json:"NameEN"`
	NameRU string          `json:"NameRU"`
	TaxPct decimal.Decimal `json:"TaxPct"`
}

type TaxObject

type TaxObject struct {
	TaxID  guid.GUID       `json:"TaxId"`  // Required. Use gettaxes endpoint to detect the guid needed
	Amount decimal.Decimal `json:"Amount"` // Required
}

type UnitOfMeasure

type UnitOfMeasure struct {
	Code      string `json:"Code"`
	Name      string `json:"Name"`
	NonActive bool   `json:"NonActive"`
}

Jump to

Keyboard shortcuts

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