orderfromcart

package module
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: 14 Imported by: 0

README

The Order from Cart Topic Consumer

The Order from Cart Firestore Consumer is a Cloud Function that receives Pub/Sub push messages from the Cart Firestore Trigger Function when a shopping cart is "checked out."

This function converts completed shopping cart descriptions into order descriptions and stores them in
an orders Firestore document collection (i.e. a different collection to that used for the carts).

Documentation

Overview

Package orderfromcart implements a Google Cloud Function to receive a shopping cart description via a Pub/Sub topic. The handler translates the cart into an order and stores it as an order document under Firestore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertCartToOrder

func ConvertCartToOrder(cart *pb.ShoppingCart) (*orders.Order, error)

ConvertCartToOrder clones the data of a shopping cart into an order structure

func OrderFromCart

func OrderFromCart(w http.ResponseWriter, r *http.Request)

OrderFromCart is Cloud Function entry point. The payload of the HTTP request is a checked out shopping cart expressed as a base64 encoded Protocol Buffer message wrapped in a JSON envelop.

See https://cloud.google.com/pubsub/docs/push for documentation of the request body JSON content.

func OrderItemItemFromShoppingCartPB

func OrderItemItemFromShoppingCartPB(pbItem *pb.CartItem) *orders.OrderItem

OrderItemItemFromShoppingCartPB is a factory method that returns a ShoppingCartItem representation derived from its protocol buffer equivalent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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