rest

package
v0.0.0-...-7544875 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticator

func Authenticator(next http.Handler) http.Handler

Types

type CreateOrderRequest

type CreateOrderRequest struct {
	Items []struct {
		ID     string  `json:"id"`
		ShopID int64   `json:"shop_id"`
		SKU    string  `json:"sku"`
		Name   string  `json:"name"`
		Uom    string  `json:"uom"`
		Qty    int64   `json:"qty"`
		Price  float64 `json:"price"`
	}
	Billing struct {
		ID      string `json:"id"`
		Name    string `json:"name"`
		Address string `json:"address"`
	}
}

CreateOrderRequest defines request for creating order

func (*CreateOrderRequest) GetBilling

func (c *CreateOrderRequest) GetBilling() order.Billing

func (*CreateOrderRequest) GetItems

func (c *CreateOrderRequest) GetItems() []order.Item

type CreateOrderResponse

type CreateOrderResponse struct {
	Data struct {
		TrxID        string `json:"trx_id"`
		PaymentTrxID string `json:"paymeny_trx_id"`
	} `json:"data"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse represents a response containing an error message.

type OrderHandler

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

func NewOrderHandler

func NewOrderHandler(svc OrderService) *OrderHandler

func (*OrderHandler) Register

func (o *OrderHandler) Register(r chi.Router)

type OrderPlacedRequest

type OrderPlacedRequest struct {
	PaymentTrxID string `json:"payment_trx_id"`
}

type OrderService

type OrderService interface {
	Placed(ctx context.Context, paymentTrxID string) (order.Order, error)
	Checkout(ctx context.Context, args order.Order) (order.Order, error)
}

Jump to

Keyboard shortcuts

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