Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrBadRequest ¶
ErrBadRequest returns bad request error response
func ErrInternalServer ¶
ErrInternalServer returns internal server error response
func ErrUnauthorized ¶
ErrUnauthorized to render unathorized error
Types ¶
type AlfamartPaymentCallbackRequest ¶
type AlfamartPaymentCallbackRequest struct {
PaymentID string `json:"payment_id"`
PaymentCode string `json:"payment_code"`
PaidAt time.Time `json:"paid_at"`
ExternalID string `json:"external_id"`
CustomerID uint64 `json:"customer_id"`
}
AlfamartPaymentCallbackRequest is a struct that sent by alfamart service on payment callback
type AuthRequest ¶
AuthRequest is a struct for register and login endpoint's request body
type ErrResponse ¶
type ErrResponse struct {
Err error `json:"-"`
HTTPStatusCode int `json:"-"`
StatusText string `json:"status"`
ErrorText string `json:"error,omitempty"`
}
ErrResponse contains err, http_status_code, status_text, app_code, error_text
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
Render error response
type Notifier ¶
type Notifier interface {
Notify(ctx context.Context, customer *customer.Customer, body interface{})
}
Notifier is an abstraction of HTTP Client that will notifies callback url by firing POST HTTP request
func GetNotifier ¶
func GetNotifier() Notifier
GetNotifier creates new notifier or returns created notifier
type NotifierImplementation ¶
NotifierImplementation is the default implementation of Notifier
type Server ¶
type Server struct {
CustomerRepository datastore.CustomerRepository
Jeff *jeff.Jeff
}
Server holds server's required resources
func (*Server) AlfamartPaymentCallbackHandler ¶
func (s *Server) AlfamartPaymentCallbackHandler() http.HandlerFunc
AlfamartPaymentCallbackHandler handles payment callback from alfamart service
func (*Server) LoginHandler ¶
func (s *Server) LoginHandler() http.HandlerFunc
LoginHandler handles request for login authentication
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler() http.HandlerFunc
RegisterHandler handles request for creating a customer
func (*Server) SetCallbackURLHandler ¶
func (s *Server) SetCallbackURLHandler() http.HandlerFunc
SetCallbackURLHandler handles request for setting customer's callback url
type SetCallbackURLRequest ¶
type SetCallbackURLRequest struct {
CallbackURL string `json:"callback_url"`
}
SetCallbackURLRequest is a struct for set callback url endpoint's request body