minicommerce

package module
v0.0.0-...-f2f6dc9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 2 Imported by: 0

README

minicommerce

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coupon

type Coupon struct {
	ID             string  `firestore:"-"`
	Description    string  `firestore:"description"`
	Active         bool    `firestore:"active"`
	AmountOff      int64   `firestore:"amountOff"`
	PercentOff     float64 `firestore:"percentOff"`
	MaxRedemptions int64   `firestore:"maxRedemptions"`
	RedeemBy       int64   `firestore:"redeemBy"`
	RedeemBefore   int64   `firestore:"redeemBefore"`
}

Coupon is the domain and data model representing a Coupon in miniCommerce

type Customer

type Customer struct {
	Name    string `firestore:"name"`
	Email   string `firestore:"email"`
	Address string `firestore:"address"`
	ZipCode string `firestore:"zipCode"`
	Phone   string `firestore:"phone"`
}

Customer is...

type Downloadable

type Downloadable struct {
	ID       string `firestore:"-" json:"id"`
	Name     string `firestore:"name" json:"name"`
	Location string `firestore:"location" json:"location"`
}

Downloadable is the location of a downloadable digital product uploaded somewhere to google cloud storage

type DownloadableDeleter

type DownloadableDeleter interface {
	Delete(ctx context.Context, id string) error
}

DownloadableDeleter ...

type DownloadableReader

type DownloadableReader interface {
	Get(ctx context.Context, id string) (*Downloadable, error)
	GetAll(ctx context.Context) ([]Downloadable, error)
}

DownloadableReader ...

type DownloadableRepository

type DownloadableRepository interface {
	DownloadableReader
	DownloadableWriter
	DownloadableDeleter
}

DownloadableRepository ...

type DownloadableWriter

type DownloadableWriter interface {
	Create(ctx context.Context, downloadable *Downloadable) error
}

DownloadableWriter ..

type IDGenerator

type IDGenerator interface {
	New() (string, error)
}

IDGenerator is the abstraction for generating ID's in minicommerce

type Order

type Order struct {
	ID        string    `firestore:"-"`
	PaymentID string    `firestore:"paymentId"`
	Coupon    string    `firestore:"coupon"`
	Items     []Product `firestore:"items"`
	Customer  Customer  `firestore:"customer"`
	Refunded  bool      `firestore:"refunded"`
	Amount    int64     `firestore:"amount"`
	Discount  int64     `firestore:"discount"`
	Shipping  int64     `firestore:"shipping"`
	NetAmount int64     `firestore:"netAmount"`
	Taxes     int64     `firestore:"taxes"`
	Total     int64     `firestore:"total"`
}

Order represents the domain model for an order or cart in minicommerce

type Payment

type Payment struct {
	ID         string `firestore:"-"`
	ExternalID string `firestore:"externalID,omitempty"`
	Amount     int64  `firestore:"amount,omitempty"`
	Paid       bool   `firestore:"paid,omitempty"`
	Refunded   bool   `firestore:"refunded,omitempty"`
}

Payment represents the domain model for payments within the system

type Product

type Product struct {
	ID           string            `firestore:"-" json:"id"`
	Created      int64             `firestore:"created" json:"created"`
	Updated      int64             `firestore:"updated" json:"updated"`
	Type         ProductType       `firestore:"type" json:"type"`
	Name         string            `firestore:"name" json:"name"`
	Description  string            `firestore:"description" json:"description"`
	Price        int64             `firestore:"price" json:"price"`
	Metadata     map[string]string `firestore:"metadata" json:"metadata"`
	Active       bool              `firestore:"active" json:"active"`
	URL          string            `firestore:"url" json:"url"`
	Downloadable []Downloadable    `firestore:"downloadable" json:"downloadables"`
}

Product represents the domain and data model for miniCommerce

type ProductReader

type ProductReader interface {
	GetAll(ctx context.Context) ([]Product, error)
	Get(ctx context.Context, id string) (*Product, error)
}

ProductReader is the interface for reading products from a given datastore

type ProductRepository

type ProductRepository interface {
	ProductReader
	ProductWriter
	ProductUpdater
}

ProductRepository is the interface that combines all readers and writers for a product

type ProductType

type ProductType string

ProductType is the representation of the product type within miniCommerce

const (
	ProductTypeDigital   ProductType = "digital"
	ProductTypeLink      ProductType = "linkable"
	ProductTypeShippable ProductType = "shippable"
)

List of Product types available for a product

type ProductUpdater

type ProductUpdater interface {
	Update(ctx context.Context, product *Product) error
}

ProductUpdater is the interface for updating a product in a given datastor

type ProductWriter

type ProductWriter interface {
	Create(ctx context.Context, product *Product) error
}

ProductWriter is the interface for creating a product in a given datastore

type Storage

type Storage interface {
	StorageWriter
	StorageReader
	StorageDeleter
}

Storage is the engine that can read,write,delete storage objects

type StorageDeleter

type StorageDeleter interface {
	Delete(ctx context.Context, location string) error
}

StorageDeleter ..

type StorageReader

type StorageReader interface {
	Read(ctx context.Context, location string) (io.ReadCloser, error)
}

StorageReader ...

type StorageWriter

type StorageWriter interface {
	Write(ctx context.Context, location string, r io.Reader) error
}

StorageWriter ..

type TimeService

type TimeService interface {
	Now() int64
}

TimeService is an abstraction on top of time pkg for easier testability whenever time is used in the minicommerce

Directories

Path Synopsis
cmd
api command
pkg
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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