application

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 17 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// PaymentFlowStandardCorrelationID used as correlationid for the start of the payment (session scoped)
	PaymentFlowStandardCorrelationID = "checkout"

	// LastPlacedOrderSessionKey is the session key for storing the last placed order
	LastPlacedOrderSessionKey = "orderservice_last_placed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderService

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

OrderService defines the order service

func (*OrderService) CancelOrder

func (os *OrderService) CancelOrder(ctx context.Context, session *web.Session, order *PlaceOrderInfo) (*cart.Cart, error)

CancelOrder cancels an previously placed order and returns the restored cart with the order content

func (*OrderService) CancelOrderWithoutRestore added in v3.1.0

func (os *OrderService) CancelOrderWithoutRestore(ctx context.Context, session *web.Session, order *PlaceOrderInfo) error

CancelOrderWithoutRestore cancels an previously placed order

func (*OrderService) CartPlaceOrder added in v3.1.0

func (os *OrderService) CartPlaceOrder(ctx context.Context, decoratedCart *decorator.DecoratedCart, payment placeorder.Payment) (*PlaceOrderInfo, error)

CartPlaceOrder places the cart passed to the function this function enables clients to pass a cart as is, without the usage of the cartReceiverService

func (*OrderService) CartPlaceOrderWithPaymentProcessing

func (os *OrderService) CartPlaceOrderWithPaymentProcessing(ctx context.Context, decoratedCart *decorator.DecoratedCart,
	session *web.Session) (*PlaceOrderInfo, error)

CartPlaceOrderWithPaymentProcessing places the cart passed to the function this function enables clients to pass a cart as is, without the usage of the cartReceiverService

func (*OrderService) ClearLastPlacedOrder

func (os *OrderService) ClearLastPlacedOrder(ctx context.Context)

ClearLastPlacedOrder clears the last placed cart, this can be useful if an cart / order is finished

func (*OrderService) CurrentCartPlaceOrder

func (os *OrderService) CurrentCartPlaceOrder(ctx context.Context, session *web.Session, cartPayment placeorder.Payment) (*PlaceOrderInfo, error)

CurrentCartPlaceOrder places the current cart without additional payment processing

func (*OrderService) CurrentCartPlaceOrderWithPaymentProcessing

func (os *OrderService) CurrentCartPlaceOrderWithPaymentProcessing(ctx context.Context, session *web.Session) (*PlaceOrderInfo, error)

CurrentCartPlaceOrderWithPaymentProcessing places the current cart which is fetched from the context

func (*OrderService) GetAvailablePaymentGateways

func (os *OrderService) GetAvailablePaymentGateways(ctx context.Context) map[string]interfaces.WebCartPaymentGateway

GetAvailablePaymentGateways returns the list of registered WebCartPaymentGateway

func (*OrderService) GetPaymentGateway

func (os *OrderService) GetPaymentGateway(ctx context.Context, paymentGatewayCode string) (interfaces.WebCartPaymentGateway, error)

GetPaymentGateway tries to get the supplied payment gateway by code from the registered payment gateways

func (*OrderService) HasLastPlacedOrder

func (os *OrderService) HasLastPlacedOrder(ctx context.Context) bool

HasLastPlacedOrder returns if a order has been previously placed

func (*OrderService) Inject

func (os *OrderService) Inject(
	logger flamingo.Logger,
	CartService *application.CartService,
	CartReceiverService *application.CartReceiverService,
	DeliveryInfoBuilder cart.DeliveryInfoBuilder,
	webCartPaymentGatewayProvider interfaces.WebCartPaymentGatewayProvider,
	decoratedCartFactory *decorator.DecoratedCartFactory,

)

Inject dependencies

func (*OrderService) LastPlacedOrCurrentCart

func (os *OrderService) LastPlacedOrCurrentCart(ctx context.Context) (*decorator.DecoratedCart, error)

LastPlacedOrCurrentCart returns the decorated cart of the last placed order if there is one if not return the current cart

func (*OrderService) LastPlacedOrder

func (os *OrderService) LastPlacedOrder(ctx context.Context) (*PlaceOrderInfo, error)

LastPlacedOrder returns the last placed order/cart if available

type PlaceOrderInfo

type PlaceOrderInfo struct {
	PaymentInfos []PlaceOrderPaymentInfo
	PlacedOrders placeorder.PlacedOrderInfos
	ContactEmail string
	Cart         cart.Cart
}

PlaceOrderInfo struct defines the data of payments on placed orders

type PlaceOrderPaymentInfo

type PlaceOrderPaymentInfo struct {
	Gateway         string
	PaymentProvider string
	Method          string
	CreditCardInfo  *placeorder.CreditCardInfo
	Amount          priceDomain.Price
	Title           string
}

PlaceOrderPaymentInfo holding payment infos

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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