Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a74c2bae8 | ||
|
|
d7f1571e09 |
@@ -1,32 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/debyltech/go-snipcart/snipcart"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
snipcartApiKey := flag.String("key", "", "Snipcart API Key")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if *snipcartApiKey == "" {
|
|
||||||
log.Fatal("missing -key flag")
|
|
||||||
}
|
|
||||||
|
|
||||||
Client := snipcart.NewClient(*snipcartApiKey)
|
|
||||||
|
|
||||||
updateOrder := snipcart.SnipcartOrderUpdate{
|
|
||||||
Status: snipcart.Delivered,
|
|
||||||
}
|
|
||||||
|
|
||||||
response, err := Client.UpdateOrder("b35990df-c0ca-4014-94de-1caa7bd7bb51", &updateOrder)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v := range response.Items {
|
|
||||||
log.Printf("%v: %v\n", k, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -127,6 +127,18 @@ type SnipcartProductVariant struct {
|
|||||||
AllowBackorder bool `json:"allowOutOfStockPurchases"`
|
AllowBackorder bool `json:"allowOutOfStockPurchases"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SnipcartProductCustomField struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Placeholder string `json:"placeholder"`
|
||||||
|
DisplayValue string `json:"displayValue"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Options string `json:"options"`
|
||||||
|
Required bool `json:"required"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
Operation float64 `json:"operation"`
|
||||||
|
OptionsArray []string `json:"optionsArray"`
|
||||||
|
}
|
||||||
|
|
||||||
type SnipcartProduct struct {
|
type SnipcartProduct struct {
|
||||||
Token string `json:"id"`
|
Token string `json:"id"`
|
||||||
Id string `json:"userDefinedId"`
|
Id string `json:"userDefinedId"`
|
||||||
@@ -134,6 +146,7 @@ type SnipcartProduct struct {
|
|||||||
Stock int `json:"stock"`
|
Stock int `json:"stock"`
|
||||||
TotalStock int `json:"totalStock"`
|
TotalStock int `json:"totalStock"`
|
||||||
AllowBackorder bool `json:"allowOutOfStockPurchases"`
|
AllowBackorder bool `json:"allowOutOfStockPurchases"`
|
||||||
|
CustomFields []SnipcartProductCustomField `json:"customFields"`
|
||||||
Variants []SnipcartProductVariant `json:"variants"`
|
Variants []SnipcartProductVariant `json:"variants"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user