Documentation
¶
Index ¶
- Constants
- func BadRequestError(w http.ResponseWriter, message string)
- func InternalServerError(w http.ResponseWriter, message string)
- func NotFoundError(w http.ResponseWriter, message string)
- func UnauthorizedError(w http.ResponseWriter, message string)
- func UnprocessableEntity(w http.ResponseWriter, message string)
- type API
- 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) 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) VatnumberLookup(ctx context.Context, w http.ResponseWriter, r *http.Request)
- type HTTPError
- type JWTClaims
- type OrderLineItem
- type OrderParams
- type PaymentParams
Constants ¶
View Source
const MaxConcurrentLookups = 10
MaxConcurrentLookups controls the number of simultaneous HTTP Order lookups
Variables ¶
This section is empty.
Functions ¶
func BadRequestError ¶
func BadRequestError(w http.ResponseWriter, message string)
BadRequestError is simple Error Wrapper
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, message string)
InternalServerError is simple Error Wrapper
func NotFoundError ¶
func NotFoundError(w http.ResponseWriter, message string)
NotFoundError is simple Error Wrapper
func UnauthorizedError ¶
func UnauthorizedError(w http.ResponseWriter, message string)
UnauthorizedError is simple Error Wrapper
func UnprocessableEntity ¶
func UnprocessableEntity(w http.ResponseWriter, message string)
UnprocessableEntity is simple Error Wrapper
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the main REST API
func (*API) ListenAndServe ¶
ListenAndServe starts the REST API
func (*API) OrderCreate ¶
OrderCreate endpoint
func (*API) PaymentCreate ¶
PaymentCreate is the endpoint for creating a payment for an order
func (*API) PaymentList ¶
PaymentList is the endpoint for listing transactions for an order
func (*API) VatnumberLookup ¶
type JWTClaims ¶
type JWTClaims struct { ID string `json:"id"` Email string `json:"email"` *jwt.StandardClaims }
type OrderLineItem ¶
type OrderParams ¶
type OrderParams struct { SessionID string `json:"session_id"` Email string `json:"email"` 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"` Data map[string]interface{} `json:"data"` LineItems []*OrderLineItem `json:"line_items"` Currency string `json:"currency"` }
type PaymentParams ¶
type PaymentParams struct { Amount uint64 `json:"amount"` Currency string `json:"currency"` StripeToken string `json:"stripe_token"` }
PaymentParams holds the parameters for creating a payment
Click to show internal directories.
Click to hide internal directories.