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) CreateNewAddress(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) 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 Experience
- type HTTPError
- type JWTClaims
- type OrderLineItem
- type OrderParams
- type PaymentParams
Constants ¶
const MaxConcurrentLookups = 10
MaxConcurrentLookups controls the number of simultaneous HTTP Order lookups
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, 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
func (*API) CreateNewAddress ¶ added in v0.2.0
CreateNewAddress will create an address associated with that user
func (*API) ListenAndServe ¶
ListenAndServe starts the REST API
func (*API) OrderCreate ¶
OrderCreate endpoint
func (*API) OrderList ¶
OrderList can query based on
- orders since &from=iso8601 - default = 0
- orders before &to=iso8601 - default = now
- sort asc or desc &sort=[asc | desc] - default = desc
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) 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 Experience ¶ added in v1.0.0
type Experience struct {
// contains filtered or unexported fields
}
type JWTClaims ¶
type JWTClaims struct { ID string `json:"id"` Email string `json:"email"` Groups []string `json:"groups"` *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"` PaypalID string `json:"paypal_payment_id"` PaypalUserID string `json:"paypal_user_id"` }
PaymentParams holds the parameters for creating a payment