fulfillapi

package
v0.0.0-...-3d84a2e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT-0 Imports: 11 Imported by: 2

Documentation

Overview

Package service contains the gRPC Fulfillment microservice implementation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProjectId is a variable so that unit tests can override it to ensures that test requests are not routed to
	// the live project! See https://firebase.google.com/doos/emulator-suite/connect_firestore
	ProjectId string

	// UnitTestNewFulfillmentServiceError should be returned by NewTaskService if we are running unit tests
	// and unitTestNewTaskServiceError is not nil.
	UnitTestNewFulfillmentServiceError error
)

Functions

This section is empty.

Types

type FulfillmentService

type FulfillmentService struct {
	pbfulfillment.UnimplementedFulfillmentAPIServer

	// FsClient is the GCP Firestore client - it is thread safe and can be reused concurrently
	FsClient *firestore.Client
	// contains filtered or unexported fields
}

FulfillmentService is a structure class with methods that implements the fulfillment.FulfillmentAPIServer gRPC API storing the data for managing fulfillment orchestration in a Google Cloud Firestore document collection.

func NewFulfillmentService

func NewFulfillmentService() (*FulfillmentService, error)

NewFulfillmentService is a factory method returning an instance of our shopping cart service.

func (*FulfillmentService) GetTaskByID

GetTaskByID retrieves a task matching the specified UUID ID in the fulfillment.GetTaskByIDRequest.

func (*FulfillmentService) GetTasks

GetTasks retrieves a page of tasks matching the search criteria specified UUID ID in the fulfillment.GetTasksRequest.

func (*FulfillmentService) SaveTasks

func (fs *FulfillmentService) SaveTasks(ctx context.Context, tasks []*schema.Task) error

SaveTasks stores the given slices of schema.Task structures in the Firestore document collection. This is for internal domain use only and so does not accept or return protobuf structures.

Note that the submission time for the task will be set / overriden by this method to match the time it was written to Firestore.

An error will be returned if the tasks are already present in Firestore.

func (*FulfillmentService) UpdateTaskStatus

UpdateTaskStatus allows the caller to modify just the status of the task and the associate reason code, i.e. giving a description of why the status was changed. The reason code is optional.

Jump to

Keyboard shortcuts

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