Documentation
¶
Index ¶
- type Address
- type AppliedDiscount
- type Client
- func (s *Client) GetAvailableStatuses() (statuses Statuses, err error)
- func (s *Client) GetCouponsForOrders(os []Order) (err error)
- func (s *Client) GetHydratedOrderByID(orderID string) (order Order, err error)
- func (s *Client) GetHydratedOrders(oq Query) (*[]Order, error)
- func (s *Client) GetOrderCount() (*OrderCount, error)
- func (s *Client) GetOrderFromRawQuery(rawQuery string) (*[]Order, error)
- func (s *Client) GetOrderQuery(oq Query) (*[]Order, error)
- func (s *Client) GetOrders(status int) (*[]Order, error)
- func (s *Client) GetOrdersAndProducts(status int) (*[]Order, error)
- func (s *Client) GetProductDetail(os []Order) (err error)
- func (s *Client) GetShipment(orderID int) (*[]Shipment, error)
- func (s *Client) GetShipments(oq Query) ([]Shipment, error)
- func (s *Client) GetShipmentsForOrders(os []Order) (err error)
- func (s *Client) GetShippingAddressesForOrders(os []Order) (err error)
- type Coupon
- type FormField
- type Order
- type OrderCount
- type OrderProduct
- type ProductOption
- type Query
- type Shipment
- type ShipmentOrderItem
- type ShippingAddress
- type StatusCount
- type StatusElement
- type Statuses
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Company string `json:"company,omitempty"`
Street1 string `json:"street_1,omitempty"`
Street2 string `json:"street_2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zip string `json:"zip,omitempty"`
Country string `json:"country,omitempty"`
CountryIso2 string `json:"country_iso2,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
FormFields []FormField `json:"form_fields,omitempty"`
}
Address is a struct that represents a BigCommerce address resource
type AppliedDiscount ¶
type AppliedDiscount struct {
ID string `json:"id,omitempty"`
Amount float64 `json:"amount,string,omitempty"`
Name string `json:"name,omitempty"`
Code interface{} `json:"code"`
Target string `json:"target,omitempty"`
}
AppliedDiscount is a struct that represents the applied discounts included in the order product resource
type Client ¶
Client is a wrapper struct that embeds the BCClient from the client package. It handles connection to the BigCommerce API
func (*Client) GetAvailableStatuses ¶ added in v0.4.0
GetAvailableStatuses will return a sorted slice of order statuses from the BC API
func (*Client) GetCouponsForOrders ¶ added in v0.3.0
GetCouponsForOrders - Will attempt to concurrently fill the order slice elements with their respective coupon objects from the BC api
func (*Client) GetHydratedOrderByID ¶ added in v0.3.4
GetHydratedOrderByID - return a single order with Products, Shipping Addresses, and Coupons Populated.
func (*Client) GetHydratedOrders ¶ added in v0.3.0
GetHydratedOrders Return a slice of Order structs based on passed in query object
func (*Client) GetOrderCount ¶
func (s *Client) GetOrderCount() (*OrderCount, error)
GetOrderCount will return an OrderCount struct containing statuses and counts
func (*Client) GetOrderFromRawQuery ¶ added in v0.6.0
GetOrderQuery will return an ordered by ID slice of Order structs based on passed in query object
func (*Client) GetOrderQuery ¶
GetOrderQuery will return an ordered by ID slice of Order structs based on passed in query object
func (*Client) GetOrdersAndProducts ¶
GetOrdersAndProducts will return a slice of Order structs with their products based on passed in status
func (*Client) GetProductDetail ¶
GetProductDetail - Will attempt to concurrently fill the order slice elements with their respective products from the BC api
func (*Client) GetShipment ¶ added in v0.5.0
GetShipment will return a slice of Shipment structs containing the shipment information
func (*Client) GetShipments ¶
GetShipments will get shipments from the orders returned by the query
func (*Client) GetShipmentsForOrders ¶ added in v0.5.0
GetShipmentsForOrders - Will attempt to concurrently fill the order slice elements with their respective shipment objects from the BC api
func (*Client) GetShippingAddressesForOrders ¶ added in v0.2.0
GetShippingAddressesForOrders - Will attempt to concurrently fill the order slice elements with their respective shipping addresses from the BC api
type Coupon ¶ added in v0.3.0
type Coupon struct {
Amount string `json:"amount,omitempty"`
Code string `json:"code,omitempty"`
CouponID int64 `json:"coupon_id,omitempty"`
Discount float64 `json:"discount,string"`
ID int64 `json:"id,omitempty"`
OrderID int64 `json:"order_id,omitempty"`
Type int64 `json:"type,omitempty"`
}
Coupon is a struct that represents the coupon detail objects that are part of the order
func (*Coupon) CouponType ¶ added in v0.3.0
CouponType will get you the text representation of the coupon type
type Order ¶
type Order struct {
ID int64 `json:"id,omitempty"`
CustomerID int64 `json:"customer_id,omitempty"`
DateCreated primative.BCDate `json:"date_created,omitempty"`
DateModified primative.BCDate `json:"date_modified,omitempty"`
DateShipped primative.BCDate `json:"date_shipped,omitempty"`
StatusID int64 `json:"status_id,omitempty"`
Status string `json:"status,omitempty"`
SubtotalExTax float64 `json:"subtotal_ex_tax,string"`
SubtotalIncTax float64 `json:"subtotal_inc_tax,string"`
SubtotalTax float64 `json:"subtotal_tax,string"`
BaseShippingCost float64 `json:"base_shipping_cost,string"`
ShippingCostExTax float64 `json:"shipping_cost_ex_tax,string"`
ShippingCostIncTax float64 `json:"shipping_cost_inc_tax,string"`
ShippingCostTax float64 `json:"shipping_cost_tax,string"`
ShippingCostTaxClassID int64 `json:"shipping_cost_tax_class_id,omitempty"`
BaseHandlingCost float64 `json:"base_handling_cost,string"`
HandlingCostExTax float64 `json:"handling_cost_ex_tax,string"`
HandlingCostIncTax float64 `json:"handling_cost_inc_tax,string"`
HandlingCostTax float64 `json:"handling_cost_tax,string"`
HandlingCostTaxClassID int64 `json:"handling_cost_tax_class_id,omitempty"`
BaseWrappingCost float64 `json:"base_wrapping_cost,string"`
WrappingCostExTax float64 `json:"wrapping_cost_ex_tax,string"`
WrappingCostIncTax float64 `json:"wrapping_cost_inc_tax,string"`
WrappingCostTax float64 `json:"wrapping_cost_tax,string"`
WrappingCostTaxClassID int64 `json:"wrapping_cost_tax_class_id,omitempty"`
TotalExTax float64 `json:"total_ex_tax,string"`
TotalIncTax float64 `json:"total_inc_tax,string"`
TotalTax float64 `json:"total_tax,string"`
ItemsTotal int64 `json:"items_total,omitempty"`
ItemsShipped int64 `json:"items_shipped,omitempty"`
PaymentMethod string `json:"payment_method,omitempty"`
PaymentProviderID string `json:"payment_provider_id,omitempty"`
PaymentStatus string `json:"payment_status,omitempty"`
RefundedAmount float64 `json:"refunded_amount,string"`
OrderIsDigital bool `json:"order_is_digital,omitempty"`
StoreCreditAmount float64 `json:"store_credit_amount,string"`
GiftCertificateAmount float64 `json:"gift_certificate_amount,string"`
IPAddress string `json:"ip_address,omitempty"`
GeoipCountry string `json:"geoip_country,omitempty"`
GeoipCountryIso2 string `json:"geoip_country_iso2,omitempty"`
CurrencyID int64 `json:"currency_id,omitempty"`
CurrencyCode string `json:"currency_code,omitempty"`
CurrencyExchangeRate string `json:"currency_exchange_rate,omitempty"`
DefaultCurrencyID int64 `json:"default_currency_id,omitempty"`
DefaultCurrencyCode string `json:"default_currency_code,omitempty"`
StaffNotes string `json:"staff_notes,omitempty"`
CustomerMessage string `json:"customer_message,omitempty"`
DiscountAmount float64 `json:"discount_amount,string"`
CouponDiscount float64 `json:"coupon_discount,string"`
ShippingAddressCount int64 `json:"shipping_address_count,omitempty"`
IsDeleted bool `json:"is_deleted,omitempty"`
EbayOrderID string `json:"ebay_order_id,omitempty"`
CartID string `json:"cart_id,omitempty"`
BillingAddress Address `json:"billing_address,omitempty"`
IsEmailOptIn bool `json:"is_email_opt_in,omitempty"`
CreditCardType interface{} `json:"credit_card_type"`
OrderSource string `json:"order_source,omitempty"`
ChannelID int64 `json:"channel_id,omitempty"`
ExternalSource interface{} `json:"external_source"`
ProductResource primative.Resource `json:"products,omitempty"`
Products []OrderProduct
ShippingResource primative.Resource `json:"shipping_addresses,omitempty"`
ShippingAddresses []ShippingAddress
CouponResource primative.Resource `json:"coupons,omitempty"`
Coupons []Coupon
Shipments []Shipment
ExternalID interface{} `json:"external_id"`
ExternalMerchantID interface{} `json:"external_merchant_id"`
TaxProviderID string `json:"tax_provider_id,omitempty"`
StoreDefaultCurrencyCode string `json:"store_default_currency_code,omitempty"`
StoreDefaultToTransactionalExchangeRate string `json:"store_default_to_transactional_exchange_rate,omitempty"`
CustomStatus string `json:"custom_status,omitempty"`
}
Order is a struct that represents the return body of BigCommerce GET /orders
type OrderCount ¶
type OrderCount struct {
StatusCounts []StatusCount `json:"statuses"`
Count int `json:"count"`
}
OrderCount is a struct that represents the return body of BigCommerce GET /orders/count
StatusCounts should be sorted based on the sort order in bigcommerce status
type OrderProduct ¶
type OrderProduct struct {
ID int64 `json:"id,omitempty"`
OrderID int64 `json:"order_id,omitempty"`
ProductID int64 `json:"product_id,omitempty"`
OrderAddressID int64 `json:"order_address_id,omitempty"`
Name string `json:"name,omitempty"`
Sku string `json:"sku,omitempty"`
Upc string `json:"upc,omitempty"`
Type string `json:"type,omitempty"`
BasePrice float64 `json:"base_price,string"`
PriceExTax float64 `json:"price_ex_tax,string"`
PriceIncTax float64 `json:"price_inc_tax,string"`
PriceTax float64 `json:"price_tax,string"`
BaseTotal float64 `json:"base_total,string"`
TotalExTax float64 `json:"total_ex_tax,string"`
TotalIncTax float64 `json:"total_inc_tax,string"`
TotalTax float64 `json:"total_tax,string"`
Weight float64 `json:"weight,string"`
Quantity int64 `json:"quantity,omitempty"`
BaseCostPrice float64 `json:"base_cost_price,string"`
CostPriceIncTax float64 `json:"cost_price_inc_tax,string"`
CostPriceExTax float64 `json:"cost_price_ex_tax,string"`
CostPriceTax float64 `json:"cost_price_tax,string"`
IsRefunded bool `json:"is_refunded,omitempty"`
QuantityRefunded int64 `json:"quantity_refunded,omitempty"`
RefundAmount float64 `json:"refund_amount,string"`
ReturnID int64 `json:"return_id,omitempty"`
WrappingName string `json:"wrapping_name,omitempty"`
BaseWrappingCost float64 `json:"base_wrapping_cost,string"`
WrappingCostExTax float64 `json:"wrapping_cost_ex_tax,string"`
WrappingCostIncTax float64 `json:"wrapping_cost_inc_tax,string"`
WrappingCostTax float64 `json:"wrapping_cost_tax,string"`
WrappingMessage string `json:"wrapping_message,omitempty"`
QuantityShipped int64 `json:"quantity_shipped,omitempty"`
FixedShippingCost float64 `json:"fixed_shipping_cost,string"`
EbayItemID string `json:"ebay_item_id,omitempty"`
EbayTransactionID string `json:"ebay_transaction_id,omitempty"`
OptionSetID int64 `json:"option_set_id,omitempty"`
ParentOrderProductID interface{} `json:"parent_order_product_id,omitempty"`
IsBundledProduct bool `json:"is_bundled_product,omitempty"`
BinPickingNumber string `json:"bin_picking_number,omitempty"`
ExternalID interface{} `json:"external_id,omitempty"`
FulfillmentSource string `json:"fulfillment_source,omitempty"`
AppliedDiscounts []AppliedDiscount `json:"applied_discounts,omitempty"`
ProductOptions []ProductOption `json:"product_options,omitempty"`
ConfigurableFields []interface{} `json:"configurable_fields,omitempty"`
}
OrderProduct is a struct that represents the product sub object that is part of the Order
type ProductOption ¶
type ProductOption struct {
ID int64 `json:"id,omitempty"`
OptionID int64 `json:"option_id,omitempty"`
OrderProductID int64 `json:"order_product_id,omitempty"`
ProductOptionID int64 `json:"product_option_id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
DisplayValue string `json:"display_value,omitempty"`
Value string `json:"value,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
DisplayStyle string `json:"display_style,omitempty"`
}
ProductOption is a struct that represents the product option detail objects that are part of the order product
type Query ¶ added in v0.3.0
type Query struct {
MinID int `url:"min_id,omitempty"`
MaxID int `url:"max_id,omitempty"`
MinTotal float64 `url:"min_total,omitempty"`
MaxTotal float64 `url:"max_total,omitempty"`
CustomerID int `url:"customer_id,omitempty"`
Email string `url:"email,omitempty"`
StatusID int `url:"status_id,omitempty"`
StatusIDIsZero bool `url:"-"`
CartID string `url:"cart_id,omitempty"`
PaymentMethod string `url:"payment_method,omitempty"`
MinDateCreated time.Time `url:"-"`
MaxDateCreated time.Time `url:"-"`
MinDateModified time.Time `url:"-"`
MaxDateModified time.Time `url:"-"`
Page int `url:"page,omitempty"`
Limit int `url:"limit,omitempty"`
Sort string `url:"sort,omitempty"`
IsDeleted bool `url:"is_deleted,omitempty"`
MinDateCreatedRaw string `url:"min_date_created,omitempty"`
MaxDateCreatedRaw string `url:"max_date_created,omitempty"`
MinDateModifiedRaw string `url:"min_date_modified,omitempty"`
MaxDateModifiedRaw string `url:"max_date_modified,omitempty"`
}
Query struct to handle orders endpoint search query params, if you want orders with a status of 0 ("incomplete" in BC) you should set StatusIDIsZero to true, otherwise it will be ignored as a zero value when building the REST query
func (Query) GetRawQuery ¶ added in v0.3.0
GetRawQuery gets the struct in query string form
type Shipment ¶
type Shipment struct {
ID int64 `json:"id"`
OrderID int64 `json:"order_id"`
CustomerID int64 `json:"customer_id"`
OrderAddressID int64 `json:"order_address_id"`
DateCreated primative.BCDate `json:"date_created"`
TrackingNumber string `json:"tracking_number"`
MerchantShippingCost float64 `json:"merchant_shipping_cost,string"`
ShippingMethod string `json:"shipping_method"`
Comments string `json:"comments"`
ShippingProvider string `json:"shipping_provider"`
TrackingCarrier string `json:"tracking_carrier"`
TrackingLink string `json:"tracking_link"`
BillingAddress Address `json:"billing_address"`
ShippingAddress Address `json:"shipping_address"`
Items []ShipmentOrderItem `json:"items"`
}
Shipment is a struct that represents BC shipment
type ShipmentOrderItem ¶ added in v0.3.0
type ShipmentOrderItem struct {
OrderProductID int64 `json:"order_product_id"`
ProductID int64 `json:"product_id"`
Quantity int64 `json:"quantity"`
}
ShipmentOrderItem is a struct that represents BC orderitem
type ShippingAddress ¶
ShippingAddress is a struct that represents a BigCommerce shipping address resource
type StatusCount ¶
type StatusCount struct {
StatusElement
SortOrder int `json:"sort_order"`
Count int `json:"count"`
}
StatusCount is a struct that represents the individual statuses and count returned by BigCommerce GET /orders/count
type StatusElement ¶ added in v0.3.4
type StatusElement struct {
CustomLabel string `json:"custom_label,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Order int64 `json:"order,omitempty"`
SystemDescription string `json:"system_description,omitempty"`
SystemLabel string `json:"system_label,omitempty"`
}
StatusElement is a struct that represents the individual order status from BigCommerce
type Statuses ¶ added in v0.4.0
type Statuses []StatusElement
Statuses is a slice of structs that represent the individual order statuses from BigCommerce