Documentation
¶
Index ¶
- Constants
- func GenerateToken(partnerKey string, timestamp int64, request, secret string) string
- func VerifyUser(username string, password string, clientCode string) (string, error)
- type Address
- type Addresses
- type Attribute
- type BaseDocument
- type CompanyInfo
- type CompanyInfos
- type ConfParameter
- type ContactPerson
- type ContactPersons
- type Customer
- type CustomerConstructor
- type CustomerDataProcessingLog
- type CustomerImportReport
- type CustomerImportReports
- type Customers
- type DocumentData
- type DocumentDatas
- type GetAddressesResponse
- type GetCompanyInfoResponse
- type GetConfParametersResponse
- type GetCustomersResponse
- type GetPointsOfSaleResponse
- type GetProductUnitsResponse
- type GetProductsResponse
- type GetSalesDocumentResponse
- type GetUserRightsResponse
- type GetVatRatesResponse
- type GetWarehousesResponse
- type IClient
- type IdentityToken
- type InvoiceRow
- type InvoiceState
- type NetTotalsByRate
- type NetTotalsByRates
- type NetTotalsByTaxRate
- type NetTotalsByTaxRates
- type PaymentAttribute
- type PaymentStatus
- type PaymentType
- type PointOfSale
- type PostCustomerResponse
- type PostPurchaseDocumentResponse
- type PostSalesDocumentResponse
- type Product
- type ProductRow
- type ProductRows
- type ProductUnit
- type PurchaseDocImportReport
- type PurchaseDocImportReports
- type PurchaseDocumentConstructor
- type PurchaseDocumentConstructors
- type Records
- type SaleDocImportReport
- type SaleDocImportReports
- type SaleDocument
- type SaleDocumentConstructor
- type SessionInfo
- type Status
- type UserCredentials
- type UserRights
- type VatRate
- type VatRates
- type VatTotalsByRate
- type VatTotalsByRates
- type VatTotalsByTaxRate
- type VatTotalsByTaxRates
- type VerifyUserResponse
- type Warehouse
- type Warehouses
Constants ¶
View Source
const ( //GetSalesDocumentsMethod ... GetSalesDocumentsMethod = "getSalesDocuments" GetUserRightsMethod = "getUserRights" //GetCustomersMethod ... GetCustomersMethod = "getCustomers" //GetVatRatesMethod ... GetVatRatesMethod = "getVatRates" //GetPaymentsMethod ... GetPaymentsMethod = "getPayments" //GetCompanyInfoMethod ... GetCompanyInfoMethod = "getCompanyInfo" VerifyIdentityTokenMethod = "verifyIdentityToken" GetPointsOfSaleMethod = "getPointsOfSale" GetIdentityToken = "getIdentityToken" GetConfParametersMethod = "getConfParameters" GetWarehousesMethod = "getWarehouses" GetAddressesMethod = "getAddresses" GetProductsMethod = "getProducts" GetProductUnitsMethod = "getProductUnits" Cash = "CASH" Card = "CARD" Transfer = "TRANSFER" Check = "CHECK" Paid = "PAID" Unpaid = "UNPAID" BankTransfer = "Direct bank transfer" CheckPayment = "Check payments" PayPal = "PayPal" CashOnDelivery = "Cash on delivery" //MaxIdleConns for Erply API MaxIdleConns = 1 //MaxConnsPerHost for Erply API MaxConnsPerHost = 1 )
View Source
const ( PAID PaymentStatus = "PAID" UNPAID PaymentStatus = "UNPAID" PENDING InvoiceState = "PENDING" CARD PaymentType = "CARD" )
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
Types ¶
type Address ¶
type Address struct {
AddressID int `json:"addressID"`
Address2 string `json:"address2"`
Address string `json:"address"`
OwnerID int `json:"ownerID"`
Street string `json:"street"`
PostalCode string `json:"postalCode"`
City string `json:"city"`
State string `json:"state"`
Country string `json:"country"`
}
Address from getAddresses
type Attribute ¶
type Attribute struct {
Name string `json:"attributeNam"`
Type string `json:"attributeType"`
Value string `json:"attributeValue"`
}
Attribute field
type BaseDocument ¶
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 ConfParameter ¶
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 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"`
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"`
}
type CustomerConstructor ¶
type CustomerDataProcessingLog ¶
type CustomerDataProcessingLog struct {
// contains filtered or unexported fields
}
CustomerDataProcessingLog ...
type CustomerImportReport ¶
type CustomerImportReports ¶
type CustomerImportReports []CustomerImportReport
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
}
type DocumentDatas ¶
type DocumentDatas []DocumentData
type GetAddressesResponse ¶
type GetAddressesResponse struct {
Status Status `json:"status"`
Addresses Addresses `json:"records"`
}
GetAddressesResponse ..
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 GetCustomersResponse ¶
type GetCustomersResponse struct {
Status Status `json:"status"`
Customers Customers `json:"records"`
}
GetCustomersResponse ...
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 GetSalesDocumentResponse ¶
type GetSalesDocumentResponse struct {
Status Status `json:"status"`
SalesDocuments []SaleDocument `json:"records"`
}
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 {
GetConfParameters() (*ConfParameter, error)
GetWarehouses() (Warehouses, error)
GetUserName() (string, error)
GetSalesDocumentByID(id string) ([]SaleDocument, error)
GetSalesDocumentsByIDs(id []string) ([]SaleDocument, error)
GetCustomersByIDs(customerID []string) (Customers, error)
GetCustomerByRegNumber(regNumber string) (*Customer, error)
GetCustomerByGLN(gln string) (*Customer, error)
GetSupplierByName(name string) (*Customer, error)
GetVatRatesByID(vatRateID string) (VatRates, error)
GetCompanyInfo() (*CompanyInfo, error)
GetProductUnits() ([]ProductUnit, error)
GetProductsByIDs(ids []string) ([]Product, error)
GetProductsByCode3(code3 string) (*Product, error)
GetAddresses() (*Address, 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
GetPointsOfSaleByID(posID string) (*PointOfSale, error)
VerifyIdentityToken(jwt string) (*SessionInfo, error)
GetIdentityToken() (*IdentityToken, error)
Close()
}
IClient interface for cached and simple client
type IdentityToken ¶
type IdentityToken struct {
Jwt string `json:"identityToken"`
}
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 NetTotalsByRate ¶
type NetTotalsByRate struct {
}
type NetTotalsByRates ¶
type NetTotalsByRates []NetTotalsByRate
type NetTotalsByTaxRate ¶
type NetTotalsByTaxRates ¶
type NetTotalsByTaxRates []NetTotalsByTaxRate
type PaymentAttribute ¶
type PaymentStatus ¶
type PaymentStatus string
type PaymentType ¶
type PaymentType string
type PointOfSale ¶
type PointOfSale struct {
WarehouseID int `json:"warehouseID"`
}
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"`
Name string `json:"name"`
Code string `json:"code"`
Code2 string `json:"code2"`
Code3 *string `json:"code3"`
Price float64 `json:"price"`
UnitName *string `json:"unitName"`
}
Product ...
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 ¶
ProductUnit ...
type PurchaseDocImportReport ¶
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 SaleDocImportReport ¶
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 SessionInfo ¶
type SessionInfo struct {
SessionKey string `json:"sessionKey"`
}
type Status ¶
type Status struct {
Request string `json:"request"`
RequestUnixTime int `json:"requestUnixTime"`
ResponseStatus string `json:"responseStatus"`
ErrorCode int `json:"errorCode"`
GenerationTime float64 `json:"generationTime"`
RecordsTotal int `json:"recordsTotal"`
RecordsInResponse int `json:"recordsInResponse"`
}
type UserCredentials ¶
type UserRights ¶
type UserRights struct {
UserName string `json:"userName"`
}
type VatTotalsByRate ¶
type VatTotalsByRate struct {
}
type VatTotalsByRates ¶
type VatTotalsByRates []VatTotalsByRate
type VatTotalsByTaxRate ¶
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 string `json:"pricelistID4"`
PricelistID5 string `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
Click to show internal directories.
Click to hide internal directories.