shopify

package
v0.0.0-...-dd33f9c Latest Latest
Warning

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

Go to latest
Published: May 19, 2016 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name        string `json:"name"`
	Company     string `json:"company,omitempty"`
	Address1    string `json:"address1"`
	Address2    string `json:"address2,omitempty"`
	City        string `json:"city"`
	State       string `json:"province,omitempty"`
	PostalCode  string `json:"zip"`
	CountryCode string `json:"country_code,omitempty"`
	Telephone   string `json:"phone,omitempty"`
}

Address maps the shopify Order Customer Address

type CartResponse

type CartResponse struct {
	Token string `json:"token"`
	Note  string `json:"note,omitempty"`
}

CartResponse models the shopify API response for cart

type Customer

type Customer struct {
	ID    int    `json:"id"`
	Email string `json:"email"`
}

Customer maps the shopify Order Customer

type Fulfillment

type Fulfillment struct {
	TrackingNumber string `json:"tracking_number,omitempty"`
	TrackingURL    string `json:"tracking_url,omitempty"`
	CreatedAt      string `json:"created_at,omitempty"` //"2015-05-18T19:09:32-04:00"
}

Fulfillment maps the shopify Order Fulfillments

type Item

type Item struct {
	Sku      string `json:"sku"`
	Quantity int    `json:"quantity"`
	//Data     string `json:"data"`
	Name      string `json:"name"`
	Price     string `json:"price"`
	TaxLines  []Tax  `json:"tax_lines"`
	VariantID int64  `json:"variant_id"`
}

Item maps the shopify Order Items

type Order

type Order struct {
	ID                 int           `json:"id,omitempty"`
	Name               string        `json:"name,omitempty"`
	Customer           Customer      `json:"customer"`
	Email              string        `json:"email,omitempty"`
	BillingAddress     Address       `json:"billing_address"`
	ShippingAddress    Address       `json:"shipping_address"`
	Shipping           []Shipping    `json:"shipping_lines"`
	DiscountCodes      []string      `json:"discount_codes,omitempty"`
	Note               string        `json:"note,omitempty"` //AutoDesk pspReferenceNumber here
	Items              []Item        `json:"line_items"`
	Fulfillments       []Fulfillment `json:"fulfillments,omitempty"`
	FulfillmentStatus  string        `json:"fulfillment_status,omitempty"`
	TotalPrice         string        `json:"total_price,omitempty"`
	TotalTax           string        `json:"total_tax,omitempty"`
	CreatedAt          string        `json:"created_at,omitempty"`   //"2015-05-18T19:09:32-04:00"
	CancelledAt        string        `json:"cancelled_at,omitempty"` //"2015-05-18T19:09:32-04:00"
	InventoryBehaviour string        `json:"inventory_behaviour,omitempty"`
	FinancialStatus    string        `json:"financial_status,omitempty"`
}

Order maps the shopify Order

type OrderResponse

type OrderResponse struct {
	SingleOrder Order   `json:"order"`
	Orders      []Order `json:"orders"`
}

OrderResponse models the shopify API response for order

type Product

type Product struct {
	BodyHTML       string           `json:"body_html,omitempty"`
	CreatedAt      string           `json:"created_at,omitempty"`
	Handle         string           `json:"handle,omitempty"`
	ID             int              `json:"id,omitempty"`
	ProductType    string           `json:"product_type,omitempty"`
	PublishedAt    string           `json:"published_at,omitempty"`
	PublishedScope string           `json:"published_scope,omitempty"`
	TemplateSuffix string           `json:"template_suffix,omitempty"`
	Title          string           `json:"title,omitempty"`
	UpdatedAt      string           `json:"updated_at,omitempty"`
	Vendor         string           `json:"vendor,omitempty"`
	Tags           string           `json:"tags,omitempty"`
	Variants       []ProductVariant `json:"variants,omitempty"`
	Options        []ProductOption  `json:"options,omitempty"`
	Images         []ProductImage   `json:"images,omitempty"`
	Image          ProductImage     `json:"image,omitempty"`
}

Product models the shopify product model

type ProductImage

type ProductImage struct {
	CreatedAt string `json:"created_at,omitempty"`
	ID        int    `json:"id,omitempty"`
	Position  int    `json:"position,omitempty"`
	ProductID int    `json:"product_id,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
	Src       string `json:"src,omitempty"`
}

ProductImage models the shopify product image object

type ProductOption

type ProductOption struct {
	ID        int    `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	Position  int    `json:"position,omitempty"`
	ProductID int    `json:"product_id,omitempty"`
}

ProductOption models the shopify product option

type ProductVariant

type ProductVariant struct {
	Barcode              string  `json:"barcode,omitempty"`
	CompareAtPrice       string  `json:"compare_at_price,omitempty"`
	CreatedAt            string  `json:"created_at,omitempty"`
	FulfillmentService   string  `json:"fulfillment_service,omitempty"`
	Grams                int     `json:"grams,omitempty"`
	ID                   int     `json:"id,omitempty"`
	InventoryManagement  string  `json:"inventory_management,omitempty"`
	InventoryPolicy      string  `json:"inventory_policy,omitempty"`
	Option1              string  `json:"option1,omitempty"`
	Option2              string  `json:"option2,omitempty"`
	Option3              string  `json:"option3,omitempty"`
	Position             int     `json:"position,omitempty"`
	Price                string  `json:"price,omitempty"`
	ProductID            int     `json:"product_id,omitempty"`
	RequiresShipping     bool    `json:"requires_shopping,omitempty"`
	Sku                  string  `json:"sku,omitempty"`
	Taxable              bool    `json:"taxable,omitempty"`
	Title                string  `json:"title,omitempty"`
	UpdatedAt            string  `json:"updated_at,omitempty"`
	InventoryQuantity    float64 `json:"inventory_quantity,omitempty"`
	OldInventoryQuantity int     `json:"old_inventory_quantity,omitempty"`
}

ProductVariant models the shopify product variant

type Shipping

type Shipping struct {
	Shipper  string `json:"source"`
	Method   string `json:"title"`
	Price    string `json:"price"`
	TaxLines []Tax  `json:"tax_lines"`
}

Shipping maps the shopify Order Shipping method

type ShippingRate

type ShippingRate struct {
	Name          string   `json:"name"`
	Code          string   `json:"code"`
	Price         string   `json:"price"`
	Source        string   `json:"source"`
	DeliveryDate  string   `json:"delivery_date"`
	DeliveryRange []string `json:"delivery_range"`
	DeliveryDays  []int    `json:"delivery_days"`
}

ShippingRate models the shopify ShippingRate object

type ShippingRatesResponse

type ShippingRatesResponse struct {
	ShippingRates []ShippingRate `json:"shipping_rates"`
	// Fields For Error cases responses:
	Zip      []string `json:"zip,omitempty"`
	Province []string `json:"province,omitempty"`
	Country  []string `json:"country,omitempty"`
	Error    []string `json:"error,omitempty"`
}

ShippingRatesResponse models the shopify ShippingRates array

type Shopify

type Shopify struct {
	Products []Product
	// contains filtered or unexported fields
}

Shopify models the shopify client parameters

func NewClient

func NewClient(domain string, secrettoken string, publicURL string) Shopify

NewClient inits shopify client

func (*Shopify) CancelOrder

func (shopifyClient *Shopify) CancelOrder(shopifyID string) (Order, error)

CancelOrder deletes order by ID

func (*Shopify) GetLiveProduct

func (shopifyClient *Shopify) GetLiveProduct(shopifyID string) (Product, error)

GetLiveProduct gets product by ID

func (*Shopify) GetOrder

func (shopifyClient *Shopify) GetOrder(shopifyID string) (Order, error)

GetOrder gets order by ID

func (*Shopify) GetOrderByName

func (shopifyClient *Shopify) GetOrderByName(shopifyOrderName string) (Order, error)

GetOrderByName gets order by Order Name

func (*Shopify) LoadProducts

func (shopifyClient *Shopify) LoadProducts()

LoadProducts returns first block of 250

func (*Shopify) PlaceOrder

func (shopifyClient *Shopify) PlaceOrder(order OrderResponse) (Order, error)

PlaceOrder creates a new order

func (*Shopify) ShippingOptions

func (shopifyClient *Shopify) ShippingOptions(order Order, postmasterKey string, additionalCharge float64) ([]ShippingRate, error)

ShippingOptions returns shipping options and rates for a given shipping address

type Tax

type Tax struct {
	Rate  float64 `json:"rate"`
	Price string  `json:"price"`
}

Tax maps the shopify Order Shipping Taxes

Jump to

Keyboard shortcuts

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