lookup endpoint updated
This commit is contained in:
@@ -56,13 +56,47 @@ type ScanStore struct {
|
||||
// store: the matched product itself, or one of its sizes. Each is a real
|
||||
// product row with its own price and stock, which is why they are flat.
|
||||
type ScanOption struct {
|
||||
Productid int `json:"productid"`
|
||||
Productname string `json:"productname"`
|
||||
Size string `json:"size"` // "500 g", "1 kg" — unitvalue + productunit
|
||||
Price float64 `json:"price"`
|
||||
Stock int `json:"stock"`
|
||||
Available bool `json:"available"`
|
||||
Image string `json:"image,omitempty"`
|
||||
// Where this is sold.
|
||||
//
|
||||
// On the option and not only on the enclosing store, because an order line
|
||||
// carries both and the app would otherwise have to reach back up the
|
||||
// response to build one. `Locationid` is the real outlet and never 0.
|
||||
Tenantid int `json:"tenantid"`
|
||||
Locationid int `json:"locationid"`
|
||||
|
||||
Productid int `json:"productid"`
|
||||
Productname string `json:"productname"`
|
||||
|
||||
// The pack size, both ways round.
|
||||
//
|
||||
// `Size` is the printable "500 g" the app has always shown. The two parts
|
||||
// are sent beside it because an order line needs the unit on its own, and
|
||||
// pulling it back out of the label means parsing a string a shop typed.
|
||||
Size string `json:"size"`
|
||||
Unitvalue string `json:"unitvalue"`
|
||||
Productunit string `json:"productunit"`
|
||||
|
||||
// What the customer pays: the outlet's own price, or the product's retail
|
||||
// price where the outlet has not set one.
|
||||
Price float64 `json:"price"`
|
||||
// What the shop paid. NOT a price to charge — it is `products.productcost`,
|
||||
// the same field the product screens return, and billing against it would
|
||||
// sell at cost.
|
||||
Productcost float64 `json:"productcost"`
|
||||
|
||||
// Carried on the order header, so the app has them without a second read.
|
||||
Categoryid int `json:"categoryid"`
|
||||
Subcategoryid int `json:"subcategoryid"`
|
||||
|
||||
Stock int `json:"stock"`
|
||||
Available bool `json:"available"`
|
||||
|
||||
// The same URL under both names: `image` is what this endpoint has always
|
||||
// sent, `productimage` is what every other product response calls it and
|
||||
// what an order line is built from.
|
||||
Image string `json:"image,omitempty"`
|
||||
Productimage string `json:"productimage,omitempty"`
|
||||
|
||||
// Is this the product that matched, or a size hanging under it?
|
||||
IsVariant bool `json:"is_variant"`
|
||||
Variantname string `json:"variantname,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user