Documentation
¶
Overview ¶
Package mobileorder provides Transact Mobile Ordering discovery and authenticated reads.
Application protocol constants shipped in the public Android client. These identify the app; user authentication still requires genuine USC SSO.
Index ¶
- type Account
- type Acknowledgement
- type Campus
- type Cart
- type CartItem
- type CartOption
- type CartSelection
- type CartValue
- type CheckoutOptions
- type Client
- func (c *Client) Account(ctx context.Context) (*Account, error)
- func (c *Client) BuildCart(ctx context.Context, s CartSelection) (*Cart, error)
- func (c *Client) Campuses(ctx context.Context) ([]Campus, error)
- func (c *Client) CancelOrder(ctx context.Context, id int) (*Acknowledgement, error)
- func (c *Client) CheckInOrder(ctx context.Context, id int, barcode string) (*Acknowledgement, error)
- func (c *Client) CheckoutOptions(ctx context.Context, o MenuOptions) (*CheckoutOptions, error)
- func (c *Client) ContinueOrder(ctx context.Context, id int) (*OrderProgress, error)
- func (c *Client) Item(ctx context.Context, o MenuOptions, id int) (*Item, error)
- func (c *Client) Locations(ctx context.Context) ([]Location, error)
- func (c *Client) Menu(ctx context.Context, o MenuOptions) (*Menu, error)
- func (c *Client) Orders(ctx context.Context, pending bool) ([]Order, error)
- func (c *Client) PaymentMethods(ctx context.Context) ([]PaymentMethod, error)
- func (c *Client) PlaceOrder(ctx context.Context, cart Cart, expectedTotal int) (*OrderProgress, error)
- func (c *Client) Quote(ctx context.Context, cart Cart) (*Quote, error)
- func (c *Client) USC(ctx context.Context) (*Campus, error)
- type FlatMenu
- type FlatMenuItem
- type Fulfillment
- type Item
- type ItemOption
- type ItemValue
- type Location
- type Menu
- type MenuItem
- type MenuOptions
- type MenuSection
- type Order
- type OrderProgress
- type OutcomeUnknown
- type PaymentMethod
- type Quote
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acknowledgement ¶
type Acknowledgement struct {
Accepted bool `json:"accepted"`
}
Acknowledgement confirms an action accepted by the API.
type Campus ¶
type Campus struct {
ID int `json:"id"`
Name string `json:"name"`
City string `json:"city"`
Timezone string `json:"timezone"`
}
Campus describes a campus in the Transact directory.
type Cart ¶
type Cart struct {
LocationID int `json:"location_id"`
Fulfillment Fulfillment `json:"fulfillment"`
PaymentMethod *int `json:"payment_method"`
TenderID int `json:"tender_id"`
SecondaryTenderID int `json:"secondary_tender_id"`
Date *string `json:"date"`
Time *string `json:"time"`
PickupSpotID int `json:"pickup_spot_id"`
Comment string `json:"comment"`
CheckoutChoices []int `json:"checkout_choices"`
Items []CartItem `json:"items"`
}
Cart is an explicit purchase selection. Amounts are integer cents. Repeat an item entry to request multiple units, as the Android app does.
type CartItem ¶
type CartItem struct {
ItemID int `json:"itemid"`
SectionID int `json:"sectionid"`
MealExchange bool `json:"meal_ex_applied"`
Options []CartOption `json:"options"`
}
type CartOption ¶
type CartSelection ¶
type CartSelection struct {
Cart Cart
ItemIDs []int
// Choices are ITEM_ID:VALUE_ID. Combo child items use their own item IDs.
Choices []string
}
CartSelection supplies explicit choices while menu metadata supplies section and option IDs. Repeating an item ID adds another unit with the same choices.
type CheckoutOptions ¶
type CheckoutOptions struct {
LocationID int `json:"location_id"`
Status string `json:"status"`
Instructions string `json:"instructions,omitempty"`
CommentRequired bool `json:"comment_required"`
CommentInstructions string `json:"comment_instructions,omitempty"`
Dates json.RawMessage `json:"dates"`
Times json.RawMessage `json:"times"`
Tenders json.RawMessage `json:"tenders"`
PickupSpots json.RawMessage `json:"pickup_spots"`
Questions json.RawMessage `json:"questions"`
}
CheckoutOptions holds scheduling, tender rules and required checkout questions.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client accesses Transact Mobile Ordering. Its authentication token stays private.
func (*Client) BuildCart ¶
BuildCart resolves item selections against one current menu. It does not quote or submit the cart and never selects default modifier values.
func (*Client) CancelOrder ¶
func (*Client) CheckInOrder ¶
func (c *Client) CheckInOrder(ctx context.Context, id int, barcode string) (*Acknowledgement, error)
CheckInOrder announces arrival for a selected order using its check-in barcode.
func (*Client) CheckoutOptions ¶
func (c *Client) CheckoutOptions(ctx context.Context, o MenuOptions) (*CheckoutOptions, error)
func (*Client) ContinueOrder ¶
ContinueOrder advances/checks an already staged purchase; it may process payment.
func (*Client) PaymentMethods ¶
func (c *Client) PaymentMethods(ctx context.Context) ([]PaymentMethod, error)
func (*Client) PlaceOrder ¶
func (c *Client) PlaceOrder(ctx context.Context, cart Cart, expectedTotal int) (*OrderProgress, error)
PlaceOrder requotes and compares the exact expected total before submitting once. A returned stage is not a payment success until it equals "success".
type FlatMenu ¶
type FlatMenu struct {
Status string `json:"status"`
LocationID int `json:"location_id"`
Items []FlatMenuItem `json:"items"`
}
FlatMenu preserves venue status and section context alongside item summaries.
type FlatMenuItem ¶
type Fulfillment ¶
type Fulfillment string
Fulfillment identifies how an order is received.
const ( Pickup Fulfillment = "pickup" Delivery Fulfillment = "delivery" Address Fulfillment = "address" )
type Item ¶
type Item struct {
MenuItem
SectionID int `json:"section_id"`
Description string `json:"description,omitempty"`
Options []ItemOption `json:"options"`
}
Item includes the selections needed to construct a cart item.
type ItemOption ¶
type Location ¶
type Location struct {
ID int `json:"id"`
Name string `json:"name"`
PickupStatus string `json:"pickup_status"`
}
Location is a dining location available to the signed-in account.
type Menu ¶
type Menu struct {
Status string `json:"status"`
LocationID int `json:"location_id"`
Sections []MenuSection `json:"sections"`
}
Menu contains visible menu sections and item summaries; prices are cents.
type MenuOptions ¶
type MenuOptions struct {
LocationID int
Fulfillment Fulfillment
PaymentMethod int
TenderID int
Date string
Time string
}
MenuOptions selects explicit fulfillment and payment context.
type MenuSection ¶
type Order ¶
type Order struct {
ID int `json:"id"`
LocationID int `json:"location_id"`
Barcode string `json:"barcode"`
Total int `json:"total"`
Placed string `json:"placed"`
Complete bool `json:"complete"`
Refunded bool `json:"refunded"`
Items json.RawMessage `json:"items"`
}
Order includes fulfillment status and receipt data without the account envelope.
type OrderProgress ¶
type OrderProgress struct {
ID int `json:"id"`
Stage string `json:"stage"`
Message string `json:"message"`
}
OrderProgress is a staged checkout result. Only stage "success" means completed checkout.
type OutcomeUnknown ¶
type OutcomeUnknown struct{ ID int }
OutcomeUnknown means a purchase may have been accepted. Never automatically resubmit.
func (*OutcomeUnknown) Error ¶
func (e *OutcomeUnknown) Error() string
func (*OutcomeUnknown) ErrorCode ¶
func (e *OutcomeUnknown) ErrorCode() string
type PaymentMethod ¶
PaymentMethod identifies an existing account payment method; it never contains a token.