Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteTemplate ¶
WriteTemplate writes the store template in the given path.
Types ¶
type Cart ¶
func (*Cart) HasCharges ¶ added in v0.1.9
HasCharges returns true if at least one item has a positive charge amount.
func (*Cart) TotalCents ¶
Total returns the total amount, with 2 decimal places accuracy.
type Config ¶
type Config struct { Root string Log slog.Logger LiveReload bool OrderPlaced func(order *Order, msg string) StatusChanged func(order *Order, msg string) PayType PayType Account string ShipCharge float64 Client *client.Client LNPayClient *client.DcrlnPaymentClient ExchangeRateProvider func() float64 }
Config holds the configuration for a simple store.
type Order ¶
type Order struct { ID OrderID `json:"id"` User clientintf.UserID `json:"user"` Cart Cart `json:"cart"` Status OrderStatus `json:"status"` PlacedTS time.Time `json:"placed_ts"` ResolvedTS *time.Time `json:"resolved_ts"` ShipCharge float64 `json:"ship_charge"` ExchangeRate float64 `json:"exchange_rate"` PayType PayType `json:"pay_type"` Invoice string `json:"invoice"` ShipAddr *ShippingAddress `json:"shipping"` Comments []OrderComment `json:"comments"` ExpiresTS time.Time `json:"expires_ts"` }
func (*Order) TotalCents ¶
Total returns the total amount, with 2 decimal places accuracy.
type OrderComment ¶
type OrderStatus ¶
type OrderStatus string
const ( StatusPlaced OrderStatus = "placed" StatusPaid OrderStatus = "paid" StatusShipped OrderStatus = "shipped" StatusCompleted OrderStatus = "completed" StatusCanceled OrderStatus = "canceled" )
type ShippingAddress ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a simple store instance. A simple store can render a front page (index) and individual product pages.
func (*Store) Fulfill ¶
func (s *Store) Fulfill(ctx context.Context, uid clientintf.UserID, request *rpc.RMFetchResource) (*rpc.RMFetchResourceReply, error)
Click to show internal directories.
Click to hide internal directories.