Documentation ¶
Index ¶
- Constants
- type APIController
- func (c *APIController) CancelPlaceOrderAction(ctx context.Context, r *web.Request) web.Result
- func (c *APIController) ClearPlaceOrderAction(ctx context.Context, r *web.Request) web.Result
- func (c *APIController) CurrentPlaceOrderContextAction(ctx context.Context, r *web.Request) web.Result
- func (c *APIController) Inject(responder *web.Responder, placeorderHandler *placeorder.Handler, ...)
- func (c *APIController) RefreshPlaceOrderAction(ctx context.Context, r *web.Request) web.Result
- func (c *APIController) RefreshPlaceOrderBlockingAction(ctx context.Context, r *web.Request) web.Result
- func (c *APIController) StartPlaceOrderAction(ctx context.Context, r *web.Request) web.Result
- type CheckoutController
- func (cc *CheckoutController) ExpiredAction(context.Context, *web.Request) web.Result
- func (cc *CheckoutController) Inject(responder *web.Responder, router *web.Router, ...)
- func (cc *CheckoutController) PaymentAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CheckoutController) PlaceOrderAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CheckoutController) ReviewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CheckoutController) StartAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CheckoutController) SubmitCheckoutAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CheckoutController) SuccessAction(ctx context.Context, r *web.Request) web.Result
- type CheckoutViewData
- type EmptyCartInfo
- type PaymentStepViewData
- type PlaceOrderFlashData
- type ReviewStepViewData
- type SuccessViewData
- type ViewErrorInfos
Constants ¶
const ( // CheckoutErrorFlashKey is the flash key that stores error infos that are shown on the checkout form page CheckoutErrorFlashKey = "checkout.error.data" // CheckoutSuccessFlashKey is the flash key that stores the order infos which are used on the checkout success page CheckoutSuccessFlashKey = "checkout.success.data" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIController ¶
type APIController struct {
// contains filtered or unexported fields
}
APIController for checkout rest api
func (*APIController) CancelPlaceOrderAction ¶
CancelPlaceOrderAction cancels a running place order process @Summary Cancels a running place order process @Tags Checkout @Produce json @Success 200 {boolean} boolean @Failure 500 {object} errorResponse @Router /api/v1/checkout/placeorder/cancel [post]
func (*APIController) ClearPlaceOrderAction ¶
ClearPlaceOrderAction clears the last place order if in final state @Summary Clears the last placed order if in final state @Tags Checkout @Produce json @Success 200 {boolean} boolean @Failure 500 {object} errorResponse @Router /api/v1/checkout/placeorder [delete]
func (*APIController) CurrentPlaceOrderContextAction ¶
func (c *APIController) CurrentPlaceOrderContextAction(ctx context.Context, r *web.Request) web.Result
CurrentPlaceOrderContextAction returns the last saved context @Summary Returns the last saved context @Tags Checkout @Produce json @Success 200 {object} placeOrderContext @Failure 500 {object} errorResponse @Router /api/v1/checkout/placeorder [get]
func (*APIController) Inject ¶
func (c *APIController) Inject( responder *web.Responder, placeorderHandler *placeorder.Handler, cartService *cartApplication.CartService, decoratedCartFactory *decorator.DecoratedCartFactory, logger flamingo.Logger, )
Inject dependencies
func (*APIController) RefreshPlaceOrderAction ¶
RefreshPlaceOrderAction returns the current place order context and proceeds the process in a non blocking way @Summary Returns the current place order context and proceeds the process in a non blocking way @Tags Checkout @Produce json @Success 200 {object} placeOrderContext @Failure 500 {object} errorResponse @Router /api/v1/checkout/placeorder/refresh [post]
func (*APIController) RefreshPlaceOrderBlockingAction ¶
func (c *APIController) RefreshPlaceOrderBlockingAction(ctx context.Context, r *web.Request) web.Result
RefreshPlaceOrderBlockingAction proceeds the process and returns the place order context afterwards (blocking) @Summary Proceeds the process and returns the place order context afterwards (blocking) @Description This is useful to get the most recent place order context, for example after returning from an external payment provider @Tags Checkout @Produce json @Success 200 {object} placeOrderContext @Failure 500 {object} errorResponse @Router /api/v1/checkout/placeorder/refresh-blocking [post]
func (*APIController) StartPlaceOrderAction ¶
StartPlaceOrderAction starts a new process @Summary Starts the place order process, which is a background process handling payment and rollbacks if required. @Tags Checkout @Produce json @Success 201 {object} startPlaceOrderResult "201 if new process was started" @Failure 500 {object} errorResponse @Failure 400 {object} errorResponse @Param returnURL query string true "the returnURL that should be used after an external payment flow" @Router /api/v1/checkout/placeorder [put]
type CheckoutController ¶
type CheckoutController struct {
// contains filtered or unexported fields
}
CheckoutController represents the checkout controller with its injections
func (*CheckoutController) ExpiredAction ¶
ExpiredAction handles the expired cart action
func (*CheckoutController) Inject ¶
func (cc *CheckoutController) Inject( responder *web.Responder, router *web.Router, orderService *application.OrderService, decoratedCartFactory *decorator.DecoratedCartFactory, applicationCartService *cartApplication.CartService, applicationCartReceiverService *cartApplication.CartReceiverService, webIdentityService *auth.WebIdentityService, logger flamingo.Logger, checkoutFormController *forms.CheckoutFormController, config *struct { SkipStartAction bool `inject:"config:commerce.checkout.skipStartAction,optional"` SkipReviewAction bool `inject:"config:commerce.checkout.skipReviewAction,optional"` ShowReviewStepAfterPaymentError bool `inject:"config:commerce.checkout.showReviewStepAfterPaymentError,optional"` ShowEmptyCartPageIfNoItems bool `inject:"config:commerce.checkout.showEmptyCartPageIfNoItems,optional"` RedirectToCartOnInvalideCart bool `inject:"config:commerce.checkout.redirectToCartOnInvalidCart,optional"` PrivacyPolicyRequired bool `inject:"config:commerce.checkout.privacyPolicyRequired,optional"` DevMode bool `inject:"config:debug.mode,optional"` }, )
Inject dependencies
func (*CheckoutController) PaymentAction ¶
PaymentAction asks the payment adapter about the current payment status and handle it
func (*CheckoutController) PlaceOrderAction ¶
PlaceOrderAction functions as a return/notification URL for Payment Providers
func (*CheckoutController) ReviewAction ¶
ReviewAction handles the cart review action
func (*CheckoutController) StartAction ¶
StartAction handles the checkout start action
func (*CheckoutController) SubmitCheckoutAction ¶
SubmitCheckoutAction handles the main checkout
func (*CheckoutController) SuccessAction ¶
SuccessAction handles the order success action
type CheckoutViewData ¶
type CheckoutViewData struct { DecoratedCart decorator.DecoratedCart Form forms.CheckoutFormComposite CartValidationResult validation.Result ErrorInfos ViewErrorInfos AvailablePayments map[string][]paymentDomain.Method CustomerLoggedIn bool }
CheckoutViewData represents the checkout view data
type EmptyCartInfo ¶
type EmptyCartInfo struct {
CartExpired bool
}
EmptyCartInfo struct defines the data info on empty carts
type PaymentStepViewData ¶
type PaymentStepViewData struct { FlowStatus paymentDomain.FlowStatus ErrorInfos ViewErrorInfos }
PaymentStepViewData represents the payment flow view data
type PlaceOrderFlashData ¶
type PlaceOrderFlashData struct { PlacedOrderInfos placeorder.PlacedOrderInfos Email string PaymentInfos []application.PlaceOrderPaymentInfo PlacedCart cart.Cart }
PlaceOrderFlashData represents the data passed to the success page - they need to be "glob"able
type ReviewStepViewData ¶
type ReviewStepViewData struct { DecoratedCart decorator.DecoratedCart ErrorInfos ViewErrorInfos }
ReviewStepViewData represents the success view data
type SuccessViewData ¶
type SuccessViewData struct { PaymentInfos []application.PlaceOrderPaymentInfo PlacedOrderInfos placeorder.PlacedOrderInfos Email string PlacedDecoratedCart decorator.DecoratedCart }
SuccessViewData represents the success view data
type ViewErrorInfos ¶
type ViewErrorInfos struct { // HasError indicates that an general error happened HasError bool // If there is a general error this field is filled and can be used in the template ErrorMessage string // if the Error happens during processing payment (can be used in template to behave special in case of payment errors) HasPaymentError bool }
ViewErrorInfos defines the error info struct of the checkout controller views