Documentation
¶
Index ¶
- Constants
- type API
- func (a *API) AddressDelete(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) AddressList(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) AddressView(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) ClaimOrders(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) CouponView(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) CreateNewAddress(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) DownloadList(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) DownloadURL(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) Index(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) ListenAndServe(hostAndPort string) error
- func (a *API) OrderCreate(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) OrderList(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) OrderUpdate(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) OrderView(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaymentCreate(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaymentList(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaymentListForOrder(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaymentListForUser(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaymentRefund(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaymentView(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaypalCreatePayment(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) PaypalGetPayment(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) ProductsReport(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) ResendOrderReceipt(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) SalesReport(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) UserDelete(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) UserList(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) UserView(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) VatnumberLookup(ctx context.Context, w http.ResponseWriter, r *http.Request)
- type ChargerType
- type CouponApplyParams
- type CouponCache
- type CouponCacheFromURL
- type CouponNotFound
- type Experience
- type HTTPError
- type JWTClaims
- type OrderAddon
- type OrderLineItem
- type OrderParams
- type PaymentParams
- type ProductsRow
- type ReceiptParams
- type SalesRow
Constants ¶
const CacheTime = 1 * time.Minute
const DEFAULT_PER_PAGE = 50
const MaxConcurrentLookups = 10
MaxConcurrentLookups controls the number of simultaneous HTTP Order lookups
const MaxIPsPerDay = 50
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the main REST API
func NewAPIWithVersion ¶ added in v1.0.0
func NewAPIWithVersion(config *conf.Configuration, db *gorm.DB, paypal *paypalsdk.Client, mailer *mailer.Mailer, assets assetstores.Store, version string) *API
NewAPIWithVersion instantiates a new REST API
func (*API) AddressDelete ¶ added in v0.2.0
AddressDelete will soft delete the address associated with that user. It requires admin access return errors or 200 and no body
func (*API) AddressList ¶ added in v0.2.0
AddressList will return the addresses for a given user
func (*API) AddressView ¶ added in v0.2.0
AddressView will return a particular address for a given user
func (*API) ClaimOrders ¶ added in v1.0.0
ClaimOrders will look for any orders with no user id belonging to an email and claim them
func (*API) CouponView ¶ added in v1.1.0
func (*API) CreateNewAddress ¶ added in v0.2.0
CreateNewAddress will create an address associated with that user
func (*API) DownloadList ¶ added in v1.1.0
func (*API) DownloadURL ¶ added in v1.1.0
func (*API) ListenAndServe ¶
ListenAndServe starts the REST API
func (*API) OrderCreate ¶
OrderCreate endpoint
func (*API) OrderUpdate ¶ added in v0.2.0
OrderUpdate will allow an ADMIN only to update the details of a record it is also important to note that it will not let modification of an order if the order is no longer pending. Addresses can be made by posting a new one directly, OR by referencing one by ID. If both are provided, the one that is made by ID will win out and the other will be ignored. There are also blocks to changing certain fields after the state has been locked
func (*API) OrderView ¶
OrderView will request a specific order using the 'id' parameter. Only the owner of the order, an admin, or an anon order are allowed to be seen
func (*API) PaymentCreate ¶
PaymentCreate is the endpoint for creating a payment for an order
func (*API) PaymentList ¶
PaymentList will list all the payments that meet the criteria. It is only available to admins
func (*API) PaymentListForOrder ¶ added in v0.2.0
PaymentListForOrder is the endpoint for listing transactions for an order. You must be the owner of the order (user_id) or an admin. Listing the payments for an anon order.
func (*API) PaymentListForUser ¶ added in v0.2.0
PaymentListForUser is the endpoint for listing transactions for a user. The ID in the claim and the ID in the path must match (or have admin override)
func (*API) PaymentRefund ¶ added in v0.2.0
func (*API) PaymentView ¶ added in v0.2.0
func (*API) PaypalCreatePayment ¶ added in v1.0.0
PaypalCreatePayment creates a new payment that can be authorized in the browser
func (*API) PaypalGetPayment ¶ added in v1.0.0
PaypalGetPayment retrieves information on an authorized paypal payment, including the shipping address
func (*API) ProductsReport ¶ added in v1.1.0
ProductsReport list the products sold within a period
func (*API) ResendOrderReceipt ¶ added in v1.1.0
func (*API) SalesReport ¶ added in v1.1.0
SalesReport lists the sales numbers for a period
func (*API) UserDelete ¶ added in v0.2.0
UserDelete will soft delete the user. It requires admin access return errors or 200 and no body
func (*API) UserList ¶ added in v0.2.0
UserList will return all of the users. It requires admin access. It supports the filters: since iso8601 date before iso8601 date email email user_id id limit # of records to return (max)
func (*API) UserView ¶ added in v0.2.0
UserView will return the user specified. If you're an admin you can request a user that is not your self
func (*API) VatnumberLookup ¶
type ChargerType ¶ added in v1.0.0
type ChargerType string
const PaypalChargerType ChargerType = "paypal"
const StripeChargerType ChargerType = "stripe"
type CouponApplyParams ¶ added in v1.1.0
type CouponCache ¶ added in v1.1.0
func NewCouponCacheFromUrl ¶ added in v1.1.0
func NewCouponCacheFromUrl(config *conf.Configuration) CouponCache
type CouponCacheFromURL ¶ added in v1.1.0
type CouponCacheFromURL struct {
// contains filtered or unexported fields
}
type CouponNotFound ¶ added in v1.1.0
type CouponNotFound struct{}
func (CouponNotFound) Error ¶ added in v1.1.0
func (CouponNotFound) Error() string
type Experience ¶ added in v1.0.0
type Experience struct {
// contains filtered or unexported fields
}
type OrderAddon ¶ added in v1.1.0
type OrderAddon struct {
Sku string `json:"sku"`
}
type OrderLineItem ¶
type OrderLineItem struct { Sku string `json:"sku"` Path string `json:"path"` Quantity uint64 `json:"quantity"` Addons []OrderAddon `json:"addons"` MetaData map[string]interface{} `json:"meta"` }
type OrderParams ¶
type OrderParams struct { SessionID string `json:"session_id"` Email string `json:"email"` IP string `json:"ip"` ShippingAddressID string `json:"shipping_address_id"` ShippingAddress *models.Address `json:"shipping_address"` BillingAddressID string `json:"billing_address_id"` BillingAddress *models.Address `json:"billing_address"` VATNumber string `json:"vatnumber"` MetaData map[string]interface{} `json:"meta"` LineItems []*OrderLineItem `json:"line_items"` Currency string `json:"currency"` FulfillmentState string `json:"fulfillment_state"` CouponCode string `json:"coupon"` }
type PaymentParams ¶
type PaymentParams struct { Amount uint64 `json:"amount"` Currency string `json:"currency"` StripeToken string `json:"stripe_token"` PaypalID string `json:"paypal_payment_id"` PaypalUserID string `json:"paypal_user_id"` }
PaymentParams holds the parameters for creating a payment
type ProductsRow ¶ added in v1.1.0
type ReceiptParams ¶ added in v1.1.0
type ReceiptParams struct {
Email string `json:"email"`
}