Documentation ¶
Index ¶
- Variables
- func ErrInternalServer(err error) render.Renderer
- func ErrInvalidRequest(err error) render.Renderer
- func ErrInvalidRequestWithMessage(err error) render.Renderer
- func ErrRender(err error) render.Renderer
- func ErrRequestFailed(err error) render.Renderer
- func ErrRequestUnauthorized(err error) render.Renderer
- type ApplePaySessionResponse
- type ErrResponse
- type Server
- func (s *Server) CreateCharge() http.HandlerFunc
- func (s *Server) ErrInternalServer(err error) render.Renderer
- func (s *Server) ErrInvalidRequest(err error) render.Renderer
- func (s *Server) ErrInvalidRequestWithMessage(err error) render.Renderer
- func (s *Server) ErrRender(err error) render.Renderer
- func (s *Server) ErrRequestFailed(err error) render.Renderer
- func (s *Server) ErrRequestUnauthorized(err error) render.Renderer
- func (s *Server) GetApplePaySession() http.HandlerFunc
- func (s *Server) GetCharge() http.HandlerFunc
- func (s *Server) GetFullCheckout() http.HandlerFunc
- func (s *Server) GetPaymentToken() http.HandlerFunc
- func (s *Server) InitialiseServer() http.Handler
- func (s *Server) ListenAndServe() error
- func (s *Server) ProcessApplePayResponse() http.HandlerFunc
- func (s *Server) ProcessGooglePayResponse() http.HandlerFunc
- func (s *Server) SetupDevRoutes()
- func (s *Server) SetupRoutes()
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = &ErrResponse{StatusCode: 404, Message: "Resource not found."}
ErrNotFound is a pre-built not-found error
Functions ¶
func ErrInternalServer ¶
ErrInternalServer returns a generic server error to the user
func ErrInvalidRequest ¶
ErrInvalidRequest is used to indicate an error on user input (with wrapped error)
func ErrInvalidRequestWithMessage ¶
ErrInvalidRequestWithMessage will log an error (as a debug log) and return an invalid request error to the user with a message.
func ErrRequestFailed ¶
ErrRequestFailed is used to indicate that user input was valid, but incorrect, hence an error
func ErrRequestUnauthorized ¶
ErrRequestUnauthorized is used to indicate that user input was valid, but incorrect, hence an error
Types ¶
type ApplePaySessionResponse ¶
type ApplePaySessionResponse struct { EpochTimestamp int64 `json:"epochTimestamp"` ExpiresAt int64 `json:"expiresAt"` MerchantSessionIdentifier string `json:"merchantSessionIdentifier"` Nonce string `json:"nonce"` MerchantIdentifier string `json:"merchantIdentifier"` DomainName string `json:"domainName"` DisplayName string `json:"displayName"` Signature string `json:"signature"` }
ApplePayResponse - ...
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error StatusCode int `json:"-"` // http response status code Message string `json:"message"` // user-level status message ErrorCode int64 `json:"code,omitempty"` // application-specific error code ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
ErrResponse is a generic struct for returning a standard error document
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
Render is the Renderer for ErrResponse struct
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the API web server
func (*Server) CreateCharge ¶
func (s *Server) CreateCharge() http.HandlerFunc
func (*Server) ErrInternalServer ¶
(*Server) ErrInternalServer will log an error and return a generic server error to the user
func (*Server) ErrInvalidRequest ¶
(*Server) ErrInvalidRequest will log an error (as a debug log) and return an invalid request error to the user
func (*Server) ErrInvalidRequestWithMessage ¶
(*Server) ErrInvalidRequestWithMessage will log an error (as a debug log) and return an invalid request error to the user with a message.
func (*Server) ErrRender ¶
(*Server) ErrRender will log an error (as a debug log) and return an render error to the user
func (*Server) ErrRequestFailed ¶
(*Server) ErrRequestFailed will log an error (as a debug log) and return an request failed error to the user
func (*Server) ErrRequestUnauthorized ¶
(*Server) ErrRequestUnauthorized will log an error (as a debug log) and return an request failed error to the user
func (*Server) GetApplePaySession ¶
func (s *Server) GetApplePaySession() http.HandlerFunc
func (*Server) GetCharge ¶
func (s *Server) GetCharge() http.HandlerFunc
func (*Server) GetFullCheckout ¶
func (s *Server) GetFullCheckout() http.HandlerFunc
func (*Server) GetPaymentToken ¶
func (s *Server) GetPaymentToken() http.HandlerFunc
func (*Server) InitialiseServer ¶
func (*Server) ListenAndServe ¶
ListenAndServe will listen for requests
func (*Server) ProcessApplePayResponse ¶
func (s *Server) ProcessApplePayResponse() http.HandlerFunc
func (*Server) ProcessGooglePayResponse ¶
func (s *Server) ProcessGooglePayResponse() http.HandlerFunc
func (*Server) SetupDevRoutes ¶
func (s *Server) SetupDevRoutes()
Routes specifically for development
func (*Server) SetupRoutes ¶
func (s *Server) SetupRoutes()
SetupRoutes configures all the routes for this service