mobileorder

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       int `json:"id"`
	CampusID int `json:"campus_id"`
}

Account identifies the signed-in user without exposing authentication tokens.

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.

func ReadCart

func ReadCart(r io.Reader) (Cart, error)

ReadCart parses a caller-owned input without storing a cart or history.

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 CartOption struct {
	ID     int         `json:"optionid"`
	Values []CartValue `json:"values"`
}

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 CartValue

type CartValue struct {
	ID          int        `json:"valueid"`
	ComboItemID int        `json:"combo_itemid"`
	ComboItems  []CartItem `json:"combo_items"`
}

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 New

func New() *Client

New constructs a client without credentials or persistent state.

func Open

func Open(ctx context.Context, options auth.Options) (*Client, error)

Open completes USC SSO and keeps the Transact identity in memory.

func (*Client) Account

func (c *Client) Account(ctx context.Context) (*Account, error)

Account verifies the current token and returns the account identity.

func (*Client) BuildCart

func (c *Client) BuildCart(ctx context.Context, s CartSelection) (*Cart, error)

BuildCart resolves item selections against one current menu. It does not quote or submit the cart and never selects default modifier values.

func (*Client) Campuses

func (c *Client) Campuses(ctx context.Context) ([]Campus, error)

Campuses returns the public campus directory.

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, id int) (*Acknowledgement, error)

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

func (c *Client) ContinueOrder(ctx context.Context, id int) (*OrderProgress, error)

ContinueOrder advances/checks an already staged purchase; it may process payment.

func (*Client) Item

func (c *Client) Item(ctx context.Context, o MenuOptions, id int) (*Item, error)

func (*Client) Locations

func (c *Client) Locations(ctx context.Context) ([]Location, error)

Locations returns the current campus dining locations.

func (*Client) Menu

func (c *Client) Menu(ctx context.Context, o MenuOptions) (*Menu, error)

func (*Client) Orders

func (c *Client) Orders(ctx context.Context, pending bool) ([]Order, error)

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".

func (*Client) Quote

func (c *Client) Quote(ctx context.Context, cart Cart) (*Quote, error)

func (*Client) USC

func (c *Client) USC(ctx context.Context) (*Campus, error)

USC returns USC Campus Dining's directory entry.

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 FlatMenuItem struct {
	MenuItem
	SectionID        int    `json:"section_id"`
	Section          string `json:"section"`
	SectionAvailable bool   `json:"section_available"`
}

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 ItemOption struct {
	ID            int         `json:"id"`
	Name          string      `json:"name"`
	Minimum       int         `json:"minimum"`
	Maximum       int         `json:"maximum"`
	AllowQuantity bool        `json:"allow_quantity"`
	Values        []ItemValue `json:"values"`
}

type ItemValue

type ItemValue struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Price       int    `json:"price"`
	Available   bool   `json:"available"`
	ComboItemID int    `json:"combo_item_id,omitempty"`
}

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 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.

func (m Menu) Flatten() FlatMenu
type MenuItem struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Price     int    `json:"price"`
	Available bool   `json:"available"`
}
type MenuOptions struct {
	LocationID    int
	Fulfillment   Fulfillment
	PaymentMethod int
	TenderID      int
	Date          string
	Time          string
}

MenuOptions selects explicit fulfillment and payment context.

type MenuSection struct {
	ID        int        `json:"id"`
	Name      string     `json:"name"`
	Available bool       `json:"available"`
	Items     []MenuItem `json:"items"`
}

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

type PaymentMethod struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

PaymentMethod identifies an existing account payment method; it never contains a token.

type Quote

type Quote struct {
	Total int             `json:"total"`
	Cart  json.RawMessage `json:"cart"`
	Date  string          `json:"date"`
	Time  string          `json:"time"`
}

Quote contains server pricing and scheduling details. It does not place an order.

Jump to

Keyboard shortcuts

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