api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	GetSalesDocumentsMethod = "getSalesDocuments"
	GetCustomersMethod      = "getCustomers"

	GetCountriesMethod       = "getCountries"
	GetEmployeesMethod       = "getEmployees"
	GetBusinessAreasMethod   = "getBusinessAreas"
	GetProjectsMethod        = "getProjects"
	GetProjectStatusesMethod = "getProjectStatuses"
	GetCurrenciesMethod      = "getCurrencies"
	GetVatRatesMethod        = "getVatRates"
	GetPaymentsMethod        = "getPayments"
	GetUserRightsMethod      = "getUserRights"
	//GetCompanyInfoMethod ...
	GetCompanyInfoMethod      = "getCompanyInfo"
	VerifyIdentityTokenMethod = "verifyIdentityToken"
	GetPointsOfSaleMethod     = "getPointsOfSale"
	GetIdentityToken          = "getIdentityToken"
	GetJWTTokenMethod         = "getJwtToken"
	GetConfParametersMethod   = "getConfParameters"

	GetWarehousesMethod        = "getWarehouses"
	GetAddressesMethod         = "getAddresses"
	GetProductsMethod          = "getProducts"
	GetProductCategoriesMethod = "getProductCategories"
	GetProductBrandsMethod     = "getBrands"
	GetProductGroupsMethod     = "getProductGroups"
	GetProductUnitsMethod      = "getProductUnits"
	VerifyCustomerUserMethod   = "verifyCustomerUser"

	Cash           = "CASH"
	Card           = "CARD"
	Transfer       = "TRANSFER"
	Check          = "CHECK"
	Unpaid         = "UNPAID"
	BankTransfer   = "Direct bank transfer"
	CheckPayment   = "Check payments"
	PayPal         = "PayPal"
	CashOnDelivery = "Cash on delivery"
	//MaxIdleConns for Erply API
	MaxIdleConns = 25

	//MaxConnsPerHost for Erply API
	MaxConnsPerHost = 25
)
View Source
const (
	UNPAID  PaymentStatus = "UNPAID"
	PENDING InvoiceState  = "PENDING"
	CARD    PaymentType   = "CARD"
)

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(partnerKey string, timestamp int64, request, secret string) string

func VerifyUser

func VerifyUser(username string, password string, clientCode string, client *http.Client) (string, error)

VerifyUser will give you session key

Types

type Address

type Address struct {
	AddressID  int         `json:"addressID"`
	OwnerID    int         `json:"ownerID"`
	TypeID     interface{} `json:"typeID"`
	Address2   string      `json:"address2"`
	Address    string      `json:"address"`
	Street     string      `json:"street"`
	PostalCode string      `json:"postalCode"`
	City       string      `json:"city"`
	State      string      `json:"state"`
	Country    string      `json:"country"`
}

Address from getAddresses

type AddressRequest added in v0.2.0

type AddressRequest struct {
	AddressID  int    `json:"addressID"`
	OwnerID    int    `json:"ownerID"`
	TypeID     int    `json:"typeID"`
	Address2   string `json:"address2"`
	Address    string `json:"address"`
	Street     string `json:"street"`
	PostalCode string `json:"postalCode"`
	City       string `json:"city"`
	State      string `json:"state"`
	Country    string `json:"country"`
}

type Addresses

type Addresses []Address

Addresses from getAddresses

type Attribute

type Attribute struct {
	Name  string `json:"attributeNam"`
	Type  string `json:"attributeType"`
	Value string `json:"attributeValue"`
}

Attribute field

type BaseDocument

type BaseDocument struct {
	ID     int    `json:"id"`
	Number string `json:"number"`
	Type   string `json:"type"`
	Date   string `json:"date"`
}

type BusinessArea added in v0.1.0

type BusinessArea struct {
	Id           uint   `json:"id"`
	Name         string `json:"name"`
	Added        uint64 `json:"added"`
	LastModified uint64 `json:"lastModified"`
}

type CompanyInfo

type CompanyInfo struct {
	ID                 string `json:"id"`
	Name               string `json:"name"`
	Code               string `json:"code"`
	VAT                string `json:"VAT"`
	Phone              string `json:"phone"`
	Mobile             string `json:"mobile"`
	Fax                string `json:"fax"`
	Email              string `json:"email"`
	Web                string `json:"web"`
	BankAccountNumber  string `json:"bankAccountNumber"`
	BankName           string `json:"bankName"`
	BankSWIFT          string `json:"bankSWIFT"`
	BankIBAN           string `json:"bankIBAN"`
	BankAccountNumber2 string `json:"bankAccountNumber2"`
	BankName2          string `json:"bankName2"`
	BankSWIFT2         string `json:"bankSWIFT2"`
	BankIBAN2          string `json:"bankIBAN2"`
	Address            string `json:"address"`
	Country            string `json:"country"`

	//field for ConfParameters
	ConfParameters ConfParameter
}

CompanyInfo ..

type CompanyInfos

type CompanyInfos []CompanyInfo

CompanyInfos ..

type ConfParameter

type ConfParameter struct {
	Announcement         string `json:"invoice_announcement_eng"`
	InvoiceClientIsPayer string `json:"invoice_client_is_payer"`
}

type ContactPerson

type ContactPerson struct {
	ContactPersonID   int    `json:"contactPersonID"`
	FullName          string `json:"fullName"`
	GroupName         string `json:"groupName"`
	CountryID         string `json:"countryID"`
	Phone             string `json:"phone"`
	Email             string `json:"email"`
	Fax               string `json:"fax"`
	Code              string `json:"code"`
	BankName          string `json:"bankName"`
	BankAccountNumber string `json:"bankAccountNumber"`
	BankIBAN          string `json:"bankIBAN"`
	BankSWIFT         string `json:"bankSWIFT"`
	Notes             string `json:"notes"`
}

type ContactPersons

type ContactPersons []ContactPerson

type Country added in v0.1.0

type Country struct {
	CountryId             uint   `json:"countryID"`
	CountryName           string `json:"countryName"`
	CountryCode           string `json:"countryCode"`
	MemberOfEuropeanUnion byte   `json:"memberOfEuropeanUnion"`
	LastModified          string `json:"lastModified"`
	Added                 uint64 `json:"added"`
}

type Currency added in v0.1.0

type Currency struct {
	CurrencyID   string `json:"currencyID"`
	Code         string `json:"code"`
	Name         string `json:"name"`
	Default      string `json:"default"`
	NameShort    string `json:"nameShort"`
	NameFraction string `json:"nameFraction"`
	Added        string `json:"added"`
	LastModified string `json:"lastModified"`
}

type Customer

type Customer struct {
	ID                   int            `json:"id"`
	CustomerID           int            `json:"customerID"`
	TypeID               string         `json:"type_id"`
	FullName             string         `json:"fullName"`
	CompanyName          string         `json:"companyName"`
	FirstName            string         `json:"firstName"`
	LastName             string         `json:"lastName"`
	GroupID              int            `json:"groupID"`
	EDI                  string         `json:"EDI"`
	IsPOSDefaultCustomer int            `json:"isPOSDefaultCustomer"`
	CountryID            string         `json:"countryID"`
	Phone                string         `json:"phone"`
	EInvoiceEmail        string         `json:"eInvoiceEmail"`
	Email                string         `json:"email"`
	Fax                  string         `json:"fax"`
	Code                 string         `json:"code"`
	ReferenceNumber      string         `json:"referenceNumber"`
	VatNumber            string         `json:"vatNumber"`
	BankName             string         `json:"bankName"`
	BankAccountNumber    string         `json:"bankAccountNumber"`
	BankIBAN             string         `json:"bankIBAN"`
	BankSWIFT            string         `json:"bankSWIFT"`
	PaymentDays          int            `json:"paymentDays"`
	Notes                string         `json:"notes"`
	LastModified         int            `json:"lastModified"`
	CustomerType         string         `json:"customerType"`
	Address              string         `json:"address"`
	CustomerAddresses    Addresses      `json:"addresses"`
	Street               string         `json:"street"`
	Address2             string         `json:"address2"`
	City                 string         `json:"city"`
	PostalCode           string         `json:"postalCode"`
	Country              string         `json:"country"`
	State                string         `json:"state"`
	ContactPersons       ContactPersons `json:"contactPersons"`

	// Web-shop related fields
	Username  string `json:"webshopUsername"`
	LastLogin string `json:"webshopLastLogin"`
}

type CustomerConstructor

type CustomerConstructor struct {
	CustomerID        int
	CompanyName       string
	Address           string
	PostalCode        string
	AddressTypeID     int
	City              string
	State             string
	Country           string
	FirstName         string
	LastName          string
	FullName          string
	RegistryCode      string
	VatNumber         string
	Email             string
	Phone             string
	BankName          string
	BankAccountNumber string

	// Web-shop related fields
	Username string
	Password string
}

type CustomerDataProcessingLog

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

CustomerDataProcessingLog ...

type CustomerImportReport

type CustomerImportReport struct {
	ClientID   int `json:"clientID"`
	CustomerID int `json:"customerID"`
}

type CustomerImportReports

type CustomerImportReports []CustomerImportReport

type Customers

type Customers []Customer

type DocumentData

type DocumentData struct {
	//Document type
	Type string
	//Currency code: "EUR", "USD" etc. Currency must be defined in your Erply account.
	CurrencyCode string
	//eg. 2010-01-29
	//Each sales document must have a date. If omitted, API applies current date.
	Date string
	//eg. 14:59:00
	//If omitted, API applies current time.
	Time string
	//Assign a custom number to this sales document. As opposed to invoiceNo, this field may contain letters, spacing and punctuation.
	CustomNumber string
	// number of invoice document in provider system
	InvoiceNumber string
	// Invoice content text
	InvoiceContentText string
	///Sales document's custom reference number. This field must be used only if you want to override default reference numbers.
	CustomReferenceNumber string
	//Notes printed on the invoice
	Notes string
	//Additional text
	Text string
	//Status of the document itself.
	//For invoices, possible values: PENDING, READY, MAILED, PRINTED. For orders, possible values are: PENDING, READY, SHIPPED, FULFILLED, CANCELLED
	InvoiceState InvoiceState
	//Expected invoice payment method: eg. CASH, CARD, TRANSFER, CHECK, GIFTCARD.
	PaymentType PaymentType
	// DEB for debit and CRED for credit
	PaymentMethod string
	//By default: system-specific, usually 14.
	//In how many days the invoice is due.
	PaymentDays string
	//Invoice payment status.
	//Possible values: PAID, UNPAID.
	PaymentStatus PaymentStatus
	//Invoice payment information, who paid, when, how.
	//Max 255 characters
	PaymentInfo string
	//Payment reference number
	PaymentReferenceNumber string
	//ISO date (yyyy-mm-dd)
	// Customer requested delivery date (for the whole document). You may also set requested delivery dates for each line individually, see deliveryDate#
	DeliveryDate string
	//ISO date (yyyy-mm-dd)
	ShippingDate string
	//Search by exact warehouse code.
	WarehouseCode string
	//seller company registry code
	Seller   CustomerConstructor
	Payer    CustomerConstructor
	Buyer    CustomerConstructor
	Delivery CustomerConstructor

	ProductRows ProductRows
	CustomerId  uint
}

type DocumentDatas

type DocumentDatas []DocumentData

type Employee added in v0.1.0

type Employee struct {
	EmployeeID             string              `json:"employeeID"`
	FullName               string              `json:"fullName"`
	EmployeeName           string              `json:"employeeName"`
	FirstName              string              `json:"firstName"`
	LastName               string              `json:"lastName"`
	Phone                  string              `json:"phone"`
	Mobile                 string              `json:"mobile"`
	Email                  string              `json:"email"`
	Fax                    string              `json:"fax"`
	Code                   string              `json:"code"`
	Gender                 string              `json:"gender"`
	UserID                 string              `json:"userID"`
	Username               string              `json:"username"`
	UserGroupID            string              `json:"userGroupID"`
	Warehouses             []EmployeeWarehouse `json:"warehouses"`
	PointsOfSale           string              `json:"pointsOfSale"`
	ProductIDs             []EmployeeProduct   `json:"productIDs"`
	Attributes             []ObjAttribute      `json:"attributes"`
	LastModified           uint64              `json:"lastModified"`
	LastModifiedByUserName string              `json:"lastModifiedByUserName"`

	// detail fileds
	Skype        string `json:"skype"`
	Birthday     string `json:"birthday"`
	JobTitleID   uint   `json:"jobTitleID"`
	JobTitleName string `json:"jobTitleName"`
	Notes        string `json:"notes"`
	Added        uint64 `json:"added"`
}

type EmployeeProduct added in v0.1.0

type EmployeeProduct struct {
	ProductID    uint   `json:"productID"`
	ProductCode  string `json:"productCode"`
	ProductName  string `json:"productName"`
	ProductGroup uint   `json:"productGroup"`
}

type EmployeeWarehouse added in v0.1.0

type EmployeeWarehouse struct {
	Id uint `json:"id"`
}

type Endpoint added in v0.2.0

type Endpoint struct {
	Url           string `json:"url"`
	Documentation string `json:documentation""`
}

type GetAddressesResponse

type GetAddressesResponse struct {
	Status    Status    `json:"status"`
	Addresses Addresses `json:"records"`
}

GetAddressesResponse ..

type GetBusinessAreasResponse added in v0.1.0

type GetBusinessAreasResponse struct {
	Status        Status         `json:"status"`
	BusinessAreas []BusinessArea `json:"records"`
}

type GetCompanyInfoResponse

type GetCompanyInfoResponse struct {
	Status       Status       `json:"status"`
	CompanyInfos CompanyInfos `json:"records"`
}

GetCompanyInfoResponse ...

type GetConfParametersResponse

type GetConfParametersResponse struct {
	Status         Status          `json:"status"`
	ConfParameters []ConfParameter `json:"records"`
}

GetConfParametersResponse ...

type GetCountriesResponse added in v0.1.0

type GetCountriesResponse struct {
	Status    Status    `json:"status"`
	Countries []Country `json:"records"`
}

type GetCurrenciesResponse added in v0.1.0

type GetCurrenciesResponse struct {
	Status     Status     `json:"status"`
	Currencies []Currency `json:"records"`
}

type GetCustomersResponse

type GetCustomersResponse struct {
	Status    Status    `json:"status"`
	Customers Customers `json:"records"`
}

GetCustomersResponse ...

type GetEmployeesResponse added in v0.1.0

type GetEmployeesResponse struct {
	Status    Status     `json:"status"`
	Employees []Employee `json:"records"`
}

type GetPointsOfSaleResponse

type GetPointsOfSaleResponse struct {
	Status       Status        `json:"status"`
	PointsOfSale []PointOfSale `json:"records"`
}

type GetProductUnitsResponse

type GetProductUnitsResponse struct {
	Status       Status        `json:"status"`
	ProductUnits []ProductUnit `json:"records"`
}

GetProductUnitsResponse ...

type GetProductsResponse

type GetProductsResponse struct {
	Status   Status    `json:"status"`
	Products []Product `json:"records"`
}

GetProductsResponse ...

type GetProjectStatusesResponse added in v0.1.0

type GetProjectStatusesResponse struct {
	Status          Status          `json:"status"`
	ProjectStatuses []ProjectStatus `json:"records"`
}

type GetProjectsResponse added in v0.1.0

type GetProjectsResponse struct {
	Status   Status    `json:"status"`
	Projects []Project `json:"records"`
}

type GetSalesDocumentResponse

type GetSalesDocumentResponse struct {
	Status         Status         `json:"status"`
	SalesDocuments []SaleDocument `json:"records"`
}

type GetSuppliersResponse added in v0.1.0

type GetSuppliersResponse struct {
	Status    Status     `json:"status"`
	Suppliers []Supplier `json:"records"`
}

GetSuppliersResponse

type GetUserRightsResponse

type GetUserRightsResponse struct {
	Status  Status       `json:"status"`
	Records []UserRights `json:"records"`
}

type GetVatRatesResponse

type GetVatRatesResponse struct {
	Status   Status    `json:"status"`
	VatRates []VatRate `json:"records"`
}

GetVatRatesResponse ...

type GetWarehousesResponse

type GetWarehousesResponse struct {
	Status     Status     `json:"status"`
	Warehouses Warehouses `json:"records"`
}

type IClient

type IClient interface {
	GetServiceEndpoints() (*ServiceEndpoints, error)
	GetConfParameters() (*ConfParameter, error)
	GetWarehouses() (Warehouses, error)
	GetUserName() (string, error)
	GetSalesDocumentByID(id string) ([]SaleDocument, error)
	GetSalesDocumentsByIDs(id []string) ([]SaleDocument, error)
	GetCustomers(ctx context.Context, filters map[string]string) ([]Customer, error)
	GetCustomersByIDs(customerID []string) (Customers, error)
	GetCustomerByRegNumber(regNumber string) (*Customer, error)
	GetCustomerByGLN(gln string) (*Customer, error)
	GetSuppliers(ctx context.Context, filters map[string]string) ([]Supplier, error)
	GetSupplierByName(name string) (*Customer, error)
	GetVatRatesByID(vatRateID string) (VatRates, error)
	GetCompanyInfo() (*CompanyInfo, error)
	GetProductUnits() ([]ProductUnit, error)
	GetProductCategories(ctx context.Context, filters map[string]string) ([]ProductCategory, error)
	GetProductBrands(ctx context.Context, filters map[string]string) ([]ProductBrand, error)
	GetProductGroups(ctx context.Context, filters map[string]string) ([]ProductGroup, error)
	GetProducts(ctx context.Context, filters map[string]string) ([]Product, error)
	GetProductsByIDs(ids []string) ([]Product, error)
	GetProductsByCode3(code3 string) (*Product, error)
	GetAddresses(filters map[string]string) ([]Address, error)
	GetCountries(ctx context.Context, filters map[string]string) ([]Country, error)
	GetEmployees(ctx context.Context, filters map[string]string) ([]Employee, error)
	GetBusinessAreas(ctx context.Context, filters map[string]string) ([]BusinessArea, error)
	GetProjects(ctx context.Context, filters map[string]string) ([]Project, error)
	GetProjectStatus(ctx context.Context, filters map[string]string) ([]ProjectStatus, error)
	GetCurrencies(ctx context.Context, filters map[string]string) ([]Currency, error)
	PostPurchaseDocument(in *PurchaseDocumentConstructor, provider string) (PurchaseDocImportReports, error)
	PostSalesDocumentFromWoocomm(in *SaleDocumentConstructor, shopOrderID string) (SaleDocImportReports, error)
	PostSalesDocument(in *SaleDocumentConstructor, provider string) (SaleDocImportReports, error)
	PostCustomer(in *CustomerConstructor) (*CustomerImportReport, error)
	PostSupplier(in *CustomerConstructor) (*CustomerImportReport, error)
	DeleteDocumentsByID(id string) error
	GetPointsOfSale(ctx context.Context, filters map[string]string) ([]PointOfSale, error)
	GetPointsOfSaleByID(posID string) (*PointOfSale, error)
	VerifyIdentityToken(jwt string) (*SessionInfo, error)
	GetIdentityToken() (*IdentityToken, error)
	GetJWTToken(partnerKey string) (*JwtToken, error)
	SavePayment(in *PaymentInfo) (int64, error)
	SaveAddress(in *AddressRequest) (int, error)
	GetPayments(ctx context.Context, filters map[string]string) ([]PaymentInfo, error)
	VerifyCustomerUser(username, password string) (*WebshopClient, error)
	CalculateShoppingCart(in *DocumentData) (*ShoppingCartTotals, error)
	IsCustomerUsernameAvailable(username string) (bool, error)
	Close()
}

IClient interface for cached and simple client

func NewClient

func NewClient(sessionKey string, clientCode string, customCli *http.Client) IClient

NewClient Takes three params: sessionKey string obtained from credentials or jwt clientCode erply customer identification number and a custom http Client if needs to be overwritten. if nil will use default http client provided by the SDK

func NewClientV2

func NewClientV2(partnerKey string, secret string, clientCode string) IClient

type IdentityToken

type IdentityToken struct {
	Jwt string `json:"identityToken"`
}

type InstallationRequest added in v0.1.0

type InstallationRequest struct {
	CompanyName string `json:"companyName"`
	FirstName   string `json:"firstName"`
	LastName    string `json:"lastName"`
	Phone       string `json:"phone"`
	Email       string `json:"email"`
	SendEmail   int    `json:"sendEmail"`
}

type InstallationResponse added in v0.1.0

type InstallationResponse struct {
	ClientCode int    `json:"clientCode"`
	UserName   string `json:"username"`
	Password   string `json:"password"`
}

func CreateInstallation added in v0.1.0

func CreateInstallation(baseUrl, partnerKey string, in *InstallationRequest, cli *http.Client) (*InstallationResponse, error)

type InvoiceRow

type InvoiceRow struct {
	RowID             string `json:"rowID"`
	ProductID         string `json:"productID"`
	Product           *Product
	ItemName          string  `json:"itemName"`
	Barcode           string  `json:"barcode"`
	VatrateID         string  `json:"vatrateID"`
	Amount            string  `json:"amount"`
	Price             string  `json:"price"`
	Discount          string  `json:"discount"`
	BillingStartDate  string  `json:"billingStartDate"`
	BillingEndDate    string  `json:"billingEndDate"`
	Code              string  `json:"code"`
	FinalNetPrice     float64 `json:"finalNetPrice"`
	FinalPriceWithVAT float64 `json:"finalPriceWithVAT"`
	RowNetTotal       float64 `json:"rowNetTotal"`
	RowVAT            float64 `json:"rowVAT"`
	RowTotal          float64 `json:"rowTotal"`
	CampaignIDs       string  `json:"campaignIDs"`
}

type InvoiceState

type InvoiceState string

type JwtToken added in v0.1.0

type JwtToken struct {
	Token string `json:"token"`
}

type JwtTokenResponse added in v0.1.0

type JwtTokenResponse struct {
	Status  Status   `json:"status"`
	Records JwtToken `json:"records"`
}

type NetTotalsByRate

type NetTotalsByRate struct {
}

type NetTotalsByRates

type NetTotalsByRates []NetTotalsByRate

type NetTotalsByTaxRate

type NetTotalsByTaxRate struct {
	VatrateID int     `json:"vatrateID"`
	Total     float64 `json:"total"`
}

type NetTotalsByTaxRates

type NetTotalsByTaxRates []NetTotalsByTaxRate

type ObjAttribute added in v0.1.0

type ObjAttribute struct {
	AttributeName  string `json:"attributeName"`
	AttributeType  string `json:"attributeType"`
	AttributeValue string `json:"attributeValue"`
}

type PaymentAttribute

type PaymentAttribute struct {
	AttributeName  string `json:"attributeName"`
	AttributeType  string `json:"attributeType"`
	AttributeValue string `json:"attributeValue"`
}

type PaymentInfo added in v0.1.0

type PaymentInfo struct {
	DocumentID   int    `json:"documentID"` // Invoice ID
	Type         string `json:"type"`       // CASH, TRANSFER, CARD, CREDIT, GIFTCARD, CHECK, TIP
	Date         string `json:"date"`
	Sum          string `json:"sum"`
	CurrencyCode string `json:"currencyCode"` // EUR, USD
	Info         string `json:"info"`         // Information about the payer or payment transaction
	Added        uint64 `json:"added"`
}

type PaymentStatus

type PaymentStatus string

type PaymentType

type PaymentType string

type PointOfSale

type PointOfSale struct {
	PointOfSaleID uint   `json:"pointOfSaleID"`
	Name          string `json:"name"`
	WarehouseID   int    `json:"warehouseID"`
	WarehouseName string `json:"warehouseName"`
	Added         uint64 `json:"added"`
	LastModified  uint64 `json:"lastModified"`
}

type PostCustomerResponse

type PostCustomerResponse struct {
	Status                Status                `json:"status"`
	CustomerImportReports CustomerImportReports `json:"records"`
}

type PostPurchaseDocumentResponse

type PostPurchaseDocumentResponse struct {
	Status        Status                   `json:"status"`
	ImportReports PurchaseDocImportReports `json:"records"`
}

type PostSalesDocumentResponse

type PostSalesDocumentResponse struct {
	Status        Status               `json:"status"`
	ImportReports SaleDocImportReports `json:"records"`
}

type Product

type Product struct {
	ProductID          int                `json:"productID"`
	ParentProductID    int                `json:"parentProductID"`
	Type               string             `json:"type"`
	Name               string             `json:"name"`
	Description        string             `json:"description"`
	DescriptionLong    string             `json:"longdesc"`
	Status             string             `json:"status"`
	Code               string             `json:"code"`
	Code2              string             `json:"code2"`
	Code3              *string            `json:"code3"`
	Price              float64            `json:"price"`
	PriceWithVat       float32            `json:"priceWithVat"`
	UnitName           *string            `json:"unitName"`
	Images             []ProductImage     `json:"images"`
	DisplayedInWebshop byte               `json:"displayedInWebshop"`
	CategoryId         uint               `json:"categoryID"`
	CategoryName       string             `json:"categoryName"`
	BrandID            uint               `json:"brandID"`
	BrandName          string             `json:"brandName"`
	GroupID            uint               `json:"groupID"`
	GroupName          string             `json:"groupName"`
	Warehouses         map[uint]StockInfo `json:"warehouses"`
	RelatedProducts    []string           `json:"relatedProducts"`
	Vatrate            float64            `json:"vatrate"`
	ProductVariations  []string           `json:"productVariations"` // Variations of matrix product
	VariationList      []ProductVariaton  `json:"variationList"`
}

Product ...

type ProductBrand added in v0.1.0

type ProductBrand struct {
	ID           uint   `json:"brandID"`
	Name         string `json:"name"`
	Added        uint64 `json:"added"`
	LastModified uint64 `json:"lastModified"`
}

type ProductCategory added in v0.1.0

type ProductCategory struct {
	ProductCategoryID   uint   `json:"productCategoryID"`
	ParentCategoryID    uint   `json:"parentCategoryID"`
	ProductCategoryName string `json:"productCategoryName"`
	Added               uint64 `json:"added"`
	LastModified        uint64 `json:"lastModified"`
}

type ProductDimensions added in v0.1.0

type ProductDimensions struct {
	Name             string `json:"name"`
	Value            string `json:"value"`
	Order            int    `json:"order"`
	DimensionID      int    `json:"dimensionID"`
	DimensionValueID int    `json:"dimensionValueID"`
}

type ProductGroup added in v0.1.0

type ProductGroup struct {
	ID              uint           `json:"productGroupID"`
	Name            string         `json:"name"`
	ShowInWebshop   string         `json:"showInWebshop"`
	NonDiscountable byte           `json:"nonDiscountable"`
	PositionNo      int            `json:"positionNo"`
	ParentGroupID   string         `json:"parentGroupID"`
	Added           uint64         `json:"added"`
	LastModified    uint64         `json:"lastModified"`
	SubGroups       []ProductGroup `json:"subGroups"`
}

type ProductImage added in v0.1.0

type ProductImage struct {
	PictureID       string  `json:"pictureID"`
	Name            string  `json:"name"`
	ThumbURL        string  `json:"thumbURL"`
	SmallURL        string  `json:"smallURL"`
	LargeURL        string  `json:"largeURL"`
	FullURL         string  `json:"fullURL"`
	External        byte    `json:"external"`
	HostingProvider string  `json:"hostingProvider"`
	Hash            *string `json:"hash"`
	Tenant          *string `json:"tenant"`
}

type ProductRow

type ProductRow struct {
	//ID of the product (SKU) sold. Either productID or serviceID can be set, but not both at the same time. Both can be omitted, however - in that case a free-text invoice row will be created.
	ProductID string
	ItemName  string
	//Sold quantity must be a decimal, and can not be zero.
	Amount string
	///Net sales price per item, pre-discount.
	Price string
	//Discount % that WILL BE SUBTRACTED from the price specified in previous parameter.
	Discount string
	//Customer requested delivery date for this specific item. You can also set a requested delivery date for the whole document, see deliveryDate above.
	DeliveryDate string
	//Billing start date. See previous field.
	BillingStartDate string
	//Billing end date. See previous field.
	BillingEndDate string
	// item vat rate
	VatRate string
}

type ProductRows

type ProductRows []ProductRow

type ProductUnit

type ProductUnit struct {
	UnitID string `json:"unitID"`
	Name   string `json:"name"`
}

ProductUnit ...

type ProductVariaton added in v0.1.0

type ProductVariaton struct {
	ProductID  string              `json:"productID"`
	Name       string              `json:"name"`
	Code       string              `json:"code"`
	Code2      string              `json:"code2"`
	Dimensions []ProductDimensions `json:"dimensions"`
}

type Project added in v0.1.0

type Project struct {
	ProjectID    uint   `json:"projectID"`
	Name         string `json:"name"`
	CustomerID   uint   `json:"customerID"`
	CustomerName string `json:"customerName"`
	EmployeeID   uint   `json:"employeeID"`
	EmployeeName string `json:"employeeName"`
	TypeID       uint   `json:"typeID"`
	TypeName     string `json:"typeName"`
	StatusID     uint   `json:"statusID"`
	StatusName   string `json:"statusName"`
	StartDate    string `json:"startDate"`
	EndDate      string `json:"endDate"`
	Notes        string `json:"notes"`
	LastModified uint64 `json:"lastModified"`
}

type ProjectStatus added in v0.1.0

type ProjectStatus struct {
	ProjectStatusID uint   `json:"projectStatusID"`
	Name            string `json:"name"`
	Finished        byte   `json:"finished"`
	Added           uint64 `json:"added"`
	LastModified    uint64 `json:"lastModified"`
}

type PurchaseDocImportReport

type PurchaseDocImportReport struct {
	InvoiceID    int    `json:"invoiceID"`
	CustomNumber string `json:"customNumber"`
	Rounding     int    `json:"rounding"`
	Total        int    `json:"total"`
}

type PurchaseDocImportReports

type PurchaseDocImportReports []PurchaseDocImportReport

type PurchaseDocumentConstructor

type PurchaseDocumentConstructor struct {
	DocumentData  *DocumentData
	PaymentParty  *Customer
	DeliveryParty *Customer
	SellerParty   *Customer
	VatRates      VatRates
}

type PurchaseDocumentConstructors

type PurchaseDocumentConstructors []PurchaseDocumentConstructor

type Records

type Records struct {
	SessionKey string `json:"sessionKey"`
}

type SaleDocImportReport

type SaleDocImportReport struct {
	InvoiceID    int     `json:"invoiceID"`
	CustomNumber string  `json:"customNumber"`
	Rounding     float64 `json:"rounding"`
	Total        float64 `json:"total"`
}

type SaleDocImportReports

type SaleDocImportReports []SaleDocImportReport

type SaleDocument

type SaleDocument struct {
	ID           int    `json:"id"`
	CurrencyRate string `json:"currencyRate"`
	WarehouseID  int    `json:"warehouseID"`
	Number       string `json:"number"`
	Date         string `json:"date"`
	Time         string `json:"time"`

	/*
		Parties block
	*/
	//Payer if invoice_client_is_payer = 1
	ClientID int `json:"clientID"`
	//Recipient if invoice_client_is_payer = 1
	ShipToID int `json:"shipToID"`
	ShipTo   *Customer
	//Recipient if invoice_client_is_payer = 0
	CustomerID int `json:"customerID"`
	//Payer if invoice_client_is_payer = 0
	PayerID int `json:"payerID"`
	Payer   *Customer
	//Buyer represents IClient if invoice_client_is_payer = 1 OR Customer if invoice_client_is_payer = 0
	Buyer *Customer

	//Location for additional fields from getWarehouses request to be used in seller party address.
	Location *Warehouse

	AddressID               int                 `json:"addressID"`
	PayerAddressID          int                 `json:"payerAddressID"`
	ShipToAddressID         string              `json:"shipToAddressID"`
	ContactID               int                 `json:"contactID"`
	EmployeeID              int                 `json:"employeeID"`
	PaymentDays             string              `json:"paymentDays"`
	Confirmed               string              `json:"confirmed"`
	Notes                   string              `json:"notes"`
	LastModified            int                 `json:"lastModified"`
	PackingUnitsDescription string              `json:"packingUnitsDescription"`
	CurrencyCode            string              `json:"currencyCode"`
	ContactName             string              `json:"contactName"`
	Type                    string              `json:"type"`
	InvoiceState            string              `json:"invoiceState"`
	PaymentType             string              `json:"paymentType"`
	BaseDocuments           []BaseDocument      `json:"baseDocuments"`
	NetTotal                float64             `json:"netTotal"`
	VatTotal                float64             `json:"vatTotal"`
	VatTotalsByTaxRates     VatTotalsByTaxRates `json:"vatTotalsByTaxRate"`
	Rounding                float64             `json:"rounding"`
	Total                   float64             `json:"total"`
	Paid                    string              `json:"paid"`
	PrintDiscounts          int                 `json:"printDiscounts"`
	ReferenceNumber         string              `json:"referenceNumber"`
	CustomReferenceNumber   string              `json:"customReferenceNumber"`
	PaymentStatus           string              `json:"paymentStatus"`
	Penalty                 string              `json:"penalty"`
	InvoiceLink             string              `json:"invoiceLink"`
	InvoiceRows             []InvoiceRow        `json:"rows"`
}

SaleDocument model

type SaleDocumentConstructor

type SaleDocumentConstructor struct {
	DocumentData  *DocumentData
	Attributes    []*Attribute
	PaymentParty  *Customer
	DeliveryParty *Customer
	SellerParty   *Customer
	VatRates      VatRates
}

SaleDocumentConstructor ..

type ServiceEndpoints added in v0.2.0

type ServiceEndpoints struct {
	Cafa        Endpoint `json:"cafa"`
	Pim         Endpoint `json:"pim"`
	Wms         Endpoint `json:"wms"`
	Promotion   Endpoint `json:"promotion"`
	Reports     Endpoint `json:"reports"`
	Json        Endpoint `json:"json"`
	Assignments Endpoint `json:"assignments"`
}

type SessionInfo

type SessionInfo struct {
	SessionKey string `json:"sessionKey"`
}

type ShoppingCartProduct added in v0.1.0

type ShoppingCartProduct struct {
	ProductID            string  `json:"productID"`
	Amount               string  `json:"amount"`
	OriginalPrice        float64 `json:"originalPrice"`
	OriginalPriceWithVAT float64 `json:"originalPriceWithVAT"`
	FinalPrice           float64 `json:"finalPrice"`
	FinalPriceWithVAT    float64 `json:"finalPriceWithVAT"`
	Discount             float64 `json:"discount"`
}

type ShoppingCartTotals added in v0.1.0

type ShoppingCartTotals struct {
	Rows     []ShoppingCartProduct `json:"rows"`
	NetTotal float64               `json:"netTotal"`
	VATTotal float64               `json:"vatTotal"`
	Total    float64               `json:"total"`
}

type Status

type Status struct {
	Request           string  `json:"request"`
	RequestUnixTime   int     `json:"requestUnixTime"`
	ResponseStatus    string  `json:"responseStatus"`
	ErrorCode         int     `json:"errorCode"`
	ErrorField        string  `json:"errorField"`
	GenerationTime    float64 `json:"generationTime"`
	RecordsTotal      int     `json:"recordsTotal"`
	RecordsInResponse int     `json:"recordsInResponse"`
}

type StockInfo added in v0.1.0

type StockInfo struct {
	WarehouseID   uint    `json:"warehouseID"`
	Free          int     `json:"free"`
	OrderPending  int     `json:"orderPending"`
	ReorderPoint  int     `json:"reorderPoint"`
	RestockLevel  int     `json:"restockLevel"`
	FifoCost      float32 `json:"FIFOCost"`
	PurchasePrice float32 `json:"purchasePrice"`
}

type Supplier added in v0.1.0

type Supplier struct {
	SupplierId      uint           `json:"supplierID"`
	SupplierType    string         `json:"supplierType"`
	FullName        string         `json:"fullName"`
	CompanyName     string         `json:"companyName"`
	FirstName       string         `json:"firstName"`
	LstName         string         `json:"lastName"`
	GroupId         uint           `json:"groupID"`
	GroupName       string         `json:"groupName"`
	Phone           string         `json:"phone"`
	Mobile          string         `json:"mobile"`
	Email           string         `json:"email"`
	Fax             string         `json:"fax"`
	Code            string         `json:"code"`
	IntegrationCode string         `json:"integrationCode"`
	VatrateID       uint           `json:"vatrateID"`
	CurrencyCode    string         `json:"currencyCode"`
	DeliveryTermsID uint           `json:"deliveryTermsID"`
	CountryId       uint           `json:"countryID"`
	CountryName     string         `json:"countryName"`
	CountryCode     string         `json:"countryCode"`
	Address         string         `json:"address"`
	Gln             string         `json:"GLN"`
	Attributes      []ObjAttribute `json:"attributes"`

	// Detail fields
	VatNumber           string `json:"vatNumber"`
	Skype               string `json:"skype"`
	Website             string `json:"website"`
	BankName            string `json:"bankName"`
	BankAccountNumber   string `json:"bankAccountNumber"`
	BankIBAN            string `json:"bankIBAN"`
	BankSWIFT           string `json:"bankSWIFT"`
	Birthday            string `json:"birthday"`
	CompanyID           uint   `json:"companyID"`
	ParentCompanyName   string `json:"parentCompanyName"`
	SupplierManagerID   uint   `json:"supplierManagerID"`
	SupplierManagerName string `json:"supplierManagerName"`
	PaymentDays         uint   `json:"paymentDays"`
	Notes               string `json:"notes"`
	LastModified        string `json:"lastModified"`
	Added               uint64 `json:"added"`
}

type UserCredentials

type UserCredentials struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

type UserRights

type UserRights struct {
	UserName string `json:"userName"`
}

type VatRate

type VatRate struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Rate   string `json:"rate"`
	Code   string `json:"code"`
	Active string `json:"active"`
	//Added        string `json:"added"`
	LastModified string `json:"lastModified"`
}

type VatRates

type VatRates []VatRate

type VatTotalsByRate

type VatTotalsByRate struct {
}

type VatTotalsByRates

type VatTotalsByRates []VatTotalsByRate

type VatTotalsByTaxRate

type VatTotalsByTaxRate struct {
	VatrateID int     `json:"vatrateID"`
	Total     float64 `json:"total"`
}

type VatTotalsByTaxRates

type VatTotalsByTaxRates []VatTotalsByTaxRate

type VerifyUserResponse

type VerifyUserResponse struct {
	Records []Records `json:"records"`
}

type Warehouse

type Warehouse struct {
	WarehouseID            string `json:"warehouseID"`
	PricelistID            string `json:"pricelistID"`
	PricelistID2           string `json:"pricelistID2"`
	PricelistID3           string `json:"pricelistID3"`
	PricelistID4           int    `json:"pricelistID4"`
	PricelistID5           int    `json:"pricelistID5"`
	Name                   string `json:"name"`
	Code                   string `json:"code"`
	AddressID              int    `json:"addressID"`
	Address                string `json:"address"`
	Street                 string `json:"street"`
	Address2               string `json:"address2"`
	City                   string `json:"city"`
	State                  string `json:"state"`
	Country                string `json:"country"`
	ZIPcode                string `json:"ZIPcode"`
	StoreGroups            string `json:"storeGroups"`
	CompanyName            string `json:"companyName"`
	CompanyCode            string `json:"companyCode"`
	CompanyVatNumber       string `json:"companyVatNumber"`
	Phone                  string `json:"phone"`
	Fax                    string `json:"fax"`
	Email                  string `json:"email"`
	Website                string `json:"website"`
	BankName               string `json:"bankName"`
	BankAccountNumber      string `json:"bankAccountNumber"`
	Iban                   string `json:"iban"`
	Swift                  string `json:"swift"`
	UsesLocalQuickButtons  int    `json:"usesLocalQuickButtons"`
	DefaultCustomerGroupID int    `json:"defaultCustomerGroupID"`
	IsOfflineInventory     int    `json:"isOfflineInventory"`
	TimeZone               string `json:"timeZone"`
	Attributes             []struct {
		AttributeName  string `json:"attributeName"`
		AttributeType  string `json:"attributeType"`
		AttributeValue string `json:"attributeValue"`
	} `json:"attributes"`
}

type Warehouses

type Warehouses []Warehouse

type WebshopClient added in v0.1.0

type WebshopClient struct {
	ClientID        string `json:"clientID"`
	ClientUsername  string `json:"clientUsername"`
	ClientName      string `json:"clientName"`
	ClientFirstName string `json:"clientFirstName"`
	ClientLastName  string `json:"clientLastName"`
	ClientGroupID   string `json:"clientGroupID"`
	ClientGroupName string `json:"clientGroupName"`
	CompanyID       string `json:"companyID"`
	CompanyName     string `json:"companyName"`
}

Jump to

Keyboard shortcuts

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