Documentation ¶
Index ¶
- Constants
- Variables
- type Cost
- type Direction
- type Feedback
- type Header
- type Item
- type Member
- type MemberRating
- type Message
- type Note
- type Order
- type OrderStatus
- type Orders
- func (o *Orders) DeleteMemberNote(name string) error
- func (o *Orders) GetFeedback(id int) (*Feedback, error)
- func (o *Orders) GetFeedbackList(options ...RequestOption) ([]Feedback, error)
- func (o *Orders) GetMemberNote(name string) (*Note, error)
- func (o *Orders) GetMemberRatings(name string) (*MemberRating, error)
- func (o Orders) GetOrder(id int) (*Order, error)
- func (o *Orders) GetOrderFeedback(id int) ([]Feedback, error)
- func (o *Orders) GetOrderHeader(id int) (*Header, error)
- func (o *Orders) GetOrderHeaders(options ...RequestOption) ([]Header, error)
- func (o *Orders) GetOrderItems(id int) ([]Item, error)
- func (o *Orders) GetOrderMessages(id int) ([]Message, error)
- func (o *Orders) GetShippingMethod(id int, options ...RequestOption) (*ShippingMethod, error)
- func (o *Orders) PostFeedback(fb Feedback) (*Feedback, error)
- func (o *Orders) RefreshShippingMethods() error
- func (o *Orders) ReplyFeedback(fb Feedback) error
- func (o *Orders) SendDriveThru(id int, options ...RequestOption) error
- func (o *Orders) Update(id int, order Order) error
- func (o *Orders) UpdateOrder(header Header) (*Header, error)
- func (o *Orders) UpdateOrderStatus(id int, status OrderStatus) error
- func (o *Orders) UpdatePaymentStatus(id int, status PaymentStatus) error
- func (o *Orders) UpsertMemberNote(note Note) (*Note, error)
- type PaymentStatus
- type Problem
- type RequestOption
- type Shipping
- type ShippingMethod
Constants ¶
const ( DirectionIn = "in" DirectionOut = "out" )
const ( ShippingAreaInternational = "I" ShippingAreaDomestic = "D" ShippingAreaBoth = "B" )
Variables ¶
var (
OrderStatusMap = make(map[string]OrderStatus)
)
var ProblemReasonIDs = map[int]string{
6: "Buyer did not respond to emails",
7: "Buyer email address bounced",
8: "Seller did not receive payment",
9: "Buyer found items elsewhere",
10: "Buyer no longer wants to purchase items",
11: "Buyer does not have enough funds to pay",
12: "Buyer did not comply with store policies",
13: "Buyer submitted a bogus orders",
16: "Buyer demanded a lower price on items",
57: "Package returned with incorrect address",
60: "Seller did not have items after orders was submitted",
63: "Buyer is underage",
70: "System Problem",
72: "Buyer is no longer registered",
97: "Package cannot be delivered to buyer's address",
100: "Buyer did not pay for orders",
107: "Mutual agreement between buyer and seller to cancel",
}
Functions ¶
This section is empty.
Types ¶
type Cost ¶
type Cost struct { CurrencyCode string `json:"currency_code,omitempty"` Subtotal string `json:"subtotal,omitempty"` GrandTotal string `json:"grand_total,omitempty"` Tax string `json:"salesTax_collected_by_BL,omitempty"` Etc1 string `json:"etc1,omitempty"` Etc2 string `json:"etc2,omitempty"` Insurance string `json:"insurance,omitempty"` Shipping string `json:"shipping,omitempty"` Credit string `json:"credit,omitempty"` Coupon string `json:"coupon,omitempty"` VatRate string `json:"vat_rate,omitempty"` VatAmount string `json:"vat_amount,omitempty"` }
type Direction ¶
type Direction string
Direction defines the directionality of the resource. It is used for feedback and orders. out = from this user in = to this user
type Feedback ¶
type Feedback struct { ID int `json:"feedback_id,omitempty"` OrderID int `json:"order_id"` From string `json:"from,omitempty"` To string `json:"to,omitempty"` DateRated time.Time `json:"date_rated,omitempty"` Rating util.Rating `json:"rating"` Rater string `json:"rating_of_bs,omitempty"` // rating of buyer or seller (B or S) Comment string `json:"comment"` Reply string `json:"reply,omitempty"` }
Feedback represents a feedback resource.
func (*Feedback) PrimaryKey ¶
type Header ¶
type Header struct { ID int `json:"order_id,omitempty"` DateOrdered *time.Time `json:"date_ordered,omitempty"` DateStatusChanged *time.Time `json:"date_status_changed,omitempty"` SellerName string `json:"seller_name,omitempty"` StoreName string `json:"store_name,omitempty"` BuyerName string `json:"buyer_name,omitempty"` BuyerEmail string `json:"buyer_email,omitempty"` RequireInsurance *bool `json:"require_insurance,omitempty"` Status string `json:"status,omitempty"` IsInvoiced *bool `json:"is_invoiced,omitempty"` Remarks string `json:"remarks"` TotalCount int `json:"total_count,omitempty"` UniqueCount int `json:"unique_count,omitempty"` TotalWeight string `json:"total_weight,omitempty"` BuyerOrderCount int `json:"buyer_order_count,omitempty"` IsFiled *bool `json:"is_filed,omitempty"` DriveThruSent *bool `json:"drive_thru_sent,omitempty"` TaxCollected *bool `json:"salesTax_collected_by_bl ,omitempty"` Payment struct { Method string `json:"method,omitempty"` CurrencyCode string `json:"currency_code,omitempty"` DatePaid *time.Time `json:"date_paid,omitempty"` Status string `json:"status,omitempty"` } `json:"payment,omitempty"` Shipping Shipping `json:"shipping,omitempty"` Cost Cost `json:"cost,omitempty"` DispCost Cost `json:"disp_cost,omitempty"` }
func (Header) PrimaryKey ¶
type Item ¶
type Item struct { BatchID int `json:"-"` InventoryID int `json:"inventory_id"` Item reference.Item `json:"item"` ColorID int `json:"color_id"` ColorName string `json:"color_name"` Quantity int `json:"quantity"` NewOrUsed string `json:"new_or_used"` Completeness string `json:"completeness"` UnitPrice string `json:"unit_price"` UnitPriceFinal string `json:"unit_price_final"` DispUnitPrice string `json:"disp_unit_price"` DispUnitPriceFinal string `json:"disp_unit_price_final"` CurrencyCode string `json:"currency_code"` DispCurrencyCode string `json:"disp_currency_code"` Description string `json:"description"` Remarks string `json:"remarks"` Weight string `json:"weight"` }
func (Item) PrimaryKey ¶
type MemberRating ¶
type MemberRating struct { UserName string `json:"user_name"` Rating struct { Complaints int `json:"COMPLAINT"` Neutrals int `json:"NEUTRAL"` Praises int `json:"PRAISE"` } `json:"rating"` }
MemberRating represents a Bricklink user.
type Message ¶
type Message struct { Subject string `json:"subject"` Body string `json:"body"` From string `json:"from"` To string `json:"to"` DateSent time.Time `json:"dateSent"` }
func (*Message) PrimaryKey ¶
type Note ¶
type Note struct { ID int `json:"note_id,omitempty"` UserName string `json:"user_name"` Note string `json:"note_text"` DateNoted *time.Time `json:"date_noted,omitempty"` }
Note represents a note about a member.
func (*Note) PrimaryKey ¶
type Order ¶
type Order struct { Header Items []Item Messages []Message FeedbackSent Feedback FeedbackReceived Feedback }
func (Order) PrimaryKey ¶
type OrderStatus ¶
type OrderStatus int
OrderStatus represents the status of an order. The lifetime of a transaction is defined by its status. The below outlines each status an order can have: Statuses can be set by the seller, the buyer, or by the system. N?? statuses prevent buyers from placing additional orders until the issue is resolved. Buyers can add to orders in pending, updated, processing, or ready statuses.
const ( StatusUndefined OrderStatus = iota // System StatusPending StatusUpdated // System StatusProcessing // Seller StatusReady // Seller StatusPaid // Seller or System StatusPacked // Seller StatusShipped // Seller StatusReceived // Buyer StatusCompleted // Buyer or Seller StatusOCR // System StatusNPB // System StatusNPX // System StatusNRS // System StatusNSS // System StatusCancelled // System StatusPurged )
func (OrderStatus) String ¶
func (s OrderStatus) String() string
type Orders ¶
type Orders struct { *bricklink.Bricklink ShippingMethods map[int]ShippingMethod }
func (*Orders) DeleteMemberNote ¶
DeleteMemberNote deletes the member note.
func (*Orders) GetFeedback ¶
GetFeedback returns the feedback for the given feedback ID.
func (*Orders) GetFeedbackList ¶
func (o *Orders) GetFeedbackList(options ...RequestOption) ([]Feedback, error)
GetFeedbackList returns a list of feedback in the given direction.
func (*Orders) GetMemberNote ¶
GetMemberNote returns the note for a specific member.
func (*Orders) GetMemberRatings ¶
func (o *Orders) GetMemberRatings(name string) (*MemberRating, error)
GetMemberRatings returns the details feedback ratings for a specific member.
func (Orders) GetOrder ¶
GetOrder is a convenience method that returns everything about an order at once. If the first call succeeds, this method requires 4 API calls. Errors for messages, items, and feedback are logged as messages in the returned order. Errors will have 'Error' as the subject.
func (*Orders) GetOrderFeedback ¶
GetOrderFeedback returns the feedback for an order.
func (*Orders) GetOrderHeader ¶
GetOrderHeader retrieves the transactional data for a specific order. https://www.bricklink.com/v3/api.page?page=get-order
func (*Orders) GetOrderHeaders ¶
func (o *Orders) GetOrderHeaders(options ...RequestOption) ([]Header, error)
GetOrderHeaders retrieves a list of orders you received or placed. https://www.bricklink.com/v3/api.page?page=get-orders It does not include order items, messages, or problems. Use the GetOrder() helper to retrieve an order with the full order details.
func (*Orders) GetShippingMethod ¶
func (o *Orders) GetShippingMethod(id int, options ...RequestOption) (*ShippingMethod, error)
GetShippingMethod returns a shipping method by id from the cache. If forceRefresh is true, the cache will be refreshed. The Get Shipping Method endpoint is unneeded since a single call gets the entire list. Therefore, we can serve the response without additional api calls.
func (*Orders) PostFeedback ¶
PostFeedback posts feedback for an order. OrderID, Rating, and Comment must be set
func (*Orders) RefreshShippingMethods ¶
func (*Orders) ReplyFeedback ¶
ReplyFeedback replies to feedback. Reply must be set.
func (*Orders) SendDriveThru ¶
func (o *Orders) SendDriveThru(id int, options ...RequestOption) error
SendDriveThru issues a drive-thru message to the buyer for an order. https://www.bricklink.com/v3/api.page?page=send-drive-thru
func (*Orders) UpdateOrder ¶
UpdateOrder updates the properties of a specific order header. It strips out values that are read-only before submitting the update. https://www.bricklink.com/v3/api.page?page=update-order
func (*Orders) UpdateOrderStatus ¶
func (o *Orders) UpdateOrderStatus(id int, status OrderStatus) error
UpdateOrderStatus updates the order status for an order. https://www.bricklink.com/v3/api.page?page=update-order-status
func (*Orders) UpdatePaymentStatus ¶
func (o *Orders) UpdatePaymentStatus(id int, status PaymentStatus) error
UpdatePaymentStatus updates the payment for an order. https://www.bricklink.com/v3/api.page?page=update-payment-status
type PaymentStatus ¶
type PaymentStatus int
const ( PaymentStatusUndefined PaymentStatus = iota PaymentStatusNone PaymentStatusSent PaymentStatusReceived PaymentStatusClearing PaymentStatusReturned PaymentStatusBounced PaymentStatusCompleted )
func (PaymentStatus) String ¶
func (ps PaymentStatus) String() string
type RequestOption ¶
type RequestOption func(opts *requestOptions)
func WithDirection ¶
func WithDirection(dir Direction) RequestOption
func WithExcludeStatus ¶
func WithExcludeStatus(status OrderStatus) RequestOption
func WithFiled ¶
func WithFiled(b bool) RequestOption
func WithIncludeStatus ¶
func WithIncludeStatus(status OrderStatus) RequestOption
func WithRefresh ¶
func WithRefresh(b bool) RequestOption
type Shipping ¶
type Shipping struct { MethodID int `json:"method_id,omitempty"` Method string `json:"method,omitempty"` TrackingLink string `json:"tracking_link,omitempty"` TrackingNo string `json:"tracking_no,omitempty"` DateShipped *time.Time `json:"date_shipped,omitempty"` Address *struct { Name struct { Full string `json:"full,omitempty"` } `json:"name,omitempty"` Full string `json:"full,omitempty"` CountryCode string `json:"country_code,omitempty"` } `json:"address,omitempty"` }
type ShippingMethod ¶
type ShippingMethod struct { ID int `json:"method_id"` Name string `json:"name"` Note string `json:"note"` Insurance bool `json:"insurance"` IsDefault bool `json:"is_default"` Area string `json:"area"` // International, Domestic, Both (I/D/B) IsAvailable bool `json:"is_available"` }
func (ShippingMethod) Label ¶
func (sm ShippingMethod) Label() entity.Label
func (ShippingMethod) PrimaryKey ¶
func (sm ShippingMethod) PrimaryKey() int