Documentation ¶
Index ¶
- type CartAPIController
- func (cc *CartAPIController) AddAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) ApplyCombinedVoucherGift(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) ApplyGiftCardAndGetAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) ApplyVoucherAndGetAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) BillingAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) DeleteAllItemsAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) DeleteCartAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) DeleteDelivery(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) DeleteItemAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) GetAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) Inject(responder *web.Responder, ApplicationCartService *application.CartService, ...)
- func (cc *CartAPIController) RemoveGiftCardAndGetAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) RemoveVoucherAndGetAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) UpdateDeliveryInfoAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) UpdateItemAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartAPIController) UpdatePaymentSelectionAction(ctx context.Context, r *web.Request) web.Result
- type CartAPIResult
- type CartViewActionData
- type CartViewController
- func (cc *CartViewController) AddAndViewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartViewController) CleanAndViewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartViewController) CleanDeliveryAndViewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartViewController) DeleteAllAndViewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartViewController) DeleteAndViewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartViewController) Inject(responder *web.Responder, applicationCartService *application.CartService, ...)
- func (cc *CartViewController) UpdateQtyAndViewAction(ctx context.Context, r *web.Request) web.Result
- func (cc *CartViewController) ViewAction(ctx context.Context, r *web.Request) web.Result
- type CartViewData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CartAPIController ¶
type CartAPIController struct {
// contains filtered or unexported fields
}
CartAPIController for cart api
func (*CartAPIController) AddAction ¶
AddAction Add Item to cart @Summary Add Item to cart @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param deliveryCode path string true "the identifier for the delivery in the cart" @Param marketplaceCode query string true "the product identifier that should be added" @Param variantMarketplaceCode query string false "optional the product identifier of the variant (for configurable products) that should be added" @Param qty query integer false "optional the qty that should be added" @Router /api/v1/cart/delivery/{deliveryCode}/item [post]
func (*CartAPIController) ApplyCombinedVoucherGift ¶
func (cc *CartAPIController) ApplyCombinedVoucherGift(ctx context.Context, r *web.Request) web.Result
ApplyCombinedVoucherGift applies a given code (which might be either a voucher or a Gift Card code) to the cartService and returns the cart @Summary Apply Gift Card or Voucher (auto detected) @Description Use this if you have one user input and that input can be used to either enter a voucher or a gift card @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param couponCode query string true "the couponCode that should be applied as gift card or voucher" @Router /api/v1/cart/voucher-gift-card [post]
func (*CartAPIController) ApplyGiftCardAndGetAction ¶
func (cc *CartAPIController) ApplyGiftCardAndGetAction(ctx context.Context, r *web.Request) web.Result
ApplyGiftCardAndGetAction applies the given gift card and returns the cart the request needs a query string param "couponCode" which includes the corresponding gift card code @Summary Apply Gift Card @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param couponCode query string true "the gift card code" @Router /api/v1/cart/gift-card [post]
func (*CartAPIController) ApplyVoucherAndGetAction ¶
func (cc *CartAPIController) ApplyVoucherAndGetAction(ctx context.Context, r *web.Request) web.Result
ApplyVoucherAndGetAction applies the given voucher and returns the cart @Summary Apply Voucher Code @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param couponCode query string true "the couponCode that should be applied" @Router /api/v1/cart/voucher [post]
func (*CartAPIController) BillingAction ¶
BillingAction adds billing infos @Summary Adds billing infos to the current cart @Tags Cart @Accept x-www-form-urlencoded @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param vat formData string false "vat" @Param firstname formData string true "firstname" @Param lastname formData string true "lastname" @Param middlename formData string false "middlename" @Param title formData string false "title" @Param salutation formData string false "salutation" @Param street formData string false "street" @Param streetNr formData string false "streetNr" @Param addressLine1 formData string false "addressLine1" @Param addressLine2 formData string false "addressLine2" @Param company formData string false "company" @Param postCode formData string false "postCode" @Param city formData string false "city" @Param state formData string false "state" @Param regionCode formData string false "regionCode" @Param country formData string false "country" @Param countryCode formData string false "countryCode" @Param phoneAreaCode formData string false "phoneAreaCode" @Param phoneCountryCode formData string false "phoneCountryCode" @Param phoneNumber formData string false "phoneNumber" @Param email formData string true "email" @Router /api/v1/cart/billing [put]
func (*CartAPIController) DeleteAllItemsAction ¶
DeleteAllItemsAction removes all cart items and returns the cart @Summary Remove all cart items from all deliveries and return the cart, keeps the delivery info untouched. @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Router /api/v1/cart/deliveries/items [delete]
func (*CartAPIController) DeleteCartAction ¶
DeleteCartAction removes all cart content and returns a blank cart @Summary Remove all stored cart information e.g. items, deliveries, billing address and returns the empty cart. @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Router /api/v1/cart [delete]
func (*CartAPIController) DeleteDelivery ¶
DeleteDelivery cleans the given delivery from the cart and returns the cleaned cart @Summary Cleans the given delivery from the cart @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param deliveryCode path string true "the identifier for the delivery in the cart" @Router /api/v1/cart/delivery/{deliveryCode} [delete]
func (*CartAPIController) DeleteItemAction ¶
DeleteItemAction deletes an item from the cart @Summary Delete item from cart @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param deliveryCode path string true "the identifier for the delivery in the cart" @Param itemID query string true "the item that should be deleted" @Router /api/v1/cart/delivery/{deliveryCode}/item [delete]
func (*CartAPIController) GetAction ¶
GetAction Get JSON Format of API @Summary Get the current cart @Tags Cart @Produce json @Success 200 {object} getCartResult @Failure 500 {object} CartAPIResult @Router /api/v1/cart [get]
func (*CartAPIController) Inject ¶
func (cc *CartAPIController) Inject( responder *web.Responder, ApplicationCartService *application.CartService, ApplicationCartReceiverService *application.CartReceiverService, billingAddressFormController *forms.BillingAddressFormController, deliveryFormController *forms.DeliveryFormController, simplePaymentFormController *forms.SimplePaymentFormController, Logger flamingo.Logger, )
Inject dependencies
func (*CartAPIController) RemoveGiftCardAndGetAction ¶
func (cc *CartAPIController) RemoveGiftCardAndGetAction(ctx context.Context, r *web.Request) web.Result
RemoveGiftCardAndGetAction removes the given gift card and returns the cart the request needs a query string param "couponCode" which includes the corresponding gift card code @Summary Remove Gift Card @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param couponCode query string true "the couponCode that should be deleted as gift card" @Router /api/v1/cart/gift-card [delete]
func (*CartAPIController) RemoveVoucherAndGetAction ¶
func (cc *CartAPIController) RemoveVoucherAndGetAction(ctx context.Context, r *web.Request) web.Result
RemoveVoucherAndGetAction removes the given voucher and returns the cart @Summary Remove Voucher Code @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param couponCode query string true "the couponCode that should be applied" @Router /api/v1/cart/voucher [delete]
func (*CartAPIController) UpdateDeliveryInfoAction ¶
func (cc *CartAPIController) UpdateDeliveryInfoAction(ctx context.Context, r *web.Request) web.Result
UpdateDeliveryInfoAction updates the delivery info @Summary Adds delivery infos, such as shipping address to the delivery for the cart @Tags Cart @Accept x-www-form-urlencoded @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param deliveryCode path string true "the identifier for the delivery in the cart" @Param deliveryAddress.vat formData string false "vat" @Param deliveryAddress.firstname formData string true "firstname" @Param deliveryAddress.lastname formData string true "lastname" @Param deliveryAddress.middlename formData string false "middlename" @Param deliveryAddress.title formData string false "title" @Param deliveryAddress.salutation formData string false "salutation" @Param deliveryAddress.street formData string false "street" @Param deliveryAddress.streetNr formData string false "streetNr" @Param deliveryAddress.addressLine1 formData string false "addressLine1" @Param deliveryAddress.addressLine2 formData string false "addressLine2" @Param deliveryAddress.company formData string false "company" @Param deliveryAddress.postCode formData string false "postCode" @Param deliveryAddress.city formData string false "city" @Param deliveryAddress.state formData string false "state" @Param deliveryAddress.regionCode formData string false "regionCode" @Param deliveryAddress.country formData string false "country" @Param deliveryAddress.countryCode formData string false "countryCode" @Param deliveryAddress.phoneAreaCode formData string false "phoneAreaCode" @Param deliveryAddress.phoneCountryCode formData string false "phoneCountryCode" @Param deliveryAddress.phoneNumber formData string false "phoneNumber" @Param deliveryAddress.email formData string true "email" @Param useBillingAddress formData bool false "useBillingAddress" @Param shippingMethod formData string false "shippingMethod" @Param shippingCarrier formData string false "shippingCarrier" @Param locationCode formData string false "locationCode" @Param desiredTime formData string false "desired date/time in RFC3339" format(date-time) @Router /api/v1/cart/delivery/{deliveryCode} [put]
func (*CartAPIController) UpdateItemAction ¶
UpdateItemAction updates the item qty in the current cart @Summary Update item in the cart @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param deliveryCode path string true "the identifier for the delivery in the cart" @Param itemID query string true "the item that should be updated" @Param qty query integer true "the new qty" @Router /api/v1/cart/delivery/{deliveryCode}/item [put]
func (*CartAPIController) UpdatePaymentSelectionAction ¶
func (cc *CartAPIController) UpdatePaymentSelectionAction(ctx context.Context, r *web.Request) web.Result
UpdatePaymentSelectionAction to set / update the cart payment selection @Summary Update/set the PaymentSelection for the current cart @Tags Cart @Produce json @Success 200 {object} CartAPIResult @Failure 500 {object} CartAPIResult @Param gateway query string true "name of the payment gateway - e.g. 'offline'" @Param method query string true "name of the payment method - e.g. 'offlinepayment_cashondelivery'" @Router /api/v1/cart/payment-selection [put]
type CartAPIResult ¶
type CartAPIResult struct { // Contains details if success is false Error *resultError Success bool Data interface{} DataValidationInfo *formDomain.ValidationInfo `swaggertype:"object"` CartValidationResult *validation.Result }
CartAPIResult view data
func (*CartAPIResult) SetError ¶
func (r *CartAPIResult) SetError(err error, fallbackCode string) *CartAPIResult
SetError updates the cart error field
func (*CartAPIResult) SetErrorByCode ¶
func (r *CartAPIResult) SetErrorByCode(message string, code string) *CartAPIResult
SetErrorByCode sets the error on the CartApiResult data and success to false
type CartViewActionData ¶
type CartViewActionData struct {
AddToCartProductsData []productDomain.BasicProductData
}
CartViewActionData for rendering results
type CartViewController ¶
type CartViewController struct {
// contains filtered or unexported fields
}
CartViewController for carts
func (*CartViewController) AddAndViewAction ¶
AddAndViewAction the DecoratedCart View ( / cart)
func (*CartViewController) CleanAndViewAction ¶
CleanAndViewAction empties the cart and shows it
func (*CartViewController) CleanDeliveryAndViewAction ¶
func (cc *CartViewController) CleanDeliveryAndViewAction(ctx context.Context, r *web.Request) web.Result
CleanDeliveryAndViewAction empties a single delivery and shows it
func (*CartViewController) DeleteAllAndViewAction ¶
func (cc *CartViewController) DeleteAllAndViewAction(ctx context.Context, r *web.Request) web.Result
DeleteAllAndViewAction empties the cart and shows it
func (*CartViewController) DeleteAndViewAction ¶
DeleteAndViewAction the DecoratedCart View ( / cart)
func (*CartViewController) Inject ¶
func (cc *CartViewController) Inject( responder *web.Responder, applicationCartService *application.CartService, applicationCartReceiverService *application.CartReceiverService, router *web.Router, logger flamingo.Logger, config *struct { ShowEmptyCartPageIfNoItems bool `inject:"config:commerce.cart.showEmptyCartPageIfNoItems,optional"` AdjustItemsToRestrictedQty bool `inject:"config:commerce.cart.adjustItemsToRestrictedQty,optional"` }, )
Inject dependencies
func (*CartViewController) UpdateQtyAndViewAction ¶
func (cc *CartViewController) UpdateQtyAndViewAction(ctx context.Context, r *web.Request) web.Result
UpdateQtyAndViewAction the DecoratedCart View ( / cart)
func (*CartViewController) ViewAction ¶
ViewAction the DecoratedCart View ( / cart)
type CartViewData ¶
type CartViewData struct { DecoratedCart decorator.DecoratedCart CartValidationResult validation.Result AddToCartProductsData []productDomain.BasicProductData CartRestrictionError application.RestrictionError }
CartViewData is used for cart views/templates