checkout

package
v0.0.0-...-3bb7120 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(h *Handler, router *anor.Router)

RegisterRoutes sets up the routing for the checkout-related endpoints. It maps HTTP methods and paths to their respective handler functions.

Types

type ConfirmationTokenRequest

type ConfirmationTokenRequest struct {
	ConfirmationTokenID string `json:"confirmation_token_id"`
}

func (*ConfirmationTokenRequest) Bind

func (*ConfirmationTokenRequest) Validate

func (req *ConfirmationTokenRequest) Validate() error

type CreatePaymentIntentResponse

type CreatePaymentIntentResponse struct {
	ClientSecret string                     `json:"client_secret"`
	Status       stripe.PaymentIntentStatus `json:"status"`
	OrderID      int64                      `json:"order_id,omitempty"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler manages HTTP requests for checkout operations.

func NewHandler

func NewHandler(cfg HandlerConfig) *Handler

NewHandler creates and returns a new Handler instance.

func (*Handler) AddressView

func (h *Handler) AddressView(w http.ResponseWriter, r *http.Request)

func (*Handler) ConfirmView

func (h *Handler) ConfirmView(w http.ResponseWriter, r *http.Request)

func (*Handler) CreatePaymentIntent

func (h *Handler) CreatePaymentIntent(w http.ResponseWriter, r *http.Request)

func (*Handler) PaymentMethodView

func (h *Handler) PaymentMethodView(w http.ResponseWriter, r *http.Request)

func (*Handler) Render

func (h *Handler) Render(w http.ResponseWriter, r *http.Request, templatePath string, td templates.TemplateData)

func (*Handler) RetrieveOrderSummary

func (h *Handler) RetrieveOrderSummary(w http.ResponseWriter, r *http.Request)

func (*Handler) SaveStripeConfirmationToken

func (h *Handler) SaveStripeConfirmationToken(w http.ResponseWriter, r *http.Request)

func (*Handler) SetOrderAddress

func (h *Handler) SetOrderAddress(w http.ResponseWriter, r *http.Request)

func (*Handler) SuccessView

func (h *Handler) SuccessView(w http.ResponseWriter, r *http.Request)

type HandlerConfig

type HandlerConfig struct {
	UserService          anor.UserService
	CartService          anor.CartService
	StripePaymentService anor.StripePaymentService
	OrderService         anor.OrderService
	CategorySvc          anor.CategoryService
	AddressService       anor.AddressService
	View                 *html.View
	SessionManager       *session.Manager
	Logger               *slog.Logger
	Config               *config.Config
}

HandlerConfig contains the dependencies for creating a new Handler.

type SetOrderAddressForm

type SetOrderAddressForm struct {
	AddressID   int64
	AddressType string
}

func (*SetOrderAddressForm) Bind

func (f *SetOrderAddressForm) Bind(r *http.Request) error

func (*SetOrderAddressForm) Validate

func (f *SetOrderAddressForm) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL