sales

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDocument

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

type Client

type Client struct {
	*common.Client
}

func NewClient

func NewClient(client *common.Client) *Client

func (*Client) CalculateShoppingCart

func (cli *Client) CalculateShoppingCart(ctx context.Context, filters map[string]string) (*ShoppingCartTotals, error)

func (*Client) DeleteDocument

func (cli *Client) DeleteDocument(ctx context.Context, filters map[string]string) error

func (*Client) GetPayments

func (cli *Client) GetPayments(ctx context.Context, filters map[string]string) ([]PaymentInfo, error)

func (*Client) GetProjectStatus

func (cli *Client) GetProjectStatus(ctx context.Context, filters map[string]string) ([]ProjectStatus, error)

GetProjectStatus will list projects statuses according to specified filters.

func (*Client) GetProjects

func (cli *Client) GetProjects(ctx context.Context, filters map[string]string) ([]Project, error)

GetProjects will list projects according to specified filters.

func (*Client) GetSalesDocuments

func (cli *Client) GetSalesDocuments(ctx context.Context, filters map[string]string) ([]SaleDocument, error)

func (*Client) GetVatRates

func (cli *Client) GetVatRates(ctx context.Context, filters map[string]string) (VatRates, error)

GetVatRatesByVatRateID ...

func (*Client) SavePayment

func (cli *Client) SavePayment(ctx context.Context, filters map[string]string) (int64, error)

func (*Client) SavePurchaseDocument

func (cli *Client) SavePurchaseDocument(ctx context.Context, filters map[string]string) (PurchaseDocImportReports, error)

func (*Client) SaveSalesDocument

func (cli *Client) SaveSalesDocument(ctx context.Context, filters map[string]string) (SaleDocImportReports, error)

type DocumentManager

type DocumentManager interface {
	SaveSalesDocument(ctx context.Context, filters map[string]string) (SaleDocImportReports, error)
	GetSalesDocuments(ctx context.Context, filters map[string]string) ([]SaleDocument, error)
	DeleteDocument(ctx context.Context, filters map[string]string) error
	SavePurchaseDocument(ctx context.Context, filters map[string]string) (PurchaseDocImportReports, error)
}

type GetProjectStatusesResponse

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

type GetProjectsResponse

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

type GetSalesDocumentResponse

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

type InvoiceRow

type InvoiceRow struct {
	RowID             string  `json:"rowID"`
	ProductID         string  `json:"productID"`
	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 Manager

type Manager interface {
	ProjectManager
	DocumentManager
	VatRateManager
	//payment requests
	SavePayment(ctx context.Context, filters map[string]string) (int64, error)
	GetPayments(ctx context.Context, filters map[string]string) ([]PaymentInfo, error)

	//shopping cart
	CalculateShoppingCart(ctx context.Context, filters map[string]string) (*ShoppingCartTotals, error)
}

type NetTotalsByTaxRate

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

type PaymentAttribute

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

type PaymentInfo

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 PostSalesDocumentResponse

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

type Project

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 ProjectManager

type ProjectManager interface {
	GetProjects(ctx context.Context, filters map[string]string) ([]Project, error)
	GetProjectStatus(ctx context.Context, filters map[string]string) ([]ProjectStatus, error)
}

type ProjectStatus

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 SaleDocImportReport

type SaleDocImportReport struct {
	InvoiceID int `json:"invoiceID"`
	//I noticed that if the id is empty then an empty string is returned from the API - therefore an additional field is there for the json parser not to fail
	InvoiceIDStr string  `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"`

	//Payer if invoice_client_is_payer = 1
	ClientID int `json:"clientID"`
	//Recipient if invoice_client_is_payer = 1
	ShipToID int `json:"shipToID"`
	//Recipient if invoice_client_is_payer = 0
	CustomerID int `json:"customerID"`
	//Payer if invoice_client_is_payer = 0
	PayerID int `json:"payerID"`

	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"`
}

type SavePurchaseDocumentResponse

type SavePurchaseDocumentResponse struct {
	Status        common2.Status           `json:"status"`
	ImportReports PurchaseDocImportReports `json:"records"`
}

type ShoppingCartProduct

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"`
	RowNetTotal          float64 `json:"rowNetTotal"`
	RowTotal             float64 `json:"rowTotal"`
	Discount             float64 `json:"discount"`
}

type ShoppingCartTotals

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

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 VatRateManager

type VatRateManager interface {
	GetVatRates(ctx context.Context, filters map[string]string) (VatRates, error)
}

type VatRates

type VatRates []VatRate

type VatTotalsByTaxRate

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

type VatTotalsByTaxRates

type VatTotalsByTaxRates []VatTotalsByTaxRate

Jump to

Keyboard shortcuts

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